fix crash when future cancelled

This commit is contained in:
psykose 2024-11-19 18:25:25 +01:00
parent 4a5b4c055f
commit 68e154aa08
Signed by: psykose
SSH key fingerprint: SHA256:pRMVjV3kRB6zl+wNx+sV8KoMnPqQAW6v8dNCxsCGZv8
2 changed files with 9 additions and 6 deletions

View file

@ -51,7 +51,9 @@ cargo_env = environment()
cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root()) cargo_env.set('MESON_BUILD_ROOT', meson.project_build_root())
cargo_env.set('CARGO_MANIFEST_DIR', meson.project_source_root()) cargo_env.set('CARGO_MANIFEST_DIR', meson.project_source_root())
cargo_env.set('CARGO_TARGET_DIR', meson.project_build_root() / 'target') cargo_env.set('CARGO_TARGET_DIR', meson.project_build_root() / 'target')
meson.add_devenv(cargo_env) dev_env = cargo_env
dev_env.set('RUST_BACKTRACE', 'full')
meson.add_devenv(dev_env)
custom_target( custom_target(
'cargo-build', 'cargo-build',

View file

@ -204,16 +204,17 @@ impl Client {
}) })
} }
sender sender.send(perform(future.await).await).await.map_err(|_| {
.send(perform(future.await).await) Error::OtherError(
.await "failed to send back response from tokio request (future probably cancelled)",
.expect("could not send subsonic response back to the main loop"); )
})
}); });
receiver receiver
.recv() .recv()
.await .await
.expect("could not receive subsonic response from tokio") .map_err(|_| Error::OtherError("failed to receive response from tokio loop"))?
} }
fn url(&self, path: &[&str], query: &[(&str, &str)]) -> url::Url { fn url(&self, path: &[&str], query: &[(&str, &str)]) -> url::Url {