diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-14 09:26:30 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-14 09:26:30 +0900 |
| commit | 0ea051062b127717bba2b28870a50f62825b55c4 (patch) | |
| tree | c7fec0d4520dafadd38ec07433d66fe26c7ae747 /internal/pipewire | |
| parent | b0f2ab6fffd48580d758de80165f8d97438b4066 (diff) | |
internal/pipewire: reorder context struct
This change reorders and groups struct elements. This improves readability since this struct holds a lot of state loosely related to each other.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire')
| -rw-r--r-- | internal/pipewire/pipewire.go | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/internal/pipewire/pipewire.go b/internal/pipewire/pipewire.go index 6d290d02..7b11ed35 100644 --- a/internal/pipewire/pipewire.go +++ b/internal/pipewire/pipewire.go @@ -52,8 +52,11 @@ type Context struct { buf []byte // Current [Header.Sequence] value, incremented every write. sequence Int - // Current server-side [Header.Sequence] value, incremented on every event processed. - remoteSequence Int + // Pending file descriptors to be sent with the next message. + pendingFiles []int + // File count already kept track of in [Header]. + headerFiles int + // Proxy id associations. proxy map[Int]eventProxy // Newly allocated proxies pending acknowledgement from the server. @@ -62,12 +65,14 @@ type Context struct { nextId Int // Proxies targeted by the [CoreDestroy] event pending until next [CoreSync]. pendingDestruction map[Int]struct{} - // Server side registry generation number. - generation Long - // Pending file descriptors to be sent with the next message. - pendingFiles []int - // File count already kept track of in [Header]. - headerFiles int + + // Proxy for built-in core events. + core Core + // Proxy for built-in client events. + client Client + + // Current server-side [Header.Sequence] value, incremented on every event processed. + remoteSequence Int // Files from the server. This is discarded on every Roundtrip so eventProxy // implementations must make sure to close them to avoid leaking fds. // @@ -83,13 +88,11 @@ type Context struct { // Pending footer value deferred to the next round trip, // sent if pendingFooter is nil. This is for emulating upstream behaviour deferredPendingFooter KnownSize + // Server side registry generation number. + generation Long // Deferred operations ran after a [Core.Sync] completes or Close is called. Errors //are reported as part of [ProxyConsumeError] and is not considered fatal unless panicked. syncComplete []func() error - // Proxy for built-in core events. - core Core - // Proxy for built-in client events. - client Client // Passed to [Conn.Recvmsg]. Not copied if sufficient for all received messages. iovecBuf [1 << 15]byte |
