Skip to content

Commit

Permalink
[MRSV5-10322] Improved logs to help debug issue with client and impro…
Browse files Browse the repository at this point in the history
…ved disconnectExpress
  • Loading branch information
rodrigo-g-teixeira committed Sep 20, 2023
1 parent ce3010b commit 95b4485
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/android/ConnectionExpress.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void run() {
// TODO Auto-generated catch block
e.printStackTrace();
this.socketPlugin.disconnectExpress(this.host, this.port, this.callbackContext, false);
this.callbackContext.error("Invalid parameters for 'connect' action:" + e.getMessage());
this.callbackContext.error("[run] Invalid parameters for 'connect' action:" + e.getMessage());
}
}

Expand Down
16 changes: 9 additions & 7 deletions src/android/SocketPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ public void disconnectExpress(String host, int port, CallbackContext callbackCon
// closing socket
if (socket != null) {

// checking connection
if (socket.isConnected()) {
socket.close();
if(ending) {
// checking connection
if (socket.isConnected()) {
socket.close();
}
}

// removing from pool
Expand All @@ -90,7 +92,7 @@ public void disconnectExpress(String host, int port, CallbackContext callbackCon
callbackContext.success("Disconnected!");
}
} catch (Exception e) {
callbackContext.error("Invalid parameters for 'connect' action:" + e.getMessage());
callbackContext.error("[disconnectExpress] Invalid parameters for 'connect' action:" + e.getMessage());
}
}

Expand Down Expand Up @@ -152,7 +154,7 @@ private void connect(JSONArray args, CallbackContext callbackContext) {
callbackContext.success(key);

} catch (JSONException e) {
callbackContext.error("Invalid parameters for 'connect' action: " + e.getMessage());
callbackContext.error("[connect] Invalid parameters for 'connect' action: " + e.getMessage());
}
}
}
Expand Down Expand Up @@ -253,7 +255,7 @@ private void sendExpress(JSONArray args, CallbackContext callbackContext) {
}
}
} catch (Exception e) {
callbackContext.error("Invalid parameters for 'connect' action: " + e.getMessage());
callbackContext.error("[sendExpress] Invalid parameters for 'connect' action: " + e.getMessage());
}
}

Expand Down Expand Up @@ -295,7 +297,7 @@ private void disconnect(JSONArray args, CallbackContext callbackContext) {
callbackContext.success("Disconnected from " + key);

} catch (JSONException e) {
callbackContext.error("Invalid parameters for 'connect' action:" + e.getMessage());
callbackContext.error("[disconnect] Invalid parameters for 'connect' action:" + e.getMessage());
}
}
}
Expand Down

0 comments on commit 95b4485

Please sign in to comment.