Skip to content

Commit

Permalink
Sanity checks for calls that were causing crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
vjpai committed Mar 2, 2015
1 parent acf6f31 commit 0823cb7
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/cpp/server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0823cb7

Please sign in to comment.