fix: make session::subscriptions_ a weak_ptr

This commit is contained in:
Nathan Nichols
2021-05-24 10:57:53 -05:00
parent cb045ad581
commit c0465aae27

View File

@@ -172,7 +172,7 @@ class session : public std::enable_shared_from_this<session>
std::string response_;
std::shared_ptr<BackendInterface> backend_;
std::shared_ptr<SubscriptionManager> subscriptions_;
std::weak_ptr<SubscriptionManager> subscriptions_;
std::shared_ptr<ETLLoadBalancer> balancer_;
public:
@@ -295,10 +295,13 @@ private:
BOOST_LOG_TRIVIAL(debug) << " received request : " << request;
try
{
if (subscriptions_.expired())
return;
response = buildResponse(
request,
backend_,
subscriptions_,
subscriptions_.lock(),
balancer_,
shared_from_this());
}