Browse Source

Skip body parsing if attachments aren't loaded

master
Sergey Bushik 8 years ago
parent
commit
28a7fb8331
  1. 6
      src/main/java/com/corundumstudio/socketio/protocol/PacketDecoder.java

6
src/main/java/com/corundumstudio/socketio/protocol/PacketDecoder.java

@ -292,6 +292,10 @@ public class PacketDecoder {
head.setLastBinaryPacket(packet); head.setLastBinaryPacket(packet);
} }
if (packet.hasAttachments() && !packet.isAttachmentsLoaded()) {
return;
}
if (packet.getSubType() == PacketType.ACK if (packet.getSubType() == PacketType.ACK
|| packet.getSubType() == PacketType.BINARY_ACK) { || packet.getSubType() == PacketType.BINARY_ACK) {
ByteBufInputStream in = new ByteBufInputStream(frame); ByteBufInputStream in = new ByteBufInputStream(frame);
@ -302,7 +306,6 @@ public class PacketDecoder {
if (packet.getSubType() == PacketType.EVENT if (packet.getSubType() == PacketType.EVENT
|| packet.getSubType() == PacketType.BINARY_EVENT) { || packet.getSubType() == PacketType.BINARY_EVENT) {
if (!packet.hasAttachments() || packet.isAttachmentsLoaded()) {
ByteBufInputStream in = new ByteBufInputStream(frame); ByteBufInputStream in = new ByteBufInputStream(frame);
Event event = jsonSupport.readValue(packet.getNsp(), in, Event.class); Event event = jsonSupport.readValue(packet.getNsp(), in, Event.class);
packet.setName(event.getName()); packet.setName(event.getName());
@ -310,6 +313,5 @@ public class PacketDecoder {
} }
} }
} }
}
} }
Loading…
Cancel
Save