From: Dave Watson Date: Wed, 24 Sep 2014 17:52:50 +0000 (-0700) Subject: update thrift to use managed connection X-Git-Tag: v0.22.0~328 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d8e719111859150a8d310069513dd5099a623f8f;p=folly.git 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 --- 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,