From d322624f8a789a54d319497aea3356e72d98f380 Mon Sep 17 00:00:00 2001 From: Kenneth Giusti Date: Wed, 1 Apr 2020 11:03:30 -0400 Subject: [PATCH] DISPATCH-1613: avoid error log when additional inter-router data links attach --- src/router_core/connections.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/router_core/connections.c b/src/router_core/connections.c index a6672c9549..e2b0eb12bd 100644 --- a/src/router_core/connections.c +++ b/src/router_core/connections.c @@ -1469,20 +1469,15 @@ static void qdr_detach_link_control_CT(qdr_core_t *core, qdr_connection_t *conn, // static void qdr_attach_link_data_CT(qdr_core_t *core, qdr_connection_t *conn, qdr_link_t *link) { - if (conn->role == QDR_ROLE_INTER_ROUTER) { - // As inter-router links are attached to this connection, they - // are assigned priorities in the order in which they are attached. - int next_slot = core->data_links_by_mask_bit[conn->mask_bit].count ++; - if (next_slot > QDR_MAX_PRIORITY) { - // If somebody tries to exceed max links, log an error and - // do not allow replacement of the legitimate link that is already in the max slot. - // This is not serious enough to cause a program exit, but if it ever - // happens it should be investiagted as a bug. - qd_log(core->log, QD_LOG_ERROR, "Attempt to attach too many inter-router links for priority sheaf."); - return; - } - link->priority = next_slot; - core->data_links_by_mask_bit[conn->mask_bit].links[next_slot] = link; + assert(link->link_type == QD_LINK_ROUTER); + // The first QDR_N_PRIORITIES (10) QDR_LINK_ROUTER links to attach over the + // connection are the shared priority links. These links are attached in + // priority order starting at zero. + int next_pri = core->data_links_by_mask_bit[conn->mask_bit].count; + if (next_pri < QDR_N_PRIORITIES) { + link->priority = next_pri; + core->data_links_by_mask_bit[conn->mask_bit].links[next_pri] = link; + core->data_links_by_mask_bit[conn->mask_bit].count += 1; } }