Committed by
Gerrit Code Review
BGP system test issue fix
Change-Id: I66958eeef622137ab5a3e75e172a6a5a5d0f1514
Showing
1 changed file
with
8 additions
and
17 deletions
... | @@ -472,21 +472,12 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -472,21 +472,12 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
472 | log.info("[exceptionCaught]: " + e.toString()); | 472 | log.info("[exceptionCaught]: " + e.toString()); |
473 | 473 | ||
474 | if (e.getCause() instanceof ReadTimeoutException) { | 474 | if (e.getCause() instanceof ReadTimeoutException) { |
475 | - if ((ChannelState.OPENWAIT == state) || (ChannelState.OPENSENT == state)) { | 475 | + // device timeout |
476 | - | 476 | + log.error("Disconnecting device {} due to read timeout", getPeerInfoString()); |
477 | - // When ReadTimeout timer is expired in OPENWAIT/OPENSENT state, it is considered | 477 | + sendNotification(BgpErrorType.HOLD_TIMER_EXPIRED, (byte) 0, null); |
478 | - sendNotification(BgpErrorType.HOLD_TIMER_EXPIRED, (byte) 0, null); | 478 | + state = ChannelState.IDLE; |
479 | - channel.close(); | 479 | + ctx.getChannel().close(); |
480 | - state = ChannelState.IDLE; | 480 | + return; |
481 | - return; | ||
482 | - } else if (ChannelState.OPENCONFIRM == state) { | ||
483 | - | ||
484 | - // When ReadTimeout timer is expired in OPENCONFIRM state. | ||
485 | - sendNotification(BgpErrorType.HOLD_TIMER_EXPIRED, (byte) 0, null); | ||
486 | - channel.close(); | ||
487 | - state = ChannelState.IDLE; | ||
488 | - return; | ||
489 | - } | ||
490 | } else if (e.getCause() instanceof ClosedChannelException) { | 481 | } else if (e.getCause() instanceof ClosedChannelException) { |
491 | log.debug("Channel for bgp {} already closed", getPeerInfoString()); | 482 | log.debug("Channel for bgp {} already closed", getPeerInfoString()); |
492 | } else if (e.getCause() instanceof IOException) { | 483 | } else if (e.getCause() instanceof IOException) { |
... | @@ -495,7 +486,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -495,7 +486,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
495 | // still print stack trace if debug is enabled | 486 | // still print stack trace if debug is enabled |
496 | log.debug("StackTrace for previous Exception: ", e.getCause()); | 487 | log.debug("StackTrace for previous Exception: ", e.getCause()); |
497 | } | 488 | } |
498 | - channel.close(); | 489 | + ctx.getChannel().close(); |
499 | } else if (e.getCause() instanceof BgpParseException) { | 490 | } else if (e.getCause() instanceof BgpParseException) { |
500 | byte[] data = new byte[] {}; | 491 | byte[] data = new byte[] {}; |
501 | BgpParseException errMsg = (BgpParseException) e.getCause(); | 492 | BgpParseException errMsg = (BgpParseException) e.getCause(); |
... | @@ -512,7 +503,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -512,7 +503,7 @@ class BgpChannelHandler extends IdleStateAwareChannelHandler { |
512 | log.warn("Could not process message: queue full"); | 503 | log.warn("Could not process message: queue full"); |
513 | } else { | 504 | } else { |
514 | log.error("Error while processing message from peer " + getPeerInfoString() + "state " + this.state); | 505 | log.error("Error while processing message from peer " + getPeerInfoString() + "state " + this.state); |
515 | - channel.close(); | 506 | + ctx.getChannel().close(); |
516 | } | 507 | } |
517 | } | 508 | } |
518 | 509 | ... | ... |
-
Please register or login to post a comment