From e60ff660f69ee4161ee63af3147b5a77d4139e76 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 11 Dec 2025 04:22:03 +0900 Subject: [PATCH] internal/pipewire: treat unknown opcode as fatal Skipping events can cause local state to diverge from the server. Signed-off-by: Ophestra --- internal/pipewire/client.go | 2 +- internal/pipewire/core.go | 4 ++-- internal/pipewire/securitycontext.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pipewire/client.go b/internal/pipewire/client.go index faa114b..662a24a 100644 --- a/internal/pipewire/client.go +++ b/internal/pipewire/client.go @@ -113,7 +113,7 @@ func (client *Client) consume(opcode byte, files []int, unmarshal func(v any)) e return nil default: - return &UnsupportedOpcodeError{opcode, client.String()} + panic(&UnsupportedOpcodeError{opcode, client.String()}) } } diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index d115da3..f6199c4 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -764,7 +764,7 @@ func (core *Core) consume(opcode byte, files []int, unmarshal func(v any)) error return proxy.setBoundProps(&boundProps) default: - return &UnsupportedOpcodeError{opcode, core.String()} + panic(&UnsupportedOpcodeError{opcode, core.String()}) } } @@ -831,7 +831,7 @@ func (registry *Registry) consume(opcode byte, files []int, unmarshal func(v any return nil default: - return &UnsupportedOpcodeError{opcode, registry.String()} + panic(&UnsupportedOpcodeError{opcode, registry.String()}) } } diff --git a/internal/pipewire/securitycontext.go b/internal/pipewire/securitycontext.go index c50665b..dbc3c52 100644 --- a/internal/pipewire/securitycontext.go +++ b/internal/pipewire/securitycontext.go @@ -190,7 +190,7 @@ func (securityContext *SecurityContext) consume(opcode byte, files []int, _ func // SecurityContext does not receive any events default: - return &UnsupportedOpcodeError{opcode, securityContext.String()} + panic(&UnsupportedOpcodeError{opcode, securityContext.String()}) } }