From 5964eb47969f4dc375adcdcd42305044e38e766d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 8 Feb 2024 12:31:09 +0100 Subject: [PATCH] Refactor the normal vs error path in control_senddone() 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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 46b7ab8928..e276497f9e 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -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); }