mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Convert closing the DoH socket to to isc_async callback
Simplify the closing the DoH 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:
@@ -18,6 +18,7 @@
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/netmgr.h>
|
||||
@@ -2725,6 +2726,15 @@ http_close_direct(isc_nmsocket_t *sock) {
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
http_close_cb(void *arg) {
|
||||
isc_nmsocket_t *sock = arg;
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
|
||||
http_close_direct(sock);
|
||||
isc__nmsocket_detach(&sock);
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_http_close(isc_nmsocket_t *sock) {
|
||||
bool destroy = false;
|
||||
@@ -2753,23 +2763,8 @@ isc__nm_http_close(isc_nmsocket_t *sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
isc__netievent_httpclose_t *ievent =
|
||||
isc__nm_get_netievent_httpclose(sock->worker, sock);
|
||||
|
||||
isc__nm_enqueue_ievent(sock->worker, (isc__netievent_t *)ievent);
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_async_httpclose(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
isc__netievent_httpclose_t *ievent = (isc__netievent_httpclose_t *)ev0;
|
||||
isc_nmsocket_t *sock = ievent->sock;
|
||||
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->tid == isc_tid());
|
||||
|
||||
UNUSED(worker);
|
||||
|
||||
http_close_direct(sock);
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
isc_async_run(sock->worker->loop, http_close_cb, sock);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -250,7 +250,6 @@ struct isc_nmhandle {
|
||||
};
|
||||
|
||||
typedef enum isc__netievent_type {
|
||||
netievent_httpclose,
|
||||
netievent_httpsend,
|
||||
netievent_httpendpoints,
|
||||
|
||||
@@ -1431,9 +1430,6 @@ isc__nm_http_verify_tls_peer_result_string(const isc_nmhandle_t *handle);
|
||||
void
|
||||
isc__nm_async_httpsend(isc__networker_t *worker, isc__netievent_t *ev0);
|
||||
|
||||
void
|
||||
isc__nm_async_httpclose(isc__networker_t *worker, isc__netievent_t *ev0);
|
||||
|
||||
void
|
||||
isc__nm_async_httpendpoints(isc__networker_t *worker, isc__netievent_t *ev0);
|
||||
|
||||
@@ -1651,7 +1647,6 @@ isc__nmsocket_stop(isc_nmsocket_t *listener);
|
||||
|
||||
#ifdef HAVE_LIBNGHTTP2
|
||||
NETIEVENT_SOCKET_REQ_TYPE(httpsend);
|
||||
NETIEVENT_SOCKET_TYPE(httpclose);
|
||||
NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints);
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
|
||||
@@ -1667,7 +1662,6 @@ NETIEVENT_SOCKET_TYPE(sockstop);
|
||||
|
||||
#ifdef HAVE_LIBNGHTTP2
|
||||
NETIEVENT_SOCKET_REQ_DECL(httpsend);
|
||||
NETIEVENT_SOCKET_DECL(httpclose);
|
||||
NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints);
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
|
||||
|
@@ -441,7 +441,6 @@ process_netievent(void *arg) {
|
||||
switch (ievent->type) {
|
||||
#if HAVE_LIBNGHTTP2
|
||||
NETIEVENT_CASE(httpsend);
|
||||
NETIEVENT_CASE(httpclose);
|
||||
NETIEVENT_CASE(httpendpoints);
|
||||
#endif
|
||||
NETIEVENT_CASE(streamdnsread);
|
||||
@@ -475,7 +474,6 @@ isc__nm_put_netievent(isc__networker_t *worker, void *ievent) {
|
||||
|
||||
#ifdef HAVE_LIBNGHTTP2
|
||||
NETIEVENT_SOCKET_REQ_DEF(httpsend);
|
||||
NETIEVENT_SOCKET_DEF(httpclose);
|
||||
NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints);
|
||||
#endif /* HAVE_LIBNGHTTP2 */
|
||||
|
||||
|
Reference in New Issue
Block a user