From 0d700d98339ad90e862280e540294d70c29eb33a Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Wed, 27 May 2015 01:53:45 -0700 Subject: [PATCH] Unsubscribe from normal data feeds on destruction --- src/ripple/net/InfoSub.h | 5 ++--- src/ripple/net/impl/InfoSub.cpp | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ripple/net/InfoSub.h b/src/ripple/net/InfoSub.h index 683d9a7d4..a38316a02 100644 --- a/src/ripple/net/InfoSub.h +++ b/src/ripple/net/InfoSub.h @@ -145,9 +145,8 @@ protected: private: Consumer m_consumer; Source& m_source; - hash_set mSubAccountInfo_t; // real time subscriptions - hash_set mSubAccountInfo_f; // normal subscriptions - hash_set mSubAccountTransaction; + hash_set realTimeSubscriptions_; + hash_set normalSubscriptions_; std::shared_ptr mPathRequest; std::uint64_t mSeq; }; diff --git a/src/ripple/net/impl/InfoSub.cpp b/src/ripple/net/impl/InfoSub.cpp index fa29649c4..360dc245b 100644 --- a/src/ripple/net/impl/InfoSub.cpp +++ b/src/ripple/net/impl/InfoSub.cpp @@ -60,13 +60,13 @@ InfoSub::~InfoSub () // Use the internal unsubscribe so that it won't call // back to us and modify its own parameter - if (! mSubAccountInfo_t.empty ()) + if (! realTimeSubscriptions_.empty ()) m_source.unsubAccountInternal - (mSeq, mSubAccountInfo_t, true); + (mSeq, realTimeSubscriptions_, true); - if (! mSubAccountInfo_t.empty ()) + if (! normalSubscriptions_.empty ()) m_source.unsubAccountInternal - (mSeq, mSubAccountInfo_f, false); + (mSeq, normalSubscriptions_, false); } Resource::Consumer& InfoSub::getConsumer() @@ -93,14 +93,20 @@ void InfoSub::insertSubAccountInfo (RippleAddress addr, bool rt) { ScopedLockType sl (mLock); - (rt ? mSubAccountInfo_t : mSubAccountInfo_f).insert (addr); + if (rt) + realTimeSubscriptions_.insert (addr); + else + normalSubscriptions_.insert (addr); } void InfoSub::deleteSubAccountInfo (RippleAddress addr, bool rt) { ScopedLockType sl (mLock); - (rt ? mSubAccountInfo_t : mSubAccountInfo_f).erase (addr); + if (rt) + realTimeSubscriptions_.erase (addr); + else + normalSubscriptions_.erase (addr); } void InfoSub::clearPathRequest ()