CProxy/timeout.c

23 lines
453 B
C
Raw Normal View History

2020-07-30 18:10:31 +08:00
#include "timeout.h"
#include "main.h"
#include "http_proxy.h"
2020-01-21 19:48:05 +08:00
int timeout_minute;
void *tcp_timeout_check(void *nullPtr)
2020-01-21 19:48:05 +08:00
{
int i;
2020-06-08 20:28:15 +08:00
while (1) {
2020-01-21 19:48:05 +08:00
sleep(60);
for (i = 0; i < MAX_CONNECTION; i += 2)
2020-06-08 20:28:15 +08:00
if (cts[i].fd > -1) {
if (cts[i].timer >= timeout_minute) {
2020-01-21 19:48:05 +08:00
close_connection(cts + i);
}
2020-01-21 19:48:05 +08:00
else
cts[i].timer++;
}
}
2020-06-08 20:28:15 +08:00
}