From c6e8a9bcffe4c0f236e27c663f08785d1a0a783b Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Sat, 31 Dec 2016 02:05:30 -0500 Subject: net: add a flag to indicate when a node's process queue is full Messages are dumped very quickly from the socket handler to the processor, so it's the depth of the processing queue that's interesting. The socket handler checks the process queue's size during the brief message hand-off and pauses if necessary, and the processor possibly unpauses each time a message is popped off of its queue. --- src/net.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/net.h') diff --git a/src/net.h b/src/net.h index 21864e73d1..0eb430a8bf 100644 --- a/src/net.h +++ b/src/net.h @@ -610,6 +610,7 @@ public: CCriticalSection cs_vProcessMsg; std::list vProcessMsg; + size_t nProcessQueueSize; std::deque vRecvGetData; std::list vRecvMsg; @@ -650,6 +651,7 @@ public: const NodeId id; const uint64_t nKeyedNetGroup; + std::atomic_bool fPauseRecv; protected: mapMsgCmdSize mapSendBytesPerMsgCmd; @@ -743,15 +745,6 @@ public: return nRefCount; } - // requires LOCK(cs_vRecvMsg) - unsigned int GetTotalRecvSize() - { - unsigned int total = 0; - BOOST_FOREACH(const CNetMessage &msg, vRecvMsg) - total += msg.vRecv.size() + 24; - return total; - } - // requires LOCK(cs_vRecvMsg) bool ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete); -- cgit v1.2.3