qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject [04/11] qpid-proton git commit: close the transport when the selector reports an error
Date Mon, 27 Apr 2015 15:06:08 GMT
close the transport when the selector reports an error

(cherry picked from commit aa5ea2b62fd5680bc2a36bee14f72e037d8cc276)


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

Branch: refs/heads/0.9.x
Commit: 913cb95b563c7c6e3232bf3eece2db3ea7614194
Parents: 4c5df77
Author: Rafael Schloming <rhs@alum.mit.edu>
Authored: Mon Apr 20 07:57:20 2015 -0400
Committer: Robert Gemmell <robbie@apache.org>
Committed: Mon Apr 27 15:12:49 2015 +0100

----------------------------------------------------------------------
 proton-c/src/reactor/connection.c   | 3 +++
 proton-c/src/transport/transport.c  | 2 +-
 tests/python/proton_tests/engine.py | 9 +++++++--
 3 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/913cb95b/proton-c/src/reactor/connection.c
----------------------------------------------------------------------
diff --git a/proton-c/src/reactor/connection.c b/proton-c/src/reactor/connection.c
index 3560fc5..f2bb9e9 100644
--- a/proton-c/src/reactor/connection.c
+++ b/proton-c/src/reactor/connection.c
@@ -207,6 +207,9 @@ static void pni_connection_writable(pn_selectable_t *sel)
 
 static void pni_connection_error(pn_selectable_t *sel) {
   pn_reactor_t *reactor = (pn_reactor_t *) pni_selectable_get_context(sel);
+  pn_transport_t *transport = pni_transport(sel);
+  pn_transport_close_head(transport);
+  pn_transport_close_tail(transport);
   pn_selectable_terminate(sel);
   pn_reactor_update(reactor, sel);
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/913cb95b/proton-c/src/transport/transport.c
----------------------------------------------------------------------
diff --git a/proton-c/src/transport/transport.c b/proton-c/src/transport/transport.c
index 10ac8fb..6b2ebe5 100644
--- a/proton-c/src/transport/transport.c
+++ b/proton-c/src/transport/transport.c
@@ -1648,7 +1648,7 @@ static ssize_t pn_input_read_amqp(pn_transport_t* transport, unsigned
int layer,
     }
   }
 
-  if (!available) {
+  if (!transport->close_rcvd && !available) {
     pn_do_error(transport, "amqp:connection:framing-error", "connection aborted");
     return PN_EOS;
   }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/913cb95b/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py
index 8fabf90..3944b85 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -1898,17 +1898,22 @@ class ServerTest(Test):
         self.conn = event.reactor.connection()
         self.conn.hostname = "%s:%s" % (server.host, server.port)
         self.conn.open()
+        self.remote_condition = None
         self.old_count = None
         # verify the connection stays up even if we don't explicitly send stuff
         # wait up to 3x the idle timeout
         event.reactor.schedule(3 * idle_timeout, self)
 
+      def on_connection_bound(self, event):
+        self.transport = event.transport
+
       def on_connection_remote_open(self, event):
         self.old_count = event.transport.frames_output
 
       def on_connection_remote_close(self, event):
         assert self.conn.remote_condition
         assert self.conn.remote_condition.name == "amqp:resource-limit-exceeded"
+        self.remote_condition = self.conn.remote_condition
 
       def on_timer_task(self, event):
         assert self.conn.state == (Endpoint.LOCAL_ACTIVE | Endpoint.REMOTE_ACTIVE), "Connection
terminated"
@@ -1919,8 +1924,8 @@ class ServerTest(Test):
 
     p = Program()
     Reactor(p).run()
-    assert p.conn.remote_condition
-    assert p.conn.remote_condition.name == "amqp:resource-limit-exceeded"
+    assert p.remote_condition
+    assert p.remote_condition.name == "amqp:resource-limit-exceeded"
     server.stop()
 
 class NoValue:


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


Mime
View raw message