2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 22:45:39 +00:00

Convert doing the TLS IO to to isc_async callback

Simplify the doing the TLS IO 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:52:47 +01:00
parent 3d4d099ac8
commit 8c48c51f71
3 changed files with 13 additions and 24 deletions

View File

@@ -250,8 +250,6 @@ struct isc_nmhandle {
};
typedef enum isc__netievent_type {
netievent_tlsdobio,
netievent_httpclose,
netievent_httpsend,
netievent_httpendpoints,
@@ -1276,9 +1274,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_tlsdobio(isc__networker_t *worker, isc__netievent_t *ev0);
void
isc__nm_tls_send(isc_nmhandle_t *handle, const isc_region_t *region,
isc_nm_cb_t cb, void *cbarg);
@@ -1654,8 +1649,6 @@ isc__nmsocket_stop(isc_nmsocket_t *listener);
* typedef all the netievent types
*/
NETIEVENT_SOCKET_TYPE(tlsdobio);
#ifdef HAVE_LIBNGHTTP2
NETIEVENT_SOCKET_REQ_TYPE(httpsend);
NETIEVENT_SOCKET_TYPE(httpclose);
@@ -1672,8 +1665,6 @@ NETIEVENT_SOCKET_TYPE(sockstop);
/* Now declared the helper functions */
NETIEVENT_SOCKET_DECL(tlsdobio);
#ifdef HAVE_LIBNGHTTP2
NETIEVENT_SOCKET_REQ_DECL(httpsend);
NETIEVENT_SOCKET_DECL(httpclose);

View File

@@ -439,7 +439,6 @@ process_netievent(void *arg) {
isc__networker_t *worker = ievent->worker;
switch (ievent->type) {
NETIEVENT_CASE(tlsdobio);
#if HAVE_LIBNGHTTP2
NETIEVENT_CASE(httpsend);
NETIEVENT_CASE(httpclose);
@@ -474,8 +473,6 @@ isc__nm_put_netievent(isc__networker_t *worker, void *ievent) {
isc__networker_unref(worker);
}
NETIEVENT_SOCKET_DEF(tlsdobio);
#ifdef HAVE_LIBNGHTTP2
NETIEVENT_SOCKET_REQ_DEF(httpsend);
NETIEVENT_SOCKET_DEF(httpclose);

View File

@@ -269,11 +269,21 @@ isc__nm_tls_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result,
}
}
static void
tls_do_bio_cb(void *arg) {
isc_nmsocket_t *sock = arg;
REQUIRE(VALID_NMSOCK(sock));
tls_do_bio(sock, NULL, NULL, false);
isc__nmsocket_detach(&sock);
}
static void
async_tls_do_bio(isc_nmsocket_t *sock) {
isc__netievent_tlsdobio_t *ievent =
isc__nm_get_netievent_tlsdobio(sock->worker, sock);
isc__nm_enqueue_ievent(sock->worker, (isc__netievent_t *)ievent);
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
isc_async_run(sock->worker->loop, tls_do_bio_cb, sock);
}
static int
@@ -1206,15 +1216,6 @@ error:
isc__nmsocket_detach(&tlssock);
}
void
isc__nm_async_tlsdobio(isc__networker_t *worker, isc__netievent_t *ev0) {
isc__netievent_tlsdobio_t *ievent = (isc__netievent_tlsdobio_t *)ev0;
UNUSED(worker);
tls_do_bio(ievent->sock, NULL, NULL, false);
}
void
isc__nm_tls_cleanup_data(isc_nmsocket_t *sock) {
if (sock->type == isc_nm_tcplistener &&