Skip to content

Commit

Permalink
Enable autoconnect in connection state rehandshaking
Browse files Browse the repository at this point in the history
  • Loading branch information
kaaholst committed May 20, 2024
1 parent 3f640d3 commit e9fa9d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ public void startConnect(final SqueezeService service, boolean autoConnect) {

// Start the background connect
mBackgroundHandler.post(() -> {
mPendingRequests.clear();
mPendingBrowseRequests.clear();
mCommandQueue.clear();
mCurrentCommand = false;
cleanupBayeuxClient();

final Preferences.ServerAddress serverAddress = Squeezer.getPreferences().getServerAddress();
Expand Down Expand Up @@ -327,7 +331,6 @@ private void onConnected(boolean isSqueezeNetwork) {
// If this is a rehandshake we may already have players.
boolean rehandshake = !mConnectionState.isRehandshaking();

mCurrentCommand = false;
mConnectionState.setConnectionState(ConnectionState.State.CONNECTION_COMPLETED);

// Set a timeout for the handshake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ boolean isRehandshaking() {
private final AtomicReference<String[]> mediaDirs = new AtomicReference<>();

public boolean canAutoConnect() {
return (state == State.DISCONNECTED || state == State.CONNECTION_FAILED)
return (state == State.DISCONNECTED || state == State.CONNECTION_FAILED || state == State.REHANDSHAKING)
&& ((SystemClock.elapsedRealtime() - autoConnect) > AUTO_CONNECT_INTERVAL);
}

Expand Down

0 comments on commit e9fa9d7

Please sign in to comment.