2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Detach the sock->server in uv_close() callback, not before

This commit is contained in:
Ondřej Surý
2020-10-20 21:03:27 +02:00
committed by Evan Hunt
parent 97b33e5bde
commit d72bc3eb52

View File

@@ -1092,6 +1092,11 @@ tcp_close_cb(uv_handle_t *uvhandle) {
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_CLOSE]);
atomic_store(&sock->closed, true);
atomic_store(&sock->connected, false);
if (sock->server != NULL) {
isc__nmsocket_detach(&sock->server);
}
isc__nmsocket_prep_destroy(sock);
}
@@ -1101,9 +1106,6 @@ timer_close_cb(uv_handle_t *uvhandle) {
REQUIRE(VALID_NMSOCK(sock));
if (sock->server != NULL) {
isc__nmsocket_detach(&sock->server);
}
uv_close(&sock->uv_handle.handle, tcp_close_cb);
}
@@ -1123,9 +1125,6 @@ tcp_close_direct(isc_nmsocket_t *sock) {
uv_timer_stop(&sock->timer);
uv_close((uv_handle_t *)&sock->timer, timer_close_cb);
} else {
if (sock->server != NULL) {
isc__nmsocket_detach(&sock->server);
}
uv_close(&sock->uv_handle.handle, tcp_close_cb);
}
}