summaryrefslogtreecommitdiff
path: root/src/network/poller.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/poller.cpp')
-rw-r--r--src/network/poller.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/network/poller.cpp b/src/network/poller.cpp
index ca49180..0f02cc5 100644
--- a/src/network/poller.cpp
+++ b/src/network/poller.cpp
@@ -200,7 +200,11 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
// Unblock all signals, only during the epoll_pwait call
sigset_t empty_signal_set{};
sigemptyset(&empty_signal_set);
- const int nb_events = ::epoll_pwait(this->epfd, revents, max_events, timeout.count(),
+
+ int real_timeout = std::numeric_limits<int>::max();
+ if (timeout.count() < real_timeout) // Just avoid any potential int overflow
+ real_timeout = static_cast<int>(timeout.count());
+ const int nb_events = ::epoll_pwait(this->epfd, revents, max_events, real_timeout,
&empty_signal_set);
if (nb_events == -1)
{