ganeshmurthy 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_r267827725
 
 

 ##########
 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:
   This TODO is going to be done as a part 2 of this functionality ?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to