File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ enum BindFlags {
7171 BF_WHITELIST = (1U << 2 ),
7272};
7373
74+ // The set of sockets cannot be modified while waiting
75+ // The sleep time needs to be small to avoid new sockets stalling
76+ static const uint64_t SELECT_TIMEOUT_MILLISECONDS = 50 ;
77+
7478const static std::string NET_MESSAGE_COMMAND_OTHER = " *other*" ;
7579
7680static const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL ; // SHA256("netgroup")[0:8]
@@ -1264,7 +1268,7 @@ void CConnman::SocketHandler()
12641268 //
12651269 struct timeval timeout;
12661270 timeout.tv_sec = 0 ;
1267- timeout.tv_usec = 50000 ; // frequency to poll pnode->vSend
1271+ timeout.tv_usec = SELECT_TIMEOUT_MILLISECONDS * 1000 ; // frequency to poll pnode->vSend
12681272
12691273 fd_set fdsetRecv;
12701274 fd_set fdsetSend;
@@ -1337,7 +1341,7 @@ void CConnman::SocketHandler()
13371341 }
13381342 FD_ZERO (&fdsetSend);
13391343 FD_ZERO (&fdsetError);
1340- if (!interruptNet.sleep_for (std::chrono::milliseconds (timeout. tv_usec / 1000 )))
1344+ if (!interruptNet.sleep_for (std::chrono::milliseconds (SELECT_TIMEOUT_MILLISECONDS )))
13411345 return ;
13421346 }
13431347
You can’t perform that action at this time.
0 commit comments