Skip to content

Commit 591fb92

Browse files
committed
Refresh AP pool before reconnecting
See spocon/spocon#37
1 parent b4abb97 commit 591fb92

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/src/main/java/xyz/gianlu/librespot/core/ApResolver.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ public static void fillPool() throws IOException {
4848
if (!poolReady) request("accesspoint", "dealer", "spclient");
4949
}
5050

51+
public static void refreshPool() throws IOException {
52+
poolReady = false;
53+
pool.clear();
54+
request("accesspoint", "dealer", "spclient");
55+
}
56+
5157
@NotNull
5258
private static List<String> getUrls(@NotNull JsonObject body, @NotNull String type) {
5359
JsonArray aps = body.getAsJsonArray(type);

lib/src/main/java/xyz/gianlu/librespot/core/Session.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ private void reconnect() {
704704
}
705705

706706
try {
707+
ApResolver.refreshPool();
708+
707709
if (conn != null) {
708710
conn.socket.close();
709711
receiver.stop();

0 commit comments

Comments
 (0)