REQUIRE(VALID_UVREQ(uvreq));
REQUIRE(VALID_NMHANDLE(uvreq->handle));
- isc__netievent_connectcb_t *ievent = isc__nm_get_netievent_connectcb(
- sock->mgr, sock, uvreq, eresult);
-
if (eresult == ISC_R_SUCCESS) {
- isc__nm_maybe_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
+ isc__netievent_connectcb_t ievent = { .sock = sock,
+ .req = uvreq,
+ .result = eresult };
+ isc__nm_async_connectcb(NULL, (isc__netievent_t *)&ievent);
} else {
+ isc__netievent_connectcb_t *ievent =
+ isc__nm_get_netievent_connectcb(sock->mgr, sock, uvreq,
+ eresult);
isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
(isc__netievent_t *)ievent);
}
REQUIRE(VALID_UVREQ(uvreq));
REQUIRE(VALID_NMHANDLE(uvreq->handle));
- isc__netievent_readcb_t *ievent =
- isc__nm_get_netievent_readcb(sock->mgr, sock, uvreq, eresult);
-
if (eresult == ISC_R_SUCCESS) {
- REQUIRE(sock->tid == isc_nm_tid());
- isc__nm_maybe_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
+ isc__netievent_readcb_t ievent = { .sock = sock,
+ .req = uvreq,
+ .result = eresult };
+
+ isc__nm_async_readcb(NULL, (isc__netievent_t *)&ievent);
} else {
+ isc__netievent_readcb_t *ievent = isc__nm_get_netievent_readcb(
+ sock->mgr, sock, uvreq, eresult);
isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
(isc__netievent_t *)ievent);
}
REQUIRE(VALID_UVREQ(uvreq));
REQUIRE(VALID_NMHANDLE(uvreq->handle));
- isc__netievent_sendcb_t *ievent =
- isc__nm_get_netievent_sendcb(sock->mgr, sock, uvreq, eresult);
-
if (eresult == ISC_R_SUCCESS) {
- REQUIRE(sock->tid == isc_nm_tid());
- isc__nm_maybe_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
+ isc__netievent_sendcb_t ievent = { .sock = sock,
+ .req = uvreq,
+ .result = eresult };
+ isc__nm_async_sendcb(NULL, (isc__netievent_t *)&ievent);
} else {
+ isc__netievent_sendcb_t *ievent = isc__nm_get_netievent_sendcb(
+ sock->mgr, sock, uvreq, eresult);
isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
(isc__netievent_t *)ievent);
}
isc_nmsocket_t *sock = handle->sock;
isc_nmsocket_t *psock = NULL, *rsock = sock;
isc_sockaddr_t *peer = &handle->peer;
- isc__netievent_udpsend_t *ievent = NULL;
isc__nm_uvreq_t *uvreq = NULL;
uint32_t maxudp = atomic_load(&sock->mgr->maxudp);
int ntid;
}
if (isc_nm_tid() == rsock->tid) {
- /*
- * If we're in the same thread as the socket we can send
- * the data directly, but we still need to return errors
- * via the callback for API consistency.
- */
- isc_result_t result = udp_send_direct(rsock, uvreq, peer);
- if (result != ISC_R_SUCCESS) {
- isc__nm_incstats(rsock->mgr,
- rsock->statsindex[STATID_SENDFAIL]);
- failed_send_cb(rsock, uvreq, result);
- }
+ isc__netievent_udpsend_t ievent = { .sock = rsock,
+ .req = uvreq,
+ .peer = *peer };
+
+ isc__nm_async_udpsend(NULL, (isc__netievent_t *)&ievent);
} else {
- /*
- * We need to create an event and pass it using async
- * channel
- */
- ievent = isc__nm_get_netievent_udpsend(sock->mgr, rsock);
+ isc__netievent_udpsend_t *ievent =
+ isc__nm_get_netievent_udpsend(sock->mgr, rsock);
ievent->peer = *peer;
ievent->req = uvreq;
REQUIRE(sock->tid == isc_nm_tid());
UNUSED(worker);
- if (!isc__nmsocket_active(ievent->sock)) {
+ if (inactive(sock)) {
failed_send_cb(sock, uvreq, ISC_R_CANCELED);
return;
}
REQUIRE(VALID_NMSOCK(handle->sock));
isc_nmsocket_t *sock = handle->sock;
- isc__netievent_udpread_t *ievent = NULL;
REQUIRE(sock->type == isc_nm_udpsocket);
REQUIRE(sock->statichandle == handle);
sock->recv_cbarg = cbarg;
sock->recv_read = true;
- ievent = isc__nm_get_netievent_udpread(sock->mgr, sock);
-
- if (sock->reading) {
+ if (!sock->reading && sock->tid == isc_nm_tid()) {
+ isc__netievent_udpread_t ievent = { .sock = sock };
+ isc__nm_async_udpread(NULL, (isc__netievent_t *)&ievent);
+ } else {
+ isc__netievent_udpread_t *ievent =
+ isc__nm_get_netievent_udpread(sock->mgr, sock);
isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
(isc__netievent_t *)ievent);
- } else {
- isc__nm_maybe_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
}
}