]> 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 15:37:13 +0000 (16:37 +0100)
lib/ns/client.c
lib/ns/include/ns/client.h

index 7b6f4bb4d6029af7b659329473cf8049335e3100..84b78ac0fe998bc315caf16b10f241aea4ac981c 100644 (file)
@@ -364,7 +364,7 @@ tcpconn_init(ns_client_t *client, bool force) {
         */
        tconn = isc_mem_allocate(client->sctx->mctx, sizeof(*tconn));
 
-       isc_refcount_init(&tconn->refs, 1);
+       isc_refcount_init(&tconn->clients, 1);  /* Current client */
        tconn->tcpquota = quota;
        quota = NULL;
        tconn->pipelined = false;
@@ -381,14 +381,14 @@ tcpconn_init(ns_client_t *client, bool force) {
  */
 static void
 tcpconn_attach(ns_client_t *source, ns_client_t *target) {
-       int old_refs;
+       int old_clients;
 
        REQUIRE(source->tcpconn != NULL);
        REQUIRE(target->tcpconn == NULL);
        REQUIRE(source->tcpconn->pipelined);
 
-       old_refs = isc_refcount_increment(&source->tcpconn->refs);
-       INSIST(old_refs > 0);
+       old_clients = isc_refcount_increment(&source->tcpconn->clients);
+       INSIST(old_clients > 0);
        target->tcpconn = source->tcpconn;
 }
 
@@ -401,17 +401,17 @@ tcpconn_attach(ns_client_t *source, ns_client_t *target) {
 static void
 tcpconn_detach(ns_client_t *client) {
        ns_tcpconn_t *tconn = NULL;
-       int old_refs;
+       int old_clients;
 
        REQUIRE(client->tcpconn != NULL);
 
        tconn = client->tcpconn;
        client->tcpconn = NULL;
 
-       old_refs = isc_refcount_decrement(&tconn->refs);
-       INSIST(old_refs > 0);
+       old_clients = isc_refcount_decrement(&tconn->clients);
+       INSIST(old_clients > 0);
 
-       if (old_refs == 1) {
+       if (old_clients == 1) {
                isc_quota_detach(&tconn->tcpquota);
                isc_mem_free(client->sctx->mctx, tconn);
        }
@@ -2685,7 +2685,7 @@ ns__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 110d25e95366277096e8a9fc3019b93bc68a662c..56a48646f7bc027165ce59b4ecf7a6a610872d01 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;