@@ -454,9 +454,15 @@ extension ClientConnection {
454
454
/// used to add additional handlers to the pipeline and is intended for debugging.
455
455
///
456
456
/// - Warning: The initializer closure may be invoked *multiple times*.
457
- public var debugChannelInitializer : GRPCChannelInitializer ?
457
+ #if compiler(>=5.6)
458
+ @preconcurrency
459
+ public var debugChannelInitializer : ( @Sendable ( Channel ) -> EventLoopFuture < Void > ) ?
460
+ #else
461
+ public var debugChannelInitializer : ( ( Channel ) -> EventLoopFuture < Void > ) ?
462
+ #endif
458
463
459
464
#if canImport(NIOSSL)
465
+ #if compiler(>=5.6)
460
466
/// Create a `Configuration` with some pre-defined defaults. Prefer using
461
467
/// `ClientConnection.secure(group:)` to build a connection secured with TLS or
462
468
/// `ClientConnection.insecure(group:)` to build a plaintext connection.
@@ -480,6 +486,7 @@ extension ClientConnection {
480
486
/// - Parameter debugChannelInitializer: A channel initializer will be called after gRPC has
481
487
/// initialized the channel. Defaults to `nil`.
482
488
@available ( * , deprecated, renamed: " default(target:eventLoopGroup:) " )
489
+ @preconcurrency
483
490
public init (
484
491
target: ConnectionTarget ,
485
492
eventLoopGroup: EventLoopGroup ,
@@ -496,7 +503,7 @@ extension ClientConnection {
496
503
label: " io.grpc " ,
497
504
factory: { _ in SwiftLogNoOpLogHandler ( ) }
498
505
) ,
499
- debugChannelInitializer: GRPCChannelInitializer ? = nil
506
+ debugChannelInitializer: ( @ Sendable ( Channel ) -> EventLoopFuture < Void > ) ? = nil
500
507
) {
501
508
self . target = target
502
509
self . eventLoopGroup = eventLoopGroup
@@ -512,6 +519,41 @@ extension ClientConnection {
512
519
self . backgroundActivityLogger = backgroundActivityLogger
513
520
self . debugChannelInitializer = debugChannelInitializer
514
521
}
522
+ #else
523
+ @available ( * , deprecated, renamed: " default(target:eventLoopGroup:) " )
524
+ public init (
525
+ target: ConnectionTarget ,
526
+ eventLoopGroup: EventLoopGroup ,
527
+ errorDelegate: ClientErrorDelegate ? = LoggingClientErrorDelegate ( ) ,
528
+ connectivityStateDelegate: ConnectivityStateDelegate ? = nil ,
529
+ connectivityStateDelegateQueue: DispatchQueue ? = nil ,
530
+ tls: Configuration . TLS ? = nil ,
531
+ connectionBackoff: ConnectionBackoff ? = ConnectionBackoff ( ) ,
532
+ connectionKeepalive: ClientConnectionKeepalive = ClientConnectionKeepalive ( ) ,
533
+ connectionIdleTimeout: TimeAmount = . minutes( 30 ) ,
534
+ callStartBehavior: CallStartBehavior = . waitsForConnectivity,
535
+ httpTargetWindowSize: Int = 8 * 1024 * 1024 ,
536
+ backgroundActivityLogger: Logger = Logger (
537
+ label: " io.grpc " ,
538
+ factory: { _ in SwiftLogNoOpLogHandler ( ) }
539
+ ) ,
540
+ debugChannelInitializer: ( ( Channel ) -> EventLoopFuture < Void > ) ? = nil
541
+ ) {
542
+ self . target = target
543
+ self . eventLoopGroup = eventLoopGroup
544
+ self . errorDelegate = errorDelegate
545
+ self . connectivityStateDelegate = connectivityStateDelegate
546
+ self . connectivityStateDelegateQueue = connectivityStateDelegateQueue
547
+ self . tlsConfiguration = tls. map { GRPCTLSConfiguration ( transforming: $0) }
548
+ self . connectionBackoff = connectionBackoff
549
+ self . connectionKeepalive = connectionKeepalive
550
+ self . connectionIdleTimeout = connectionIdleTimeout
551
+ self . callStartBehavior = callStartBehavior
552
+ self . httpTargetWindowSize = httpTargetWindowSize
553
+ self . backgroundActivityLogger = backgroundActivityLogger
554
+ self . debugChannelInitializer = debugChannelInitializer
555
+ }
556
+ #endif // compiler(>=5.6)
515
557
#endif // canImport(NIOSSL)
516
558
517
559
private init ( eventLoopGroup: EventLoopGroup , target: ConnectionTarget ) {
0 commit comments