summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/changes.xml6
-rw-r--r--src/nxt_conn.h3
-rw-r--r--src/nxt_conn_close.c8
3 files changed, 13 insertions, 4 deletions
diff --git a/docs/changes.xml b/docs/changes.xml
index 7c0712f3..e37c8219 100644
--- a/docs/changes.xml
+++ b/docs/changes.xml
@@ -37,6 +37,12 @@ fix HTTP cookie parsing when the value contains an equals sign.
</para>
</change>
+<change type="bugfix">
+<para>
+fix error in connection statistics when using proxy.
+</para>
+</change>
+
</changes>
diff --git a/src/nxt_conn.h b/src/nxt_conn.h
index 8a703e9a..5717d3c9 100644
--- a/src/nxt_conn.h
+++ b/src/nxt_conn.h
@@ -312,8 +312,7 @@ NXT_EXPORT void nxt_event_conn_job_sendfile(nxt_task_t *task,
\
nxt_queue_remove(&c->link); \
\
- c->idle = 0; \
- e->idle_conns_cnt--; \
+ e->idle_conns_cnt -= c->idle; \
} while (0)
diff --git a/src/nxt_conn_close.c b/src/nxt_conn_close.c
index 92bd8d1b..bdd66951 100644
--- a/src/nxt_conn_close.c
+++ b/src/nxt_conn_close.c
@@ -119,7 +119,9 @@ nxt_conn_close_handler(nxt_task_t *task, void *obj, void *data)
nxt_socket_close(task, c->socket.fd);
c->socket.fd = -1;
- engine->closed_conns_cnt++;
+ if (c->idle) {
+ engine->closed_conns_cnt++;
+ }
if (timers_pending == 0) {
nxt_work_queue_add(&engine->fast_work_queue,
@@ -155,7 +157,9 @@ nxt_conn_close_timer_handler(nxt_task_t *task, void *obj, void *data)
nxt_socket_close(task, c->socket.fd);
c->socket.fd = -1;
- engine->closed_conns_cnt++;
+ if (c->idle) {
+ engine->closed_conns_cnt++;
+ }
}
nxt_work_queue_add(&engine->fast_work_queue, c->write_state->ready_handler,