diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index fdab4870d..2dcd6f50d 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c @@ -1031,6 +1031,13 @@ static void do_TCP_unconfirmed(TCP_Server *TCP_server) static void do_TCP_confirmed(TCP_Server *TCP_server) { +#ifdef TCP_SERVER_USE_EPOLL + + if (TCP_server->last_run_pinged == unix_time()) + return; + + TCP_server->last_run_pinged = unix_time(); +#endif uint32_t i; for (i = 0; i < TCP_server->size_accepted_connections; ++i) { diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h index e28567261..1573d212a 100644 --- a/toxcore/TCP_server.h +++ b/toxcore/TCP_server.h @@ -110,6 +110,7 @@ typedef struct { #ifdef TCP_SERVER_USE_EPOLL int efd; + uint64_t last_run_pinged; #endif sock_t *socks_listening; unsigned int num_listening_socks;