mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Unsubscribe from normal data feeds on destruction
This commit is contained in:
committed by
Tom Ritchford
parent
dd902292ed
commit
0d700d9833
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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 ()
|
||||
|
||||
Reference in New Issue
Block a user