ns_server_poll(): setting current_time to now after select()

This commit is contained in:
Sergey Lyubka 2014-06-11 09:44:18 +01:00
parent 50c0b958ff
commit 96ce6bac69

View File

@ -862,6 +862,10 @@ int ns_server_poll(struct ns_server *server, int milli) {
tv.tv_usec = (milli % 1000) * 1000;
if (select((int) max_fd + 1, &read_set, &write_set, NULL, &tv) > 0) {
// select() might have been waiting for a long time, reset current_time
// now to prevent last_io_time being set to the past.
current_time = time(NULL);
// Accept new connections
if (server->listening_sock != INVALID_SOCKET &&
FD_ISSET(server->listening_sock, &read_set)) {