aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/server
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2015-03-02 15:48:51 -0800
committerGravatar Vijay Pai <vpai@google.com>2015-03-02 15:48:51 -0800
commit0823cb786b873ce5e6d180dd279865742580e3a3 (patch)
tree4a864c56d18c429aaa10992069e426256d352bf4 /src/cpp/server
parentacf6f318fc9605d94fba4873a2848c7266d7eddb (diff)
Sanity checks for calls that were causing crashes
Diffstat (limited to 'src/cpp/server')
-rw-r--r--src/cpp/server/server.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 97bf0f1a6e..5c5b8d8286 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -287,12 +287,14 @@ void Server::Wait() {
}
void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
- static const size_t MAX_OPS = 8;
- size_t nops = MAX_OPS;
- grpc_op ops[MAX_OPS];
- buf->FillOps(ops, &nops);
- GPR_ASSERT(GRPC_CALL_OK ==
- grpc_call_start_batch(call->call(), ops, nops, buf));
+ if (call->call()) {
+ static const size_t MAX_OPS = 8;
+ size_t nops = MAX_OPS;
+ grpc_op ops[MAX_OPS];
+ buf->FillOps(ops, &nops);
+ GPR_ASSERT(GRPC_CALL_OK ==
+ grpc_call_start_batch(call->call(), ops, nops, buf));
+ }
}
class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
@@ -343,7 +345,9 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
}
ctx_->call_ = call_;
Call call(call_, server_, cq_);
- ctx_->BeginCompletionOp(&call);
+ if (call_) {
+ ctx_->BeginCompletionOp(&call);
+ }
// just the pointers inside call are copied here
stream_->BindCall(&call);
delete this;