aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl/codegen/async_unary_call.h
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-02-11 08:48:13 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-02-11 08:48:13 -0800
commitb718c8af703fc3442d691a091d5c8f9c321e3b55 (patch)
tree90c9c265035f3714b81badc68ea3e6d1e1ff026b /include/grpc++/impl/codegen/async_unary_call.h
parent6456a47b184540e9be3bbff25fe39ee4072676ad (diff)
parentf79366a3c99592eccd9c719c86dca2f976804d3d (diff)
Merge github.com:grpc/grpc into compatibility_mode
Diffstat (limited to 'include/grpc++/impl/codegen/async_unary_call.h')
-rw-r--r--include/grpc++/impl/codegen/async_unary_call.h46
1 files changed, 28 insertions, 18 deletions
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index 481b20b535..f3c75dc3b1 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -62,40 +62,50 @@ class ClientAsyncResponseReader GRPC_FINAL
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const W& request)
- : context_(context), call_(channel->CreateCall(method, context, cq)) {
- init_buf_.SendInitialMetadata(context->send_initial_metadata_);
+ : context_(context),
+ call_(channel->CreateCall(method, context, cq)),
+ collection_(new CallOpSetCollection) {
+ collection_->init_buf_.SetCollection(collection_);
+ collection_->init_buf_.SendInitialMetadata(context->send_initial_metadata_);
// TODO(ctiller): don't assert
- GPR_ASSERT(init_buf_.SendMessage(request).ok());
- init_buf_.ClientSendClose();
- call_.PerformOps(&init_buf_);
+ GPR_ASSERT(collection_->init_buf_.SendMessage(request).ok());
+ collection_->init_buf_.ClientSendClose();
+ call_.PerformOps(&collection_->init_buf_);
}
void ReadInitialMetadata(void* tag) {
GPR_ASSERT(!context_->initial_metadata_received_);
- meta_buf_.set_output_tag(tag);
- meta_buf_.RecvInitialMetadata(context_);
- call_.PerformOps(&meta_buf_);
+ collection_->meta_buf_.SetCollection(collection_);
+ collection_->meta_buf_.set_output_tag(tag);
+ collection_->meta_buf_.RecvInitialMetadata(context_);
+ call_.PerformOps(&collection_->meta_buf_);
}
void Finish(R* msg, Status* status, void* tag) {
- finish_buf_.set_output_tag(tag);
+ collection_->finish_buf_.SetCollection(collection_);
+ collection_->finish_buf_.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
- finish_buf_.RecvInitialMetadata(context_);
+ collection_->finish_buf_.RecvInitialMetadata(context_);
}
- finish_buf_.RecvMessage(msg);
- finish_buf_.ClientRecvStatus(context_, status);
- call_.PerformOps(&finish_buf_);
+ collection_->finish_buf_.RecvMessage(msg);
+ collection_->finish_buf_.ClientRecvStatus(context_, status);
+ call_.PerformOps(&collection_->finish_buf_);
}
private:
ClientContext* context_;
Call call_;
- SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
- CallOpClientSendClose> init_buf_;
- CallOpSet<CallOpRecvInitialMetadata> meta_buf_;
- CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
- CallOpClientRecvStatus> finish_buf_;
+
+ class CallOpSetCollection : public CallOpSetCollectionInterface {
+ public:
+ SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
+ CallOpClientSendClose> init_buf_;
+ CallOpSet<CallOpRecvInitialMetadata> meta_buf_;
+ CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
+ CallOpClientRecvStatus> finish_buf_;
+ };
+ std::shared_ptr<CallOpSetCollection> collection_;
};
template <class W>