qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [3/4] qpid-proton git commit: NO-JIRA: Change interface to pni_post_close()
Date Mon, 27 Jul 2015 22:08:08 GMT
NO-JIRA: Change interface to pni_post_close()


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

Branch: refs/heads/master
Commit: a1c99bc700a25c7a3d84e7300d7d2c7fd1b81fc7
Parents: 873b237
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Fri Jul 24 18:40:18 2015 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon Jul 27 17:55:47 2015 -0400

----------------------------------------------------------------------
 proton-c/src/transport/transport.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a1c99bc7/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index 7a33940..a58e0bf 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -1009,14 +1009,15 @@ static int pni_post_amqp_transfer_frame(pn_transport_t *transport,
uint16_t ch,
   return framecount;
 }
 
-static int pni_post_close(pn_transport_t *transport, const char *condition, const char *description)
+static int pni_post_close(pn_transport_t *transport, pn_condition_t *cond)
 {
-  pn_condition_t *cond = NULL;
-  if (transport->connection) {
+  if (!cond && transport->connection) {
     cond = pn_connection_condition(transport->connection);
   }
+  const char *condition = NULL;
+  const char *description = NULL;
   pn_data_t *info = NULL;
-  if (!condition && pn_condition_is_set(cond)) {
+  if (pn_condition_is_set(cond)) {
     condition = pn_condition_get_name(cond);
     description = pn_condition_get_description(cond);
     info = pn_condition_info(cond);
@@ -1065,15 +1066,6 @@ int pn_do_error(pn_transport_t *transport, const char *condition, const
char *fm
     buf[0] = '\0';
   }
   va_end(ap);
-  if (!transport->close_sent) {
-    if (!transport->open_sent) {
-      pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[S]", OPEN, "");
-    }
-
-    pni_post_close(transport, condition, buf);
-    transport->close_sent = true;
-  }
-  transport->halt = true;
   pn_condition_t *cond = &transport->condition;
   if (!pn_condition_is_set(cond)) {
     pn_condition_set_name(cond, condition);
@@ -1095,6 +1087,15 @@ int pn_do_error(pn_transport_t *transport, const char *condition, const
char *fm
   if (transport->trace & PN_TRACE_DRV) {
     pn_transport_logf(transport, "ERROR %s %s", condition, buf);
   }
+  if (!transport->close_sent) {
+    if (!transport->open_sent) {
+      pn_post_frame(transport, AMQP_FRAME_TYPE, 0, "DL[S]", OPEN, "");
+    }
+
+    pni_post_close(transport, &transport->condition);
+    transport->close_sent = true;
+  }
+  transport->halt = true;
   transport->done_processing = true;
   pni_close_tail(transport);
   return PN_ERR;
@@ -2352,7 +2353,7 @@ static int pni_process_conn_teardown(pn_transport_t *transport, pn_endpoint_t
*e
   {
     if (endpoint->state & PN_LOCAL_CLOSED && !transport->close_sent) {
       if (pni_pointful_buffering(transport, NULL)) return 0;
-      int err = pni_post_close(transport, NULL, NULL);
+      int err = pni_post_close(transport, NULL);
       if (err) return err;
       transport->close_sent = true;
     }


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


Mime
View raw message