isc__netievent_tcpstartread_t *ievent = NULL;
isc_nmsocket_t *sock = handle->sock;
+ isc__networker_t *worker = &sock->mgr->workers[sock->tid];
REQUIRE(sock->tid == isc_nm_tid());
ievent = isc__nm_get_netievent_tcpstartread(sock->mgr, sock);
- isc__nm_maybe_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
+ if (worker->recvbuf_inuse) {
+ /*
+ * If we happen to call the resumeread from inside the receive
+ * callback, the worker->recvbuf might still be in use, so we
+ * need to force enqueue the next read event.
+ */
+ isc__nm_enqueue_ievent(worker, (isc__netievent_t *)ievent);
+
+ } else {
+ isc__nm_maybe_enqueue_ievent(worker,
+ (isc__netievent_t *)ievent);
+ }
}
void