]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
TLS Stream: backport connect callback handling behaviour from main
authorArtem Boldariev <artem@boldariev.com>
Thu, 30 Mar 2023 15:37:21 +0000 (18:37 +0300)
committerArtem Boldariev <artem@boldariev.com>
Thu, 30 Mar 2023 15:37:21 +0000 (18:37 +0300)
This commit contains the backport of the behaviour for handling TLS
connect callbacks when wrapping up.

The current behaviour have not caused any problems to us, yet, but we
are changing it to remain on the safer side.

lib/isc/netmgr/tlsstream.c

index d18655d74342d029863f12892ec9af2e1bdfcab1..7b490719bba47559783040ab9af4ea41d5d8b369 100644 (file)
@@ -344,10 +344,15 @@ tls_try_handshake(isc_nmsocket_t *sock, isc_result_t *presult) {
                INSIST(sock->statichandle == NULL);
                isc__nmsocket_log_tls_session_reuse(sock, sock->tlsstream.tls);
                tlshandle = isc__nmhandle_get(sock, &sock->peer, &sock->iface);
+
+               if (isc__nm_closing(sock)) {
+                       result = ISC_R_SHUTTINGDOWN;
+               }
+
                if (sock->tlsstream.server) {
                        if (isc__nmsocket_closing(sock->listener)) {
                                result = ISC_R_CANCELED;
-                       } else {
+                       } else if (result == ISC_R_SUCCESS) {
                                result = sock->listener->accept_cb(
                                        tlshandle, result,
                                        sock->listener->accept_cbarg);
@@ -466,7 +471,6 @@ tls_do_bio(isc_nmsocket_t *sock, isc_region_t *received_data,
                                        INSIST(SSL_is_init_finished(
                                                       sock->tlsstream.tls) ==
                                               1);
-                                       INSIST(!atomic_load(&sock->client));
                                        finish = true;
                                }
                        }