]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
libns: Rename ns_tcpconn refs member to clients
authorWitold Kręcicki <wpk@isc.org>
Wed, 16 Oct 2019 11:18:48 +0000 (13:18 +0200)
committerMichał Kępień <michal@isc.org>
Wed, 6 Nov 2019 20:32:54 +0000 (21:32 +0100)
bin/named/client.c
bin/named/include/named/client.h

index ab1a780a80147e926b004d9416342774bd6fb686..50fa2cd6c4d6dbff9b78e7303189dc37465094f2 100644 (file)
@@ -350,7 +350,7 @@ tcpconn_init(ns_client_t *client, bool force) {
                return (ISC_R_NOMEMORY);
        }
 
-       isc_refcount_init(&tconn->refs, 1);
+       isc_refcount_init(&tconn->clients, 1);  /* Current client */
        tconn->tcpquota = quota;
        quota = NULL;
        tconn->pipelined = false;
@@ -367,14 +367,14 @@ tcpconn_init(ns_client_t *client, bool force) {
  */
 static void
 tcpconn_attach(ns_client_t *source, ns_client_t *target) {
-       int refs;
+       int old_clients;
 
        REQUIRE(source->tcpconn != NULL);
        REQUIRE(target->tcpconn == NULL);
        REQUIRE(source->tcpconn->pipelined);
 
-       isc_refcount_increment(&source->tcpconn->refs, &refs);
-       INSIST(refs > 1);
+       isc_refcount_increment(&source->tcpconn->clients, &old_clients);
+       INSIST(old_clients > 1);
        target->tcpconn = source->tcpconn;
 }
 
@@ -387,15 +387,15 @@ tcpconn_attach(ns_client_t *source, ns_client_t *target) {
 static void
 tcpconn_detach(ns_client_t *client) {
        ns_tcpconn_t *tconn = NULL;
-       int refs;
+       int old_clients;
 
        REQUIRE(client->tcpconn != NULL);
 
        tconn = client->tcpconn;
        client->tcpconn = NULL;
 
-       isc_refcount_decrement(&tconn->refs, &refs);
-       if (refs == 0) {
+       isc_refcount_decrement(&tconn->clients, &old_clients);
+       if (old_clients == 0) {
                isc_quota_detach(&tconn->tcpquota);
                isc_mem_free(ns_g_mctx, tconn);
        }
@@ -2701,7 +2701,7 @@ client_request(isc_task_t *task, isc_event_t *event) {
                 * Limit the maximum number of simultaneous pipelined
                 * queries on TCP connection to TCP_CLIENTS_PER_CONN.
                 */
-               if ((isc_refcount_current(&client->tcpconn->refs)
+               if ((isc_refcount_current(&client->tcpconn->clients)
                            > TCP_CLIENTS_PER_CONN))
                {
                        client->tcpconn->pipelined = false;
index 969ee4c08f8aec8b8f69986862d924b1bade952c..01b6141c997cdc4d19ef92e103248bcdf9c916ef 100644 (file)
 
 /*% reference-counted TCP connection object */
 typedef struct ns_tcpconn {
-       isc_refcount_t          refs;
+       isc_refcount_t          clients;        /* Number of clients using
+                                                * this connection. Conn can
+                                                * be freed if goes to 0
+                                                */
        isc_quota_t             *tcpquota;
        bool                    pipelined;
 } ns_tcpconn_t;