Skip to content

Commit 7e55dbf

Browse files
theuniFuzzbawls
authored andcommitted
net: Add a simple function for waking the message handler
This may be used publicly in the future
1 parent 47ea844 commit 7e55dbf

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/net.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,8 +1244,8 @@ void CConnman::ThreadSocketHandler()
12441244
if (!pnode->ReceiveMsgBytes(pchBuf, nBytes, notify))
12451245
pnode->CloseSocketDisconnect();
12461246
RecordBytesRecv(nBytes);
1247-
if(notify)
1248-
condMsgProc.notify_one();
1247+
if (notify)
1248+
WakeMessageHandler();
12491249
} else if (nBytes == 0) {
12501250
// socket closed gracefully
12511251
if (!pnode->fDisconnect)
@@ -1304,6 +1304,11 @@ void CConnman::ThreadSocketHandler()
13041304
}
13051305
}
13061306

1307+
void CConnman::WakeMessageHandler()
1308+
{
1309+
condMsgProc.notify_one();
1310+
}
1311+
13071312

13081313
#ifdef USE_UPNP
13091314
void ThreadMapPort()

src/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ class CConnman
302302
void ThreadSocketHandler();
303303
void ThreadDNSAddressSeed();
304304

305+
void WakeMessageHandler();
306+
305307
CNode* FindNode(const CNetAddr& ip);
306308
CNode* FindNode(const CSubNet& subNet);
307309
CNode* FindNode(const std::string& addrName);

0 commit comments

Comments
 (0)