qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1494644 - in /qpid/trunk/qpid/cpp/src/qpid/messaging/amqp: SenderContext.cpp SenderContext.h
Date Wed, 19 Jun 2013 14:51:55 GMT
Author: gsim
Date: Wed Jun 19 14:51:55 2013
New Revision: 1494644

URL: http://svn.apache.org/r1494644
Log:
QPID-4935: handle case where peer to sender settles without setting a delivery state

Modified:
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp
    qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.h

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp?rev=1494644&r1=1494643&r2=1494644&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.cpp Wed Jun 19 14:51:55 2013
@@ -95,8 +95,8 @@ SenderContext::Delivery* SenderContext::
 
 uint32_t SenderContext::processUnsettled()
 {
-    //remove accepted messages from front of deque
-    while (!deliveries.empty() && deliveries.front().accepted()) {
+    //remove messages from front of deque once peer has confirmed receipt
+    while (!deliveries.empty() && deliveries.front().delivered()) {
         deliveries.front().settle();
         deliveries.pop_front();
     }
@@ -453,10 +453,28 @@ void SenderContext::Delivery::send(pn_li
     pn_link_advance(sender);
 }
 
+bool SenderContext::Delivery::delivered()
+{
+    if (pn_delivery_remote_state(token) || pn_delivery_settled(token)) {
+        //TODO: need a better means for signalling outcomes other than accepted
+        if (rejected()) {
+            QPID_LOG(warning, "delivery " << id << " was rejected by peer");
+        } else if (!accepted()) {
+            QPID_LOG(info, "delivery " << id << " was not accepted by peer");
+        }
+        return true;
+    } else {
+        return false;
+    }
+}
 bool SenderContext::Delivery::accepted()
 {
     return pn_delivery_remote_state(token) == PN_ACCEPTED;
 }
+bool SenderContext::Delivery::rejected()
+{
+    return pn_delivery_remote_state(token) == PN_REJECTED;
+}
 void SenderContext::Delivery::settle()
 {
     pn_delivery_settle(token);

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.h?rev=1494644&r1=1494643&r2=1494644&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/amqp/SenderContext.h Wed Jun 19 14:51:55 2013
@@ -53,7 +53,9 @@ class SenderContext
         Delivery(int32_t id);
         void encode(const qpid::messaging::MessageImpl& message, const qpid::messaging::Address&);
         void send(pn_link_t*);
+        bool delivered();
         bool accepted();
+        bool rejected();
         void settle();
       private:
         int32_t id;



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


Mime
View raw message