qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject [2/6] qpid-proton git commit: split the configuring of the transport from the opening of the socket
Date Thu, 12 Feb 2015 17:21:19 GMT
split the configuring of the transport from the opening of the socket


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

Branch: refs/heads/master
Commit: 0155a77660b264818d42ad322431f5748526c7ed
Parents: d1123b0
Author: Gordon Sim <gsim@redhat.com>
Authored: Wed Feb 11 21:53:56 2015 +0000
Committer: Gordon Sim <gsim@redhat.com>
Committed: Thu Feb 12 13:48:51 2015 +0000

----------------------------------------------------------------------
 proton-c/src/handlers/iohandler.c |  4 ++++
 proton-c/src/reactor/connection.c | 12 ++++++++++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0155a776/proton-c/src/handlers/iohandler.c
----------------------------------------------------------------------
diff --git a/proton-c/src/handlers/iohandler.c b/proton-c/src/handlers/iohandler.c
index 9c8db58..7501dd2 100644
--- a/proton-c/src/handlers/iohandler.c
+++ b/proton-c/src/handlers/iohandler.c
@@ -55,6 +55,7 @@ void pni_handle_quiesced(pn_reactor_t *reactor, pn_selector_t *selector)
{
 
 void pni_handle_transport(pn_reactor_t *reactor, pn_event_t *event);
 void pni_handle_open(pn_reactor_t *reactor, pn_event_t *event);
+void pni_handle_bound(pn_reactor_t *reactor, pn_event_t *event);
 
 static void pn_iodispatch(pn_iohandler_t *handler, pn_event_t *event) {
   pn_reactor_t *reactor = pn_event_reactor(event);
@@ -89,6 +90,9 @@ static void pn_iodispatch(pn_iohandler_t *handler, pn_event_t *event) {
   case PN_CONNECTION_LOCAL_OPEN:
     pni_handle_open(reactor, event);
     break;
+  case PN_CONNECTION_BOUND:
+    pni_handle_bound(reactor, event);
+    break;
   case PN_TRANSPORT:
     pni_handle_transport(reactor, event);
     break;

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0155a776/proton-c/src/reactor/connection.c
----------------------------------------------------------------------
diff --git a/proton-c/src/reactor/connection.c b/proton-c/src/reactor/connection.c
index eea0594..281ce20 100644
--- a/proton-c/src/reactor/connection.c
+++ b/proton-c/src/reactor/connection.c
@@ -22,6 +22,7 @@
 #include <proton/connection.h>
 #include <proton/object.h>
 #include <proton/sasl.h>
+#include <proton/ssl.h>
 #include <proton/transport.h>
 #include <assert.h>
 #include <stdio.h>
@@ -104,7 +105,17 @@ void pni_handle_open(pn_reactor_t *reactor, pn_event_t *event) {
   pn_sasl_mechanisms(sasl, "ANONYMOUS");
   pn_transport_bind(transport, conn);
   pn_decref(transport);
+}
+
+void pni_handle_bound(pn_reactor_t *reactor, pn_event_t *event) {
+  assert(reactor);
+  assert(event);
+
+  pn_connection_t *conn = pn_event_connection(event);
   const char *hostname = pn_connection_get_hostname(conn);
+  if (!hostname) {
+      return;
+  }
   pn_string_t *str = pn_string(hostname);
   char *host = pn_string_buffer(str);
   const char *port = "5672";
@@ -115,6 +126,7 @@ void pni_handle_open(pn_reactor_t *reactor, pn_event_t *event) {
   }
   pn_socket_t sock = pn_connect(pn_reactor_io(reactor), host, port);
   pn_free(str);
+  pn_transport_t *transport = pn_event_transport(event);
   pn_reactor_selectable_transport(reactor, sock, transport);
 }
 


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


Mime
View raw message