diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index 5e88c866af..65d57929f9 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -2956,6 +2956,29 @@ isc__nm_http_set_max_streams(isc_nmsocket_t *listener, atomic_store(&listener->h2.max_concurrent_streams, max_streams); } +typedef struct http_endpoints_data { + isc_nmsocket_t *listener; + isc_nm_http_endpoints_t *endpoints; +} http_endpoints_data_t; + +static void +http_set_endpoints_cb(void *arg) { + http_endpoints_data_t *data = arg; + const int tid = isc_tid(); + isc_nmsocket_t *listener = data->listener; + isc_nm_http_endpoints_t *endpoints = data->endpoints; + isc__networker_t *worker = &listener->worker->netmgr->workers[tid]; + + isc_mem_put(worker->loop->mctx, data, sizeof(*data)); + + isc_nm_http_endpoints_detach(&listener->h2.listener_endpoints[tid]); + isc_nm_http_endpoints_attach(endpoints, + &listener->h2.listener_endpoints[tid]); + + isc_nm_http_endpoints_detach(&endpoints); + isc__nmsocket_detach(&listener); +} + void isc_nm_http_set_endpoints(isc_nmsocket_t *listener, isc_nm_http_endpoints_t *eps) { @@ -2970,29 +2993,18 @@ isc_nm_http_set_endpoints(isc_nmsocket_t *listener, atomic_store(&eps->in_use, true); for (size_t i = 0; i < isc_loopmgr_nloops(loopmgr); i++) { - isc__netievent__http_eps_t *ievent = - isc__nm_get_netievent_httpendpoints( - &listener->worker->netmgr->workers[i], listener, - eps); - isc__nm_enqueue_ievent(&listener->worker->netmgr->workers[i], - (isc__netievent_t *)ievent); + isc__networker_t *worker = + &listener->worker->netmgr->workers[i]; + http_endpoints_data_t *data = isc_mem_getx( + worker->loop->mctx, sizeof(*data), ISC_MEM_ZERO); + + isc__nmsocket_attach(listener, &data->listener); + isc_nm_http_endpoints_attach(eps, &data->endpoints); + + isc_async_run(worker->loop, http_set_endpoints_cb, data); } } -void -isc__nm_async_httpendpoints(isc__networker_t *worker, isc__netievent_t *ev0) { - isc__netievent__http_eps_t *ievent = (isc__netievent__http_eps_t *)ev0; - const int tid = isc_tid(); - isc_nmsocket_t *listener = ievent->sock; - isc_nm_http_endpoints_t *eps = ievent->endpoints; - - UNUSED(worker); - - isc_nm_http_endpoints_detach(&listener->h2.listener_endpoints[tid]); - isc_nm_http_endpoints_attach(eps, - &listener->h2.listener_endpoints[tid]); -} - static void http_init_listener_endpoints(isc_nmsocket_t *listener, isc_nm_http_endpoints_t *epset) { diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index 26ed2ddacf..719b769f19 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -250,8 +250,6 @@ struct isc_nmhandle { }; typedef enum isc__netievent_type { - netievent_httpendpoints, - netievent_streamdnsread, netievent_streamdnscancel, @@ -1426,9 +1424,6 @@ isc__nm_http_set_maxage(isc_nmhandle_t *handle, const uint32_t ttl); const char * isc__nm_http_verify_tls_peer_result_string(const isc_nmhandle_t *handle); -void -isc__nm_async_httpendpoints(isc__networker_t *worker, isc__netievent_t *ev0); - bool isc__nm_parse_httpquery(const char *query_string, const char **start, size_t *len); @@ -1641,10 +1636,6 @@ isc__nmsocket_stop(isc_nmsocket_t *listener); * typedef all the netievent types */ -#ifdef HAVE_LIBNGHTTP2 -NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints); -#endif /* HAVE_LIBNGHTTP2 */ - NETIEVENT_SOCKET_REQ_RESULT_TYPE(sendcb); NETIEVENT_SOCKET_TYPE(streamdnsread); @@ -1655,10 +1646,6 @@ NETIEVENT_SOCKET_TYPE(sockstop); /* Now declared the helper functions */ -#ifdef HAVE_LIBNGHTTP2 -NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints); -#endif /* HAVE_LIBNGHTTP2 */ - 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 bb45f5e83d..3c9f045887 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -439,9 +439,6 @@ process_netievent(void *arg) { isc__networker_t *worker = ievent->worker; switch (ievent->type) { -#if HAVE_LIBNGHTTP2 - NETIEVENT_CASE(httpendpoints); -#endif NETIEVENT_CASE(streamdnsread); NETIEVENT_CASE(streamdnscancel); @@ -471,10 +468,6 @@ isc__nm_put_netievent(isc__networker_t *worker, void *ievent) { isc__networker_unref(worker); } -#ifdef HAVE_LIBNGHTTP2 -NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints); -#endif /* HAVE_LIBNGHTTP2 */ - NETIEVENT_SOCKET_DEF(streamdnsread); NETIEVENT_SOCKET_HANDLE_DEF(streamdnscancel);