File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ var packageDependencies: [Package.Dependency] = [
21
21
. package ( url: " https://github.com/apple/swift-protobuf.git " , . upToNextMinor( from: " 1.1.1 " ) ) ,
22
22
. package ( url: " https://github.com/kylef/Commander.git " , . upToNextMinor( from: " 0.8.0 " ) ) ,
23
23
. package ( url: " https://github.com/apple/swift-nio-zlib-support.git " , . upToNextMinor( from: " 1.0.0 " ) ) ,
24
- . package ( url: " https://github.com/apple/swift-nio.git " , . upToNextMinor( from: " 1.11 .0 " ) ) ,
24
+ . package ( url: " https://github.com/apple/swift-nio.git " , . upToNextMinor( from: " 1.12 .0 " ) ) ,
25
25
. package ( url: " https://github.com/apple/swift-nio-nghttp2-support.git " , . upToNextMinor( from: " 1.0.0 " ) ) ,
26
26
. package ( url: " https://github.com/apple/swift-nio-http2.git " , . revision( " dd9339e6310ad8537a271f3ff60a4f3976ca8e4d " ) )
27
27
]
Original file line number Diff line number Diff line change @@ -55,15 +55,20 @@ extension GRPCChannelHandler: ChannelInboundHandler {
55
55
return
56
56
}
57
57
58
- var responseHeaders = HTTPHeaders ( )
59
- responseHeaders. add ( name: " content-type " , value: " application/grpc " )
60
- ctx. write ( self . wrapOutboundOut ( . headers( responseHeaders) ) , promise: nil )
61
-
62
58
let codec = callHandler. makeGRPCServerCodec ( )
59
+ let handlerRemoved : EventLoopPromise < Bool > = ctx. eventLoop. newPromise ( )
60
+ handlerRemoved. futureResult. whenSuccess { handlerWasRemoved in
61
+ assert ( handlerWasRemoved)
62
+
63
+ ctx. pipeline. add ( handler: callHandler, after: codec) . whenComplete {
64
+ var responseHeaders = HTTPHeaders ( )
65
+ responseHeaders. add ( name: " content-type " , value: " application/grpc " )
66
+ ctx. write ( self . wrapOutboundOut ( . headers( responseHeaders) ) , promise: nil )
67
+ }
68
+ }
69
+
63
70
ctx. pipeline. add ( handler: codec, after: self )
64
- . then { ctx. pipeline. add ( handler: callHandler, after: codec) }
65
- //! FIXME(lukasa): Fix the ordering of this with NIO 1.12 and replace with `remove(, promise:)`.
66
- . whenComplete { _ = ctx. pipeline. remove ( handler: self ) }
71
+ . whenComplete { ctx. pipeline. remove ( handler: self , promise: handlerRemoved) }
67
72
68
73
case . message, . end:
69
74
preconditionFailure ( " received \( requestPart) , should have been removed as a handler at this point " )
You can’t perform that action at this time.
0 commit comments