From 6851dd30cae7c748f4fc953de268f7989787501c Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Thu, 17 Dec 2015 14:53:21 -0800
Subject: [PATCH] MAINT-5977: Check get_consuming() as well as listener return
 when draining queue.

---
 indra/llcommon/llevents.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index fc2d8d5e238..0c5e55dc76d 100755
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -57,6 +57,7 @@
 #include "stringize.h"
 #include "llerror.h"
 #include "llsdutil.h"
+#include "llcoros.h"
 #if LL_MSVC
 #pragma warning (disable : 4702)
 #endif
@@ -512,7 +513,10 @@ bool LLEventStream::post(const LLSD& event)
  *****************************************************************************/
 bool LLEventMailDrop::post(const LLSD& event)
 {
-    bool posted = LLEventStream::post(event);
+    bool posted = false;
+    
+    if (!mSignal->empty())
+        posted = LLEventStream::post(event);
     
     if (!posted)
     {   // if the event was not handled we will save it for later so that it can 
@@ -530,7 +534,7 @@ LLBoundListener LLEventMailDrop::listen_impl(const std::string& name,
 {
     if (!mEventHistory.empty())
     {
-        if (listener(mEventHistory.front()))
+        if (listener(mEventHistory.front()) || LLCoros::get_consuming())
         {
             mEventHistory.pop_front();
         }
-- 
GitLab