diff --git a/src/Client/EpollNetProvider.hpp b/src/Client/EpollNetProvider.hpp index 3c627f83e..453a5d43c 100644 --- a/src/Client/EpollNetProvider.hpp +++ b/src/Client/EpollNetProvider.hpp @@ -64,7 +64,7 @@ class EpollNetProvider { int wait(int timeout); private: - static constexpr size_t DEFAULT_TIMEOUT = 100; + static constexpr int TIMEOUT_INFINITY = -1; static constexpr size_t EPOLL_EVENTS_MAX = 128; //return 0 if all data from buffer was processed (sent or read); @@ -261,7 +261,7 @@ EpollNetProvider::wait(int timeout) { assert(timeout >= 0); if (timeout == 0) - timeout = DEFAULT_TIMEOUT; + timeout = TIMEOUT_INFINITY; LOG_DEBUG("Network engine wait for ", timeout, " milliseconds"); /* Send pending requests. */ for (auto conn = m_Connector.m_ReadyToSend.begin(); diff --git a/src/Client/LibevNetProvider.hpp b/src/Client/LibevNetProvider.hpp index 52a853b23..1da6f9527 100644 --- a/src/Client/LibevNetProvider.hpp +++ b/src/Client/LibevNetProvider.hpp @@ -361,8 +361,10 @@ int LibevNetProvider::wait(int timeout) { assert(timeout >= 0); - ev_timer_init(&m_TimeoutWatcher, &timeout_cb, timeout / MILLISECONDS, 0 /* repeat */); - ev_timer_start(m_Loop, &m_TimeoutWatcher); + if (timeout > 0) { + ev_timer_init(&m_TimeoutWatcher, &timeout_cb, timeout / MILLISECONDS, 0 /* repeat */); + ev_timer_start(m_Loop, &m_TimeoutWatcher); + } /* Queue pending connections to be send. */ for (auto conn = m_Connector.m_ReadyToSend.begin(); conn != m_Connector.m_ReadyToSend.end();) {