Skip to content

Commit

Permalink
Make a few more write calls flushing. (#391)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMage authored Mar 5, 2019
1 parent c082197 commit 30a7fbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/SwiftGRPCNIO/GRPCChannelHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ extension GRPCChannelHandler: ChannelInboundHandler {
switch requestPart {
case .head(let requestHead):
guard let callHandler = getCallHandler(channel: ctx.channel, requestHead: requestHead) else {
errorCaught(ctx: ctx, error: GRPCError.server(.unimplementedMethod(requestHead.uri)))
return
errorCaught(ctx: ctx, error: GRPCError.server(.unimplementedMethod(requestHead.uri)))
return
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ open class UnaryResponseCallContextImpl<ResponseMessage: Message>: UnaryResponse
// Send the response provided to the promise.
//! FIXME: It would be nicer to chain sending the status onto a successful write, but for some reason the
// "write message" future doesn't seem to get fulfilled?
self.channel.write(NIOAny(WrappedResponse.message(responseMessage)), promise: nil)
self.channel.writeAndFlush(NIOAny(WrappedResponse.message(responseMessage)), promise: nil)

return self.responseStatus
}
Expand Down

0 comments on commit 30a7fbc

Please sign in to comment.