-
Notifications
You must be signed in to change notification settings - Fork 10
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
Connection closed despite successful command #24
Comments
Can you try getting debug logs while this is happening? (feel free to ask how if necessary) |
adding |
I store the Client inside of a struct. While the first function works perfectly fine, at the start of the second function, the Client is already disconnected. The disconnect doesn't seem to just happen when a command is sent. Both are functions are inside and impl and the Client is stored in the corresponding struct. Does the client go out of scope and then disconnect or something? Also in the first function, the struct is borrowed as mutable so you can use .as_mut() on the Client and the unwrap() (Option). However, in the other function the struct is not borrowed at mutable and has to match the Option. Anna is wondering if the is part of the problem. |
You also need to install a subscriber, e.g. from the But I think I know what is happening: The runtime created here is dropped implicitly at the end of the scope, which in turn breaks the TCP connection used internally by this library. Keeping the runtime around as long as the |
Does this still occur for you? |
I'll close this for now, feel free to reopen if necessary. |
I can successfully create a connection with mpd and ask for the protocol version e.g. but as soon as I send a command the connection is closed. Due to ConnectionClosed being an error in the Result from running a command, if I query the status e.g., i won't actually get it. However, the commands have an effect on the mpd server: stop works and I can see status data being sent back over TCP.
By running
tcpdump
I can see that to the end of a TCP connection, this library sends an empty message over TCP, which is followed by an empty TCP message by mpd and again, and empty TCP message by this library:Afaik sending an empty message means that you are shutting down the TCP connection.
The text was updated successfully, but these errors were encountered: