Git Product home page Git Product logo

Comments (7)

elomatreb avatar elomatreb commented on June 26, 2024

Can you try getting debug logs while this is happening? (feel free to ask how if necessary)

from mpd_client.

auroraanna avatar auroraanna commented on June 26, 2024

adding RUST_LOG=debug didn't change the output but other than last time i tried, the unwrapping the command's Result doesn't error but it does in another function. investigating this…

from mpd_client.

auroraanna avatar auroraanna commented on June 26, 2024

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.

from mpd_client.

auroraanna avatar auroraanna commented on June 26, 2024

source code here

from mpd_client.

elomatreb avatar elomatreb commented on June 26, 2024

adding RUST_LOG=debug didn't change the output

You also need to install a subscriber, e.g. from the tracing_subscriber crate (as simple as tracing_subscriber::fmt().init(); at the top of the main function).

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 Client exists might already be sufficient to fix this behavior.

from mpd_client.

elomatreb avatar elomatreb commented on June 26, 2024

Does this still occur for you?

from mpd_client.

elomatreb avatar elomatreb commented on June 26, 2024

I'll close this for now, feel free to reopen if necessary.

from mpd_client.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.