Skip to content

Commit 30a7fbc

Browse files
authored
Make a few more write calls flushing. (grpc#391)
1 parent c082197 commit 30a7fbc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/SwiftGRPCNIO/GRPCChannelHandler.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ extension GRPCChannelHandler: ChannelInboundHandler {
5353
switch requestPart {
5454
case .head(let requestHead):
5555
guard let callHandler = getCallHandler(channel: ctx.channel, requestHead: requestHead) else {
56-
errorCaught(ctx: ctx, error: GRPCError.server(.unimplementedMethod(requestHead.uri)))
57-
return
56+
errorCaught(ctx: ctx, error: GRPCError.server(.unimplementedMethod(requestHead.uri)))
57+
return
5858
}
5959

6060
let codec = callHandler.makeGRPCServerCodec()
@@ -69,7 +69,7 @@ extension GRPCChannelHandler: ChannelInboundHandler {
6969
// handler doesn't have the data to determine whether headers should be returned, as it is
7070
// this handler that checks whether the stub for the requested Service/Method is implemented.
7171
// This likely signals that the architecture for these handlers could be improved.
72-
ctx.write(self.wrapOutboundOut(.headers(HTTPHeaders())), promise: nil)
72+
ctx.writeAndFlush(self.wrapOutboundOut(.headers(HTTPHeaders())), promise: nil)
7373
}
7474
}
7575

Sources/SwiftGRPCNIO/ServerCallContexts/UnaryResponseCallContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ open class UnaryResponseCallContextImpl<ResponseMessage: Message>: UnaryResponse
5050
// Send the response provided to the promise.
5151
//! FIXME: It would be nicer to chain sending the status onto a successful write, but for some reason the
5252
// "write message" future doesn't seem to get fulfilled?
53-
self.channel.write(NIOAny(WrappedResponse.message(responseMessage)), promise: nil)
53+
self.channel.writeAndFlush(NIOAny(WrappedResponse.message(responseMessage)), promise: nil)
5454

5555
return self.responseStatus
5656
}

0 commit comments

Comments
 (0)