close effRibInWriter properly 02/78502/5
authorMatej Perina <matej.perina@pantheon.tech>
Thu, 6 Dec 2018 13:55:43 +0000 (14:55 +0100)
committerRobert Varga <nite@hq.sk>
Fri, 7 Dec 2018 10:06:48 +0000 (10:06 +0000)
We cannot close effRibInWriter before we clear tables
without graceful restart support.

Change-Id: Ife2f76aa4b2a9db991b570c9930084c17aeb2cc0
JIRA:BGPCEP-495
Signed-off-by: Matej Perina <matej.perina@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java

index 4f4fb0a2f17901966413a8c9d03361bb956b4712..fd568c63c3a89477ed6179d1f5dc9977f647a8d6 100644 (file)
@@ -415,6 +415,7 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
             }
             this.ribWriter.clearTables(Sets.difference(this.tables, forwardingTables));
             if (restartingLocally) {
+                this.effRibInWriter.close();
                 this.peerRestartStopwatch = Stopwatch.createStarted();
                 handleSelectionReferralTimer();
                 this.missingEOT.addAll(this.tables);
@@ -507,9 +508,6 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         if (!isRestartingGracefully()) {
             future = terminateConnection();
         } else {
-            if (isLocalRestarting()){
-                this.effRibInWriter.close();
-            }
             final Set<TablesKey> gracefulTables = getGracefulTables();
             this.ribWriter.storeStaleRoutes(gracefulTables);
             future = this.ribWriter.clearTables(Sets.difference(this.tables, gracefulTables));