Code Review
/
mdsal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Netty Replicator - improve the reconnection and keepalive mechanisms
[mdsal.git]
/
replicate
/
mdsal-replicate-netty
/
src
/
main
/
java
/
org
/
opendaylight
/
mdsal
/
replicate
/
netty
/
SourceRequestHandler.java
diff --git
a/replicate/mdsal-replicate-netty/src/main/java/org/opendaylight/mdsal/replicate/netty/SourceRequestHandler.java
b/replicate/mdsal-replicate-netty/src/main/java/org/opendaylight/mdsal/replicate/netty/SourceRequestHandler.java
index b7811f01845eca02166532d4bd18b1120a550ce3..2d2065d50d4657aee58ccef5e6b38bc73080bf3a 100644
(file)
--- a/
replicate/mdsal-replicate-netty/src/main/java/org/opendaylight/mdsal/replicate/netty/SourceRequestHandler.java
+++ b/
replicate/mdsal-replicate-netty/src/main/java/org/opendaylight/mdsal/replicate/netty/SourceRequestHandler.java
@@
-43,7
+43,7
@@
final class SourceRequestHandler extends SimpleChannelInboundHandler<ByteBuf> {
@Override
public void channelInactive(final ChannelHandlerContext ctx) {
@Override
public void channelInactive(final ChannelHandlerContext ctx) {
- LOG.
trace
("Channel {} going inactive", ctx.channel());
+ LOG.
info
("Channel {} going inactive", ctx.channel());
if (reg != null) {
reg.close();
reg = null;
if (reg != null) {
reg.close();
reg = null;
@@
-62,11
+62,19
@@
final class SourceRequestHandler extends SimpleChannelInboundHandler<ByteBuf> {
case Constants.MSG_SUBSCRIBE_REQ:
subscribe(channel, msg);
break;
case Constants.MSG_SUBSCRIBE_REQ:
subscribe(channel, msg);
break;
+ case Constants.MSG_PONG:
+ break;
default:
throw new IllegalStateException("Unexpected message type " + msgType);
}
}
default:
throw new IllegalStateException("Unexpected message type " + msgType);
}
}
+ @Override
+ public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) {
+ LOG.warn("Closing channel {} due to an error", ctx.channel(), cause);
+ ctx.close();
+ }
+
private void subscribe(final Channel channel, final ByteBuf msg) throws IOException {
verify(reg == null, "Unexpected subscription when already subscribed");
private void subscribe(final Channel channel, final ByteBuf msg) throws IOException {
verify(reg == null, "Unexpected subscription when already subscribed");