internal/pipewire: fail on unacknowledged proxies
All checks were successful
Test / Create distribution (push) Successful in 39s
Test / Sandbox (push) Successful in 2m39s
Test / Sandbox (race detector) (push) Successful in 4m42s
Test / Hakurei (push) Successful in 5m0s
Test / Hpkg (push) Successful in 4m58s
Test / Hakurei (race detector) (push) Successful in 6m32s
Test / Flake checks (push) Successful in 1m28s
All checks were successful
Test / Create distribution (push) Successful in 39s
Test / Sandbox (push) Successful in 2m39s
Test / Sandbox (race detector) (push) Successful in 4m42s
Test / Hakurei (push) Successful in 5m0s
Test / Hpkg (push) Successful in 4m58s
Test / Hakurei (race detector) (push) Successful in 6m32s
Test / Flake checks (push) Successful in 1m28s
These proxies (with special cases documented in the implementation) are only safe for use after acknowledgement from the server. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
e7a665e043
commit
32fb137bb2
@ -18,6 +18,7 @@ import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"maps"
|
||||
"net"
|
||||
"slices"
|
||||
"strconv"
|
||||
@ -424,6 +425,14 @@ func (e DanglingFilesError) Error() string {
|
||||
return "received " + strconv.Itoa(len(e)) + " dangling files"
|
||||
}
|
||||
|
||||
// An UnacknowledgedProxyError holds newly allocated proxy ids that the server failed
|
||||
// to acknowledge after an otherwise successful [Context.Roundtrip].
|
||||
type UnacknowledgedProxyError []Int
|
||||
|
||||
func (e UnacknowledgedProxyError) Error() string {
|
||||
return "server did not acknowledge " + strconv.Itoa(len(e)) + " proxies"
|
||||
}
|
||||
|
||||
// roundtripSyncID is the id passed to Context.coreSync during a [Context.Roundtrip].
|
||||
const roundtripSyncID = 0
|
||||
|
||||
@ -489,6 +498,10 @@ func (ctx *Context) Roundtrip() (err error) {
|
||||
if len(ctx.receivedFiles) < receivedHeaderFiles {
|
||||
return DanglingFilesError(ctx.receivedFiles[len(ctx.receivedFiles)-receivedHeaderFiles:])
|
||||
}
|
||||
|
||||
if len(ctx.pendingIds) != 0 {
|
||||
return UnacknowledgedProxyError(slices.Collect(maps.Keys(ctx.pendingIds)))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user