Commit 96ce6bac authored by Sergey Lyubka's avatar Sergey Lyubka

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

parent 50c0b958
...@@ -862,6 +862,10 @@ int ns_server_poll(struct ns_server *server, int milli) { ...@@ -862,6 +862,10 @@ int ns_server_poll(struct ns_server *server, int milli) {
tv.tv_usec = (milli % 1000) * 1000; tv.tv_usec = (milli % 1000) * 1000;
if (select((int) max_fd + 1, &read_set, &write_set, NULL, &tv) > 0) { 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 // Accept new connections
if (server->listening_sock != INVALID_SOCKET && if (server->listening_sock != INVALID_SOCKET &&
FD_ISSET(server->listening_sock, &read_set)) { FD_ISSET(server->listening_sock, &read_set)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment