From a50ca30e769a628f609f8cc0eedf5bc10b3f1b5a Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Sat, 21 Feb 2015 06:39:20 +0100 Subject: Use a timer to try reconnecting to the XMPP server only each 2 seconds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the connection is lost, immediately try to reconnect, then try to reconnect every 2 seconds. This is much better than the previous “Try to re-connect as fast as possible”. --- src/network/poller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/network/poller.cpp') diff --git a/src/network/poller.cpp b/src/network/poller.cpp index 29c4bce..ffc4f2d 100644 --- a/src/network/poller.cpp +++ b/src/network/poller.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -133,7 +134,7 @@ void Poller::stop_watching_send_events(SocketHandler* socket_handler) int Poller::poll(const std::chrono::milliseconds& timeout) { - if (this->socket_handlers.empty()) + if (this->socket_handlers.empty() && timeout == utils::no_timeout) return -1; #if POLLER == POLL int nb_events = ::poll(this->fds, this->nfds, timeout.count()); -- cgit v1.2.3