Added missing BgpSession.exceptionCaught() method to handle
exceptions on the Netty channel.
Change-Id: I9b927abfb21f87d52575158cbecc193d6102f094
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSession.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSession.java
index 7a3fe45..f2c5233 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSession.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/bgp/BgpSession.java
@@ -32,6 +32,7 @@
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.ExceptionEvent;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.util.HashedWheelTimer;
import org.jboss.netty.util.Timeout;
@@ -236,7 +237,7 @@
}
/**
- * Closes the netty channel.
+ * Closes the Netty channel.
*
* @param ctx the Channel Handler Context
*/
@@ -289,7 +290,22 @@
log.debug("BGP Session Disconnected from {} on {}",
ctx.getChannel().getRemoteAddress(),
ctx.getChannel().getLocalAddress());
+ processChannelDisconnected();
+ }
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
+ log.debug("BGP Session Exception Caught from {} on {}: {}",
+ ctx.getChannel().getRemoteAddress(),
+ ctx.getChannel().getLocalAddress(),
+ e);
+ processChannelDisconnected();
+ }
+
+ /**
+ * Processes the channel being disconnected.
+ */
+ private void processChannelDisconnected() {
//
// Withdraw the routes advertised by this BGP peer
//