mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
Convert canceling StreamDNS socket to to isc_async callback
Simplify the canceling of the StreamDNS 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:
parent
2185dc75f0
commit
7ddc49d66a
@ -250,8 +250,6 @@ struct isc_nmhandle {
|
||||
};
|
||||
|
||||
typedef enum isc__netievent_type {
|
||||
netievent_streamdnscancel,
|
||||
|
||||
netievent_settlsctx,
|
||||
netievent_sockstop, /* for multilayer sockets */
|
||||
} isc__netievent_type;
|
||||
@ -1467,9 +1465,6 @@ isc__nm_streamdns_stoplistening(isc_nmsocket_t *sock);
|
||||
void
|
||||
isc__nm_streamdns_cleanup_data(isc_nmsocket_t *sock);
|
||||
|
||||
void
|
||||
isc__nm_async_streamdnscancel(isc__networker_t *worker, isc__netievent_t *ev0);
|
||||
|
||||
void
|
||||
isc__nm_streamdns_cancelread(isc_nmhandle_t *handle);
|
||||
|
||||
@ -1634,8 +1629,6 @@ isc__nmsocket_stop(isc_nmsocket_t *listener);
|
||||
|
||||
NETIEVENT_SOCKET_REQ_RESULT_TYPE(sendcb);
|
||||
|
||||
NETIEVENT_SOCKET_HANDLE_TYPE(streamdnscancel);
|
||||
|
||||
NETIEVENT_SOCKET_TLSCTX_TYPE(settlsctx);
|
||||
NETIEVENT_SOCKET_TYPE(sockstop);
|
||||
|
||||
@ -1643,8 +1636,6 @@ NETIEVENT_SOCKET_TYPE(sockstop);
|
||||
|
||||
NETIEVENT_SOCKET_REQ_RESULT_DECL(sendcb);
|
||||
|
||||
NETIEVENT_SOCKET_HANDLE_DECL(streamdnscancel);
|
||||
|
||||
NETIEVENT_SOCKET_TLSCTX_DECL(settlsctx);
|
||||
NETIEVENT_SOCKET_DECL(sockstop);
|
||||
|
||||
|
@ -439,8 +439,6 @@ process_netievent(void *arg) {
|
||||
isc__networker_t *worker = ievent->worker;
|
||||
|
||||
switch (ievent->type) {
|
||||
NETIEVENT_CASE(streamdnscancel);
|
||||
|
||||
NETIEVENT_CASE(settlsctx);
|
||||
NETIEVENT_CASE(sockstop);
|
||||
default:
|
||||
@ -467,8 +465,6 @@ isc__nm_put_netievent(isc__networker_t *worker, void *ievent) {
|
||||
isc__networker_unref(worker);
|
||||
}
|
||||
|
||||
NETIEVENT_SOCKET_HANDLE_DEF(streamdnscancel);
|
||||
|
||||
NETIEVENT_SOCKET_TLSCTX_DEF(settlsctx);
|
||||
NETIEVENT_SOCKET_DEF(sockstop);
|
||||
|
||||
|
@ -962,6 +962,15 @@ isc__nm_streamdns_stoplistening(isc_nmsocket_t *sock) {
|
||||
isc__nmsocket_stop(sock);
|
||||
}
|
||||
|
||||
static void
|
||||
streamdns_cancelread_cb(void *arg) {
|
||||
isc_nmsocket_t *sock = arg;
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
|
||||
streamdns_failed_read_cb(sock, ISC_R_EOF, false);
|
||||
isc__nmsocket_detach(&sock);
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_streamdns_cancelread(isc_nmhandle_t *handle) {
|
||||
isc_nmsocket_t *sock = NULL;
|
||||
@ -972,24 +981,8 @@ isc__nm_streamdns_cancelread(isc_nmhandle_t *handle) {
|
||||
|
||||
sock = handle->sock;
|
||||
|
||||
isc__netievent_streamdnscancel_t *ievent =
|
||||
isc__nm_get_netievent_streamdnscancel(sock->worker,
|
||||
handle->sock, handle);
|
||||
isc__nm_enqueue_ievent(sock->worker, (isc__netievent_t *)ievent);
|
||||
}
|
||||
|
||||
void
|
||||
isc__nm_async_streamdnscancel(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
isc__netievent_streamdnscancel_t *ievent =
|
||||
(isc__netievent_streamdnscancel_t *)ev0;
|
||||
isc_nmsocket_t *sock = ievent->sock;
|
||||
|
||||
UNUSED(worker);
|
||||
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->tid == isc_tid());
|
||||
|
||||
streamdns_failed_read_cb(sock, ISC_R_EOF, false);
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
isc_async_run(sock->worker->loop, streamdns_cancelread_cb, sock);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user