diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index 868b02882d7d48b4fe83e10f6d406978e1548eee..d3086aef0a0a776a5c6792b02c328936a4c482bf 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -105,7 +105,15 @@ class ServerContext { bool IsCancelled() const; - // Best-effort API to cancel the call from the server. + // Cancel the Call from the server. This is a best-effort API and depending on + // when this is called, the Call may still appear successful to the client. + // For example, if called on a separate thread, it might race with the + // server handler which might return success to the client before TryCancel() + // was called. + // + // It is the caller's responsibility to prevent such races and ensure that the + // serverhandler returns Status::CANCELLED if TryCancel() is called (unless + // the serverhandler is already returning an error code) void TryCancel() const; const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata() { diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 48838901d27bf11dd27900911462a0fe3689e37e..5fae056b63b1c364fc8aef4aa3d5fef4015aabf4 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -797,8 +797,6 @@ TEST_P(End2endServerTryCancelTest, BidiStreamServerCancelAfter) { TestBidiStreamServerCancel(CANCEL_AFTER_PROCESSING, 5); } -// ===== - TEST_P(End2endTest, RequestStreamOneRequest) { ResetStub(); EchoRequest request;