Skip to content
Snippets Groups Projects
Commit 36bb8a00 authored by ncteisen's avatar ncteisen
Browse files

s/hanging/pending/g

parent 43f2b55a
No related branches found
No related tags found
No related merge requests found
......@@ -141,8 +141,8 @@ class ServerStreamingHandler : public MethodHandler {
}
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
param.call->PerformOps(&ops);
if (param.server_context->has_hanging_ops_) {
param.call->cq()->Pluck(&param.server_context->hanging_ops_);
if (param.server_context->has_pending_ops_) {
param.call->cq()->Pluck(&param.server_context->pending_ops_);
}
param.call->cq()->Pluck(&ops);
}
......@@ -188,8 +188,8 @@ class TemplatedBidiStreamingHandler : public MethodHandler {
}
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
param.call->PerformOps(&ops);
if (param.server_context->has_hanging_ops_) {
param.call->cq()->Pluck(&param.server_context->hanging_ops_);
if (param.server_context->has_pending_ops_) {
param.call->cq()->Pluck(&param.server_context->pending_ops_);
}
param.call->cq()->Pluck(&ops);
}
......
......@@ -273,8 +273,8 @@ class ServerContext {
uint32_t initial_metadata_flags() const { return 0; }
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> hanging_ops_;
bool has_hanging_ops_;
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> pending_ops_;
bool has_pending_ops_;
CompletionOp* completion_op_;
bool has_notify_when_done_tag_;
void* async_notify_when_done_tag_;
......
......@@ -589,27 +589,27 @@ class ServerWriter final : public ServerWriterInterface<W> {
if (options.is_last_message()) {
options.set_buffer_hint();
}
if (!ctx_->hanging_ops_.SendMessage(msg, options).ok()) {
if (!ctx_->pending_ops_.SendMessage(msg, options).ok()) {
return false;
}
if (!ctx_->sent_initial_metadata_) {
ctx_->hanging_ops_.SendInitialMetadata(ctx_->initial_metadata_,
ctx_->pending_ops_.SendInitialMetadata(ctx_->initial_metadata_,
ctx_->initial_metadata_flags());
if (ctx_->compression_level_set()) {
ctx_->hanging_ops_.set_compression_level(ctx_->compression_level());
ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
}
ctx_->sent_initial_metadata_ = true;
}
call_->PerformOps(&ctx_->hanging_ops_);
call_->PerformOps(&ctx_->pending_ops_);
// if this is the last message we defer the pluck until AFTER we start
// the trailing md op. This prevents hangs. See
// https://github.com/grpc/grpc/issues/11546
if (options.is_last_message()) {
ctx_->has_hanging_ops_ = true;
ctx_->has_pending_ops_ = true;
return true;
}
ctx_->has_hanging_ops_ = false;
return call_->cq()->Pluck(&ctx_->hanging_ops_);
ctx_->has_pending_ops_ = false;
return call_->cq()->Pluck(&ctx_->pending_ops_);
}
private:
......@@ -661,26 +661,27 @@ class ServerReaderWriterBody final {
if (options.is_last_message()) {
options.set_buffer_hint();
}
if (!ctx_->hanging_ops_.SendMessage(msg, options).ok()) {
if (!ctx_->pending_ops_.SendMessage(msg, options).ok()) {
return false;
}
if (!ctx_->sent_initial_metadata_) {
ctx_->hanging_ops_.SendInitialMetadata(ctx_->initial_metadata_,
ctx_->pending_ops_.SendInitialMetadata(ctx_->initial_metadata_,
ctx_->initial_metadata_flags());
if (ctx_->compression_level_set()) {
ctx_->hanging_ops_.set_compression_level(ctx_->compression_level());
ctx_->pending_ops_.set_compression_level(ctx_->compression_level());
}
ctx_->sent_initial_metadata_ = true;
}
call_->PerformOps(&ctx_->hanging_ops_);
call_->PerformOps(&ctx_->pending_ops_);
// if this is the last message we defer the pluck until AFTER we start
// the trailing md op. This prevents hangs. See
// https://github.com/grpc/grpc/issues/11546
if (options.is_last_message()) {
ctx_->has_hanging_ops_ = true;
ctx_->has_pending_ops_ = true;
return true;
}
return call_->cq()->Pluck(&ctx_->hanging_ops_);
ctx_->has_pending_ops_ = false;
return call_->cq()->Pluck(&ctx_->pending_ops_);
}
private:
......
......@@ -29,7 +29,6 @@
namespace grpc {
namespace testing {
// const int kNumResponseStreamsMsgs = 3;
const int kServerDefaultResponseStreamsToSend = 3;
const char* const kServerResponseStreamsToSend = "server_responses_to_send";
const char* const kServerCancelAfterReads = "cancel_after_reads";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment