Add write buffer hint to C++ server handlers so that writes actually go

out when expected.
pull/388/head
Vijay Pai 10 years ago
parent 47ef2f8b6a
commit dbc0f5940a
  1. 2
      src/cpp/server/async_server_context.cc
  2. 2
      src/cpp/server/server_rpc_handler.cc

@ -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) {

@ -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.");

Loading…
Cancel
Save