From 8cda77f5ff35bf04e56e700422c0bda72723162d Mon Sep 17 00:00:00 2001 From: Markus Sommer Date: Wed, 2 Jun 2021 16:13:05 +0200 Subject: [PATCH] Distinguish different CLA instances during restart There may be a situation where there are multiple PeerDisappeared-messages for the same CLA waiting to be processed. This might cause the manager to restart the same CLA multiple times in quick succession. To prevent this, we can check if the pointer to the CLA from the PeerDisappeared-message points to the same instance as the one currently stored in the manager's `convs` map. --- pkg/cla/manager.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/cla/manager.go b/pkg/cla/manager.go index 17683af5..3d421ed1 100644 --- a/pkg/cla/manager.go +++ b/pkg/cla/manager.go @@ -1,5 +1,7 @@ // SPDX-FileCopyrightText: 2019, 2020 Alvar Penning -// SPDX-FileCopyrightText: 2020 Markus Sommer +// SPDX-FileCopyrightText: 2020, 2021 Markus Sommer +// SPDX-FileCopyrightText: 2021 Artur Sterz +// SPDX-FileCopyrightText: 2021 Jonas Höchst // // SPDX-License-Identifier: GPL-3.0-or-later @@ -266,7 +268,18 @@ func (manager *Manager) unregisterConvergence(conv Convergence) { return } - convElem.(*convergenceElem).deactivate(manager.queueTtl) + element := convElem.(*convergenceElem) + + if element.conv != conv { + log.WithFields(log.Fields{ + "cla": conv, + "address": conv.Address(), + }).Error("CLA not unregistered, different instance.") + + return + } + + element.deactivate(manager.queueTtl) manager.convs.Delete(conv.Address()) }