Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Sources/Containerization/UnixSocketRelay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 q: DispatchQueue
private let queue: DispatchQueue
private let log: Logger?
private let state: Mutex<State>

private struct State {
Expand All @@ -44,10 +44,10 @@ package final class UnixSocketRelay: Sendable {
) throws {
self.port = port
self.configuration = socket
self.state = Mutex<State>(.init())
self.vm = vm
self.queue = queue
self.log = log
self.q = queue
self.state = Mutex<State>(.init())
}

deinit {
Expand Down Expand Up @@ -224,7 +224,7 @@ extension UnixSocketRelay {
let relay = BidirectionalRelay(
fd1: hostFd,
fd2: guestFd,
queue: q,
queue: queue,
log: log
)

Expand Down
7 changes: 4 additions & 3 deletions Sources/Containerization/UnixSocketRelayManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand All @@ -45,7 +45,7 @@ extension UnixSocketRelayManager {
port: port,
socket: socket,
vm: vm,
queue: q,
queue: queue,
log: log
)

Expand All @@ -54,6 +54,7 @@ extension UnixSocketRelayManager {
try await relay.start()
} catch {
relays.removeValue(forKey: socket.id)
throw error
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/ContainerizationOS/Socket/BidirectionalRelay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down