diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-14 09:20:58 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-14 09:20:58 +0900 |
| commit | b0f2ab6fffd48580d758de80165f8d97438b4066 (patch) | |
| tree | e58678218b33bc2e4fccc1582214b70d0f1bd8b6 /internal/pipewire/pipewire.go | |
| parent | 00a5bdf006ba800e0797ff4c2b732e5df4fa28ff (diff) | |
internal/pipewire: implement Core::Destroy
This change also implements pending destructible check on Sync. Destruction method should always be implemented as a wrapper of destructible.destroy.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/pipewire.go')
| -rw-r--r-- | internal/pipewire/pipewire.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/pipewire/pipewire.go b/internal/pipewire/pipewire.go index 35d380fc..6d290d02 100644 --- a/internal/pipewire/pipewire.go +++ b/internal/pipewire/pipewire.go @@ -60,6 +60,8 @@ type Context struct { pendingIds map[Int]struct{} // Smallest available Id for the next proxy. 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. @@ -121,6 +123,7 @@ func New(conn Conn, props SPADict) (*Context, error) { PW_ID_CLIENT: {}, } ctx.nextId = Int(len(ctx.proxy)) + ctx.pendingDestruction = make(map[Int]struct{}) if err := ctx.core.hello(); err != nil { return nil, err @@ -503,13 +506,21 @@ func (e DanglingFilesError) Error() string { } // An UnacknowledgedProxyError holds newly allocated proxy ids that the server failed -// to acknowledge after an otherwise successful [Context.Roundtrip]. +// to acknowledge after an otherwise successful [Core.Sync]. type UnacknowledgedProxyError []Int func (e UnacknowledgedProxyError) Error() string { return "server did not acknowledge " + strconv.Itoa(len(e)) + " proxies" } +// An UnacknowledgedProxyDestructionError holds destroyed proxy ids that the server failed +// to acknowledge after an otherwise successful [Core.Sync]. +type UnacknowledgedProxyDestructionError []Int + +func (e UnacknowledgedProxyDestructionError) Error() string { + return "server did not acknowledge " + strconv.Itoa(len(e)) + " proxy destructions" +} + // A ProxyFatalError describes an error that terminates event handling during a // [Context.Roundtrip] and makes further event processing no longer possible. type ProxyFatalError struct { |
