diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2016-12-31 02:05:26 -0500 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2017-01-12 23:05:24 -0500 |
commit | c5a8b1b946b1ab0bb82bd4270b2a40f5731abcff (patch) | |
tree | a1ee1e54db0ae10d0641c2a6c1ff5189125cb681 /src/net_processing.h | |
parent | c72cc88ed39652e44b5be48e9455f6f395bd7e83 (diff) |
net: rework the way that the messagehandler sleeps
In order to sleep accurately, the message handler needs to know if _any_ node
has more processing that it should do before the entire thread sleeps.
Rather than returning a value that represents whether ProcessMessages
encountered a message that should trigger a disconnnect, interpret the return
value as whether or not that node has more work to do.
Also, use a global fProcessWake value that can be set by other threads,
which takes precedence (for one cycle) over the messagehandler's decision.
Note that the previous behavior was to only process one message per loop
(except in the case of a bad checksum or invalid header). That was changed in
PR #3180.
The only change here in that regard is that the current node now falls to the
back of the processing queue for the bad checksum/invalid header cases.
Diffstat (limited to 'src/net_processing.h')
-rw-r--r-- | src/net_processing.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/net_processing.h b/src/net_processing.h index 230d805bd4..1f33def1f7 100644 --- a/src/net_processing.h +++ b/src/net_processing.h @@ -46,6 +46,7 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru * @param[in] pto The node which we are sending messages to. * @param[in] connman The connection manager for that node. * @param[in] interrupt Interrupt condition for processing threads + * @return True if there is more work to be done */ bool SendMessages(CNode* pto, CConnman& connman, std::atomic<bool>& interrupt); |