diff --git a/src/net.cpp b/src/net.cpp index 27bbf58a98..a5fe513a1e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -2385,16 +2385,18 @@ void CConnman::SetNetworkActive(bool active) { LogPrint(BCLog::NET, "SetNetworkActive: %s\n", active); - if (!active) { - fNetworkActive = false; + if (fNetworkActive == active) { + return; + } + fNetworkActive = active; + + if (!fNetworkActive) { LOCK(cs_vNodes); // Close sockets to all nodes for (CNode* pnode : vNodes) { pnode->CloseSocketDisconnect(); } - } else { - fNetworkActive = true; } uiInterface.NotifyNetworkActiveChanged(fNetworkActive);