]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Refactor the normal vs error path in control_senddone()
authorOndřej Surý <ondrej@isc.org>
Thu, 8 Feb 2024 11:31:09 +0000 (12:31 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 8 Feb 2024 16:16:41 +0000 (17:16 +0100)
The code flow in control_senddone() was modified to be simpler to follow
and superfluous INSIST() was zapped from control_recvmessage().

bin/named/controlconf.c

index 46b7ab89280933cc9ebf616b9635fef0e06eacc4..e276497f9e682b8482c351e959924acf242df4cc 100644 (file)
@@ -262,10 +262,11 @@ control_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
                /* Everything is peachy, continue reading from the socket */
                isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage,
                                        conn);
-               goto done;
+               /* Detach the sending reference */
+               controlconnection_detach(&conn);
+               return;
        }
 
-       /* This is the error path */
        if (result != ISC_R_SHUTTINGDOWN) {
                char socktext[ISC_SOCKADDR_FORMATSIZE];
                isc_sockaddr_t peeraddr = isc_nmhandle_peeraddr(handle);
@@ -277,9 +278,9 @@ control_senddone(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
                              socktext, isc_result_totext(result));
        }
 
+       /* Shutdown the reading */
        conn_shutdown(conn);
 
-done:
        /* Detach the sending reference */
        controlconnection_detach(&conn);
 }
@@ -559,9 +560,6 @@ cleanup:
        case ISC_R_EOF:
                break;
        default:
-               /* We can't get here on normal path */
-               INSIST(result != ISC_R_SUCCESS);
-
                log_invalid(&conn->ccmsg, result);
        }