You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/12/30 22:13:13 UTC

[25/50] [abbrv] qpid-proton git commit: PROTON-1067: python messenger: cannot acknowledge messages, messenger forces auto-ack or pre-settled.

PROTON-1067: python messenger: cannot acknowledge messages, messenger forces auto-ack or pre-settled.

Change send-settle-mode defaults on outgoing links (but respect user settings if
there are any)

- sender: if outgoing_window, default to PN_SND_MIXED - let the application decide.
- reciever: if incoming_window, default to PN_SND_UNSETTLED - let the app settle.

Clearly if the app sets an incoming window, they want to settle messages
manually so requesting "UNSETTLED" by default makes no sense. It works with
existing messenger tests and examples because links are always established from
the sending end, but making a receiving (subscribing) link to a broker such as
qpidd shows the problem: messenger always requests SND_SETTLED, the broker
obliges, so it is impossible for the receiver to control settlement.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1da4b120
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1da4b120
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1da4b120

Branch: refs/heads/go1
Commit: 1da4b120121463170030ab762ff52815657dd152
Parents: 95eece7
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Dec 14 10:55:47 2015 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Mon Dec 14 12:09:01 2015 -0500

----------------------------------------------------------------------
 proton-c/src/messenger/messenger.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1da4b120/proton-c/src/messenger/messenger.c
----------------------------------------------------------------------
diff --git a/proton-c/src/messenger/messenger.c b/proton-c/src/messenger/messenger.c
index 277642f..b08e00a 100644
--- a/proton-c/src/messenger/messenger.c
+++ b/proton-c/src/messenger/messenger.c
@@ -106,7 +106,7 @@ struct pn_messenger_t {
   int draining;      // # links in drain state
   int connection_error;
   int flags;
-  pn_snd_settle_mode_t snd_settle_mode;
+  int snd_settle_mode;          /* pn_snd_settle_mode_t or -1 for unset */
   pn_rcv_settle_mode_t rcv_settle_mode;
   pn_tracer_t tracer;
   pn_ssl_verify_mode_t ssl_peer_authentication_mode;
@@ -665,7 +665,7 @@ pn_messenger_t *pn_messenger(const char *name)
     m->domain = pn_string(NULL);
     m->connection_error = 0;
     m->flags = PN_FLAGS_ALLOW_INSECURE_MECHS; // TODO: Change this back to 0 for the Proton 0.11 release
-    m->snd_settle_mode = PN_SND_SETTLED;
+    m->snd_settle_mode = -1;    /* Default depends on sender/receiver */
     m->rcv_settle_mode = PN_RCV_FIRST;
     m->tracer = NULL;
     m->ssl_peer_authentication_mode = PN_SSL_VERIFY_PEER_NAME;
@@ -1748,11 +1748,17 @@ pn_link_t *pn_messenger_link(pn_messenger_t *messenger, const char *address,
 
   if ((sender && pn_messenger_get_outgoing_window(messenger)) ||
       (!sender && pn_messenger_get_incoming_window(messenger))) {
-    // use required settlement (defaults to sending pre-settled messages)
-    pn_link_set_snd_settle_mode(link, messenger->snd_settle_mode);
+    if (messenger->snd_settle_mode == -1) { /* Choose default based on sender/receiver */
+      /* For a sender use MIXED so the application can decide whether each
+         message is settled or not. For a receiver request UNSETTLED, since the
+         user set an incoming_window which means they want to decide settlement.
+      */
+      pn_link_set_snd_settle_mode(link, sender ? PN_SND_MIXED : PN_SND_UNSETTLED);
+    } else {                    /* Respect user setting */
+      pn_link_set_snd_settle_mode(link, (pn_snd_settle_mode_t)messenger->snd_settle_mode);
+    }
     pn_link_set_rcv_settle_mode(link, messenger->rcv_settle_mode);
   }
-  // XXX
   if (pn_streq(name, "#")) {
     if (pn_link_is_sender(link)) {
       pn_terminus_set_dynamic(pn_link_target(link), true);


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