You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2018/01/15 19:43:51 UTC

[2/2] qpid-dispatch git commit: DISPATCH-912: move setting rhost from connection-bound to remote-open event to ensure proton has retrieved the necessary info

DISPATCH-912: move setting rhost from connection-bound to remote-open event to ensure proton has retrieved the necessary info


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

Branch: refs/heads/master
Commit: f8a1c9c975f3f8d859a4d57ce0d705fe4bd12e68
Parents: e9f8502
Author: Gordon Sim <gs...@redhat.com>
Authored: Mon Jan 15 15:47:23 2018 +0000
Committer: Gordon Sim <gs...@redhat.com>
Committed: Mon Jan 15 19:43:23 2018 +0000

----------------------------------------------------------------------
 src/server.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/f8a1c9c9/src/server.c
----------------------------------------------------------------------
diff --git a/src/server.c b/src/server.c
index 5cf967e..5005cb3 100644
--- a/src/server.c
+++ b/src/server.c
@@ -577,7 +577,9 @@ void connect_fail(qd_connection_t *ctx, const char *name, const char *descriptio
 
 
 /* Get the host IP address for the remote end */
-static void set_rhost_port(qd_connection_t *ctx) {
+static void set_rhost_port(pn_event_t *e) {
+    pn_connection_t *pn_conn = pn_event_connection(e);
+    qd_connection_t *ctx = pn_connection_get_context(pn_conn);
     pn_transport_t *tport  = pn_connection_transport(ctx->pn_conn);
     const struct sockaddr* sa = pn_netaddr_sockaddr(pn_netaddr_remote(tport));
     size_t salen = pn_netaddr_socklen(pn_netaddr_remote(tport));
@@ -592,7 +594,6 @@ static void set_rhost_port(qd_connection_t *ctx) {
     }
 }
 
-
 /* Configure the transport once it is bound to the connection */
 static void on_connection_bound(qd_server_t *server, pn_event_t *e) {
     pn_connection_t *pn_conn = pn_event_connection(e);
@@ -614,7 +615,6 @@ static void on_connection_bound(qd_server_t *server, pn_event_t *e) {
         config = &ctx->listener->config;
         const char *name = config->host_port;
         pn_transport_set_server(tport);
-        set_rhost_port(ctx);
 
         sys_mutex_lock(server->lock); /* Policy check is not thread safe */
         ctx->policy_counted = qd_policy_socket_accept(server->qd->policy, ctx->rhost);
@@ -874,6 +874,7 @@ static bool handle(qd_server_t *qd_server, pn_event_t *e) {
         break;
 
     case PN_CONNECTION_REMOTE_OPEN:
+        set_rhost_port(e);
         // If we are transitioning to the open state, notify the client via callback.
         if (ctx && ctx->timer) {
             qd_timer_free(ctx->timer);


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