Skip to content

Commit

Permalink
Call onClose after socket is closed
Browse files Browse the repository at this point in the history
Call onClose from socket connection only after socket is closed
  • Loading branch information
almozavr committed Aug 26, 2014
1 parent 334cd9f commit 8f72ede
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Autobahn/src/de/tavendo/autobahn/WebSocketConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ public void handleMessage(Message msg) {
if (DEBUG) Log.d(TAG, "WebSockets Close received (" + close.mCode + " - " + close.mReason + ")");

final int tavendoCloseCode = (close.mCode == 1000) ? ConnectionHandler.CLOSE_NORMAL : ConnectionHandler.CLOSE_CONNECTION_LOST;
onClose(tavendoCloseCode, close.mReason);

if (mActive) {
mWriter.forward(new WebSocketMessage.Close(1000));
Expand All @@ -450,6 +449,7 @@ public void handleMessage(Message msg) {
}
}

onClose(tavendoCloseCode, close.mReason);

} else if (msg.obj instanceof WebSocketMessage.ServerHandshake) {

Expand Down

0 comments on commit 8f72ede

Please sign in to comment.