Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to solve issue #281 by taking the
connection_lock_
inwaitForEvent()
.Additionally, I observed that multiple
periodic_updater
s could be running.This happens when mpd is playing and no events happen.
This causes the mpd connection to drop when
mpd_recv_idle
times out.If the current
periodic_updater
is sleeping at this moment,update
will run and start a new one,while the current one will also continue running (there is a new connection to mpd at this moment, so it sees no reason to stop). Adding a mutex to make sure
update
only continues when the currentperiodic_updater
has stopped, fixes this.It would be nice if more people could try out this code, since I'm not sure #281 is solved by this, maybe it just happens more infrequently.