fix: emit a CONNECT_ERROR event upon connection failure

See also: 53c73749a8
This commit is contained in:
Damien Arrachequesne
2021-04-27 00:08:16 +02:00
parent e8ffe9d138
commit d324e7f396

View File

@@ -91,7 +91,9 @@ public class Socket extends Emitter {
add(On.on(io, Manager.EVENT_ERROR, new Listener() { add(On.on(io, Manager.EVENT_ERROR, new Listener() {
@Override @Override
public void call(Object... args) { public void call(Object... args) {
Socket.super.emit(EVENT_CONNECT_ERROR, args[0]); if (!Socket.this.connected) {
Socket.super.emit(EVENT_CONNECT_ERROR, args[0]);
}
} }
})); }));
add(On.on(io, Manager.EVENT_CLOSE, new Listener() { add(On.on(io, Manager.EVENT_CLOSE, new Listener() {