2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 05:57:52 +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
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

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 */
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);
}