]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use ISC_R_SHUTTINGDOWN to detect netmgr shutting down
authorOndřej Surý <ondrej@isc.org>
Tue, 11 Jan 2022 13:27:28 +0000 (14:27 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 13 Jan 2022 08:14:12 +0000 (09:14 +0100)
When the dispatch code was refactored in libdns, the netmgr was changed
to return ISC_R_SHUTTINGDOWN when the netmgr is shutting down, and the
ISC_R_CANCELED is now reserved only for situation where the callback was
canceled by the caller.

This change wasn't reflected in the controlconf.c channel which was
still looking for ISC_R_CANCELED as the shutdown event.

bin/named/controlconf.c
lib/isccc/ccmsg.c

index 3a276cdca25cf17dc9ae8dd9ee363bb9c54ba5c5..2d7bcd8f60adecfc9839ff18a3396e8cc1d64cfc 100644 (file)
@@ -231,7 +231,7 @@ control_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
        }
 
        if (atomic_load_acquire(&listener->controls->shuttingdown) ||
-           result == ISC_R_CANCELED)
+           result == ISC_R_SHUTTINGDOWN)
        {
                goto cleanup_sendhandle;
        } else if (result != ISC_R_SUCCESS) {
@@ -414,7 +414,7 @@ control_recvmessage(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
        }
 
        if (result != ISC_R_SUCCESS) {
-               if (result == ISC_R_SHUTTINGDOWN || result == ISC_R_CANCELED) {
+               if (result == ISC_R_SHUTTINGDOWN) {
                        atomic_store_release(&listener->controls->shuttingdown,
                                             true);
                } else if (result != ISC_R_EOF) {
@@ -630,7 +630,7 @@ control_newconn(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
        isc_sockaddr_t peeraddr;
 
        if (result != ISC_R_SUCCESS) {
-               if (result == ISC_R_CANCELED) {
+               if (result == ISC_R_SHUTTINGDOWN) {
                        shutdown_listener(listener);
                }
                return (result);
index a2d4ad3d4ce204c7e33a861a09f234269deb8424..9ee48ab9c0c8e89b21c71ffb40b455f62b1d8899 100644 (file)
@@ -51,17 +51,22 @@ recv_data(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
 
        INSIST(VALID_CCMSG(ccmsg));
 
-       if (eresult == ISC_R_CANCELED || eresult == ISC_R_EOF) {
+       switch (eresult) {
+       case ISC_R_SHUTTINGDOWN:
+       case ISC_R_CANCELED:
+       case ISC_R_EOF:
                ccmsg->result = eresult;
                goto done;
-       } else if (region == NULL && eresult == ISC_R_SUCCESS) {
-               ccmsg->result = ISC_R_EOF;
-               goto done;
-       } else if (eresult != ISC_R_SUCCESS) {
+       case ISC_R_SUCCESS:
+               if (region == NULL) {
+                       ccmsg->result = ISC_R_EOF;
+                       goto done;
+               }
+               ccmsg->result = ISC_R_SUCCESS;
+               break;
+       default:
                ccmsg->result = eresult;
                goto done;
-       } else {
-               ccmsg->result = eresult;
        }
 
        if (!ccmsg->length_received) {