Skip to content

Commit 46e431b

Browse files
authored
Merge pull request #252 from u5surf/issue-228
Bugfix: fixed issues/228 Change the reffered source of upstream_state
2 parents 443d883 + 4bbac92 commit 46e431b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/ngx_http_vhost_traffic_status_shm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,28 +481,28 @@ ngx_http_vhost_traffic_status_shm_add_upstream(ngx_http_request_t *r)
481481

482482
found:
483483

484-
state = r->upstream_states->elts;
485-
if (state[0].peer == NULL) {
484+
state = u->state;
485+
if (state->peer == NULL) {
486486
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
487487
"shm_add_upstream::peer failed");
488488
return NGX_ERROR;
489489
}
490490

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

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

502502
} else {
503503
p = ngx_cpymem(p, uscf->host.data, uscf->host.len);
504504
*p++ = NGX_HTTP_VHOST_TRAFFIC_STATUS_KEY_SEPARATOR;
505-
p = ngx_cpymem(p, state[0].peer->data, state[0].peer->len);
505+
p = ngx_cpymem(p, state->peer->data, state->peer->len);
506506
type = NGX_HTTP_VHOST_TRAFFIC_STATUS_UPSTREAM_UG;
507507
}
508508

0 commit comments

Comments
 (0)