Sanity checks for calls that were causing crashes

pull/920/head
Vijay Pai 10 years ago
parent acf6f318fc
commit 0823cb786b
  1. 18
      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) {
static const size_t MAX_OPS = 8; if (call->call()) {
size_t nops = MAX_OPS; static const size_t MAX_OPS = 8;
grpc_op ops[MAX_OPS]; size_t nops = MAX_OPS;
buf->FillOps(ops, &nops); grpc_op ops[MAX_OPS];
GPR_ASSERT(GRPC_CALL_OK == buf->FillOps(ops, &nops);
grpc_call_start_batch(call->call(), ops, nops, buf)); GPR_ASSERT(GRPC_CALL_OK ==
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_);
ctx_->BeginCompletionOp(&call); if (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