cpp: TSocketPool: make it possible to add servers by struct
authorDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:19:50 +0000 (05:19 +0000)
committerDavid Reiss <dreiss@apache.org>
Tue, 9 Mar 2010 05:19:50 +0000 (05:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920675 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/transport/TSocketPool.cpp
lib/cpp/src/transport/TSocketPool.h

index 1150282..c50877d 100644 (file)
@@ -125,6 +125,12 @@ void TSocketPool::addServer(const string& host, int port) {
   servers_.push_back(shared_ptr<TSocketPoolServer>(new TSocketPoolServer(host, port)));
 }
 
+void TSocketPool::addServer(shared_ptr<TSocketPoolServer> &server) {
+  if (server) {
+    servers_.push_back(server);
+  }
+}
+
 void TSocketPool::setServers(const vector< shared_ptr<TSocketPoolServer> >& servers) {
   servers_ = servers;
 }
index 8c50669..749116a 100644 (file)
@@ -112,6 +112,11 @@ class TSocketPool : public TSocket {
     */
    void addServer(const std::string& host, int port);
 
+   /**
+    * Add a server to the pool
+    */
+  void addServer(boost::shared_ptr<TSocketPoolServer> &server);
+
    /**
     * Set list of servers in this pool
     */