}
}
-TSocketPool::TSocketPool(const vector<pair<string, int> > servers) : TSocket(),
+TSocketPool::TSocketPool(const std::vector<pair<string, int> >& servers) : TSocket(),
numRetries_(1),
retryInterval_(60),
maxConsecutiveFailures_(1),
}
}
+TSocketPool::TSocketPool(const std::vector<TSocketPoolServer>& servers) : TSocket(),
+ servers_(servers),
+ numRetries_(1),
+ retryInterval_(60),
+ maxConsecutiveFailures_(1),
+ randomize_(true),
+ alwaysTryLast_(true)
+{
+}
+
TSocketPool::TSocketPool(const string& host, int port) : TSocket(),
numRetries_(1),
retryInterval_(60),
servers_.push_back(TSocketPoolServer(host, port));
}
+std::vector<TSocketPoolServer> TSocketPool::getServers() {
+ return servers_;
+}
+
void TSocketPool::setNumRetries(int numRetries) {
numRetries_ = numRetries;
}
*
* @param servers list of pairs of host name and port
*/
- TSocketPool(const std::vector<std::pair<std::string, int> > servers);
+ TSocketPool(const std::vector<std::pair<std::string, int> >& servers);
+
+ /**
+ * Socket pool constructor
+ *
+ * @param servers list of TSocketPoolServers
+ */
+ TSocketPool(const std::vector<TSocketPoolServer>& servers);
/**
* Socket pool constructor
*/
void addServer(const std::string& host, int port);
+
+ /**
+ * Get list of servers in this pool
+ */
+ std::vector<TSocketPoolServer> getServers();
+
/**
* Sets how many times to keep retrying a host in the connect function.
*/