fixup! HACK: make isc_nm_tlsconnect() work when being invoked from within the context of a network thread
This commit is contained in:
@@ -810,6 +810,7 @@ struct isc_nmsocket {
|
||||
BIO *ssl_bio;
|
||||
isc_nmsocket_t *tlslistener;
|
||||
bool connect_from_networker;
|
||||
atomic_bool result_updated;
|
||||
enum {
|
||||
TLS_INIT,
|
||||
TLS_HANDSHAKE,
|
||||
|
||||
@@ -74,18 +74,21 @@ inactive(isc_nmsocket_t *sock) {
|
||||
|
||||
static void
|
||||
update_result(isc_nmsocket_t *sock, const isc_result_t result) {
|
||||
if (!sock->tlsstream.server) {
|
||||
LOCK(&sock->lock);
|
||||
sock->result = result;
|
||||
SIGNAL(&sock->cond);
|
||||
while (!atomic_load(&sock->active)) {
|
||||
WAIT(&sock->scond, &sock->lock);
|
||||
if (!atomic_load(&sock->tlsstream.result_updated)) {
|
||||
atomic_store(&sock->tlsstream.result_updated, true);
|
||||
if (!sock->tlsstream.server) {
|
||||
LOCK(&sock->lock);
|
||||
sock->result = result;
|
||||
SIGNAL(&sock->cond);
|
||||
while (!atomic_load(&sock->active)) {
|
||||
WAIT(&sock->scond, &sock->lock);
|
||||
}
|
||||
UNLOCK(&sock->lock);
|
||||
} else {
|
||||
LOCK(&sock->lock);
|
||||
sock->result = result;
|
||||
UNLOCK(&sock->lock);
|
||||
}
|
||||
UNLOCK(&sock->lock);
|
||||
} else {
|
||||
LOCK(&sock->lock);
|
||||
sock->result = result;
|
||||
UNLOCK(&sock->lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user