isc__nm_http_stoplistening(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->type == isc_nm_httplistener);
+ REQUIRE(isc_tid() == sock->tid);
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
UNREACHABLE();
}
- REQUIRE(isc_tid() == sock->tid);
- isc__netievent_httpstop_t ievent = { .sock = sock };
- isc__nm_async_httpstop(NULL, (isc__netievent_t *)&ievent);
-}
-
-void
-isc__nm_async_httpstop(isc__networker_t *worker, isc__netievent_t *ev0) {
- isc__netievent_httpstop_t *ievent = (isc__netievent_httpstop_t *)ev0;
- isc_nmsocket_t *sock = ievent->sock;
-
- UNUSED(worker);
-
- REQUIRE(VALID_NMSOCK(sock));
-
atomic_store(&sock->listening, false);
- atomic_store(&sock->closing, false);
atomic_store(&sock->closed, true);
+ sock->recv_cb = NULL;
+ sock->recv_cbarg = NULL;
+
if (sock->outer != NULL) {
isc_nm_stoplistening(sock->outer);
isc_nmsocket_close(&sock->outer);
netievent_tcpdnsstop,
netievent_tlsdnslisten,
netievent_tlsdnsstop,
- netievent_httpstop,
netievent_detach,
} isc__netievent_type;
void
isc__nm_async_httpsend(isc__networker_t *worker, isc__netievent_t *ev0);
-void
-isc__nm_async_httpstop(isc__networker_t *worker, isc__netievent_t *ev0);
-
void
isc__nm_async_httpclose(isc__networker_t *worker, isc__netievent_t *ev0);
NETIEVENT_SOCKET_TYPE(tlsdnscycle);
#ifdef HAVE_LIBNGHTTP2
-NETIEVENT_SOCKET_TYPE(httpstop);
NETIEVENT_SOCKET_REQ_TYPE(httpsend);
NETIEVENT_SOCKET_TYPE(httpclose);
NETIEVENT_SOCKET_HTTP_EPS_TYPE(httpendpoints);
NETIEVENT_SOCKET_DECL(tlsdnscycle);
#ifdef HAVE_LIBNGHTTP2
-NETIEVENT_SOCKET_DECL(httpstop);
NETIEVENT_SOCKET_REQ_DECL(httpsend);
NETIEVENT_SOCKET_DECL(httpclose);
NETIEVENT_SOCKET_HTTP_EPS_DECL(httpendpoints);
NETIEVENT_CASE(tlsdobio);
NETIEVENT_CASE(tlscancel);
- NETIEVENT_CASE(httpstop);
NETIEVENT_CASE(httpsend);
NETIEVENT_CASE(httpclose);
NETIEVENT_CASE(httpendpoints);
NETIEVENT_SOCKET_DEF(tlsdnsshutdown);
#ifdef HAVE_LIBNGHTTP2
-NETIEVENT_SOCKET_DEF(httpstop);
NETIEVENT_SOCKET_REQ_DEF(httpsend);
NETIEVENT_SOCKET_DEF(httpclose);
NETIEVENT_SOCKET_HTTP_EPS_DEF(httpendpoints);
return (ISC_R_CANCELED);
}
+ REQUIRE(ssock->accept_cb != NULL);
+
csock = isc_mem_get(ssock->worker->mctx, sizeof(isc_nmsocket_t));
isc__nmsocket_init(csock, ssock->worker, isc_nm_tcpsocket,
&ssock->iface);
isc_quota_detach(&sock->quota);
}
+ isc__nmsocket_clearcb(sock);
isc__nmsocket_timer_stop(sock);
isc__nm_stop_reading(sock);
isc_nmhandle_detach(&sock->recv_handle);
}
+ isc__nmsocket_clearcb(sock);
isc__nmsocket_timer_stop(sock);
isc__nm_stop_reading(sock);
if (SSL_is_server(sock->tls.tls)) {
REQUIRE(sock->recv_handle != NULL);
+ REQUIRE(sock->accept_cb != NULL);
result = sock->accept_cb(sock->recv_handle,
ISC_R_SUCCESS,
sock->accept_cbarg);
-
if (result != ISC_R_SUCCESS) {
isc_nmhandle_detach(&sock->recv_handle);
goto failure;
isc_nmhandle_detach(&sock->recv_handle);
}
+ isc__nmsocket_clearcb(sock);
isc__nmsocket_timer_stop(sock);
isc__nm_stop_reading(sock);
isc__nmsocket_log_tls_session_reuse(sock, sock->tlsstream.tls);
tlshandle = isc__nmhandle_get(sock, &sock->peer, &sock->iface);
if (sock->tlsstream.server) {
- result = sock->listener->accept_cb(
- tlshandle, result,
- sock->listener->accept_cbarg);
+ if (sock->listener->accept_cb == NULL) {
+ result = ISC_R_CANCELED;
+ } else {
+ result = sock->listener->accept_cb(
+ tlshandle, result,
+ sock->listener->accept_cbarg);
+ }
} else {
tls_call_connect_cb(sock, tlshandle, result);
}
isc__nm_tls_stoplistening(isc_nmsocket_t *sock) {
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->type == isc_nm_tlslistener);
+ REQUIRE(sock->tlsstream.tls == NULL);
+ REQUIRE(sock->tlsstream.ctx == NULL);
if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
true)) {
sock->recv_cb = NULL;
sock->recv_cbarg = NULL;
- INSIST(sock->tlsstream.tls == NULL);
- INSIST(sock->tlsstream.ctx == NULL);
-
if (sock->outer != NULL) {
isc_nm_stoplistening(sock->outer);
isc__nmsocket_detach(&sock->outer);
return;
}
+ isc__nmsocket_clearcb(sock);
+ isc__nmsocket_timer_stop(sock);
+ isc__nm_stop_reading(sock);
+
uv_close((uv_handle_t *)&sock->read_timer, read_timer_close_cb);
}