* Pause reading on this socket, while still remembering the callback.
*/
+void
+isc_nm_cancelread(isc_nmhandle_t *handle);
+/*%<
+ * Cancel reading on a connected socket. Calls the read/recv callback on
+ * active handles with a result code of ISC_R_CANCELED.
+ *
+ * Requires:
+ * \li 'sock' is a valid netmgr socket
+ * \li ...for which a read/recv callback has been defined.
+ */
+
isc_result_t
isc_nm_resumeread(isc_nmsocket_t *sock);
/*%<
void
isc__nm_tcp_shutdown(isc_nmsocket_t *sock);
/*%<
- * Called on shutdown to close and clean up a listening TCP socket.
+ * Called during the shutdown process to close and clean up connected
+ * sockets.
+ */
+
+void
+isc__nm_tcp_cancelread(isc_nmsocket_t *sock);
+/*%<
+ * Stop reading on a connected socket.
*/
void
}
}
+void
+isc_nm_cancelread(isc_nmhandle_t *handle) {
+ REQUIRE(VALID_NMHANDLE(handle));
+
+ switch (handle->sock->type) {
+ case isc_nm_tcpsocket:
+ isc__nm_tcp_cancelread(handle->sock);
+ break;
+ default:
+ INSIST(0);
+ ISC_UNREACHABLE();
+ }
+}
+
isc_result_t
isc_nm_pauseread(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
+
switch (sock->type) {
case isc_nm_tcpsocket:
return (isc__nm_tcp_pauseread(sock));
isc_result_t
isc_nm_resumeread(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
+
switch (sock->type) {
case isc_nm_tcpsocket:
return (isc__nm_tcp_resumeread(sock));
void
isc_nm_stoplistening(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
+
switch (sock->type) {
case isc_nm_udplistener:
isc__nm_udp_stoplistening(sock);
sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
}
}
+
+void
+isc__nm_tcp_cancelread(isc_nmsocket_t *sock) {
+ REQUIRE(VALID_NMSOCK(sock));
+
+ if (sock->type == isc_nm_tcpsocket && sock->tcphandle != NULL &&
+ sock->rcb.recv != NULL)
+ {
+ sock->rcb.recv(sock->tcphandle, ISC_R_CANCELED, NULL,
+ sock->rcbarg);
+ }
+}
isc_nmhandle_ref
isc_nmhandle_setdata
isc_nmhandle_unref
+isc_nm_cancelread
isc_nm_closedown
isc_nm_destroy
isc_nm_detach