This function only needs to be ran once per second when epoll is

enabled because all it does then is send pings and check timeouts
which are calculated by the second.
This commit is contained in:
irungentoo 2014-05-24 22:20:24 -04:00
parent f295125e41
commit 9d53bc5d1d
No known key found for this signature in database
GPG Key ID: 10349DC9BED89E98
2 changed files with 8 additions and 0 deletions

View File

@ -1031,6 +1031,13 @@ static void do_TCP_unconfirmed(TCP_Server *TCP_server)
static void do_TCP_confirmed(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; uint32_t i;
for (i = 0; i < TCP_server->size_accepted_connections; ++i) { for (i = 0; i < TCP_server->size_accepted_connections; ++i) {

View File

@ -110,6 +110,7 @@ typedef struct {
#ifdef TCP_SERVER_USE_EPOLL #ifdef TCP_SERVER_USE_EPOLL
int efd; int efd;
uint64_t last_run_pinged;
#endif #endif
sock_t *socks_listening; sock_t *socks_listening;
unsigned int num_listening_socks; unsigned int num_listening_socks;