qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1514907 - /qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
Date Fri, 16 Aug 2013 22:15:06 GMT
Author: gsim
Date: Fri Aug 16 22:15:06 2013
New Revision: 1514907

URL: http://svn.apache.org/r1514907
Log:
QPID-5078: ensure listeners are always notified if a message was left on the queue

Modified:
    qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?rev=1514907&r1=1514906&r2=1514907&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Fri Aug 16 22:15:06 2013
@@ -393,6 +393,7 @@ bool Queue::getNextMessage(Message& m, C
     if (!checkNotDeleted(c)) return false;
     QueueListeners::NotificationSet set;
     ScopedAutoDelete autodelete(*this);
+    bool messageFound(false);
     while (true) {
         //TODO: reduce lock scope
         Mutex::ScopedLock locker(messageLock);
@@ -434,7 +435,8 @@ bool Queue::getNextMessage(Message& m, C
                     QPID_LOG(debug, "Message " << msg->getSequence() << "
retrieved from '"
                              << name << "'");
                     m = *msg;
-                    return true;
+                    messageFound = true;
+                    break;
                 } else {
                     //message(s) are available but consumer hasn't got enough credit
                     QPID_LOG(debug, "Consumer can't currently accept message from '" <<
name << "'");
@@ -456,11 +458,12 @@ bool Queue::getNextMessage(Message& m, C
         } else {
             QPID_LOG(debug, "No messages to dispatch on queue '" << name << "'");
             listeners.addListener(c);
-            return false;
+            break;
         }
+
     }
     set.notify();
-    return false;
+    return messageFound;
 }
 
 void Queue::removeListener(Consumer::shared_ptr c)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message