Browse Source

Skip body parsing if attachments aren't loaded

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

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

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

Loading…
Cancel
Save