Skip to content
Snippets Groups Projects
Commit 4b988c29 authored by Mandeep Dhami's avatar Mandeep Dhami
Browse files

Added check for decode to avoid out of order invocation (wrt to decodeLast)

parent 5129beb5
No related branches found
No related tags found
No related merge requests found
......@@ -39,9 +39,22 @@ public class OFMessageDecoder extends FrameDecoder {
@Override
protected Object decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buffer) throws Exception {
List<OFMessage> message =
factory.parseMessage(buffer);
if (!channel.isConnected()) {
// In testing, I see decode being called AFTER decode last.
// This check avoids that from reading curroupted frames
return null;
}
List<OFMessage> message = factory.parseMessage(buffer);
return message;
}
@Override
protected Object decodeLast(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buffer) throws Exception {
// This is not strictly needed atthis time. It is used to detect
// connection reset detection from netty (for debug)
return null;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment