This is an automated email from the ASF dual-hosted git repository.

syfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 02ffc91396 [RPC] Fix socket bind errno on corner case (#15292)
02ffc91396 is described below

commit 02ffc913965d6c4da9336d34faaed1d8eeb013db
Author: wrongtest <[email protected]>
AuthorDate: Wed Jul 12 14:37:47 2023 +0800

    [RPC] Fix socket bind errno on corner case (#15292)
    
    fix socket bind errno on corner case
---
 src/support/socket.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/support/socket.h b/src/support/socket.h
index be6910c023..f62702bbc4 100644
--- a/src/support/socket.h
+++ b/src/support/socket.h
@@ -262,17 +262,17 @@ class Socket {
           0) {
         return port;
       } else {
-        LOG(WARNING) << "Bind failed to " << host << ":" << port;
-      }
 #if defined(_WIN32)
-      if (WSAGetLastError() != WSAEADDRINUSE) {
-        Socket::Error("TryBindHost");
-      }
+        if (WSAGetLastError() != WSAEADDRINUSE) {
+          Socket::Error("TryBindHost");
+        }
 #else
-      if (errno != EADDRINUSE) {
-        Socket::Error("TryBindHost");
-      }
+        if (errno != EADDRINUSE) {
+          Socket::Error("TryBindHost");
+        }
 #endif
+        LOG(WARNING) << "Bind failed to " << host << ":" << port;
+      }
     }
     return -1;
   }

Reply via email to