diff --git a/reporting/server/SubscriptionManager.cpp b/reporting/server/SubscriptionManager.cpp index 2b9a9200..76ca5272 100644 --- a/reporting/server/SubscriptionManager.cpp +++ b/reporting/server/SubscriptionManager.cpp @@ -130,24 +130,4 @@ void SubscriptionManager::unsubProposedTransactions(std::shared_ptr& session) { streamSubscribers_[TransactionsProposed].erase(session); -} - -void -SubscriptionManager::clearSession(std::shared_ptr const& session) -{ - for(auto& stream : streamSubscribers_) - stream.erase(session); - - for(auto& [account, subscribers] : accountSubscribers_) - { - if (subscribers.find(session) != subscribers.end()) - accountSubscribers_[account].erase(session); - } - - - for(auto& [account, subscribers] : accountProposedSubscribers_) - { - if (subscribers.find(session) != subscribers.end()) - accountProposedSubscribers_[account].erase(session); - } } \ No newline at end of file diff --git a/reporting/server/SubscriptionManager.h b/reporting/server/SubscriptionManager.h index f088b82d..2cea85be 100644 --- a/reporting/server/SubscriptionManager.h +++ b/reporting/server/SubscriptionManager.h @@ -93,9 +93,6 @@ public: void unsubProposedTransactions(std::shared_ptr& session); - - void - clearSession(std::shared_ptr const& session); }; #endif //SUBSCRIPTION_MANAGER_H \ No newline at end of file diff --git a/reporting/server/session.h b/reporting/server/session.h index 95d3b656..23afe8f8 100644 --- a/reporting/server/session.h +++ b/reporting/server/session.h @@ -220,6 +220,17 @@ public: &session::on_write, shared_from_this())); } + void + close(boost::beast::websocket::close_reason const& cr) + { + boost::beast::error_code ec; + + ws_.close(cr, ec); + + if (ec) + return fail(ec, "close"); + } + private: // Get on the correct executor @@ -287,7 +298,7 @@ private: return; if (ec) - return fail(ec, "read"); + fail(ec, "read"); std::string msg{ static_cast(buffer_.data().data()), buffer_.size()};