ChugR commented on a change in pull request #472: Dispatch 1288 1 - policy for outbound connectors URL: https://github.com/apache/qpid-dispatch/pull/472#discussion_r267842419
########## File path: src/policy.c ########## @@ -1110,6 +1152,62 @@ void qd_policy_amqp_open(qd_connection_t *qd_conn) { } +void qd_policy_amqp_open_connector(qd_connection_t *qd_conn) { + pn_connection_t *conn = qd_connection_pn(qd_conn); + qd_dispatch_t *qd = qd_server_dispatch(qd_conn->server); + qd_policy_t *policy = qd->policy; + bool connection_allowed = true; + + if (policy->enableVhostPolicy && + (!qd_conn->role || !strcmp(qd_conn->role, "normal") || !strcmp(qd_conn->role, "route-container"))) { + // Open connection or not based on policy. + const char *hostip = qd_connection_remote_ip(qd_conn); + const char *conn_name = qd_connection_name(qd_conn); + uint32_t conn_id = qd_conn->connection_id; + + qd_connector_t *connector = qd_connection_connector(qd_conn); + const char *policy_vhost = qd_connector_policy_vhost(connector); + + if (!qd_conn->policy_settings) { + qd_conn->policy_settings = NEW(qd_policy_settings_t); // TODO: memory pool for settings + ZERO(qd_conn->policy_settings); + } + + if (strlen(policy_vhost) > 0) { + // This connector connection is controlled by policy. + if (qd_policy_open_fetch_settings(policy, qd_conn->user_id, hostip, policy_vhost, conn_name, + POLICY_VHOST_GROUP, conn_id, + qd_conn->policy_settings)) { + // It's too late to apply transport policy settings as the local + // AMQP Open has already been sent. + // TODO: Apply transport max_frame and channel_max to outgoing Review comment: There are duplicate settings for the same AMQP values in connector and in vhostUserGroupSettings. At the point of this comment it is too late to for the vhostUserGroupSettings value to be applied. This sounds like a need to document which settings from the user group get applied. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org