Skip to content

Commit 2dba753

Browse files
committed
Rearranged start sequence to avoid invalid state
1 parent c50f314 commit 2dba753

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ void authenticate(@NotNull Authentication.LoginCredentials credentials) throws I
348348
authLock.notifyAll();
349349
}
350350

351-
dealer.connect();
352-
player.initState();
353-
TimeProvider.init(this);
354351
eventService.language(conf().preferredLocale());
352+
TimeProvider.init(this);
353+
player.initState();
354+
dealer.connect();
355355

356356
LOGGER.info("Authenticated as {}!", apWelcome.getCanonicalUsername());
357357
mercuryClient.interestedIn("spotify:user:attributes:update", this);
@@ -500,7 +500,7 @@ private void sendUnchecked(Packet.Type cmd, byte[] payload) throws IOException {
500500
}
501501

502502
private void waitAuthLock() {
503-
if(closing && conn == null){
503+
if (closing && conn == null) {
504504
LOGGER.debug("Connection was broken while Session.close() has been called");
505505
return;
506506
}
@@ -519,7 +519,7 @@ private void waitAuthLock() {
519519
}
520520

521521
public void send(Packet.Type cmd, byte[] payload) throws IOException {
522-
if(closing && conn == null){
522+
if (closing && conn == null) {
523523
LOGGER.debug("Connection was broken while Session.close() has been called");
524524
return;
525525
}

0 commit comments

Comments
 (0)