Skip to content

Commit

Permalink
Merge pull request #252 from u5surf/issue-228
Browse files Browse the repository at this point in the history
Bugfix: fixed issues/228 Change the reffered source of upstream_state
  • Loading branch information
u5surf committed Oct 18, 2022
2 parents 443d883 + 4bbac92 commit 46e431b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ngx_http_vhost_traffic_status_shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,28 +481,28 @@ ngx_http_vhost_traffic_status_shm_add_upstream(ngx_http_request_t *r)

found:

state = r->upstream_states->elts;
if (state[0].peer == NULL) {
state = u->state;
if (state->peer == NULL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
"shm_add_upstream::peer failed");
return NGX_ERROR;
}

dst.len = (uscf->port ? 0 : uscf->host.len + sizeof("@") - 1) + state[0].peer->len;
dst.len = (uscf->port ? 0 : uscf->host.len + sizeof("@") - 1) + state->peer->len;
dst.data = ngx_pnalloc(r->pool, dst.len);
if (dst.data == NULL) {
return NGX_ERROR;
}

p = dst.data;
if (uscf->port) {
p = ngx_cpymem(p, state[0].peer->data, state[0].peer->len);
p = ngx_cpymem(p, state->peer->data, state->peer->len);
type = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_UA;

} else {
p = ngx_cpymem(p, uscf->host.data, uscf->host.len);
*p++ = NGX_HTTP_VHOST_TRAFFIC_STATUS_KEY_SEPARATOR;
p = ngx_cpymem(p, state[0].peer->data, state[0].peer->len);
p = ngx_cpymem(p, state->peer->data, state->peer->len);
type = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_UG;
}

Expand Down

0 comments on commit 46e431b

Please sign in to comment.