From: Ondřej Surý Date: Thu, 23 Mar 2023 21:46:58 +0000 (+0100) Subject: Convert sending on the TLS socket to to isc_async callback X-Git-Tag: v9.19.12~66^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=35b4ef0a08fa7916559c4bc25e34a46a9378cae4;p=thirdparty%2Fbind9.git Convert sending on the TLS socket to to isc_async callback Simplify the sending on the TLS socket by using the isc_async API from the loopmgr instead of using the asychronous netievent mechanism in the netmgr. --- diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index 96307c7e5d4..4283ac062c2 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -250,7 +250,6 @@ struct isc_nmhandle { }; typedef enum isc__netievent_type { - netievent_tlssend, netievent_tlsconnect, netievent_tlsdobio, @@ -1286,9 +1285,6 @@ isc__nm_tcp_senddns(isc_nmhandle_t *handle, const isc_region_t *region, * ahead of data (two bytes (16 bit) in big-endian format). */ -void -isc__nm_async_tlssend(isc__networker_t *worker, isc__netievent_t *ev0); - void isc__nm_async_tlsdobio(isc__networker_t *worker, isc__netievent_t *ev0); @@ -1677,8 +1673,6 @@ NETIEVENT_SOCKET_TYPE(httpclose); NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints); #endif /* HAVE_LIBNGHTTP2 */ -NETIEVENT_SOCKET_REQ_TYPE(tlssend); - NETIEVENT_SOCKET_REQ_RESULT_TYPE(sendcb); NETIEVENT_SOCKET_TYPE(streamdnsread); @@ -1698,8 +1692,6 @@ NETIEVENT_SOCKET_DECL(httpclose); NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints); #endif /* HAVE_LIBNGHTTP2 */ -NETIEVENT_SOCKET_REQ_DECL(tlssend); - NETIEVENT_SOCKET_REQ_RESULT_DECL(sendcb); NETIEVENT_SOCKET_DECL(streamdnsread); diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 3579f9f95d4..bc4f50f8d9f 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -439,7 +439,6 @@ process_netievent(void *arg) { isc__networker_t *worker = ievent->worker; switch (ievent->type) { - NETIEVENT_CASE(tlssend); NETIEVENT_CASE(tlsdobio); #if HAVE_LIBNGHTTP2 NETIEVENT_CASE(httpsend); @@ -484,8 +483,6 @@ NETIEVENT_SOCKET_DEF(httpclose); NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints); #endif /* HAVE_LIBNGHTTP2 */ -NETIEVENT_SOCKET_REQ_DEF(tlssend); - NETIEVENT_SOCKET_DEF(streamdnsread); NETIEVENT_SOCKET_HANDLE_DEF(streamdnscancel); diff --git a/lib/isc/netmgr/tlsstream.c b/lib/isc/netmgr/tlsstream.c index 8e686be5e35..6010a2b8609 100644 --- a/lib/isc/netmgr/tlsstream.c +++ b/lib/isc/netmgr/tlsstream.c @@ -948,18 +948,16 @@ isc_nm_listentls(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface, return (result); } -void -isc__nm_async_tlssend(isc__networker_t *worker, isc__netievent_t *ev0) { - isc__netievent_tlssend_t *ievent = (isc__netievent_tlssend_t *)ev0; - isc_nmsocket_t *sock = ievent->sock; - isc__nm_uvreq_t *req = ievent->req; +static void +tls_send_direct(void *arg) { + isc__nm_uvreq_t *req = arg; REQUIRE(VALID_UVREQ(req)); - REQUIRE(sock->tid == isc_tid()); - UNUSED(worker); + isc_nmsocket_t *sock = req->sock; - ievent->req = NULL; + REQUIRE(VALID_NMSOCK(sock)); + REQUIRE(sock->tid == isc_tid()); if (inactive(sock)) { req->cb.send(req->handle, ISC_R_CANCELED, req->cbarg); @@ -975,7 +973,6 @@ done: static void tls_send(isc_nmhandle_t *handle, const isc_region_t *region, isc_nm_cb_t cb, void *cbarg, const bool dnsmsg) { - isc__netievent_tlssend_t *ievent = NULL; isc__nm_uvreq_t *uvreq = NULL; isc_nmsocket_t *sock = NULL; @@ -996,11 +993,7 @@ tls_send(isc_nmhandle_t *handle, const isc_region_t *region, isc_nm_cb_t cb, *(uint16_t *)uvreq->tcplen = htons(region->length); } - /* - * We need to create an event and pass it using async channel - */ - ievent = isc__nm_get_netievent_tlssend(sock->worker, sock, uvreq); - isc__nm_enqueue_ievent(sock->worker, (isc__netievent_t *)ievent); + isc_async_run(sock->worker->loop, tls_send_direct, uvreq); } void