Skip to content

Commit

Permalink
fix(devtools): callback fail when debug ws disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
lavnFan authored and zoomchan-cxj committed Feb 6, 2023
1 parent 33218ee commit 56d71bc
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public void onConnect() {
@Override
public void onDisconnect(int code, String reason) {
LogUtils.d("onDisconnect","code:" + code + ",reason:" + reason);
if (mConnectCallback != null) {
mConnectCallback.onFailure(new Exception(reason));
mConnectCallback = null;
}
if (code == 0 && (WebSocketClient.DISCONNECT_REASON_EOF.equals(reason)
|| WebSocketClient.DISCONNECT_REASON_CONNECT.equals(reason))) {
reconnect();
Expand All @@ -114,8 +118,6 @@ public void onDisconnect(int code, String reason) {
}

private void abort(Throwable cause) {
closeQuietly();

// Trigger failure callbacks
if (mConnectCallback != null) {
mConnectCallback.onFailure(cause);
Expand All @@ -125,6 +127,8 @@ private void abort(Throwable cause) {
callback.onFailure(cause);
}
mCallbacks.clear();

closeQuietly();
}

public interface JSDebuggerCallback {
Expand Down

0 comments on commit 56d71bc

Please sign in to comment.