Skip to content

Commit

Permalink
Refresh AP pool before reconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
devgianlu committed Jun 25, 2021
1 parent b4abb97 commit 591fb92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/main/java/xyz/gianlu/librespot/core/ApResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ public static void fillPool() throws IOException {
if (!poolReady) request("accesspoint", "dealer", "spclient");
}

public static void refreshPool() throws IOException {
poolReady = false;
pool.clear();
request("accesspoint", "dealer", "spclient");
}

@NotNull
private static List<String> getUrls(@NotNull JsonObject body, @NotNull String type) {
JsonArray aps = body.getAsJsonArray(type);
Expand Down
2 changes: 2 additions & 0 deletions lib/src/main/java/xyz/gianlu/librespot/core/Session.java
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,8 @@ private void reconnect() {
}

try {
ApResolver.refreshPool();

if (conn != null) {
conn.socket.close();
receiver.stop();
Expand Down

0 comments on commit 591fb92

Please sign in to comment.