Merge nucleic/upbeat-slate-lemur-7euo into dev
This commit is contained in:
@@ -34,18 +34,23 @@ public struct Vminitd: Sendable {
|
||||
public let grpcClient: GRPCClient<HTTP2ClientTransport.WrappedChannel>
|
||||
private let connectionTask: Task<Void, Error>
|
||||
|
||||
public init(connection: FileHandle, group: any EventLoopGroup) throws {
|
||||
let channel = try ClientBootstrap(group: group)
|
||||
.channelInitializer { channel in
|
||||
channel.eventLoop.makeCompletedFuture(withResultOf: {
|
||||
try channel.pipeline.syncOperations.addHandler(HTTP2ConnectBufferingHandler())
|
||||
})
|
||||
}
|
||||
.withConnectedSocket(connection.fileDescriptor).wait()
|
||||
let transport = HTTP2ClientTransport.WrappedChannel.wrapping(
|
||||
channel: channel,
|
||||
public init(connection: FileHandle, group: any EventLoopGroup) async throws {
|
||||
// Configure the gRPC pipeline from inside the channel initializer — before the channel
|
||||
// becomes active — so no early server frames (e.g. SETTINGS) are dropped. `configure` is
|
||||
// supplied by `wrapping(config:serviceConfig:makeChannel:)` and must be called exactly once.
|
||||
let fd = connection.fileDescriptor
|
||||
let transport = try await HTTP2ClientTransport.WrappedChannel.wrapping(
|
||||
config: .defaults { $0.connection.maxIdleTime = nil }
|
||||
)
|
||||
) { configure in
|
||||
try await ClientBootstrap(group: group)
|
||||
.withConnectedSocket(fd) { channel in
|
||||
channel.eventLoop.makeCompletedFuture {
|
||||
try channel.pipeline.syncOperations.addHandler(HTTP2ConnectBufferingHandler())
|
||||
}.flatMap { _ in
|
||||
configure(channel)
|
||||
}
|
||||
}
|
||||
}
|
||||
let grpcClient = GRPCClient(transport: transport)
|
||||
self.grpcClient = grpcClient
|
||||
self.client = Com_Apple_Containerization_Sandbox_V3_SandboxContext.Client(wrapping: self.grpcClient)
|
||||
|
||||
Reference in New Issue
Block a user