Open
Description
Describe the bug
During the process of calling the getTLSVersionSync method in my Swift code, I encountered an error at the line where NWProtocolTLS.definition is referenced. This is a critical part of the method that attempts to fetch the TLS version either from the Network framework or NIOSSL. I'm not sure why the error is occurring, but need assistance in resolving it.
I am currently using grpc-swift version "1.15.0" / Xcode version 15.0 RC
To reproduce
The steps to reproduce this bug are as follows:
class EventLoopGroupProvider {
static let shared = MultiThreadedEventLoopGroup(numberOfThreads: 1)
}
public protocol InitializableGRPCClient: GRPCClient {
init(channel: GRPCChannel, defaultCallOptions: CallOptions)
}
public protocol gRPC_ClientProtocol {
associatedtype Client: InitializableGRPCClient
static func makeClient(_ callOptions: CallOptions) async throws -> Client
}
public extension gRPC_ClientProtocol {
static func makeClient(_ callOptions: CallOptions = .init()) async throws -> Client {
try await withCheckedThrowingContinuation { continuation in
DispatchQueue.global(qos: .background).async {
do {
let endpoint = "tls-\(AppSetting.shared.gRPC_EndPoint)"
let channel = try GRPCChannelPool.with(
target: .host(endpoint),
transportSecurity: .tls(.makeClientConfigurationBackedByNIOSSL()),
eventLoopGroup: EventLoopGroupProvider.shared
)
let client: Client = .init(channel: channel, defaultCallOptions: callOptions)
continuation.resume(returning: client)
} catch {
continuation.resume(throwing: error)
}
}
}
}
}
gRPC Server Description
There was no problem with TLS processing for that packet.
However, as soon as the client sends the data encrypted with the session key exchanged in TLS, it is immediately disconnected on the server side.