Skip to content

Instantly share code, notes, and snippets.

@theuni
Created January 6, 2017 17:58
Show Gist options
  • Save theuni/9c18405455a2569156671aadcf242500 to your computer and use it in GitHub Desktop.
Save theuni/9c18405455a2569156671aadcf242500 to your computer and use it in GitHub Desktop.
diff --git a/src/net.cpp b/src/net.cpp
index b99499b..99de154 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -646,7 +646,6 @@ void CNode::copyStats(CNodeStats &stats)
bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete)
{
- LOCK(cs_vRecvMsg);
complete = false;
int64_t nTime = GetTimeMicros();
nLastRecv = nTime / 1000000;
@@ -1891,7 +1890,8 @@ void CConnman::ThreadMessageHandler()
}
std::unique_lock<std::mutex> lock(mutexMsgProc);
- condMsgProc.wait_until(lock, std::chrono::steady_clock::now() + std::chrono::milliseconds(100), [this, &fMoreWork] { return fMoreWork || fMsgProcWake; });
+ if (!fMoreWork)
+ condMsgProc.wait_until(lock, std::chrono::steady_clock::now() + std::chrono::milliseconds(100), [this] { return fMsgProcWake; });
fMsgProcWake = false;
}
}
diff --git a/src/net.h b/src/net.h
index a0aac2e..778451e 100644
--- a/src/net.h
+++ b/src/net.h
@@ -726,8 +726,7 @@ private:
const ServiceFlags nLocalServices;
const int nMyStartingHeight;
int nSendVersion;
- std::list<CNetMessage> vRecvMsg;
- CCriticalSection cs_vRecvMsg;
+ std::list<CNetMessage> vRecvMsg; // Used only by SocketHandler thread
public:
NodeId GetId() const {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment