From bfe182f2217586100eebc2a8965bdf2e2fb62586 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 26 Apr 2021 07:23:39 +0200 Subject: [PATCH] [Net] Fix socket poll timeout on Windows. Now correctly computes the timeout value in milliseconds. (cherry picked from commit 46f7b0f74bc8907fe988eb55169203a095babaf3) --- drivers/unix/net_socket_posix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index 92cd69755f6..4bae6d3002f 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -452,7 +452,7 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const { FD_ZERO(&wr); FD_ZERO(&ex); FD_SET(_sock, &ex); - struct timeval timeout = { p_timeout, 0 }; + struct timeval timeout = { p_timeout / 1000, (p_timeout % 1000) * 1000 }; // For blocking operation, pass NULL timeout pointer to select. struct timeval *tp = NULL; if (p_timeout >= 0) {