qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject qpid-proton git commit: PROTON-877: Move client outcome processing to output side - Also add some (somewhat imperfect) tests
Date Mon, 11 May 2015 19:57:05 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master 196ef80bc -> 520f0d8e3


PROTON-877: Move client outcome processing to output side
- Also add some (somewhat imperfect) tests


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

Branch: refs/heads/master
Commit: 520f0d8e3d215dbd38b8ae0d9222f5a66d860c66
Parents: 196ef80
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Fri May 8 17:12:02 2015 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon May 11 15:55:59 2015 -0400

----------------------------------------------------------------------
 proton-c/src/sasl/sasl.c            | 15 ++++++----
 tests/python/proton_tests/engine.py | 47 ++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/520f0d8e/proton-c/src/sasl/sasl.c
----------------------------------------------------------------------
diff --git a/proton-c/src/sasl/sasl.c b/proton-c/src/sasl/sasl.c
index ae3a025..4a2a2f0 100644
--- a/proton-c/src/sasl/sasl.c
+++ b/proton-c/src/sasl/sasl.c
@@ -337,8 +337,13 @@ static void pni_post_sasl_frame(pn_transport_t *transport)
       pn_post_frame(transport, SASL_FRAME_TYPE, 0, "DL[B]", SASL_OUTCOME, sasl->outcome);
       pni_emit(transport);
       break;
-    case SASL_NONE:
     case SASL_RECVED_OUTCOME:
+      if (sasl->last_state < SASL_POSTED_INIT) {
+        desired_state = SASL_POSTED_INIT;
+        continue;
+      }
+      break;
+    case SASL_NONE:
       return;
     }
     sasl->last_state = desired_state;
@@ -575,9 +580,8 @@ int pn_do_mechanisms(pn_transport_t *transport, uint8_t frame_type, uint16_t
cha
       pni_process_mechanisms(transport, pn_string_get(mechs))) {
     pni_sasl_set_desired_state(transport, SASL_POSTED_INIT);
   } else {
-    sasl->last_state = SASL_RECVED_OUTCOME;
-    sasl->halt = true;
-    pn_transport_close_tail(transport);
+    sasl->outcome = PN_SASL_PERM;
+    pni_sasl_set_desired_state(transport, SASL_RECVED_OUTCOME);
   }
 
   pn_free(mechs);
@@ -617,8 +621,7 @@ int pn_do_outcome(pn_transport_t *transport, uint8_t frame_type, uint16_t
channe
 
   pni_sasl_t *sasl = transport->sasl;
   sasl->outcome = (pn_sasl_outcome_t) outcome;
-  sasl->last_state = SASL_RECVED_OUTCOME;
-  sasl->halt = true;
+  pni_sasl_set_desired_state(transport, SASL_RECVED_OUTCOME);
 
   return 0;
 }

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/520f0d8e/tests/python/proton_tests/engine.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/engine.py b/tests/python/proton_tests/engine.py
index 05c8e19..924b3bc 100644
--- a/tests/python/proton_tests/engine.py
+++ b/tests/python/proton_tests/engine.py
@@ -2505,3 +2505,50 @@ class SaslEventTest(CollectorTest):
       self.drain()
     p = transport.pending()
     self.expect()
+
+  def testPipelinedServerReadFirst(self):
+    if "java" in sys.platform:
+      raise Skipped()
+    conn = Connection()
+    conn.collect(self.collector)
+    transport = Transport(Transport.CLIENT)
+    s = transport.sasl()
+    s.allowed_mechs("ANONYMOUS PLAIN")
+    transport.bind(conn)
+    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND)
+    transport.push('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
+                   '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
+                   '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
+                   '\x00')
+    self.expect(Event.TRANSPORT)
+    p = transport.pending()
+    bytes = transport.peek(p)
+    transport.pop(p)
+
+    server = Transport(Transport.SERVER)
+    server.push(bytes)
+    assert server.sasl().outcome == SASL.OK
+
+  def testPipelinedServerWriteFirst(self):
+    if "java" in sys.platform:
+      raise Skipped()
+    conn = Connection()
+    conn.collect(self.collector)
+    transport = Transport(Transport.CLIENT)
+    s = transport.sasl()
+    s.allowed_mechs("ANONYMOUS")
+    transport.bind(conn)
+    p = transport.pending()
+    bytes = transport.peek(p)
+    transport.pop(p)
+    self.expect(Event.CONNECTION_INIT, Event.CONNECTION_BOUND, Event.TRANSPORT)
+    transport.push('AMQP\x03\x01\x00\x00\x00\x00\x00\x1c\x02\x01\x00\x00\x00S@'
+                   '\xc0\x0f\x01\xe0\x0c\x01\xa3\tANONYMOUS\x00\x00\x00\x10'
+                   '\x02\x01\x00\x00\x00SD\xc0\x03\x01P\x00AMQP\x00\x01\x00'
+                   '\x00')
+    self.expect(Event.TRANSPORT)
+    p = transport.pending()
+    bytes = transport.peek(p)
+    transport.pop(p)
+    # XXX: the bytes above appear to be correct, but we don't get any
+    # sort of event indicating that the transport is authenticated


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


Mime
View raw message