Fix the isc_nm_closedown() to actually close the pending connections

1. The isc__nm_tcp_send() and isc__nm_tcp_read() was not checking
   whether the socket was still alive and scheduling reads/sends on
   closed socket.

2. The isc_nm_read(), isc_nm_send() and isc_nm_resumeread() have been
   changed to always return the error conditions via the callbacks, so
   they always succeed.  This applies to all protocols (UDP, TCP and
   TCPDNS).
This commit is contained in:
Ondřej Surý
2020-10-21 12:52:09 +02:00
committed by Evan Hunt
parent 6af08d1ca6
commit f7c82e406e
13 changed files with 203 additions and 262 deletions

View File

@@ -133,10 +133,8 @@ isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize) {
ccmsg->maxsize = maxsize;
}
isc_result_t
void
isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg) {
isc_result_t result;
REQUIRE(VALID_CCMSG(ccmsg));
if (ccmsg->buffer != NULL) {
@@ -149,16 +147,11 @@ isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg) {
ccmsg->length_received = false;
if (ccmsg->reading) {
result = isc_nm_resumeread(ccmsg->handle);
isc_nm_resumeread(ccmsg->handle);
} else {
result = isc_nm_read(ccmsg->handle, recv_data, ccmsg);
isc_nm_read(ccmsg->handle, recv_data, ccmsg);
ccmsg->reading = true;
}
if (result != ISC_R_SUCCESS) {
ccmsg->reading = false;
}
return (result);
}
void

View File

@@ -87,7 +87,7 @@ isccc_ccmsg_setmaxsize(isccc_ccmsg_t *ccmsg, unsigned int maxsize);
*\li 512 <= "maxsize" <= 4294967296
*/
isc_result_t
void
isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg);
/*%
* Schedule an event to be delivered when a command channel message is
@@ -97,11 +97,6 @@ isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg);
*
*\li "ccmsg" be valid.
*
* Returns:
*
*\li #ISC_R_SUCCESS -- no error
*\li Anything that the isc_nm_read() call can return.
*
* Notes:
*
*\li The event delivered is a fully generic event. It will contain no