Repository: qpid-dispatch Updated Branches: refs/heads/master a2612ca4f -> bff877e1a
DISPATCH-414 - Store the role with connections, not the listener config. (patch from Ganesh Murthy) This closes #89 Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/bff877e1 Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/bff877e1 Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/bff877e1 Branch: refs/heads/master Commit: bff877e1aade8ac64768c13f8b31cdec5b9e538c Parents: a2612ca Author: Ted Ross <[email protected]> Authored: Thu Aug 4 14:49:46 2016 -0400 Committer: Ted Ross <[email protected]> Committed: Thu Aug 4 14:49:46 2016 -0400 ---------------------------------------------------------------------- src/server.c | 16 +++++++++++++--- src/server_private.h | 1 + 2 files changed, 14 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/bff877e1/src/server.c ---------------------------------------------------------------------- diff --git a/src/server.c b/src/server.c index 0787022..ee6f8b6 100644 --- a/src/server.c +++ b/src/server.c @@ -102,6 +102,8 @@ static void free_qd_connection(qd_connection_t *ctx) if (ctx->free_user_id) free((char*)ctx->user_id); + free(ctx->role); + free_qd_connection_t(ctx); } @@ -409,8 +411,6 @@ qd_error_t qd_entity_refresh_sslProfile(qd_entity_t* entity, void *impl) qd_error_t qd_entity_refresh_connection(qd_entity_t* entity, void *impl) { qd_connection_t *conn = (qd_connection_t*)impl; - const qd_server_config_t *config = - conn->connector ? conn->connector->config : conn->listener->config; pn_transport_t *tport = 0; pn_sasl_t *sasl = 0; pn_ssl_t *ssl = 0; @@ -436,7 +436,7 @@ qd_error_t qd_entity_refresh_connection(qd_entity_t* entity, void *impl) conn->pn_conn ? pn_connection_remote_container(conn->pn_conn) : 0) == 0 && connection_entity_update_host(entity, conn) == 0 && qd_entity_set_string(entity, "sasl", mech) == 0 && - qd_entity_set_string(entity, "role", config->role) == 0 && + qd_entity_set_string(entity, "role", conn->role) == 0 && qd_entity_set_string(entity, "dir", conn->connector ? "out" : "in") == 0 && qd_entity_set_string(entity, "user", user) == 0 && qd_set_connection_properties(entity, conn) == 0 && @@ -613,6 +613,11 @@ static void thread_process_listeners_LH(qd_server_t *qd_server) ctx->event_stall = false; ctx->policy_counted = policy_counted; + // Copy the role from the listener config + int role_length = strlen(ctx->listener->config->role) + 1; + ctx->role = (char*) malloc(role_length); + strcpy(ctx->role, ctx->listener->config->role); + pn_connection_t *conn = pn_connection(); ctx->collector = pn_collector(); pn_connection_collect(conn, ctx->collector); @@ -1156,6 +1161,11 @@ static void cxtr_try_open(void *context) ctx->n_receivers = 0; ctx->open_container = 0; + // Copy the role from the connector config + int role_length = strlen(ctx->connector->config->role) + 1; + ctx->role = (char*) malloc(role_length); + strcpy(ctx->role, ctx->connector->config->role); + DEQ_INIT(ctx->deferred_calls); ctx->deferred_call_lock = sys_mutex(); ctx->event_stall = false; http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/bff877e1/src/server_private.h ---------------------------------------------------------------------- diff --git a/src/server_private.h b/src/server_private.h index 6a9bb76..922468c 100644 --- a/src/server_private.h +++ b/src/server_private.h @@ -116,6 +116,7 @@ struct qd_connection_t { sys_mutex_t *deferred_call_lock; bool event_stall; bool policy_counted; + char *role; //The specified role of the connection, e.g. "normal", "inter-router", "route-container" etc. }; DEQ_DECLARE(qd_connection_t, qd_connection_list_t); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
