Maintain unused channels for 20 seconds before closing.
Uses mark+sweep style garbage collection to flag and then drop client channels which are not referenced by an operation.
This requires creating a shared_ptr reference loop between Context::Pvt (the internal reference) and Channel. This loop is explicitly broken by Context::Pvt::close() (the external reference dtor) as well as the new Context::cacheClean() and the timer callback Context::Pvt::cacheClean().
Maintain unused channels for 20 seconds before closing.
Uses mark+sweep style garbage collection to flag and then drop client channels which are not referenced by an operation.
This requires creating a shared_ptr reference loop between
Context::Pvt
(the internal reference) andChannel
. This loop is explicitly broken byContext::Pvt::close()
(the external reference dtor) as well as the newContext::cacheClean()
and the timer callbackContext::Pvt::cacheClean()
.