From 8adaa3641fe3d7e28db8c4563fb182dc464f5104 Mon Sep 17 00:00:00 2001 From: Duke Date: Tue, 17 Sep 2024 11:29:24 -0400 Subject: [PATCH] Exit out of TLSManager::waitFor() loop if shutdown requested --- src/hush/tlsmanager.cpp | 6 ++++++ src/net.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/src/hush/tlsmanager.cpp b/src/hush/tlsmanager.cpp index ee1329dd7..8b03445ce 100644 --- a/src/hush/tlsmanager.cpp +++ b/src/hush/tlsmanager.cpp @@ -10,6 +10,8 @@ #include "tlsmanager.h" #include "utiltls.h" +extern bool ShutdownRequested(); + using namespace std; // store our preferred cipherlist so we can use it for debug/etc later on std::string TLS_CIPHERLIST; @@ -85,6 +87,10 @@ int TLSManager::waitFor(SSLConnectionRoutine eRoutine, SOCKET hSocket, WOLFSSL* while (true) { + if(ShutdownRequested()) { + LogPrintf("%s: shutdown requested, exiting\n", __func__); + return retOp; + } // clear the current thread's error queue wolfSSL_ERR_clear_error(); diff --git a/src/net.cpp b/src/net.cpp index fd6ec86fe..f6893a54e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2927,6 +2927,7 @@ void SetNetworkActive(bool active) if (!fNetworkActive) { LOCK(cs_vNodes); // Close sockets to all nodes + LogPrint("net", "%s: closing sockets to all nodes\n", __func__); for (CNode* pnode : vNodes) { pnode->CloseSocketDisconnect(); }