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;
|
|
|
|
|
2020-08-16 07:58:53 +08:00
|
|
|
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) {
|
2021-07-20 22:17:06 +08:00
|
|
|
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) {
|
2020-08-16 07:58:53 +08:00
|
|
|
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
|
|
|
}
|