Open dsheets opened 6 months ago
Thanks! Yes this is a known shortcoming, nice to see something being done about it.
If you're interested in this fix, I may take a look at clearing the value in the future.
That would be nice. Do you want to handle that under this PR or a separate one?
bump you think you can take a shot at updating the user on disconnect / reconnect?
Hi, sorry for the delay. I might have some time to take a look at this next week.
Don't use async Mutexes for short-lived locks like this. Use a normal std
mutex instead. See this section of the tokio book for more information.
bump @Finomnis is right. Could you change it accordingly?
The current active user was almost persisted and reported but wasn't. The handler for the discovery server is under an Arc so I introduced a Mutex to protect the username field and made setting the username and sending the credentials atomic so that every valid credential send corresponds to an active user update.
There doesn't appear currently to be any way for this
activeUser
field to be reset back to the empty string when a user disconnects so one could argue that it's actually more broken now than before as it will keep reporting the last user to connect indefinitely instead of the user with a currently active session.If you're interested in this fix, I may take a look at clearing the value in the future.
This issue was reported by @TimotheeGerber in https://github.com/TimotheeGerber/spotify-connect/pull/4#discussion_r1428834453.