2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

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().
This commit is contained in:
Ondřej Surý
2024-02-08 12:31:09 +01:00
parent de25743e00
commit 5964eb4796

View 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 */ /* Everything is peachy, continue reading from the socket */
isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage, isccc_ccmsg_readmessage(&conn->ccmsg, control_recvmessage,
conn); conn);
goto done; /* Detach the sending reference */
controlconnection_detach(&conn);
return;
} }
/* This is the error path */
if (result != ISC_R_SHUTTINGDOWN) { if (result != ISC_R_SHUTTINGDOWN) {
char socktext[ISC_SOCKADDR_FORMATSIZE]; char socktext[ISC_SOCKADDR_FORMATSIZE];
isc_sockaddr_t peeraddr = isc_nmhandle_peeraddr(handle); 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)); socktext, isc_result_totext(result));
} }
/* Shutdown the reading */
conn_shutdown(conn); conn_shutdown(conn);
done:
/* Detach the sending reference */ /* Detach the sending reference */
controlconnection_detach(&conn); controlconnection_detach(&conn);
} }
@@ -559,9 +560,6 @@ cleanup:
case ISC_R_EOF: case ISC_R_EOF:
break; break;
default: default:
/* We can't get here on normal path */
INSIST(result != ISC_R_SUCCESS);
log_invalid(&conn->ccmsg, result); log_invalid(&conn->ccmsg, result);
} }