Skip to content

Commit

Permalink
Sleep longer when USE_WAKEUP_PIPE is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
codablock authored and Dmitriy Korniychuk committed Feb 8, 2022
1 parent b1f7f33 commit 89b336c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,16 @@ enum BindFlags {
BF_WHITELIST = (1U << 2),
};

#ifndef USE_WAKEUP_PIPE
// The set of sockets cannot be modified while waiting
// The sleep time needs to be small to avoid new sockets stalling
static const uint64_t SELECT_TIMEOUT_MILLISECONDS = 50;
#else
// select() is woken up through the wakeup pipe whenever a new node is added, so we can wait much longer.
// We are however still somewhat limited in how long we can sleep as there is periodic work (cleanup) to be done in
// the socket handler thread
static const uint64_t SELECT_TIMEOUT_MILLISECONDS = 1000;
#endif

const static std::string NET_MESSAGE_COMMAND_OTHER = "*other*";

Expand Down

0 comments on commit 89b336c

Please sign in to comment.