You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2011/12/08 21:44:17 UTC
svn commit: r1212109 - in /thrift/trunk/lib/cpp/src:
transport/TServerSocket.cpp windows/config.h
Author: roger
Date: Thu Dec 8 20:44:16 2011
New Revision: 1212109
URL: http://svn.apache.org/viewvc?rev=1212109&view=rev
Log:
THRIFT-1433 TServerSocket fix for MSVC
Patch: Peace C
Modified:
thrift/trunk/lib/cpp/src/transport/TServerSocket.cpp
thrift/trunk/lib/cpp/src/windows/config.h
Modified: thrift/trunk/lib/cpp/src/transport/TServerSocket.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/transport/TServerSocket.cpp?rev=1212109&r1=1212108&r2=1212109&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/transport/TServerSocket.cpp (original)
+++ thrift/trunk/lib/cpp/src/transport/TServerSocket.cpp Thu Dec 8 20:44:16 2011
@@ -310,14 +310,18 @@ void TServerSocket::listen() {
len = sizeof(address);
do {
- if (0 == bind(serverSocket_, (struct sockaddr *) &address, len)) {
+ if (0 == ::bind(serverSocket_, (struct sockaddr *) &address, len)) {
break;
}
// use short circuit evaluation here to only sleep if we need to
} while ((retries++ < retryLimit_) && (sleep(retryDelay_) == 0));
+#else
+ GlobalOutput.perror("TSocket::open() Unix Domain socket path not supported on windows", -99);
+ throw TTransportException(TTransportException::NOT_OPEN, " Unix Domain socket path not supported");
+#endif
} else {
do {
- if (0 == bind(serverSocket_, res->ai_addr, res->ai_addrlen)) {
+ if (0 == ::bind(serverSocket_, res->ai_addr, res->ai_addrlen)) {
break;
}
// use short circuit evaluation here to only sleep if we need to
@@ -325,12 +329,6 @@ void TServerSocket::listen() {
// free addrinfo
freeaddrinfo(res0);
-
-#else
- GlobalOutput.perror("TSocket::open() Unix Domain socket path not supported on windows", -99);
- throw TTransportException(TTransportException::NOT_OPEN, " Unix Domain socket path not supported");
-#endif
-
}
// throw an error if we failed to bind properly
Modified: thrift/trunk/lib/cpp/src/windows/config.h
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/cpp/src/windows/config.h?rev=1212109&r1=1212108&r2=1212109&view=diff
==============================================================================
--- thrift/trunk/lib/cpp/src/windows/config.h (original)
+++ thrift/trunk/lib/cpp/src/windows/config.h Thu Dec 8 20:44:16 2011
@@ -72,6 +72,11 @@ typedef ptrdiff_t ssize_t;
// Missing functions.
#define usleep(ms) Sleep(ms)
+inline int sleep(DWORD ms)
+{
+ Sleep(ms);
+ return 0;
+}
#if WINVER <= 0x0502
#define poll(fds, nfds, timeout) \