Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Close connection when catching an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
matsjj committed May 26, 2016
1 parent 37788ea commit 297a49d
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import network.thunder.core.communication.processor.exceptions.LNException;

public class ProcessorHandler extends ChannelDuplexHandler {

Expand Down Expand Up @@ -49,14 +48,9 @@ public void channelRead (ChannelHandlerContext ctx, Object msg) throws Exception
messageExecutor.sendMessageDownwards(message);
}
}
} catch (LNException e1) {
if (e1.shouldDisconnect()) {
ctx.close();
}
throw e1;
} catch (Exception e) {
e.printStackTrace();
throw e;
} catch (Exception e1) {
e1.printStackTrace();
ctx.close();
}
}

Expand All @@ -79,7 +73,7 @@ public void write (ChannelHandlerContext ctx, Object msg, ChannelPromise promise

} catch (Exception e) {
e.printStackTrace();
throw e;
ctx.close();
}
}

Expand Down

0 comments on commit 297a49d

Please sign in to comment.