conn->shuttingdown = true;
/*
- * Calling invalidate on ccmsg will shutdown the TCP connection, thus
- * we are making sure that no read callback will be called ever again.
+ * Close the TCP connection to make sure that no read callback will be
+ * called for it ever again.
*/
- isccc_ccmsg_invalidate(&conn->ccmsg);
+ isccc_ccmsg_disconnect(&conn->ccmsg);
/* Detach the reading reference */
controlconnection_detach(&conn);
controllistener_t *listener = conn->listener;
+ isccc_ccmsg_invalidate(&conn->ccmsg);
+
conn_cleanup(conn);
if (conn->buffer != NULL) {
isccc_sexpr_free(&response);
- isccc_ccmsg_invalidate(ccmsg);
+ isccc_ccmsg_disconnect(ccmsg);
isc_loopmgr_shutdown(loopmgr);
}
isc_loopmgr_run(loopmgr);
+ isccc_ccmsg_invalidate(&rndc_ccmsg);
+
isc_log_destroy(&log);
isc_log_setcontext(NULL);
isc_nm_send(ccmsg->handle, region, ccmsg_senddone, ccmsg);
}
+void
+isccc_ccmsg_disconnect(isccc_ccmsg_t *ccmsg) {
+ REQUIRE(VALID_CCMSG(ccmsg));
+
+ if (ccmsg->handle != NULL) {
+ isc_nmhandle_close(ccmsg->handle);
+ isc_nmhandle_detach(&ccmsg->handle);
+ }
+}
+
void
isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg) {
REQUIRE(VALID_CCMSG(ccmsg));
if (ccmsg->buffer != NULL) {
isc_buffer_free(&ccmsg->buffer);
}
- if (ccmsg->handle != NULL) {
- isc_nmhandle_close(ccmsg->handle);
- isc_nmhandle_detach(&ccmsg->handle);
- }
}
void
*/
void
-isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
+isccc_ccmsg_disconnect(isccc_ccmsg_t *ccmsg);
/*%
- * Clean up all allocated state, and invalidate the structure.
+ * Disconnect from the connected netmgr handle associated with a command
+ * channel message.
*
* Requires:
*
- *\li "ccmsg" be valid.
+ *\li "ccmsg" to be valid.
+ */
+
+void
+isccc_ccmsg_invalidate(isccc_ccmsg_t *ccmsg);
+/*%
+ * Clean up the magic number and the dynamic buffer associated with a command
+ * channel message.
*
- * Ensures:
+ * Requires:
*
- *\li "ccmsg" is invalidated and disassociated with all memory contexts,
- * sockets, etc.
+ *\li "ccmsg" to be valid.
*/
void