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 {
71
71
BF_WHITELIST = (1U << 2 ),
72
72
};
73
73
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
+
74
78
const static std::string NET_MESSAGE_COMMAND_OTHER = " *other*" ;
75
79
76
80
static const uint64_t RANDOMIZER_ID_NETGROUP = 0x6c0edd8036ef4036ULL ; // SHA256("netgroup")[0:8]
@@ -1264,7 +1268,7 @@ void CConnman::SocketHandler()
1264
1268
//
1265
1269
struct timeval timeout;
1266
1270
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
1268
1272
1269
1273
fd_set fdsetRecv;
1270
1274
fd_set fdsetSend;
@@ -1337,7 +1341,7 @@ void CConnman::SocketHandler()
1337
1341
}
1338
1342
FD_ZERO (&fdsetSend);
1339
1343
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 )))
1341
1345
return ;
1342
1346
}
1343
1347
You can’t perform that action at this time.
0 commit comments