diff options
author | Vladimir Homutov <vl@nginx.com> | 2016-09-02 18:27:08 +0300 |
---|---|---|
committer | Vladimir Homutov <vl@nginx.com> | 2016-09-02 18:27:08 +0300 |
commit | 64223df67078cec444cdf71584015036c68dcc32 (patch) | |
tree | fd1227772d783c34cfb9cb924368d8b45986533b /src/stream/ngx_stream_proxy_module.c | |
parent | c6d456da87fab9fc953f4f0d8506ac83415e774c (diff) | |
download | nginx-64223df67078cec444cdf71584015036c68dcc32.tar.gz nginx-64223df67078cec444cdf71584015036c68dcc32.zip |
Stream: $upstream_bytes_sent and $upstream_bytes_received.
Diffstat (limited to 'src/stream/ngx_stream_proxy_module.c')
-rw-r--r-- | src/stream/ngx_stream_proxy_module.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c index dd8d7811d..edffaf8e5 100644 --- a/src/stream/ngx_stream_proxy_module.c +++ b/src/stream/ngx_stream_proxy_module.c @@ -1630,6 +1630,9 @@ ngx_stream_proxy_next_upstream(ngx_stream_session_t *s) } #endif + u->state->bytes_received = u->received; + u->state->bytes_sent = pc->sent; + ngx_close_connection(pc); u->peer.connection = NULL; } @@ -1658,13 +1661,20 @@ ngx_stream_proxy_finalize(ngx_stream_session_t *s, ngx_uint_t rc) u->resolved->ctx = NULL; } + pc = u->peer.connection; + + if (u->state) { + if (pc) { + u->state->bytes_received = u->received; + u->state->bytes_sent = pc->sent; + } + } + if (u->peer.free && u->peer.sockaddr) { u->peer.free(&u->peer, u->peer.data, 0); u->peer.sockaddr = NULL; } - pc = u->peer.connection; - if (pc) { ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, "close stream proxy upstream connection: %d", pc->fd); |