mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #776] [CLOSED] Improvements in librespot-core #1073
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#1073
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/776
Author: @Johannesd3
Created: 5/28/2021
Status: ❌ Closed
Base:
dev← Head:remove-weak-refs📝 Commits (8)
17e6718Remove weak refs in session components2d71de9Make themCopy5b6b010UseMercuryFuturefor subscriptionsf874df4Split TcpStream for connection immediatelyd037992Remove unused allocation73c82a0Add macro to create packets917234dChanges suggested by @plietarfc754c5Remove MercurySender📊 Changes
20 files changed (+567 additions, -346 deletions)
View changed files
📝
Cargo.lock(+0 -1)📝
audio/src/fetch/receive.rs(+13 -12)📝
audio/src/lib.rs(+1 -1)📝
connect/src/spirc.rs(+51 -42)➖
core/src/component.rs(+0 -37)📝
core/src/connection/codec.rs(+33 -21)📝
core/src/connection/handshake.rs(+32 -24)📝
core/src/connection/mod.rs(+14 -6)📝
core/src/lib.rs(+3 -8)➖
core/src/mercury/sender.rs(+0 -53)📝
core/src/session.rs(+45 -33)📝
core/src/session/audio_key.rs(+14 -13)📝
core/src/session/channel.rs(+6 -6)➕
core/src/session/component.rs(+46 -0)📝
core/src/session/mercury/mod.rs(+75 -59)📝
core/src/session/mercury/types.rs(+41 -21)📝
core/src/util.rs(+186 -0)📝
metadata/Cargo.toml(+0 -1)📝
metadata/src/cover.rs(+7 -6)📝
metadata/src/lib.rs(+0 -2)📄 Description
The so-called components
AudioKeyManager,ChannelManagerandMercuryManagerall possess a weak reference toSessionInternal. I'm not sure why they were introduced around855a7e87a7(@plietar do you remember?), but I noticed that it's possible to replace them with a lifetime-based approach:The components would be plain references to
SessionInternal. They just have some additional methods, and that's it.MercuryManagerInner& co would be saved behind a mutex inSessionInternal:github.com/librespot-org/librespot@17e671814b/core/src/session.rs (L55-L57)The only difficulty was in
spirc, but due toasync/awaitit was possible to generate a self-referential future which owns aSessionand at the same contains a reference to it inside of theMercurySender.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.