diff options
| author | Cory Fields <[email protected]> | 2016-12-31 02:05:28 -0500 |
|---|---|---|
| committer | Cory Fields <[email protected]> | 2017-01-12 23:05:25 -0500 |
| commit | 4d712e366ca7fffaf96394ef01c9246482c0d92e (patch) | |
| tree | aa61383f6bf692c4fda2f697ad6fba3e4c199913 /src/net.cpp | |
| parent | net: rework the way that the messagehandler sleeps (diff) | |
| download | discoin-4d712e366ca7fffaf96394ef01c9246482c0d92e.tar.xz discoin-4d712e366ca7fffaf96394ef01c9246482c0d92e.zip | |
net: add a new message queue for the message processor
This separates the storage of messages from the net and queued messages for
processing, allowing the locks to be split.
Diffstat (limited to 'src/net.cpp')
| -rw-r--r-- | src/net.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/net.cpp b/src/net.cpp index 947f01679..df2109e3f 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1239,8 +1239,18 @@ void CConnman::ThreadSocketHandler() if (!pnode->ReceiveMsgBytes(pchBuf, nBytes, notify)) pnode->CloseSocketDisconnect(); RecordBytesRecv(nBytes); - if (notify) + if (notify) { + auto it(pnode->vRecvMsg.begin()); + for (; it != pnode->vRecvMsg.end(); ++it) { + if (!it->complete()) + break; + } + { + LOCK(pnode->cs_vProcessMsg); + pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), it); + } WakeMessageHandler(); + } } else if (nBytes == 0) { |