Shashikanth VH
Committed by Gerrit Code Review

Process protocol message read partially from the buffer.

Change-Id: I1888dce82bea566796bc222329650582cba5a276
......@@ -48,13 +48,27 @@ public class BgpMessageDecoder extends FrameDecoder {
HexDump.dump(buffer);
BgpMessageReader<BgpMessage> reader = BgpFactories.getGenericReader();
List<BgpMessage> msgList = new LinkedList<BgpMessage>();
List<BgpMessage> msgList = (List<BgpMessage>) ctx.getAttachment();
while (buffer.readableBytes() > 0) {
BgpHeader bgpHeader = new BgpHeader();
BgpMessage message = reader.readFrom(buffer, bgpHeader);
msgList.add(message);
if (msgList == null) {
msgList = new LinkedList<>();
}
return msgList;
try {
while (buffer.readableBytes() > 0) {
buffer.markReaderIndex();
BgpHeader bgpHeader = new BgpHeader();
BgpMessage message = reader.readFrom(buffer, bgpHeader);
msgList.add(message);
}
return msgList;
} catch (Exception e) {
log.debug("Bgp protocol message decode error");
buffer.resetReaderIndex();
buffer.discardReadBytes();
ctx.setAttachment(msgList);
}
return null;
}
}
\ No newline at end of file
......