[PR #1129] [MERGED] add session timeout handling #1241

Closed
opened 2026-02-27 20:01:42 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1129
Author: @eladyn
Created: 3/17/2023
Status: Merged
Merged: 6/1/2023
Merged by: @roderickvd

Base: devHead: session_timeout


📝 Commits (8)

  • 80711f9 add session timeout handling
  • 2d575db fix reconnection for invalid sessions
  • 9522f8f move session timeout handling to Spirc
  • 3898d1a make time_delta computation safer
  • 077effe docs: recommend session_timeout for Session
  • e690b70 implement session timeouts within the session
  • 316992b update changelog
  • 075c055 fix clippy warnings

📊 Changes

5 files changed (+64 additions, -22 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 core/src/mercury/mod.rs (+1 -2)
📝 core/src/session.rs (+50 -9)
📝 core/src/version.rs (+1 -1)
📝 src/main.rs (+11 -10)

📄 Description

See https://github.com/librespot-org/librespot/issues/1102#issuecomment-1398277032.

This makes sure that we receive a ping at least every 2 minutes (which seems to happen consistently, when connected) and otherwise shuts down the session, since the connection stalled in this case. (inspired by the librespot-java implementation)

In combination with the changes to main.rs, this makes sure that librespot successfully reconnects.

I tested this by suspending my laptop and waking it up several hours later. After less than 2 minutes, it noticed that the connection had stalled and restarted itself.

(Hopefully) Fixes #1102.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/librespot-org/librespot/pull/1129 **Author:** [@eladyn](https://github.com/eladyn) **Created:** 3/17/2023 **Status:** ✅ Merged **Merged:** 6/1/2023 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `session_timeout` --- ### 📝 Commits (8) - [`80711f9`](https://github.com/librespot-org/librespot/commit/80711f9b2ec7af8690b4ad6994202526cc8a460c) add session timeout handling - [`2d575db`](https://github.com/librespot-org/librespot/commit/2d575db0adc665148fadd0cc57656442c69592f9) fix reconnection for invalid sessions - [`9522f8f`](https://github.com/librespot-org/librespot/commit/9522f8fad0d30285580a90963dfbe9acbd824152) move session timeout handling to Spirc - [`3898d1a`](https://github.com/librespot-org/librespot/commit/3898d1a53db7ac1124b775f27a874339b8b1b702) make time_delta computation safer - [`077effe`](https://github.com/librespot-org/librespot/commit/077effedc665a0154ba55be8cdfc575691284219) docs: recommend session_timeout for Session - [`e690b70`](https://github.com/librespot-org/librespot/commit/e690b70ebca15bfc86034abd82821a6b8c033711) implement session timeouts within the session - [`316992b`](https://github.com/librespot-org/librespot/commit/316992bf347a4bd56cc30c2f779277eb3ae7aa03) update changelog - [`075c055`](https://github.com/librespot-org/librespot/commit/075c05575436ec4aff3c4fb5f3e74b98d38c0ea0) fix clippy warnings ### 📊 Changes **5 files changed** (+64 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `core/src/mercury/mod.rs` (+1 -2) 📝 `core/src/session.rs` (+50 -9) 📝 `core/src/version.rs` (+1 -1) 📝 `src/main.rs` (+11 -10) </details> ### 📄 Description See https://github.com/librespot-org/librespot/issues/1102#issuecomment-1398277032. This makes sure that we receive a `ping` at least every 2 minutes (which seems to happen consistently, when connected) and otherwise shuts down the session, since the connection stalled in this case. (inspired by the `librespot-java` implementation) In combination with the changes to `main.rs`, this makes sure that librespot successfully reconnects. I tested this by suspending my laptop and waking it up several hours later. After less than 2 minutes, it noticed that the connection had stalled and restarted itself. (Hopefully) Fixes #1102. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:01:42 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librespot#1241
No description provided.