diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-10-27 20:13:13 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-10-27 20:13:13 +0900 |
| commit | ea29e6bad114306b78820cb674863a9bf3041fa5 (patch) | |
| tree | da87b09d5b3b57d6744db90b697124c5d4569e8d /internal/pipewire/securitycontext.go | |
| parent | 672cf9abcac6f25abfdd2541cae6455c6da38fc3 (diff) | |
internal/pipewire: re-format for readability
This package was the first somewhat large piece of code that was
primarily written using the built-in display of my laptop. The
experience had been deeply unpleasant due to the awkward 3:2 aspect
ratio not working well with my setup, which almost always involved
having the implementation and tests side-by-side. This experience is
what provoked me to re-instate the 80-column limit that I had long
resented and rejected. This package however predates the formal
re-instating of this limit, and was never updated.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/securitycontext.go')
| -rw-r--r-- | internal/pipewire/securitycontext.go | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/internal/pipewire/securitycontext.go b/internal/pipewire/securitycontext.go index ec19a64a..f277a99e 100644 --- a/internal/pipewire/securitycontext.go +++ b/internal/pipewire/securitycontext.go @@ -35,31 +35,31 @@ const ( // SecurityContextCreate is sent to create a new security context. // -// Creates a new security context with a socket listening FD. -// PipeWire will accept new client connections on listen_fd. +// Creates a new security context with a socket listening FD. PipeWire will +// accept new client connections on listen_fd. // -// listen_fd must be ready to accept new connections when this -// request is sent by the client. In other words, the client must -// call bind(2) and listen(2) before sending the FD. +// listen_fd must be ready to accept new connections when this request is sent +// by the client. In other words, the client must call bind(2) and listen(2) +// before sending the FD. // -// close_fd is a FD closed by the client when PipeWire should stop -// accepting new connections on listen_fd. +// close_fd is a FD closed by the client when PipeWire should stop accepting new +// connections on listen_fd. // -// PipeWire must continue to accept connections on listen_fd when -// the client which created the security context disconnects. +// PipeWire must continue to accept connections on listen_fd when the client +// which created the security context disconnects. // -// After sending this request, closing listen_fd and close_fd -// remains the only valid operation on them. +// After sending this request, closing listen_fd and close_fd remains the only +// valid operation on them. type SecurityContextCreate struct { - // The offset in the SCM_RIGHTS msg_control message to - // the fd to listen on for new connections. + // The offset in the SCM_RIGHTS msg_control message to the fd to listen on + // for new connections. ListenFd Fd - // The offset in the SCM_RIGHTS msg_control message to - // the fd used to stop listening. + // The offset in the SCM_RIGHTS msg_control message to the fd used to stop + // listening. CloseFd Fd - // Extra properties. These will be copied on the client - // that connects through this context. + // Extra properties. These will be copied on the client that connects + // through this context. Properties *SPADict `json:"props"` } @@ -170,7 +170,9 @@ func (scc *securityContextCloser) Close() (err error) { return } -// BindAndCreate binds a new socket to the specified pathname and pass it to Create. +// BindAndCreate binds a new socket to the specified pathname and pass it to +// Create. +// // It returns an [io.Closer] corresponding to [SecurityContextCreate.CloseFd]. func (securityContext *SecurityContext) BindAndCreate(pathname string, props SPADict) (io.Closer, error) { if err := securityContext.checkDestroy(); err != nil { @@ -231,10 +233,19 @@ func (securityContext *SecurityContext) consume(opcode byte, files []int, _ func func (securityContext *SecurityContext) setBoundProps(event *CoreBoundProps) error { securityContext.mustCheckDestroy() if securityContext.ID != event.ID { - return &InconsistentIdError{Proxy: securityContext, ID: securityContext.ID, ServerID: event.ID} + return &InconsistentIdError{ + Proxy: securityContext, + ID: securityContext.ID, + ServerID: event.ID, + } } if securityContext.GlobalID != event.GlobalID { - return &InconsistentIdError{Global: true, Proxy: securityContext, ID: securityContext.GlobalID, ServerID: event.GlobalID} + return &InconsistentIdError{ + Global: true, + Proxy: securityContext, + ID: securityContext.GlobalID, + ServerID: event.GlobalID, + } } return nil } |
