Skip to content

Commit

Permalink
Clean up callbacks when reporting service discovery failure and disco…
Browse files Browse the repository at this point in the history
…nnecting

peripheralDisconnected better handles callback cleanups and autoconnect behaviours.
  • Loading branch information
peitschie committed Jul 19, 2022
1 parent 4a48120 commit 367f900
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/android/Peripheral.java
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,9 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
if (refreshCallback != null) {
refreshCallback.error(this.asJSONObject("Service discovery failed"));
refreshCallback = null;
} else {
connectCallback.error(this.asJSONObject("Service discovery failed"));
disconnect();
}

peripheralDisconnected("Service discovery failed");
}
}

Expand Down

0 comments on commit 367f900

Please sign in to comment.