internal/pipewire: implement Core::Destroy
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m28s
Test / Hakurei (push) Successful in 3m25s
Test / Hpkg (push) Successful in 4m19s
Test / Sandbox (race detector) (push) Successful in 4m26s
Test / Hakurei (race detector) (push) Successful in 5m21s
Test / Flake checks (push) Successful in 1m43s
All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m28s
Test / Hakurei (push) Successful in 3m25s
Test / Hpkg (push) Successful in 4m19s
Test / Sandbox (race detector) (push) Successful in 4m26s
Test / Hakurei (race detector) (push) Successful in 5m21s
Test / Flake checks (push) Successful in 1m43s
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>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user