Skip to content

Commit 75dd4c7

Browse files
committed
More aggressive reconnection trigger
1 parent e8d9bfe commit 75dd4c7

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

core/src/main/java/xyz/gianlu/librespot/connectstate/DeviceStateHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public void onMessage(@NotNull String uri, @NotNull Map<String, String> headers,
122122
connectionId = headers.get("Spotify-Connection-Id");
123123
}
124124

125+
LOGGER.debug("Updated Spotify-Connection-Id: " + connectionId);
125126
notifyReady();
126127
} else if (Objects.equals(uri, "hm://connect-state/v1/connect/volume")) {
127128
Connect.SetVolumeCommand cmd = Connect.SetVolumeCommand.parseFrom(BytesArrayList.streamBase64(payloads));

core/src/main/java/xyz/gianlu/librespot/dealer/DealerClient.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.io.Closeable;
1919
import java.io.IOException;
20-
import java.net.SocketException;
2120
import java.util.Arrays;
2221
import java.util.HashMap;
2322
import java.util.List;
@@ -336,13 +335,8 @@ public void onMessage(@NotNull WebSocket ws, @NotNull String text) {
336335

337336
@Override
338337
public void onFailure(@NotNull WebSocket ws, @NotNull Throwable t, @Nullable Response response) {
339-
if (t instanceof SocketException) {
340-
LOGGER.warn("An exception occurred. Reconnecting...", t);
341-
close();
342-
return;
343-
}
344-
345-
LOGGER.error("Unexpected failure when handling message!", t);
338+
LOGGER.warn("An exception occurred. Reconnecting...", t);
339+
close();
346340
}
347341
}
348342
}

0 commit comments

Comments
 (0)