fix: check the type of the initial packet

Before this fix, the client could mark the polling transport as open
even though the handshake packet was not received properly (for
example, after a parsing error).

See also: 1c8cba8818
This commit is contained in:
Damien Arrachequesne
2020-12-11 15:02:48 +01:00
parent dfe65e3b3b
commit 2b5dfb99f8

View File

@@ -114,7 +114,7 @@ abstract public class Polling extends Transport {
Parser.DecodePayloadCallback callback = new Parser.DecodePayloadCallback() { Parser.DecodePayloadCallback callback = new Parser.DecodePayloadCallback() {
@Override @Override
public boolean call(Packet packet, int index, int total) { public boolean call(Packet packet, int index, int total) {
if (self.readyState == ReadyState.OPENING) { if (self.readyState == ReadyState.OPENING && Packet.OPEN.equals(packet.type)) {
self.onOpen(); self.onOpen();
} }