diff --git a/lib/isccc/ccmsg.c b/lib/isccc/ccmsg.c index 80d622da79..4c033dd975 100644 --- a/lib/isccc/ccmsg.c +++ b/lib/isccc/ccmsg.c @@ -102,10 +102,7 @@ recv_data(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, done: isc_nm_read_stop(handle); - if (ccmsg->reading) { - ccmsg->reading = false; - ccmsg->recv_cb(handle, eresult, ccmsg->recv_cbarg); - } + ccmsg->recv_cb(handle, eresult, ccmsg->recv_cbarg); return; } @@ -145,7 +142,6 @@ isccc_ccmsg_readmessage(isccc_ccmsg_t *ccmsg, isc_nm_cb_t cb, void *cbarg) { ccmsg->recv_cbarg = cbarg; ccmsg->length_received = false; - ccmsg->reading = true; isc_nm_read(ccmsg->handle, recv_data, ccmsg); } @@ -159,10 +155,6 @@ ccmsg_senddone(isc_nmhandle_t *handle, isc_result_t eresult, void *arg) { ccmsg->send_cb(handle, eresult, ccmsg->send_cbarg); ccmsg->send_cb = NULL; - if (eresult != ISC_R_SUCCESS && ccmsg->reading) { - recv_data(handle, eresult, NULL, ccmsg); - } - isc_nmhandle_detach(&handle); } @@ -184,6 +176,7 @@ isccc_ccmsg_disconnect(isccc_ccmsg_t *ccmsg) { REQUIRE(VALID_CCMSG(ccmsg)); if (ccmsg->handle != NULL) { + isc_nm_read_stop(ccmsg->handle); isc_nmhandle_close(ccmsg->handle); isc_nmhandle_detach(&ccmsg->handle); } diff --git a/lib/isccc/include/isccc/ccmsg.h b/lib/isccc/include/isccc/ccmsg.h index 7a20a7c2e1..5120732901 100644 --- a/lib/isccc/include/isccc/ccmsg.h +++ b/lib/isccc/include/isccc/ccmsg.h @@ -54,7 +54,6 @@ typedef struct isccc_ccmsg { void *recv_cbarg; isc_nm_cb_t send_cb; void *send_cbarg; - bool reading; } isccc_ccmsg_t; ISC_LANG_BEGINDECLS