cpp: TSocketPool: make it possible to add servers by struct
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920675 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/transport/TSocketPool.cpp b/lib/cpp/src/transport/TSocketPool.cpp
index 1150282..c50877d 100644
--- a/lib/cpp/src/transport/TSocketPool.cpp
+++ b/lib/cpp/src/transport/TSocketPool.cpp
@@ -125,6 +125,12 @@
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;
}
diff --git a/lib/cpp/src/transport/TSocketPool.h b/lib/cpp/src/transport/TSocketPool.h
index 8c50669..749116a 100644
--- a/lib/cpp/src/transport/TSocketPool.h
+++ b/lib/cpp/src/transport/TSocketPool.h
@@ -113,6 +113,11 @@
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
*/
void setServers(const std::vector< boost::shared_ptr<TSocketPoolServer> >& servers);