From 9c2cd809481588bf88da315f4711fc869babb85f Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Wed, 8 Apr 2020 10:46:29 +0200 Subject: [PATCH] Still invoke ReleaseNodeVector when interrupted --- src/net.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index a154ef6f981f76..fb9aaacd084dbf 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1662,7 +1662,7 @@ void CConnman::SocketHandler() for (CNode* pnode : vErrorNodes) { if (interruptNet) { - return; + break; } // let recv() return errors and then handle it SocketRecvData(pnode); @@ -1671,7 +1671,7 @@ void CConnman::SocketHandler() for (CNode* pnode : vReceivableNodes) { if (interruptNet) { - return; + break; } if (pnode->fPauseRecv) { continue; @@ -1682,7 +1682,7 @@ void CConnman::SocketHandler() for (CNode* pnode : vSendableNodes) { if (interruptNet) { - return; + break; } LOCK(pnode->cs_vSend); @@ -1696,6 +1696,10 @@ void CConnman::SocketHandler() ReleaseNodeVector(vReceivableNodes); ReleaseNodeVector(vSendableNodes); + if (interruptNet) { + return; + } + { LOCK(cs_vNodes); // remove nodes from mapSendableNodes, so that the next iteration knows that there is no work to do