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 (#29836)
  • Loading branch information
sharadb-amazon authored Oct 18, 2023
1 parent 836ceec commit 6b64a80
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 @@ -297,6 +297,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 6b64a80

Please sign in to comment.