mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #427] [MERGED] Gracefully handle lost network connections #922
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#922
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/427
Author: @kaymes
Created: 1/23/2020
Status: ✅ Merged
Merged: 1/30/2020
Merged by: @sashahilton00
Base:
dev← Head:connection-lost-crash📝 Commits (10+)
362106dFix error handling for closed channel.b6c676aPrevent librespot from panicking if server connection is lost.3fe3849Enable Mercury to be shut down and all pending requests being cancelled.04b52d7Have player handle Mercury errors while loading tracks.ea1e092Enable proper shutdown of the channels.719943aDon't panic if spirc terminates prematurely.17821b2Rename variable to be in line with existing code.f26db01Rate-limit automatic re-connection attempts when spirc shuts down.dadab48Don't exit if too many spirc failures.0e22678Workaround for Rust 1.33 borrow checker.📊 Changes
7 files changed (+158 additions, -50 deletions)
View changed files
📝
connect/src/spirc.rs(+5 -1)📝
core/src/channel.rs(+14 -2)📝
core/src/connection/mod.rs(+20 -2)📝
core/src/mercury/mod.rs(+31 -15)📝
core/src/session.rs(+9 -3)📝
playback/src/player.rs(+23 -5)📝
src/main.rs(+56 -22)📄 Description
Currently librespot tends to panic as soon as something goes wrong with the server connection. Lost server connections can have a variety of causes such as network issues or a spotify server becoming unavailable. Librespot should recover from lost server connections gracefully and reconnect and/or wait for a new connection from a client.
Here I made a series of changes that convert panics into proper error handling in case of lost connections.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.