Skip to content

Commit

Permalink
tv-casting-app/android: resetting discovery state vars onStartDiscove…
Browse files Browse the repository at this point in the history
…ryFailed
  • Loading branch information
sharadb-amazon committed Oct 18, 2023
1 parent ed890b4 commit 64476ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ public void onDiscoveryStopped(String serviceType) {
@Override
public void onStartDiscoveryFailed(String serviceType, int errorCode) {
Log.e(TAG, "Discovery failed to start: Error code:" + errorCode);
TvCastingApp.getInstance().resetDiscoveryState();
failureCallback.handle(
new MatterError(
3, "NsdDiscoveryListener Discovery failed to start: Nsd Error code:" + errorCode));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ public void stopVideoPlayerDiscovery() {
}
}

void resetDiscoveryState() {
synchronized (discoveryLock) {
Log.d(TAG, "TvCastingApp resetting discovery state");
this.discoveryStarted = false;
this.nsdDiscoveryListener = null;
if (multicastLock != null && multicastLock.isHeld()) {
multicastLock.release();
}
}
}

public native boolean openBasicCommissioningWindow(
int duration,
CommissioningCallbacks commissioningCallbacks,
Expand Down

0 comments on commit 64476ee

Please sign in to comment.