|
|
@ -2468,21 +2468,16 @@ bool ProcessMessages(CNode* pfrom, CConnman& connman, std::atomic<bool>& interru |
|
|
|
if (pfrom->nSendSize >= nMaxSendBufferSize) |
|
|
|
if (pfrom->nSendSize >= nMaxSendBufferSize) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
auto it = pfrom->vRecvMsg.begin(); |
|
|
|
std::list<CNetMessage> msgs; |
|
|
|
if (it == pfrom->vRecvMsg.end()) |
|
|
|
{ |
|
|
|
return false; |
|
|
|
LOCK(pfrom->cs_vProcessMsg); |
|
|
|
|
|
|
|
if (pfrom->vProcessMsg.empty()) |
|
|
|
// end, if an incomplete message is found
|
|
|
|
return false; |
|
|
|
if (!it->complete()) |
|
|
|
// Just take one message
|
|
|
|
return false; |
|
|
|
msgs.splice(msgs.begin(), pfrom->vProcessMsg, pfrom->vProcessMsg.begin()); |
|
|
|
|
|
|
|
fMoreWork = !pfrom->vProcessMsg.empty(); |
|
|
|
// get next message
|
|
|
|
} |
|
|
|
CNetMessage msg = std::move(*it); |
|
|
|
CNetMessage& msg(msgs.front()); |
|
|
|
|
|
|
|
|
|
|
|
// at this point, any failure means we can delete the current message
|
|
|
|
|
|
|
|
pfrom->vRecvMsg.erase(pfrom->vRecvMsg.begin()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fMoreWork = !pfrom->vRecvMsg.empty() && pfrom->vRecvMsg.front().complete(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg.SetVersion(pfrom->GetRecvVersion()); |
|
|
|
msg.SetVersion(pfrom->GetRecvVersion()); |
|
|
|
// Scan for message start
|
|
|
|
// Scan for message start
|
|
|
|