THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
=> some more improvements

Patch: James Dickson

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1174801 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TSocket.cpp b/lib/cpp/src/transport/TSocket.cpp
index 48d0007..2db8f8b 100644
--- a/lib/cpp/src/transport/TSocket.cpp
+++ b/lib/cpp/src/transport/TSocket.cpp
@@ -181,10 +181,6 @@
 
 void TSocket::openConnection(struct addrinfo *res) {
 
-#ifdef _WIN32
-    TWinsockSingleton::create();
-#endif // _WIN32
-
   if (isOpen()) {
     return;
   }
@@ -276,7 +272,7 @@
     goto done;
   }
 
-  if (errno != EINPROGRESS) {
+  if ((errno != EINPROGRESS) && (errno != EWOULDBLOCK)) {
     int errno_copy = errno;
     GlobalOutput.perror("TSocket::open() connect() " + getSocketInfo(), errno_copy);
     throw TTransportException(TTransportException::NOT_OPEN, "connect() failed", errno_copy);
@@ -346,6 +342,11 @@
 }
 
 void TSocket::local_open(){
+
+#ifdef _WIN32
+    TWinsockSingleton::create();
+#endif // _WIN32
+
   if (isOpen()) {
     return;
   }