void
isc__nm_http_stoplistening(isc_nmsocket_t *sock) {
- isc__netievent_httpstop_t *ievent = NULL;
-
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->type == isc_nm_httplistener);
ISC_UNREACHABLE();
}
- ievent = isc__nm_get_netievent_httpstop(sock->mgr, sock);
- isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
- (isc__netievent_t *)ievent);
+ if (!isc__nm_in_netthread()) {
+ isc__netievent_httpstop_t *ievent =
+ isc__nm_get_netievent_httpstop(sock->mgr, sock);
+ isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
+ (isc__netievent_t *)ievent);
+ } else {
+ isc__netievent_httpstop_t ievent = { .sock = sock };
+ isc__nm_async_httpstop(NULL, (isc__netievent_t *)&ievent);
+ }
}
static void
UNUSED(worker);
REQUIRE(VALID_NMSOCK(sock));
- REQUIRE(sock->tid == isc_nm_tid());
atomic_store(&sock->listening, false);
atomic_store(&sock->closing, false);
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->type == isc_nm_tlslistener);
+ if (!atomic_compare_exchange_strong(&sock->closing, &(bool){ false },
+ true)) {
+ INSIST(0);
+ ISC_UNREACHABLE();
+ }
+
atomic_store(&sock->listening, false);
atomic_store(&sock->closed, true);
sock->recv_cb = NULL;