2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 05:28:00 +00:00

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.
This commit is contained in:
Ondřej Surý 2023-03-23 22:46:58 +01:00
parent 4f27b14cd1
commit 35b4ef0a08
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41
3 changed files with 8 additions and 26 deletions

View File

@ -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);

View File

@ -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);

View File

@ -948,19 +948,17 @@ 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));
isc_nmsocket_t *sock = req->sock;
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->tid == isc_tid());
UNUSED(worker);
ievent->req = NULL;
if (inactive(sock)) {
req->cb.send(req->handle, ISC_R_CANCELED, req->cbarg);
goto done;
@ -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