add connected method

This commit is contained in:
Naoyuki Kanezawa
2014-11-04 01:16:28 +09:00
parent 1aa6e4a907
commit 575fecc2d8

View File

@@ -68,8 +68,7 @@ public class Socket extends Emitter {
put(EVENT_RECONNECTING, 1);
}};
private boolean connected;
private boolean disconnected = true;
private volatile boolean connected;
private int ids;
private String nsp;
private Manager io;
@@ -258,7 +257,6 @@ public class Socket extends Emitter {
private void onclose(String reason) {
logger.fine(String.format("close (%s)", reason));
this.connected = false;
this.disconnected = true;
this.emit(EVENT_DISCONNECT, reason);
}
@@ -344,7 +342,6 @@ public class Socket extends Emitter {
private void onconnect() {
this.connected = true;
this.disconnected = false;
this.emit(EVENT_CONNECT);
this.emitBuffered();
}
@@ -419,6 +416,10 @@ public class Socket extends Emitter {
return io;
}
public boolean connected() {
return connected;
}
private static Object[] toArray(JSONArray array) {
int length = array.length();
Object[] data = new Object[length];