qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1630830 - in /qpid/proton/branches/examples/proton-c: include/proton/messenger.h src/messenger/messenger.c
Date Fri, 10 Oct 2014 12:54:20 GMT
Author: gsim
Date: Fri Oct 10 12:54:19 2014
New Revision: 1630830

URL: http://svn.apache.org/r1630830
Log:
PROTON-671: patch for settlement modes from dominic

Modified:
    qpid/proton/branches/examples/proton-c/include/proton/messenger.h
    qpid/proton/branches/examples/proton-c/src/messenger/messenger.c

Modified: qpid/proton/branches/examples/proton-c/include/proton/messenger.h
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/include/proton/messenger.h?rev=1630830&r1=1630829&r2=1630830&view=diff
==============================================================================
--- qpid/proton/branches/examples/proton-c/include/proton/messenger.h (original)
+++ qpid/proton/branches/examples/proton-c/include/proton/messenger.h Fri Oct 10 12:54:19
2014
@@ -25,6 +25,9 @@
 #include <proton/import_export.h>
 #include <proton/message.h>
 #include <proton/selectable.h>
+#include <proton/condition.h>
+#include <proton/terminus.h>
+#include <proton/link.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -932,6 +935,24 @@ PN_EXTERN int pn_messenger_set_flags(pn_
  */
 PN_EXTERN int pn_messenger_get_flags(pn_messenger_t *messenger);
 
+/**
+ * Set the local sender settle mode for the underlying link.
+ *
+ * @param[in] messenger the messenger
+ * @param[in] mode the sender settle mode
+ */
+PN_EXTERN int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger,
+                                               const pn_snd_settle_mode_t mode);
+
+/**
+ * Set the local receiver settle mode for the underlying link.
+ *
+ * @param[in] messenger the messenger
+ * @param[in] mode the receiver settle mode
+ */
+PN_EXTERN int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger,
+                                               const pn_rcv_settle_mode_t mode);
+
 #ifdef __cplusplus
 }
 #endif

Modified: qpid/proton/branches/examples/proton-c/src/messenger/messenger.c
URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/src/messenger/messenger.c?rev=1630830&r1=1630829&r2=1630830&view=diff
==============================================================================
--- qpid/proton/branches/examples/proton-c/src/messenger/messenger.c (original)
+++ qpid/proton/branches/examples/proton-c/src/messenger/messenger.c Fri Oct 10 12:54:19 2014
@@ -101,6 +101,8 @@ struct pn_messenger_t {
   int draining;      // # links in drain state
   int connection_error;
   int flags;
+  pn_snd_settle_mode_t snd_settle_mode;
+  pn_rcv_settle_mode_t rcv_settle_mode;
   bool blocking;
   bool passive;
   bool interrupted;
@@ -645,6 +647,8 @@ pn_messenger_t *pn_messenger(const char 
     m->domain = pn_string(NULL);
     m->connection_error = 0;
     m->flags = 0;
+    m->snd_settle_mode = PN_SND_SETTLED;
+    m->rcv_settle_mode = PN_RCV_FIRST;
   }
 
   return m;
@@ -1681,9 +1685,9 @@ pn_link_t *pn_messenger_link(pn_messenge
 
   if ((sender && pn_messenger_get_outgoing_window(messenger)) ||
       (!sender && pn_messenger_get_incoming_window(messenger))) {
-    // use explicit settlement via dispositions (not pre-settled)
-    pn_link_set_snd_settle_mode( link, PN_SND_UNSETTLED );
-    pn_link_set_rcv_settle_mode( link, PN_RCV_SECOND );
+    // use required settlement (defaults to sending pre-settled messages)
+    pn_link_set_snd_settle_mode(link, messenger->snd_settle_mode);
+    pn_link_set_rcv_settle_mode(link, messenger->rcv_settle_mode);
   }
   // XXX
   if (pn_streq(name, "#")) {
@@ -2263,3 +2267,21 @@ PN_EXTERN int pn_messenger_get_flags(pn_
 {
   return messenger ? messenger->flags : 0;
 }
+
+int pn_messenger_set_snd_settle_mode(pn_messenger_t *messenger,
+                                     const pn_snd_settle_mode_t mode)
+{
+  if (!messenger)
+    return PN_ARG_ERR;
+  messenger->snd_settle_mode = mode;
+  return 0;
+}
+
+int pn_messenger_set_rcv_settle_mode(pn_messenger_t *messenger,
+                                     const pn_rcv_settle_mode_t mode)
+{
+  if (!messenger)
+    return PN_ARG_ERR;
+  messenger->rcv_settle_mode = mode;
+  return 0;
+}



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


Mime
View raw message