Committed by
Gerrit Code Review
BGP system test issue fix.
Change-Id: I26f30e800a2d88377fde9d6da8ccca25581250ce
Showing
1 changed file
with
11 additions
and
3 deletions
... | @@ -361,6 +361,13 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -361,6 +361,13 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
361 | 361 | ||
362 | } | 362 | } |
363 | 363 | ||
364 | + //Stop keepalive timer | ||
365 | + private void stopKeepAliveTimer() { | ||
366 | + if ((keepAliveTimer != null) && (keepAliveTimer.getKeepAliveTimer() != null)) { | ||
367 | + keepAliveTimer.getKeepAliveTimer().cancel(); | ||
368 | + } | ||
369 | + } | ||
370 | + | ||
364 | // ************************* | 371 | // ************************* |
365 | // Channel handler methods | 372 | // Channel handler methods |
366 | // ************************* | 373 | // ************************* |
... | @@ -457,9 +464,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -457,9 +464,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
457 | duplicateBGPIdFound = Boolean.FALSE; | 464 | duplicateBGPIdFound = Boolean.FALSE; |
458 | } | 465 | } |
459 | 466 | ||
460 | - if (null != keepAliveTimer) { | 467 | + stopKeepAliveTimer(); |
461 | - keepAliveTimer.getKeepAliveTimer().cancel(); | ||
462 | - } | ||
463 | } else { | 468 | } else { |
464 | bgpconfig.setPeerConnState(peerAddr, BgpPeerCfg.State.IDLE); | 469 | bgpconfig.setPeerConnState(peerAddr, BgpPeerCfg.State.IDLE); |
465 | log.warn("No bgp ip in channelHandler registered for " + "disconnected peer {}", getPeerInfoString()); | 470 | log.warn("No bgp ip in channelHandler registered for " + "disconnected peer {}", getPeerInfoString()); |
... | @@ -476,6 +481,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -476,6 +481,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
476 | log.error("Disconnecting device {} due to read timeout", getPeerInfoString()); | 481 | log.error("Disconnecting device {} due to read timeout", getPeerInfoString()); |
477 | sendNotification(BgpErrorType.HOLD_TIMER_EXPIRED, (byte) 0, null); | 482 | sendNotification(BgpErrorType.HOLD_TIMER_EXPIRED, (byte) 0, null); |
478 | state = ChannelState.IDLE; | 483 | state = ChannelState.IDLE; |
484 | + stopKeepAliveTimer(); | ||
479 | ctx.getChannel().close(); | 485 | ctx.getChannel().close(); |
480 | return; | 486 | return; |
481 | } else if (e.getCause() instanceof ClosedChannelException) { | 487 | } else if (e.getCause() instanceof ClosedChannelException) { |
... | @@ -486,6 +492,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -486,6 +492,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
486 | // still print stack trace if debug is enabled | 492 | // still print stack trace if debug is enabled |
487 | log.debug("StackTrace for previous Exception: ", e.getCause()); | 493 | log.debug("StackTrace for previous Exception: ", e.getCause()); |
488 | } | 494 | } |
495 | + stopKeepAliveTimer(); | ||
489 | ctx.getChannel().close(); | 496 | ctx.getChannel().close(); |
490 | } else if (e.getCause() instanceof BgpParseException) { | 497 | } else if (e.getCause() instanceof BgpParseException) { |
491 | byte[] data = new byte[] {}; | 498 | byte[] data = new byte[] {}; |
... | @@ -502,6 +509,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -502,6 +509,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
502 | } else if (e.getCause() instanceof RejectedExecutionException) { | 509 | } else if (e.getCause() instanceof RejectedExecutionException) { |
503 | log.warn("Could not process message: queue full"); | 510 | log.warn("Could not process message: queue full"); |
504 | } else { | 511 | } else { |
512 | + stopKeepAliveTimer(); | ||
505 | log.error("Error while processing message from peer " + getPeerInfoString() + "state " + this.state); | 513 | log.error("Error while processing message from peer " + getPeerInfoString() + "state " + this.state); |
506 | ctx.getChannel().close(); | 514 | ctx.getChannel().close(); |
507 | } | 515 | } | ... | ... |
-
Please register or login to post a comment