[PR #1345] [MERGED] core: retry session connection #1348

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

📋 Pull Request Information

Original PR: https://github.com/librespot-org/librespot/pull/1345
Author: @kingosticks
Created: 9/19/2024
Status: Merged
Merged: 9/23/2024
Merged by: @roderickvd

Base: devHead: session-retry-connect


📝 Commits (1)

  • 118a2f3 core: retry Session access-point connection.

📊 Changes

3 files changed (+48 additions, -7 deletions)

View changed files

📝 CHANGELOG.md (+2 -1)
📝 core/src/connection/mod.rs (+23 -0)
📝 core/src/session.rs (+23 -6)

📄 Description

When session connection fails, retry the access point. If still fails for a non-auth-login reason, repeat for the other access points. Also some logging tweaks.

When blocking ap-gew1.spotify.com, now I see each a retry for each AP on that host, until it finds an AP on a different host and succeeds.

[2024-09-20T22:41:44Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient
[2024-09-20T22:41:44Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070"
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point...
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z WARN  librespot_core::session] Try another access point...
[2024-09-20T22:41:44Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:443"
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point...
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z WARN  librespot_core::session] Try another access point...
[2024-09-20T22:41:44Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:80"
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point...
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111)
[2024-09-20T22:41:44Z WARN  librespot_core::session] Try another access point...
[2024-09-20T22:41:44Z INFO  librespot_core::session] Connecting to AP "ap-guc3.spotify.com:4070"
[2024-09-20T22:41:44Z DEBUG librespot_core::connection] Authenticating with AP using AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS
[2024-09-20T22:41:45Z INFO  librespot_core::session] Authenticated as 'XXX' !

When using bad credentials, it does not retry:

[2024-09-20T23:12:15Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient
[2024-09-20T23:12:15Z INFO  librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070"
[2024-09-20T23:12:15Z DEBUG librespot_core::connection] Authenticating with AP using AUTHENTICATION_SPOTIFY_TOKEN
[2024-09-20T23:12:15Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials }

🔄 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/1345 **Author:** [@kingosticks](https://github.com/kingosticks) **Created:** 9/19/2024 **Status:** ✅ Merged **Merged:** 9/23/2024 **Merged by:** [@roderickvd](https://github.com/roderickvd) **Base:** `dev` ← **Head:** `session-retry-connect` --- ### 📝 Commits (1) - [`118a2f3`](https://github.com/librespot-org/librespot/commit/118a2f3d2f5df5b5ef7093bdedb1ec41f5991988) core: retry Session access-point connection. ### 📊 Changes **3 files changed** (+48 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -1) 📝 `core/src/connection/mod.rs` (+23 -0) 📝 `core/src/session.rs` (+23 -6) </details> ### 📄 Description When session connection fails, retry the access point. If still fails for a non-auth-login reason, repeat for the other access points. Also some logging tweaks. When blocking ap-gew1.spotify.com, now I see each a retry for each AP on that host, until it finds an AP on a different host and succeeds. ``` [2024-09-20T22:41:44Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient [2024-09-20T22:41:44Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070" [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point... [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z WARN librespot_core::session] Try another access point... [2024-09-20T22:41:44Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:443" [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point... [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z WARN librespot_core::session] Try another access point... [2024-09-20T22:41:44Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:80" [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Retry access point... [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Connection failed: Connection refused (os error 111) [2024-09-20T22:41:44Z WARN librespot_core::session] Try another access point... [2024-09-20T22:41:44Z INFO librespot_core::session] Connecting to AP "ap-guc3.spotify.com:4070" [2024-09-20T22:41:44Z DEBUG librespot_core::connection] Authenticating with AP using AUTHENTICATION_STORED_SPOTIFY_CREDENTIALS [2024-09-20T22:41:45Z INFO librespot_core::session] Authenticated as 'XXX' ! ``` When using bad credentials, it does not retry: ``` [2024-09-20T23:12:15Z DEBUG librespot_core::http_client] Requesting https://apresolve.spotify.com/?type=accesspoint&type=dealer&type=spclient [2024-09-20T23:12:15Z INFO librespot_core::session] Connecting to AP "ap-gew1.spotify.com:4070" [2024-09-20T23:12:15Z DEBUG librespot_core::connection] Authenticating with AP using AUTHENTICATION_SPOTIFY_TOKEN [2024-09-20T23:12:15Z ERROR librespot] could not initialize spirc: Permission denied { Login failed with reason: Bad credentials } ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 20:02:06 +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#1348
No description provided.