mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-02 01:25:52 +00:00
clear session on shutdown
This commit is contained in:
@@ -131,23 +131,3 @@ SubscriptionManager::unsubProposedTransactions(std::shared_ptr<session>& session
|
||||
{
|
||||
streamSubscribers_[TransactionsProposed].erase(session);
|
||||
}
|
||||
|
||||
void
|
||||
SubscriptionManager::clearSession(std::shared_ptr<session> 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);
|
||||
}
|
||||
}
|
||||
@@ -93,9 +93,6 @@ public:
|
||||
|
||||
void
|
||||
unsubProposedTransactions(std::shared_ptr<session>& session);
|
||||
|
||||
void
|
||||
clearSession(std::shared_ptr<session> const& session);
|
||||
};
|
||||
|
||||
#endif //SUBSCRIPTION_MANAGER_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<char const*>(buffer_.data().data()), buffer_.size()};
|
||||
|
||||
Reference in New Issue
Block a user