File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ NodeId nLastNodeId = 0;
100
100
CCriticalSection cs_nLastNodeId;
101
101
102
102
static CSemaphore *semOutbound = NULL ;
103
+ boost::condition_variable messageHandlerCondition;
103
104
104
105
// Signals for message handling
105
106
static CNodeSignals g_signals;
@@ -532,8 +533,10 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
532
533
pch += handled;
533
534
nBytes -= handled;
534
535
535
- if (msg.complete ())
536
+ if (msg.complete ()) {
536
537
msg.nTime = GetTimeMicros ();
538
+ messageHandlerCondition.notify_one ();
539
+ }
537
540
}
538
541
539
542
return true ;
@@ -1358,6 +1361,9 @@ bool OpenNetworkConnection(const CAddress& addrConnect, CSemaphoreGrant *grantOu
1358
1361
1359
1362
void ThreadMessageHandler ()
1360
1363
{
1364
+ boost::mutex condition_mutex;
1365
+ boost::unique_lock<boost::mutex> lock (condition_mutex);
1366
+
1361
1367
SetThreadPriority (THREAD_PRIORITY_BELOW_NORMAL);
1362
1368
while (true )
1363
1369
{
@@ -1417,7 +1423,7 @@ void ThreadMessageHandler()
1417
1423
}
1418
1424
1419
1425
if (fSleep )
1420
- MilliSleep ( 100 );
1426
+ messageHandlerCondition. timed_wait (lock, boost::posix_time::microsec_clock::universal_time () + boost::posix_time::milliseconds ( 100 ) );
1421
1427
}
1422
1428
}
1423
1429
You can’t perform that action at this time.
0 commit comments