Merge of r4766, r4767: ngx_http_upstream_add() changes.
*) Fixed to return NULL if an error occurs. *) Microoptimization: replaced an expression known to be constant with the constant value.
This commit is contained in:
parent
af87c31654
commit
77dc045e9e
|
@ -4422,18 +4422,18 @@ ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
|
||||||
uscf->servers = ngx_array_create(cf->pool, 1,
|
uscf->servers = ngx_array_create(cf->pool, 1,
|
||||||
sizeof(ngx_http_upstream_server_t));
|
sizeof(ngx_http_upstream_server_t));
|
||||||
if (uscf->servers == NULL) {
|
if (uscf->servers == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
us = ngx_array_push(uscf->servers);
|
us = ngx_array_push(uscf->servers);
|
||||||
if (us == NULL) {
|
if (us == NULL) {
|
||||||
return NGX_CONF_ERROR;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngx_memzero(us, sizeof(ngx_http_upstream_server_t));
|
ngx_memzero(us, sizeof(ngx_http_upstream_server_t));
|
||||||
|
|
||||||
us->addrs = u->addrs;
|
us->addrs = u->addrs;
|
||||||
us->naddrs = u->naddrs;
|
us->naddrs = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uscfp = ngx_array_push(&umcf->upstreams);
|
uscfp = ngx_array_push(&umcf->upstreams);
|
||||||
|
|
Loading…
Reference in New Issue