Skip to content

Commit

Permalink
Implement v3/v4 parsing of multiple messages in one HTTP polling body.
Browse files Browse the repository at this point in the history
  • Loading branch information
unverbraucht committed Jan 24, 2024
1 parent a9c99d1 commit 71755ee
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, PacketsM
}
while (content.isReadable()) {
try {
Packet packet = decoder.decodePackets(content, client);
final ByteBuf packetBuf;
final int separatorPos = content.bytesBefore((byte) 0x1E);
if (separatorPos != -1) {
// Multiple packets in one, copy out the next packet to parse
packetBuf = content.copy(content.readerIndex(), separatorPos);
content.readerIndex(separatorPos + 1);
} else {
packetBuf = content;
}
Packet packet = decoder.decodePackets(packetBuf, client);

Namespace ns = namespacesHub.get(packet.getNsp());
if (ns == null) {
Expand Down

0 comments on commit 71755ee

Please sign in to comment.