Sanity checks for calls that were causing crashes

pull/920/head
Vijay Pai 10 years ago
parent acf6f318fc
commit 0823cb786b
  1. 4
      src/cpp/server/server.cc

@ -287,12 +287,14 @@ void Server::Wait() {
} }
void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) { void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) {
if (call->call()) {
static const size_t MAX_OPS = 8; static const size_t MAX_OPS = 8;
size_t nops = MAX_OPS; size_t nops = MAX_OPS;
grpc_op ops[MAX_OPS]; grpc_op ops[MAX_OPS];
buf->FillOps(ops, &nops); buf->FillOps(ops, &nops);
GPR_ASSERT(GRPC_CALL_OK == GPR_ASSERT(GRPC_CALL_OK ==
grpc_call_start_batch(call->call(), ops, nops, buf)); grpc_call_start_batch(call->call(), ops, nops, buf));
}
} }
class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
@ -343,7 +345,9 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
} }
ctx_->call_ = call_; ctx_->call_ = call_;
Call call(call_, server_, cq_); Call call(call_, server_, cq_);
if (call_) {
ctx_->BeginCompletionOp(&call); ctx_->BeginCompletionOp(&call);
}
// just the pointers inside call are copied here // just the pointers inside call are copied here
stream_->BindCall(&call); stream_->BindCall(&call);
delete this; delete this;

Loading…
Cancel
Save