mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Convert sending on the DoH socket to to isc_async callback
Simplify the sending on 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:
@@ -2157,11 +2157,13 @@ error:
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
http_send_cb(void *arg);
|
||||||
|
|
||||||
void
|
void
|
||||||
isc__nm_http_send(isc_nmhandle_t *handle, const isc_region_t *region,
|
isc__nm_http_send(isc_nmhandle_t *handle, const isc_region_t *region,
|
||||||
isc_nm_cb_t cb, void *cbarg) {
|
isc_nm_cb_t cb, void *cbarg) {
|
||||||
isc_nmsocket_t *sock = NULL;
|
isc_nmsocket_t *sock = NULL;
|
||||||
isc__netievent_httpsend_t *ievent = NULL;
|
|
||||||
isc__nm_uvreq_t *uvreq = NULL;
|
isc__nm_uvreq_t *uvreq = NULL;
|
||||||
|
|
||||||
REQUIRE(VALID_NMHANDLE(handle));
|
REQUIRE(VALID_NMHANDLE(handle));
|
||||||
@@ -2179,8 +2181,7 @@ isc__nm_http_send(isc_nmhandle_t *handle, const isc_region_t *region,
|
|||||||
uvreq->uvbuf.base = (char *)region->base;
|
uvreq->uvbuf.base = (char *)region->base;
|
||||||
uvreq->uvbuf.len = region->length;
|
uvreq->uvbuf.len = region->length;
|
||||||
|
|
||||||
ievent = isc__nm_get_netievent_httpsend(sock->worker, sock, uvreq);
|
isc_async_run(sock->worker->loop, http_send_cb, uvreq);
|
||||||
isc__nm_enqueue_ievent(sock->worker, (isc__netievent_t *)ievent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2270,26 +2271,22 @@ server_httpsend(isc_nmhandle_t *handle, isc_nmsocket_t *sock,
|
|||||||
isc__nm_uvreq_put(&req, sock);
|
isc__nm_uvreq_put(&req, sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
isc__nm_async_httpsend(isc__networker_t *worker, isc__netievent_t *ev0) {
|
http_send_cb(void *arg) {
|
||||||
isc__netievent_httpsend_t *ievent = (isc__netievent_httpsend_t *)ev0;
|
isc__nm_uvreq_t *req = arg;
|
||||||
isc_nmsocket_t *sock = ievent->sock;
|
|
||||||
isc__nm_uvreq_t *req = ievent->req;
|
|
||||||
isc_nmhandle_t *handle = NULL;
|
|
||||||
isc_nm_http_session_t *session = NULL;
|
|
||||||
|
|
||||||
UNUSED(worker);
|
REQUIRE(VALID_UVREQ(req));
|
||||||
|
|
||||||
|
isc_nmsocket_t *sock = req->sock;
|
||||||
|
|
||||||
REQUIRE(VALID_NMSOCK(sock));
|
REQUIRE(VALID_NMSOCK(sock));
|
||||||
REQUIRE(VALID_UVREQ(req));
|
|
||||||
REQUIRE(VALID_HTTP2_SESSION(sock->h2.session));
|
REQUIRE(VALID_HTTP2_SESSION(sock->h2.session));
|
||||||
|
|
||||||
ievent->req = NULL;
|
isc_nmhandle_t *handle = req->handle;
|
||||||
handle = req->handle;
|
|
||||||
|
|
||||||
REQUIRE(VALID_NMHANDLE(handle));
|
REQUIRE(VALID_NMHANDLE(handle));
|
||||||
|
|
||||||
session = sock->h2.session;
|
isc_nm_http_session_t *session = sock->h2.session;
|
||||||
if (session != NULL && session->client) {
|
if (session != NULL && session->client) {
|
||||||
client_httpsend(handle, sock, req);
|
client_httpsend(handle, sock, req);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -250,7 +250,6 @@ struct isc_nmhandle {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef enum isc__netievent_type {
|
typedef enum isc__netievent_type {
|
||||||
netievent_httpsend,
|
|
||||||
netievent_httpendpoints,
|
netievent_httpendpoints,
|
||||||
|
|
||||||
netievent_streamdnsread,
|
netievent_streamdnsread,
|
||||||
@@ -1427,9 +1426,6 @@ isc__nm_http_set_maxage(isc_nmhandle_t *handle, const uint32_t ttl);
|
|||||||
const char *
|
const char *
|
||||||
isc__nm_http_verify_tls_peer_result_string(const isc_nmhandle_t *handle);
|
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
|
void
|
||||||
isc__nm_async_httpendpoints(isc__networker_t *worker, isc__netievent_t *ev0);
|
isc__nm_async_httpendpoints(isc__networker_t *worker, isc__netievent_t *ev0);
|
||||||
|
|
||||||
@@ -1646,7 +1642,6 @@ isc__nmsocket_stop(isc_nmsocket_t *listener);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_LIBNGHTTP2
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
NETIEVENT_SOCKET_REQ_TYPE(httpsend);
|
|
||||||
NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints);
|
NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints);
|
||||||
#endif /* HAVE_LIBNGHTTP2 */
|
#endif /* HAVE_LIBNGHTTP2 */
|
||||||
|
|
||||||
@@ -1661,7 +1656,6 @@ NETIEVENT_SOCKET_TYPE(sockstop);
|
|||||||
/* Now declared the helper functions */
|
/* Now declared the helper functions */
|
||||||
|
|
||||||
#ifdef HAVE_LIBNGHTTP2
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
NETIEVENT_SOCKET_REQ_DECL(httpsend);
|
|
||||||
NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints);
|
NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints);
|
||||||
#endif /* HAVE_LIBNGHTTP2 */
|
#endif /* HAVE_LIBNGHTTP2 */
|
||||||
|
|
||||||
|
@@ -440,7 +440,6 @@ process_netievent(void *arg) {
|
|||||||
|
|
||||||
switch (ievent->type) {
|
switch (ievent->type) {
|
||||||
#if HAVE_LIBNGHTTP2
|
#if HAVE_LIBNGHTTP2
|
||||||
NETIEVENT_CASE(httpsend);
|
|
||||||
NETIEVENT_CASE(httpendpoints);
|
NETIEVENT_CASE(httpendpoints);
|
||||||
#endif
|
#endif
|
||||||
NETIEVENT_CASE(streamdnsread);
|
NETIEVENT_CASE(streamdnsread);
|
||||||
@@ -473,7 +472,6 @@ isc__nm_put_netievent(isc__networker_t *worker, void *ievent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_LIBNGHTTP2
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
NETIEVENT_SOCKET_REQ_DEF(httpsend);
|
|
||||||
NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints);
|
NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints);
|
||||||
#endif /* HAVE_LIBNGHTTP2 */
|
#endif /* HAVE_LIBNGHTTP2 */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user