Skip to content

Commit

Permalink
Fixes skupperproject#1743: manage connection lifecycle on TLS ordinal…
Browse files Browse the repository at this point in the history
… mgmt
  • Loading branch information
kgiusti committed Feb 20, 2025
1 parent 8a6f770 commit d2571d3
Show file tree
Hide file tree
Showing 9 changed files with 435 additions and 76 deletions.
8 changes: 8 additions & 0 deletions python/skupper_router/management/skrouter.json
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,14 @@
"type": "integer",
"graph": true,
"description": "The number of seconds since a delivery was sent on this connection. Will display a - (dash) if no deliveries have been sent on the connection."
},
"tlsOrdinal": {
"description": "If the ssl attribute is true this attribute shows the value of the TLS ordinal in use by the connection. This value reflects the value of the ordinal attribute from the sslProfile that was used when the TLS session was created.",
"type": "integer"
},
"groupCorrelationId": {
"description": "The identifier used to group inter-router and inter-router-data connections generated by the same connector.",
"type": "string"
}
}
},
Expand Down
11 changes: 4 additions & 7 deletions src/adaptors/amqp/amqp_adaptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,10 @@ static void AMQP_opened_handler(qd_router_t *router, qd_connection_t *conn, bool
qd_router_connection_get_config(conn, &role, &cost, &name,
&conn->strip_annotations_in, &conn->strip_annotations_out, &link_capacity);

if (connector && !!connector->ctor_config->data_connection_count) {
memcpy(conn->group_correlator, connector->ctor_config->group_correlator, QD_DISCRIMINATOR_SIZE);
if (connector->is_data_connector) {
// override the configured role to identify this as a data connection
assert(role == QDR_ROLE_INTER_ROUTER);
role = QDR_ROLE_INTER_ROUTER_DATA;
}
if (connector && connector->is_data_connector) {
// override the configured role to identify this as a data connection
assert(role == QDR_ROLE_INTER_ROUTER);
role = QDR_ROLE_INTER_ROUTER_DATA;
}

// check offered capabilities for streaming link support and connection trunking support
Expand Down
10 changes: 2 additions & 8 deletions src/adaptors/amqp/connection_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,8 @@ QD_EXPORT qd_error_t qd_entity_refresh_connector(qd_entity_t* entity, void *impl
// TODO(kgiusti): inter-router connections may have several qd_connector_ts active due to the router data connection
// count configuration. However we can only report 1 connector via management. It would be more accurate to report
// all connectors associated with this management entity
sys_mutex_lock(&ctor_config->lock);
assert(sys_thread_role(0) == SYS_THREAD_MAIN || sys_thread_proactor_mode() == SYS_THREAD_PROACTOR_MODE_TIMER); // only mgmt thread can access connectors list
connector = DEQ_HEAD(ctor_config->connectors);
if (connector) {
// prevent I/O thread from freeing connector while it is being accessed
sys_atomic_inc(&connector->ref_count);
}
sys_mutex_unlock(&ctor_config->lock);

if (connector) {
int i = 1;
Expand Down Expand Up @@ -275,7 +270,6 @@ QD_EXPORT qd_error_t qd_entity_refresh_connector(qd_entity_t* entity, void *impl
}

sys_mutex_unlock(&connector->lock);
qd_connector_decref(connector); // release local reference
free(failover_info);
} else {
qd_error(QD_ERROR_NOT_FOUND, "No active connector present");
Expand Down Expand Up @@ -369,7 +363,7 @@ QD_EXPORT void qd_connection_manager_start(qd_dispatch_t *qd)
}

while (ctor_config) {
qd_connector_config_connect(ctor_config);
qd_connector_config_activate(ctor_config);
ctor_config = DEQ_NEXT(ctor_config);
}

Expand Down
Loading

0 comments on commit d2571d3

Please sign in to comment.