]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
TLS: cancel reading on the underlying TCP socket after (see below)
authorArtem Boldariev <artem@boldariev.com>
Fri, 30 Apr 2021 12:55:21 +0000 (15:55 +0300)
committerArtem Boldariev <artem@boldariev.com>
Fri, 7 May 2021 12:47:24 +0000 (15:47 +0300)
... the last handle has been detached after calling write
callback. That makes it possible to detach from the underlying socket
and not to keep the socket object alive for too long. This issue was
causing TLS tests with quota to fail because quota might not have been
detached on time (because it was still referenced by the underlying
TCP socket).

One could say that this commit is an ideological continuation of:

513cdb52ecd4e63566672217f7390574f68c4d2d.

lib/isc/netmgr/tlsstream.c

index e738d555fbda9eb4180d80f7359d5da7cea649fa..264ffcde41ece416c92949906fd023a1d60f9c69 100644 (file)
@@ -113,8 +113,14 @@ tls_senddone(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
        send_req->tlssock = NULL;
 
        if (send_req->cb != NULL) {
+               INSIST(VALID_NMHANDLE(tlssock->statichandle));
                send_req->cb(send_req->handle, eresult, send_req->cbarg);
                isc_nmhandle_detach(&send_req->handle);
+               /* The last handle has been just detached: close the underlying
+                * socket. */
+               if (tlssock->statichandle == NULL) {
+                       finish = true;
+               }
        }
 
        isc_mem_put(handle->sock->mgr->mctx, send_req->data.base,