You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/07/19 19:30:28 UTC

[qpid-proton] 02/04: PROTON-2061: [C++] Sender auto settlement should only happen after receiver settlement

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 1500219ff197563def5bb60d196a10b9ffaaef6f
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Jul 19 14:07:51 2019 -0400

    PROTON-2061: [C++] Sender auto settlement should only happen after receiver settlement
---
 cpp/src/messaging_adapter.cpp | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/cpp/src/messaging_adapter.cpp b/cpp/src/messaging_adapter.cpp
index a495f58..3cda8cd 100644
--- a/cpp/src/messaging_adapter.cpp
+++ b/cpp/src/messaging_adapter.cpp
@@ -154,25 +154,26 @@ void on_delivery(messaging_handler& handler, pn_event_t* event) {
         }
         credit_topup(lnk);
     } else {
-        tracker t(make_wrapper<tracker>(dlv));
         // sender
         if (pn_delivery_updated(dlv)) {
-            uint64_t rstate = pn_delivery_remote_state(dlv);
-            if (rstate == PN_ACCEPTED) {
+            tracker t(make_wrapper<tracker>(dlv));
+            switch(pn_delivery_remote_state(dlv)) {
+            case PN_ACCEPTED:
                 handler.on_tracker_accept(t);
-            }
-            else if (rstate == PN_REJECTED) {
+                break;
+            case PN_REJECTED:
                 handler.on_tracker_reject(t);
-            }
-            else if (rstate == PN_RELEASED || rstate == PN_MODIFIED) {
+                break;
+            case PN_RELEASED:
+            case PN_MODIFIED:
                 handler.on_tracker_release(t);
+                break;
             }
-
             if (t.settled()) {
                 handler.on_tracker_settle(t);
+                if (lctx.auto_settle)
+                    t.settle();
             }
-            if (lctx.auto_settle)
-                t.settle();
         }
     }
 }


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