Persistent conns in TSocketPool

Summary: Added support for persistent conns in TSocketPool
         Also, added some util functions in TNonblockingServer

Reviewed By: mcslee

Test Plan: Ran a test search cluster with these changes - open was only called once (I put fprintfs in open and close), after which the socket was reused

Revert: OK

TracCamp Project: Thrift

DiffCamp Revision: 11425


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665668 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TSocketPool.h b/lib/cpp/src/transport/TSocketPool.h
index 6c3b0f7..a455aca 100644
--- a/lib/cpp/src/transport/TSocketPool.h
+++ b/lib/cpp/src/transport/TSocketPool.h
@@ -36,6 +36,9 @@
   // Port to connect on
   int port_;
 
+  // Socket for the server
+  int socket_;
+
   // Last time connecting to this server failed
   int lastFailTime_;
 
@@ -138,11 +141,21 @@
     */
    void open();
 
+   /*
+    * Closes the UNIX socket
+    */
+   void close();
+
  protected:
 
+  void setCurrentServer(const boost::shared_ptr<TSocketPoolServer> &server);
+
    /** List of servers to connect to */
   std::vector< boost::shared_ptr<TSocketPoolServer> > servers_;
 
+  /** Current server */
+  boost::shared_ptr<TSocketPoolServer> currentServer_;
+
    /** How many times to retry each host in connect */
    int numRetries_;