Unsubscribe from normal data feeds on destruction

This commit is contained in:
Nik Bougalis
2015-05-27 01:53:45 -07:00
committed by Tom Ritchford
parent dd902292ed
commit 0d700d9833
2 changed files with 14 additions and 9 deletions

View File

@@ -145,9 +145,8 @@ protected:
private:
Consumer m_consumer;
Source& m_source;
hash_set <RippleAddress> mSubAccountInfo_t; // real time subscriptions
hash_set <RippleAddress> mSubAccountInfo_f; // normal subscriptions
hash_set <RippleAddress> mSubAccountTransaction;
hash_set <RippleAddress> realTimeSubscriptions_;
hash_set <RippleAddress> normalSubscriptions_;
std::shared_ptr <PathRequest> mPathRequest;
std::uint64_t mSeq;
};

View File

@@ -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 ()