Thrift: Supported for file descriptor == 0 and cleanup error output

Summary:
Thrift improperly initialized file descriptors to zero and treated 0 and an invalid value.  0 is a valid file descriptor.  Also, commented out error message on client disconnect for TThreadPoolServer

Reviewed By: Marc & Karl

Revert Plan: revertible

Notes:


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664972 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TServerSocket.cpp b/lib/cpp/src/transport/TServerSocket.cpp
index f9f3e7f..8d5e5e4 100644
--- a/lib/cpp/src/transport/TServerSocket.cpp
+++ b/lib/cpp/src/transport/TServerSocket.cpp
@@ -13,14 +13,14 @@
 
 TServerSocket::TServerSocket(int port) :
   port_(port),
-  serverSocket_(0),
+  serverSocket_(-1),
   acceptBacklog_(1024),
   sendTimeout_(0),
   recvTimeout_(0) {}
 
 TServerSocket::TServerSocket(int port, int sendTimeout, int recvTimeout) :
   port_(port),
-  serverSocket_(0),
+  serverSocket_(-1),
   acceptBacklog_(1024),
   sendTimeout_(sendTimeout),
   recvTimeout_(recvTimeout) {}
@@ -116,7 +116,7 @@
                               (struct sockaddr *) &clientAddress,
                               (socklen_t *) &size);
     
-  if (clientSocket <= 0) {
+  if (clientSocket < 0) {
     perror("TServerSocket::accept()");
     throw TTransportException(TTX_UNKNOWN, "ERROR:" + errno);
   }
@@ -132,11 +132,11 @@
 }
 
 void TServerSocket::close() {
-  if (serverSocket_ > 0) {
+  if (serverSocket_ >= 0) {
     shutdown(serverSocket_, SHUT_RDWR);
     ::close(serverSocket_);
   }
-  serverSocket_ = 0;
+  serverSocket_ = -1;
 }
 
 }}} // facebook::thrift::transport