From d8e719111859150a8d310069513dd5099a623f8f Mon Sep 17 00:00:00 2001 From: Dave Watson Date: Wed, 24 Sep 2014 10:52:50 -0700 Subject: [PATCH] update thrift to use managed connection Summary: Use the new managed connection code in folly. Cleans things up a fair bit The only catch was the current ConnectionManager code uses raw pointers, thrift expects shared_ptr so the request object can keep the channel around until the requests are finished Test Plan: fbconfig -r thrift/lib/cpp2; fbmake runtests Reviewed By: afrind@fb.com Subscribers: trunkagent, njormrod, doug, fugalh, alandau, bmatheny, dcsommer, afrind FB internal diff: D1519923 Tasks: 5002343 --- folly/experimental/wangle/ConnectionManager.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/folly/experimental/wangle/ConnectionManager.h b/folly/experimental/wangle/ConnectionManager.h index 30117e43..9ac356d6 100644 --- a/folly/experimental/wangle/ConnectionManager.h +++ b/folly/experimental/wangle/ConnectionManager.h @@ -121,6 +121,15 @@ class ConnectionManager: public folly::DelayedDestruction { size_t getNumConnections() const { return conns_.size(); } + template + void iterateConns(F func) { + auto it = conns_.begin(); + while ( it != conns_.end()) { + func(&(*it)); + it++; + } + } + private: class CloseIdleConnsCallback : public folly::EventBase::LoopCallback, -- 2.34.1