diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index bd12d76fd51..3ef49e6612a 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -501,19 +501,19 @@ CallbackTestServiceImpl::ResponseStream( std::to_string(num_msgs_sent_)); if (num_msgs_sent_ == server_responses_to_send_ - 1 && server_coalescing_api_ != 0) { - num_msgs_sent_++; { std::lock_guard l(finish_mu_); if (!finished_) { + num_msgs_sent_++; StartWriteLast(&response_, WriteOptions()); } } // If we use WriteLast, we shouldn't wait before attempting Finish FinishOnce(Status::OK); } else { - num_msgs_sent_++; std::lock_guard l(finish_mu_); if (!finished_) { + num_msgs_sent_++; StartWrite(&response_); } }