Added missing BgpSession.exceptionCaught() method to handle
exceptions on the Netty channel. Change-Id: I9b927abfb21f87d52575158cbecc193d6102f094
Showing
1 changed file
with
17 additions
and
1 deletions
... | @@ -32,6 +32,7 @@ import org.jboss.netty.buffer.ChannelBuffer; | ... | @@ -32,6 +32,7 @@ import org.jboss.netty.buffer.ChannelBuffer; |
32 | import org.jboss.netty.buffer.ChannelBuffers; | 32 | import org.jboss.netty.buffer.ChannelBuffers; |
33 | import org.jboss.netty.channel.ChannelHandlerContext; | 33 | import org.jboss.netty.channel.ChannelHandlerContext; |
34 | import org.jboss.netty.channel.ChannelStateEvent; | 34 | import org.jboss.netty.channel.ChannelStateEvent; |
35 | +import org.jboss.netty.channel.ExceptionEvent; | ||
35 | import org.jboss.netty.channel.SimpleChannelHandler; | 36 | import org.jboss.netty.channel.SimpleChannelHandler; |
36 | import org.jboss.netty.util.HashedWheelTimer; | 37 | import org.jboss.netty.util.HashedWheelTimer; |
37 | import org.jboss.netty.util.Timeout; | 38 | import org.jboss.netty.util.Timeout; |
... | @@ -236,7 +237,7 @@ public class BgpSession extends SimpleChannelHandler { | ... | @@ -236,7 +237,7 @@ public class BgpSession extends SimpleChannelHandler { |
236 | } | 237 | } |
237 | 238 | ||
238 | /** | 239 | /** |
239 | - * Closes the netty channel. | 240 | + * Closes the Netty channel. |
240 | * | 241 | * |
241 | * @param ctx the Channel Handler Context | 242 | * @param ctx the Channel Handler Context |
242 | */ | 243 | */ |
... | @@ -289,7 +290,22 @@ public class BgpSession extends SimpleChannelHandler { | ... | @@ -289,7 +290,22 @@ public class BgpSession extends SimpleChannelHandler { |
289 | log.debug("BGP Session Disconnected from {} on {}", | 290 | log.debug("BGP Session Disconnected from {} on {}", |
290 | ctx.getChannel().getRemoteAddress(), | 291 | ctx.getChannel().getRemoteAddress(), |
291 | ctx.getChannel().getLocalAddress()); | 292 | ctx.getChannel().getLocalAddress()); |
293 | + processChannelDisconnected(); | ||
294 | + } | ||
292 | 295 | ||
296 | + @Override | ||
297 | + public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { | ||
298 | + log.debug("BGP Session Exception Caught from {} on {}: {}", | ||
299 | + ctx.getChannel().getRemoteAddress(), | ||
300 | + ctx.getChannel().getLocalAddress(), | ||
301 | + e); | ||
302 | + processChannelDisconnected(); | ||
303 | + } | ||
304 | + | ||
305 | + /** | ||
306 | + * Processes the channel being disconnected. | ||
307 | + */ | ||
308 | + private void processChannelDisconnected() { | ||
293 | // | 309 | // |
294 | // Withdraw the routes advertised by this BGP peer | 310 | // Withdraw the routes advertised by this BGP peer |
295 | // | 311 | // | ... | ... |
-
Please register or login to post a comment