mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-17 08:03:44 -04:00
TLS: bail out earlier when NM is stopping
In some operations - most prominently when establishing connection -
it might be beneficial to bail out earlier when the network manager
is stopping.
The issue is backported from loopmgr branch, where such a change is
not only beneficial, but required.
(cherry picked from commit fc74b15e67)
This commit is contained in:
parent
0754def85d
commit
ba7fabde01
1 changed files with 12 additions and 0 deletions
|
|
@ -674,6 +674,9 @@ isc_nm_listentls(isc_nm_t *mgr, isc_sockaddr_t *iface,
|
|||
isc_nmsocket_t *tsock = NULL;
|
||||
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
if (atomic_load(&mgr->closing)) {
|
||||
return (ISC_R_SHUTTINGDOWN);
|
||||
}
|
||||
|
||||
tlssock = isc_mem_get(mgr->mctx, sizeof(*tlssock));
|
||||
|
||||
|
|
@ -834,6 +837,10 @@ isc__nm_tls_resumeread(isc_nmhandle_t *handle) {
|
|||
if (!atomic_compare_exchange_strong(&handle->sock->readpaused,
|
||||
&(bool){ false }, false))
|
||||
{
|
||||
if (inactive(handle->sock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
async_tls_do_bio(handle->sock);
|
||||
}
|
||||
}
|
||||
|
|
@ -931,6 +938,11 @@ isc_nm_tlsconnect(isc_nm_t *mgr, isc_sockaddr_t *local, isc_sockaddr_t *peer,
|
|||
|
||||
REQUIRE(VALID_NM(mgr));
|
||||
|
||||
if (atomic_load(&mgr->closing)) {
|
||||
cb(NULL, ISC_R_SHUTTINGDOWN, cbarg);
|
||||
return;
|
||||
}
|
||||
|
||||
nsock = isc_mem_get(mgr->mctx, sizeof(*nsock));
|
||||
isc__nmsocket_init(nsock, mgr, isc_nm_tlssocket, local);
|
||||
nsock->extrahandlesize = extrahandlesize;
|
||||
|
|
|
|||
Loading…
Reference in a new issue