summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2019-10-17 12:04:02 -0400
committerNat Goodspeed <nat@lindenlab.com>2020-03-25 18:58:16 -0400
commit6805e82acdcde9a3f18681427a33a5bc7be7a0a6 (patch)
tree213dbfddd223298c5c5a4a9e5be28d8f260477a7 /indra/llcommon
parent4d65539db786056cfa8e43fd841a51b5bc0c7612 (diff)
DRTVWR-476: Introduce LLEventMailDrop::discard() (instead of flush()).
Overriding virtual LLEventPump::flush() for the semantic of discarding LLEventMailDrop's queued events turns out not to be such a great idea, because LLEventPumps::flush(), which calls every registered LLEventPump's flush() method, is called every mainloop tick. The first time we hit a use case in which we expected LLEventMailDrop to hold queued events across a mainloop tick, we were baffled that they were never delivered. Moving that logic to a separate method specific to LLEventMailDrop resolves that problem. Naming it discard() clarifies its intended functionality.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llevents.cpp9
-rw-r--r--indra/llcommon/llevents.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index 99abb333bb..186e710c43 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -602,6 +602,11 @@ LLBoundListener LLEventMailDrop::listen_impl(const std::string& name,
return LLEventStream::listen_impl(name, listener, after, before);
}
+void LLEventMailDrop::discard()
+{
+ mEventHistory.clear();
+ LLEventStream::flush();
+}
/*****************************************************************************
* LLEventQueue
@@ -621,8 +626,8 @@ bool LLEventQueue::post(const LLSD& event)
void LLEventQueue::flush()
{
- if(!mSignal) return;
-
+ if(!mSignal) return;
+
// Consider the case when a given listener on this LLEventQueue posts yet
// another event on the same queue. If we loop over mEventQueue directly,
// we'll end up processing all those events during the same flush() call
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index 3c388bf176..ce2aa2f3c9 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -610,7 +610,8 @@ public:
virtual bool post(const LLSD& event) override;
/// Remove any history stored in the mail drop.
- virtual void flush() override { mEventHistory.clear(); LLEventStream::flush(); };
+ void discard();
+
protected:
virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&,
const NameList& after,