Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding non-existing song to queue hangs #62

Open
naglis opened this issue Oct 11, 2023 · 0 comments
Open

Adding non-existing song to queue hangs #62

naglis opened this issue Oct 11, 2023 · 0 comments

Comments

@naglis
Copy link
Contributor

naglis commented Oct 11, 2023

Using latest commit from main branch with following test:

#[test]
#[should_panic(expected = "Failed to access")]
fn add_non_existing_song_returns_error() {
    let mut mpd = connect();
    let _song_id = mpd.push(Song { file: "file:///hopefully/non/existing/song.mp3".to_string(), ..Default::default() }).unwrap();
}

results in the MPD connection hanging until MPD closes the client connection due to inactivity and the returned error is Parse(BadPair).

IIUC this is caused by the read_pair() implementation introduced in 8642c72. It parses the error ACK [52@0] {addid} Failed to access /hopefully/non/existing/song.mp3: No such file or directory returned by MPD as the song ID value and then read_field hangs when waiting for expect_ok(), since there is no OK line in case of an error.

naglis added a commit to naglis/rust-mpd that referenced this issue Dec 7, 2023
This reverts commit 8642c72.

The `read_pair()` implementation added in this commit causes connection to hang in case of an error[1].

[1]: kstep#62
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant