CProxy/timeout.c

23 lines
449 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) {
sleep(10);
2021-05-18 14:18:56 +08:00
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-12-15 10:43:06 +08:00
} else
2020-01-21 19:48:05 +08:00
cts[i].timer++;
}
2021-05-18 14:18:56 +08:00
}
2020-01-21 19:48:05 +08:00
}
2020-06-08 20:28:15 +08:00
}