2018-12-07 09:29:41 +08:00
|
|
|
#include "main.h"
|
|
|
|
#include "http.h"
|
|
|
|
#include "time.h"
|
|
|
|
|
2018-12-21 19:13:07 +08:00
|
|
|
int timeout_seconds;
|
2018-12-07 09:29:41 +08:00
|
|
|
|
|
|
|
void *close_timeout_connectionLoop(void *nullPtr)
|
|
|
|
{
|
2018-12-21 19:13:07 +08:00
|
|
|
int i;
|
2018-12-07 09:29:41 +08:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
sleep(1);
|
|
|
|
for (i = 0; i < MAX_CONNECTION; i += 2)
|
2018-12-21 19:13:07 +08:00
|
|
|
if (cts[i].fd > -1&& (int)(time(NULL) - cts[i].last_event_time) >= timeout_seconds)
|
|
|
|
close_connection(cts + i);
|
2018-12-07 09:29:41 +08:00
|
|
|
}
|
|
|
|
}
|