librespot-org / librespot-java

The most up-to-date open source Spotify client
Apache License 2.0
375 stars 91 forks source link

DealerClient ignores pending messages sometimes #834

Open notalexa opened 7 months ago

notalexa commented 7 months ago

Describe the bug The DealerClient ignores pending messages in the following situation (since two listeners are registered): The client receives a message for the second listener (pending). The first listener registers and starts processing. The message is ignored since the second listener is not registered yet.

To Reproduce The situation was seen in the following situation (in most cases on a raspberry pi): Run the player with zeroconf. Select the player in the smartphone app. Sometimes, the player doesn't start playing and the app is waiting "forever" to display the player (because the transfer message is dropped in the player).

Expected behavior The player should always start playing the current track

Screenshots/Stracktraces/Logs No screenshot

Version/Commit A fix is to start handling messages after the initialization is complete. An implementation can be found at https://github.com/notalexa/librespot-java/tree/timing-fixes (together with an additional finite socket timeout). (I hope, I found all occurences of starting the player.)