Skip to content

Commit

Permalink
Add write buffer hint to C++ server handlers so that writes actually go
Browse files Browse the repository at this point in the history
out when expected.
  • Loading branch information
vjpai committed Feb 4, 2015
1 parent 47ef2f8 commit dbc0f59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/cpp/server/async_server_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ AsyncServerContext::~AsyncServerContext() { grpc_call_destroy(call_); }

void AsyncServerContext::Accept(grpc_completion_queue *cq) {
GPR_ASSERT(grpc_call_server_accept(call_, cq, this) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_server_end_initial_metadata(call_, 0) == GRPC_CALL_OK);
GPR_ASSERT(grpc_call_server_end_initial_metadata(call_, GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK);
}

bool AsyncServerContext::StartRead(google::protobuf::Message *request) {
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/server/server_rpc_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void ServerRpcHandler::StartRpc() {

if (status.IsOk()) {
// Send the response if we get an ok status.
async_server_context_->StartWrite(*response, 0);
async_server_context_->StartWrite(*response, GRPC_WRITE_BUFFER_HINT);
type = WaitForNextEvent();
if (type != CompletionQueue::SERVER_WRITE_OK) {
status = Status(StatusCode::INTERNAL, "Error writing response.");
Expand Down

0 comments on commit dbc0f59

Please sign in to comment.