From b901ed233fb10369e654a921977ea21518f3780d Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Wed, 18 Feb 2026 09:59:22 -0800 Subject: [PATCH 1/4] Rethrow an error --- Sources/Containerization/UnixSocketRelayManager.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Containerization/UnixSocketRelayManager.swift b/Sources/Containerization/UnixSocketRelayManager.swift index 0aa4be91..01131be7 100644 --- a/Sources/Containerization/UnixSocketRelayManager.swift +++ b/Sources/Containerization/UnixSocketRelayManager.swift @@ -54,6 +54,7 @@ extension UnixSocketRelayManager { try await relay.start() } catch { relays.removeValue(forKey: socket.id) + throw error } } From fb9b628f55417088ca4ad9f0d93590cf90351396 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Wed, 18 Feb 2026 11:15:21 -0800 Subject: [PATCH 2/4] Downgrade a warning to debug level since this is expected behavior for certain socket types --- Sources/ContainerizationOS/Socket/BidirectionalRelay.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ContainerizationOS/Socket/BidirectionalRelay.swift b/Sources/ContainerizationOS/Socket/BidirectionalRelay.swift index bb306f12..c57b49ae 100644 --- a/Sources/ContainerizationOS/Socket/BidirectionalRelay.swift +++ b/Sources/ContainerizationOS/Socket/BidirectionalRelay.swift @@ -182,7 +182,7 @@ public final class BidirectionalRelay: Sendable { ) source.cancel() if shutdown(destinationFd, SHUT_WR) != 0 { - log?.warning( + log?.debug( "failed to shut down writes", metadata: [ "errno": "\(errno)", From d9c6e45647704fbd392b92746de32995fd8942ac Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Wed, 18 Feb 2026 11:19:07 -0800 Subject: [PATCH 3/4] Improve a variable name --- Sources/Containerization/UnixSocketRelay.swift | 6 +++--- Sources/Containerization/UnixSocketRelayManager.swift | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Containerization/UnixSocketRelay.swift b/Sources/Containerization/UnixSocketRelay.swift index 6ce5ef67..eab20d77 100644 --- a/Sources/Containerization/UnixSocketRelay.swift +++ b/Sources/Containerization/UnixSocketRelay.swift @@ -26,7 +26,7 @@ package final class UnixSocketRelay: Sendable { private let configuration: UnixSocketConfiguration private let log: Logger? private let vm: any VirtualMachineInstance - private let q: DispatchQueue + private let queue: DispatchQueue private let state: Mutex private struct State { @@ -47,7 +47,7 @@ package final class UnixSocketRelay: Sendable { self.state = Mutex(.init()) self.vm = vm self.log = log - self.q = queue + self.queue = queue } deinit { @@ -224,7 +224,7 @@ extension UnixSocketRelay { let relay = BidirectionalRelay( fd1: hostFd, fd2: guestFd, - queue: q, + queue: queue, log: log ) diff --git a/Sources/Containerization/UnixSocketRelayManager.swift b/Sources/Containerization/UnixSocketRelayManager.swift index 01131be7..ceae276c 100644 --- a/Sources/Containerization/UnixSocketRelayManager.swift +++ b/Sources/Containerization/UnixSocketRelayManager.swift @@ -21,13 +21,13 @@ import Logging package actor UnixSocketRelayManager { private let vm: any VirtualMachineInstance private var relays: [String: UnixSocketRelay] - private let q: DispatchQueue + private let queue: DispatchQueue private let log: Logger? init(vm: any VirtualMachineInstance, log: Logger? = nil) { self.vm = vm self.relays = [:] - self.q = DispatchQueue(label: "com.apple.containerization.socket-relay") + self.queue = DispatchQueue(label: "com.apple.containerization.socket-relay") self.log = log } } @@ -45,7 +45,7 @@ extension UnixSocketRelayManager { port: port, socket: socket, vm: vm, - queue: q, + queue: queue, log: log ) From b28ad0161e5e651b2a7e749d921377cf03f37e86 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Wed, 18 Feb 2026 12:25:30 -0800 Subject: [PATCH 4/4] Improve the order of parameters --- Sources/Containerization/UnixSocketRelay.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Containerization/UnixSocketRelay.swift b/Sources/Containerization/UnixSocketRelay.swift index eab20d77..e7a3304a 100644 --- a/Sources/Containerization/UnixSocketRelay.swift +++ b/Sources/Containerization/UnixSocketRelay.swift @@ -24,9 +24,9 @@ import Synchronization package final class UnixSocketRelay: Sendable { private let port: UInt32 private let configuration: UnixSocketConfiguration - private let log: Logger? private let vm: any VirtualMachineInstance private let queue: DispatchQueue + private let log: Logger? private let state: Mutex private struct State { @@ -44,10 +44,10 @@ package final class UnixSocketRelay: Sendable { ) throws { self.port = port self.configuration = socket - self.state = Mutex(.init()) self.vm = vm - self.log = log self.queue = queue + self.log = log + self.state = Mutex(.init()) } deinit {