From: Oliver Kurth Date: Fri, 27 Jul 2018 18:46:22 +0000 (-0700) Subject: Fixed socket timeout issue when we send multiple namespacetool commands. X-Git-Tag: stable-11.0.0~492 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4453414;p=thirdparty%2Fopen-vm-tools.git Fixed socket timeout issue when we send multiple namespacetool commands. When namespacetool commands are run without any delay, the second command may fail because the previous socket connection was not closed. --- diff --git a/open-vm-tools/lib/rpcChannel/simpleSocket.c b/open-vm-tools/lib/rpcChannel/simpleSocket.c index 463413730..001fcb4fb 100644 --- a/open-vm-tools/lib/rpcChannel/simpleSocket.c +++ b/open-vm-tools/lib/rpcChannel/simpleSocket.c @@ -394,6 +394,14 @@ Socket_ConnectVMCI(unsigned int cid, // IN --localPort; continue; } + if (apiErr == SOCKERR_CONNECT && sysErr == SYSERR_ETIMEDOUT) { + /* + * ETIMEDOUT on connect due to timeout. + * Simply try next port. + */ + --localPort; + continue; + } if (apiErr == SOCKERR_CONNECT && sysErr == SYSERR_EINTR) { /* * EINTR on connect due to signal. diff --git a/open-vm-tools/lib/rpcChannel/simpleSocket.h b/open-vm-tools/lib/rpcChannel/simpleSocket.h index a715aefbd..7fe6efbde 100644 --- a/open-vm-tools/lib/rpcChannel/simpleSocket.h +++ b/open-vm-tools/lib/rpcChannel/simpleSocket.h @@ -53,6 +53,7 @@ typedef enum { #define SYSERR_EACCESS WSAEACCES #define SYSERR_EINTR WSAEINTR #define SYSERR_ECONNRESET WSAECONNRESET +#define SYSERR_ETIMEDOUT WSAETIMEDOUT typedef int socklen_t; @@ -62,6 +63,7 @@ typedef int socklen_t; #define SYSERR_EACCESS EACCES #define SYSERR_EINTR EINTR #define SYSERR_ECONNRESET ECONNRESET +#define SYSERR_ETIMEDOUT ETIMEDOUT typedef int SOCKET; #define SOCKET_ERROR (-1)