]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Added function that counts how many connections are active within...
authorStephan Bosch <stephan@dovecot.fi>
Tue, 13 Sep 2016 23:30:16 +0000 (01:30 +0200)
committerGitLab <gitlab@git.dovecot.net>
Wed, 2 Nov 2016 11:42:18 +0000 (13:42 +0200)
src/lib-http/http-client-peer.c
src/lib-http/http-client-private.h

index f10b2b9884be79f11a68a4aed24042c9edb4e1a4..0bcaa4591d45a0109f402cc82ce3fca5be05e19e 100644 (file)
@@ -782,6 +782,21 @@ http_client_peer_idle_connections(struct http_client_peer *peer)
        return idle;
 }
 
+unsigned int
+http_client_peer_active_connections(struct http_client_peer *peer)
+{
+       struct http_client_connection *const *conn_idx;
+       unsigned int active = 0;
+
+       /* find idle connections */
+       array_foreach(&peer->conns, conn_idx) {
+               if (http_client_connection_is_active(*conn_idx))
+                       active++;
+       }
+
+       return active;
+}
+
 unsigned int
 http_client_peer_pending_connections(struct http_client_peer *peer)
 {
index d5ad05d94b8bc4dc822797cc76e77475f5348e27..1c1ec8aa7aace69aa027779379f8fc5cf36d2482 100644 (file)
@@ -459,6 +459,8 @@ bool http_client_peer_is_connected(struct http_client_peer *peer);
 unsigned int
 http_client_peer_idle_connections(struct http_client_peer *peer);
 unsigned int
+http_client_peer_active_connections(struct http_client_peer *peer);
+unsigned int
 http_client_peer_pending_connections(struct http_client_peer *peer);
 void http_client_peer_switch_ioloop(struct http_client_peer *peer);