MINOR: proxy: add 'served' field to proxy, equal to total of all servers'
This will allow lb_chash to determine the total active sessions for a
proxy without any computation.
Signed-off-by: Andrew Rodland <andrewr@vimeo.com>
diff --git a/src/queue.c b/src/queue.c
index 1f27c49..08a6c3d 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -126,6 +126,7 @@
strm->target = &srv->obj_type;
stream_add_srv_conn(strm, srv);
srv->served++;
+ srv->proxy->served++;
if (px->lbprm.server_take_conn)
px->lbprm.server_take_conn(srv);
diff --git a/src/stream.c b/src/stream.c
index 151bcb0..738a23c 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2515,6 +2515,7 @@
if (sess->srv_conn) {
sess->srv_conn->served--;
+ sess->srv_conn->proxy->served--;
if (sess->srv_conn->proxy->lbprm.server_drop_conn)
sess->srv_conn->proxy->lbprm.server_drop_conn(sess->srv_conn);
stream_del_srv_conn(sess);
@@ -2522,6 +2523,7 @@
if (newsrv) {
newsrv->served++;
+ newsrv->proxy->served++;
if (newsrv->proxy->lbprm.server_take_conn)
newsrv->proxy->lbprm.server_take_conn(newsrv);
stream_add_srv_conn(sess, newsrv);