[ONOS-5627] Continuously handle LISP request when exception occurs
Change-Id: Ib1b32a5f3299d77632704e955a512aad4af37d92
diff --git a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
index d1ad800..1b14a2f 100644
--- a/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
+++ b/protocols/lisp/ctl/src/main/java/org/onosproject/lisp/ctl/LispChannelHandler.java
@@ -39,28 +39,30 @@
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
- // first we need to check whether this is an ECM
- if (msg instanceof LispEncapsulatedControl) {
- LispMessage innerMsg = extractLispMessage((LispEncapsulatedControl) msg);
- if (innerMsg instanceof LispMapRequest) {
- LispMapResolver mapResolver = new LispMapResolver();
- LispMessage lispMessage = mapResolver.processMapRequest((LispEncapsulatedControl) msg);
+ try {
+ // first we need to check whether this is an ECM
+ if (msg instanceof LispEncapsulatedControl) {
+ LispMessage innerMsg =
+ extractLispMessage((LispEncapsulatedControl) msg);
+ if (innerMsg instanceof LispMapRequest) {
+ LispMapResolver mapResolver = new LispMapResolver();
+ LispMessage lispMessage =
+ mapResolver.processMapRequest(
+ (LispEncapsulatedControl) msg);
- // try to remove the received map-request message from buffer
- ReferenceCountUtil.release(msg);
-
- ctx.writeAndFlush(lispMessage);
+ ctx.writeAndFlush(lispMessage);
+ }
}
- }
- if (msg instanceof LispMapRegister) {
- LispMapServer mapServer = new LispMapServer();
- LispMapNotify mapNotify = mapServer.processMapRegister((LispMapRegister) msg);
+ if (msg instanceof LispMapRegister) {
+ LispMapServer mapServer = new LispMapServer();
+ LispMapNotify mapNotify =
+ mapServer.processMapRegister((LispMapRegister) msg);
- // try to remove the received map-register message from buffer
+ ctx.writeAndFlush(mapNotify);
+ }
+ } finally {
ReferenceCountUtil.release(msg);
-
- ctx.writeAndFlush(mapNotify);
}
}
@@ -87,7 +89,8 @@
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
throws Exception {
log.warn(cause.getMessage());
- ctx.close();
+
+ //TODO: add error handle mechanisms for each cases
}
/**