Wired in connection open and close events
@@ -1264,8 +1264,11 @@ static qdr_address_t *qdr_lookup_terminus_address_CT(qdr_core_t *core,
static void qdr_connection_opened_CT(qdr_core_t *core, qdr_action_t *action, bool discard)
{
+
if (!discard) {
qdr_connection_t *conn = action->args.connection.conn;
+
+ do {
DEQ_ITEM_INIT(conn);
DEQ_INSERT_TAIL(core->open_connections, conn);
@@ -1273,9 +1276,7 @@ static void qdr_connection_opened_CT(qdr_core_t *core, qdr_action_t *action, boo
//
// No action needed for NORMAL connections
//
- qdr_field_free(action->args.connection.connection_label);
- qdr_field_free(action->args.connection.container_id);
- return;
+ break;
}
if (conn->role == QDR_ROLE_INTER_ROUTER) {
@@ -1288,9 +1289,7 @@ static void qdr_connection_opened_CT(qdr_core_t *core, qdr_action_t *action, boo
else {
qd_log(core->log, QD_LOG_CRITICAL, "Exceeded maximum inter-router connection count");
conn->role = QDR_ROLE_NORMAL;
- qdr_field_free(action->args.connection.connection_label);
- qdr_field_free(action->args.connection.container_id);
- return;
+ break;
}
if (!conn->incoming) {
@@ -1328,6 +1327,9 @@ static void qdr_connection_opened_CT(qdr_core_t *core, qdr_action_t *action, boo
// edge router established connection to interior
qdr_edge_connection_opened(core->edge, conn);
}
+ } while (false);
+
+ qdrc_event_conn_raise(core, QDRC_EVENT_CONN_OPENED, conn);
}
qdr_field_free(action->args.connection.connection_label);
@@ -1417,6 +1419,8 @@ static void qdr_connection_closed_CT(qdr_core_t *core, qdr_action_t *action, boo
qdr_edge_connection_closed(core->edge);
}
+ qdrc_event_conn_raise(core, QDRC_EVENT_CONN_CLOSED, conn);
+
DEQ_REMOVE(core->open_connections, conn);
qdr_connection_free(conn);
}
