net: Add a simple function for waking the message handler

This may be used publicly in the future
This commit is contained in:
Cory Fields 2016-12-31 02:05:21 -05:00
parent f5c36d19b6
commit ef7b5ecbb7
2 changed files with 8 additions and 4 deletions

View file

@ -1239,8 +1239,8 @@ void CConnman::ThreadSocketHandler()
if (!pnode->ReceiveMsgBytes(pchBuf, nBytes, notify)) if (!pnode->ReceiveMsgBytes(pchBuf, nBytes, notify))
pnode->CloseSocketDisconnect(); pnode->CloseSocketDisconnect();
RecordBytesRecv(nBytes); RecordBytesRecv(nBytes);
if(notify) if (notify)
condMsgProc.notify_one(); WakeMessageHandler();
} }
else if (nBytes == 0) else if (nBytes == 0)
{ {
@ -1315,8 +1315,10 @@ void CConnman::ThreadSocketHandler()
} }
} }
void CConnman::WakeMessageHandler()
{
condMsgProc.notify_one();
}

View file

@ -341,6 +341,8 @@ private:
void ThreadSocketHandler(); void ThreadSocketHandler();
void ThreadDNSAddressSeed(); void ThreadDNSAddressSeed();
void WakeMessageHandler();
uint64_t CalculateKeyedNetGroup(const CAddress& ad); uint64_t CalculateKeyedNetGroup(const CAddress& ad);
CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CNetAddr& ip);