2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Always call TCP connect callback from within a worker context

This change ensures that a TCP connect callback is called from within
the context of a worker thread in case of a low-level error when
descriptors cannot be created (e.g. when there are too many open file
descriptors).
This commit is contained in:
Artem Boldariev 2021-04-23 17:50:04 +03:00
parent 1349142333
commit 8510c5cd59

View File

@ -317,9 +317,13 @@ isc_nm_tcpconnect(isc_nm_t *mgr, isc_nmiface_t *local, isc_nmiface_t *peer,
if (result != ISC_R_SUCCESS) {
if (isc__nm_in_netthread()) {
sock->tid = isc_nm_tid();
isc__nmsocket_clearcb(sock);
isc__nm_connectcb(sock, req, result, false);
} else {
isc__nmsocket_clearcb(sock);
sock->tid = isc_random_uniform(mgr->nworkers);
isc__nm_connectcb(sock, req, result, true);
}
isc__nmsocket_clearcb(sock);
isc__nm_connectcb(sock, req, result, false);
atomic_store(&sock->closed, true);
isc__nmsocket_detach(&sock);
return;