mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-03 18:15:51 +00:00
add functionality to clear session
This commit is contained in:
@@ -130,4 +130,24 @@ void
|
||||
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,6 +93,9 @@ public:
|
||||
|
||||
void
|
||||
unsubProposedTransactions(std::shared_ptr<session>& session);
|
||||
|
||||
void
|
||||
clearSession(std::shared_ptr<session> const& session);
|
||||
};
|
||||
|
||||
#endif //SUBSCRIPTION_MANAGER_H
|
||||
@@ -220,15 +220,6 @@ public:
|
||||
&session::on_write, shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
close(boost::beast::websocket::close_reason const& cr)
|
||||
{
|
||||
ws_.async_close(
|
||||
cr,
|
||||
boost::beast::bind_front_handler(
|
||||
&session::on_close, shared_from_this()));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Get on the correct executor
|
||||
@@ -296,7 +287,8 @@ private:
|
||||
return;
|
||||
|
||||
if (ec)
|
||||
fail(ec, "read");
|
||||
return fail(ec, "read");
|
||||
|
||||
std::string msg{
|
||||
static_cast<char const*>(buffer_.data().data()), buffer_.size()};
|
||||
// BOOST_LOG_TRIVIAL(debug) << __func__ << msg;
|
||||
@@ -355,13 +347,6 @@ private:
|
||||
// Do another read
|
||||
do_read();
|
||||
}
|
||||
|
||||
void
|
||||
on_close(boost::beast::error_code const& ec)
|
||||
{
|
||||
if (ec)
|
||||
return fail(ec, "close");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // RIPPLE_REPORTING_SESSION_H
|
||||
Reference in New Issue
Block a user