Only copy stuff when status is ok

pull/2183/head
yang-g 10 years ago
parent 01ac44bf08
commit 3deb0069f4
  1. 10
      src/cpp/server/server.cc

@ -368,10 +368,12 @@ Server::GenericAsyncRequest::GenericAsyncRequest(
bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) { bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) {
// TODO(yangg) remove the copy here. // TODO(yangg) remove the copy here.
static_cast<GenericServerContext*>(context_)->method_ = call_details_.method; if (*status) {
static_cast<GenericServerContext*>(context_)->host_ = call_details_.host; static_cast<GenericServerContext*>(context_)->method_ = call_details_.method;
gpr_free(call_details_.method); static_cast<GenericServerContext*>(context_)->host_ = call_details_.host;
gpr_free(call_details_.host); gpr_free(call_details_.method);
gpr_free(call_details_.host);
}
return BaseAsyncRequest::FinalizeResult(tag, status); return BaseAsyncRequest::FinalizeResult(tag, status);
} }

Loading…
Cancel
Save