mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
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:
parent
f295125e41
commit
9d53bc5d1d
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user