Skip to content

Commit ad95db4

Browse files
authored
Fixes #1743: manage connection lifecycle on TLS ordinal mgmt (#1747)
Based on what I've learned doing POC work in the router core and PR request feedback. The tls ordinal is leveraged as a group attribute for the core. This will allow the core to identify which connection in the group takes precedence. Also removed extra copies of the correlator string and various code cleanups.
1 parent 397c834 commit ad95db4

File tree

10 files changed

+520
-116
lines changed

10 files changed

+520
-116
lines changed

python/skupper_router/management/skrouter.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,18 @@
17431743
"type": "integer",
17441744
"graph": true,
17451745
"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."
1746+
},
1747+
"tlsOrdinal": {
1748+
"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.",
1749+
"type": "integer"
1750+
},
1751+
"groupCorrelationId": {
1752+
"description": "The identifier used to group inter-router and inter-router-data connections generated by the same connector.",
1753+
"type": "string"
1754+
},
1755+
"groupOrdinal": {
1756+
"description": "Indicates the precedence of the connection within the group. Connections with the highest ordinal value within the group will be used to forward new message streams.",
1757+
"type": "integer"
17461758
}
17471759
}
17481760
},

src/adaptors/amqp/connection_manager.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,8 @@ QD_EXPORT qd_error_t qd_entity_refresh_connector(qd_entity_t* entity, void *impl
176176
// TODO(kgiusti): inter-router connections may have several qd_connector_ts active due to the router data connection
177177
// count configuration. However we can only report 1 connector via management. It would be more accurate to report
178178
// all connectors associated with this management entity
179-
sys_mutex_lock(&ctor_config->lock);
179+
assert(sys_thread_role(0) == SYS_THREAD_MAIN || sys_thread_proactor_mode() == SYS_THREAD_PROACTOR_MODE_TIMER); // only mgmt thread can access connectors list
180180
connector = DEQ_HEAD(ctor_config->connectors);
181-
if (connector) {
182-
// prevent I/O thread from freeing connector while it is being accessed
183-
sys_atomic_inc(&connector->ref_count);
184-
}
185-
sys_mutex_unlock(&ctor_config->lock);
186181

187182
if (connector) {
188183
int i = 1;
@@ -275,7 +270,6 @@ QD_EXPORT qd_error_t qd_entity_refresh_connector(qd_entity_t* entity, void *impl
275270
}
276271

277272
sys_mutex_unlock(&connector->lock);
278-
qd_connector_decref(connector); // release local reference
279273
free(failover_info);
280274
} else {
281275
qd_error(QD_ERROR_NOT_FOUND, "No active connector present");
@@ -369,7 +363,7 @@ QD_EXPORT void qd_connection_manager_start(qd_dispatch_t *qd)
369363
}
370364

371365
while (ctor_config) {
372-
qd_connector_config_connect(ctor_config);
366+
qd_connector_config_activate(ctor_config);
373367
ctor_config = DEQ_NEXT(ctor_config);
374368
}
375369

0 commit comments

Comments
 (0)