瀏覽代碼

Merge pull request #48203 from Faless/net/4.x_socket_poll_timeout

[Net] Fix socket poll timeout on Windows.
Rémi Verschelde 4 年之前
父節點
當前提交
1943d2bda6
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/unix/net_socket_posix.cpp

+ 1 - 1
drivers/unix/net_socket_posix.cpp

@@ -446,7 +446,7 @@ Error NetSocketPosix::poll(PollType p_type, int p_timeout) const {
 	FD_ZERO(&wr);
 	FD_ZERO(&wr);
 	FD_ZERO(&ex);
 	FD_ZERO(&ex);
 	FD_SET(_sock, &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 nullptr  timeout pointer to select.
 	// For blocking operation, pass nullptr  timeout pointer to select.
 	struct timeval *tp = nullptr;
 	struct timeval *tp = nullptr;
 	if (p_timeout >= 0) {
 	if (p_timeout >= 0) {