mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge #9535: Split CNode::cs_vSend: message processing and message sending
376b3c2
Make the cs_sendProcessing a LOCK instead of a TRY_LOCK (Matt Corallo)d7c58ad
Split CNode::cs_vSend: message processing and message sending (Matt Corallo)
This commit is contained in:
commit
82274c02ed
25
src/net.cpp
25
src/net.cpp
@ -1147,12 +1147,10 @@ void CConnman::ThreadSocketHandler()
|
||||
// * Hand off all complete messages to the processor, to be handled without
|
||||
// blocking here.
|
||||
{
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend) {
|
||||
if (!pnode->vSendMsg.empty()) {
|
||||
FD_SET(pnode->hSocket, &fdsetSend);
|
||||
continue;
|
||||
}
|
||||
LOCK(pnode->cs_vSend);
|
||||
if (!pnode->vSendMsg.empty()) {
|
||||
FD_SET(pnode->hSocket, &fdsetSend);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
{
|
||||
@ -1272,12 +1270,10 @@ void CConnman::ThreadSocketHandler()
|
||||
continue;
|
||||
if (FD_ISSET(pnode->hSocket, &fdsetSend))
|
||||
{
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend) {
|
||||
size_t nBytes = SocketSendData(pnode);
|
||||
if (nBytes) {
|
||||
RecordBytesSent(nBytes);
|
||||
}
|
||||
LOCK(pnode->cs_vSend);
|
||||
size_t nBytes = SocketSendData(pnode);
|
||||
if (nBytes) {
|
||||
RecordBytesSent(nBytes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1875,9 +1871,8 @@ void CConnman::ThreadMessageHandler()
|
||||
|
||||
// Send messages
|
||||
{
|
||||
TRY_LOCK(pnode->cs_vSend, lockSend);
|
||||
if (lockSend)
|
||||
GetNodeSignals().SendMessages(pnode, *this, flagInterruptMsgProc);
|
||||
LOCK(pnode->cs_sendProcessing);
|
||||
GetNodeSignals().SendMessages(pnode, *this, flagInterruptMsgProc);
|
||||
}
|
||||
if (flagInterruptMsgProc)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user