Skip to content

Commit

Permalink
fixed a problem with the socket.io lib causing a possible deadlock du…
Browse files Browse the repository at this point in the history
…ring startup
  • Loading branch information
Martin Lippert committed May 29, 2014
1 parent 6e5c04e commit e0c2567
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
private SocketIO socket;
private String host;

private boolean connectedToUserspace;
private transient boolean connectedToUserspace;
private transient boolean connected;

public SocketIOMessagingConnector(final String username) {
host = System.getProperty("flux-host", "http://localhost:3000");
Expand Down Expand Up @@ -71,6 +72,8 @@ public void onError(SocketIOException ex) {
@Override
public void onConnect() {
try {
connected = true;

JSONObject message = new JSONObject();
message.put("channel", username);

Expand All @@ -96,6 +99,7 @@ public void ack(Object... answer) {

@Override
public void onDisconnect() {
connected = false;
notifyDisconnected();
}

Expand All @@ -119,7 +123,7 @@ public void send(String messageType, JSONObject message) {

@Override
public boolean isConnected() {
return socket.isConnected() && connectedToUserspace;
return connected && connectedToUserspace;
}

}

0 comments on commit e0c2567

Please sign in to comment.