BBlack has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/134833

Change subject: fix for faulty BGP session collisions
......................................................................

fix for faulty BGP session collisions

The code that maintains the in/out connection lists wasn't
being invoked in all cases where the connection was closed.

Moved the scattered releaseResources() (no-op?) and
connectionClosed() calls on self.bgpPeering down into the
common _closeConnection() code so that they're always
invoked.

Change-Id: I98ecf9723c3f401ba23ffd63becf7b1eb3cf3329
---
M pybal/bgp.py
1 file changed, 4 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal 
refs/changes/33/134833/1

diff --git a/pybal/bgp.py b/pybal/bgp.py
index 1d6556b..23717a0 100644
--- a/pybal/bgp.py
+++ b/pybal/bgp.py
@@ -993,7 +993,6 @@
             for timer in (self.connectRetryTimer, self.holdTimer, 
self.keepAliveTimer,
                           self.delayOpenTimer, self.idleHoldTimer):
                 timer.cancel()
-            if self.bgpPeering is not None: 
self.bgpPeering.releaseResources(self.protocol)
             self._closeConnection()
             self.connectRetryCounter = 0         
             self.state = ST_IDLE
@@ -1045,9 +1044,7 @@
             else:
                 self.connectRetryTimer.cancel()
                 self._closeConnection()
-                if self.bgpPeering: 
self.bgpPeering.releaseResources(self.protocol)
                 self.state = ST_IDLE
-                if self.bgpPeering: 
self.bgpPeering.connectionClosed(self.protocol)
         elif self.state == ST_ACTIVE:
             # State Active, event 18
             self.connectRetryTimer.reset(self.connectRetryTime)
@@ -1058,11 +1055,9 @@
             self.state = ST_IDLE
         elif self.state == ST_OPENSENT:
             # State OpenSent, event 18
-            if self.bgpPeering: self.bgpPeering.releaseResources(self.protocol)
             self._closeConnection()
             self.connectRetryTimer.reset(self.connectRetryTime)
             self.state = ST_ACTIVE
-            if self.bgpPeering: self.bgpPeering.connectionClosed(self.protocol)
         elif self.state in (ST_OPENCONFIRM, ST_ESTABLISHED):
             self._errorClose()
 
@@ -1167,7 +1162,6 @@
         if self.state in (ST_OPENSENT, ST_OPENCONFIRM):
             # State OpenSent, event 24
             self.connectRetryTimer.cancel()
-            if self.bgpPeering: self.bgpPeering.releaseResources(self.protocol)
             self._closeConnection()
             self.state = ST_IDLE          
         elif self.state in (ST_CONNECT, ST_ACTIVE):
@@ -1333,9 +1327,6 @@
             self.keepAliveTimer):
             timer.cancel()
 
-        # Release BGP resources (routes, etc)
-        if self.bgpPeering: self.bgpPeering.releaseResources(self.protocol)
-        
         self._closeConnection()
         
         self.connectRetryCounter += 1
@@ -1348,6 +1339,10 @@
         
         if self.protocol is not None:
             self.protocol.closeConnection()
+        # Release resources and remove from connections list
+        if self.bgpPeering:
+            self.bgpPeering.releaseResources(self.protocol)
+            self.bgpPeering.connectionClosed(self.protocol)
     
 
 class BGP(protocol.Protocol):

-- 
To view, visit https://gerrit.wikimedia.org/r/134833
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I98ecf9723c3f401ba23ffd63becf7b1eb3cf3329
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: BBlack <bbl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to