aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/grpc++/impl/call.h13
-rw-r--r--src/cpp/common/call.cc46
2 files changed, 56 insertions, 3 deletions
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h
index de789febe6..91f3f58443 100644
--- a/include/grpc++/impl/call.h
+++ b/include/grpc++/impl/call.h
@@ -38,7 +38,7 @@
#include <grpc++/completion_queue.h>
#include <memory>
-#include <vector>
+#include <map>
namespace google {
namespace protobuf {
@@ -59,7 +59,9 @@ class CallOpBuffer final : public CompletionQueueTag {
void Reset(void *next_return_tag);
- void AddSendInitialMetadata(std::vector<std::pair<grpc::string, grpc::string> > *metadata);
+ // Does not take ownership.
+ void AddSendInitialMetadata(
+ std::multimap<grpc::string, grpc::string> *metadata);
void AddSendMessage(const google::protobuf::Message &message);
void AddRecvMessage(google::protobuf::Message *message);
void AddClientSendClose();
@@ -74,7 +76,12 @@ class CallOpBuffer final : public CompletionQueueTag {
void FinalizeResult(void *tag, bool *status) override;
private:
- void *return_tag_;
+ void *return_tag_ = nullptr;
+ std::multimap<grpc::string, grpc::string>* metadata_ = nullptr;
+ const google::protobuf::Message* send_message_ = nullptr;
+ google::protobuf::Message* recv_message_ = nullptr;
+ bool client_send_close_ = false;
+ Status* status_ = nullptr;
};
class CCallDeleter {
diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc
index 0315ffb6bd..37e374bad3 100644
--- a/src/cpp/common/call.cc
+++ b/src/cpp/common/call.cc
@@ -36,6 +36,52 @@
namespace grpc {
+void CallOpBuffer::Reset(void* next_return_tag) {
+ return_tag_ = next_return_tag;
+ metadata_ = nullptr;
+ send_message_ = nullptr;
+ recv_message_ = nullptr;
+ client_send_close_ = false;
+ status_ = false;
+}
+
+void CallOpBuffer::AddSendInitialMetadata(
+ std::multimap<igrpc::string, grpc::string>* metadata) {
+ metadata_ = metadata;
+}
+
+void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) {
+ send_message_ = &message;
+}
+
+void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) {
+ recv_message_ = message;
+}
+
+void CallOpBuffer::AddClientSendClose() {
+ client_sent_close_ = true;
+}
+
+void CallOpBuffer::AddClientRecvStatus(Status *status) {
+ status_ = status;
+}
+
+void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) {
+
+
+}
+
+void CallOpBuffer::FinalizeResult(void *tag, bool *status) {
+
+}
+
+void CCallDeleter::operator()(grpc_call* c) {
+ grpc_call_destroy(c);
+}
+
+Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq)
+ : channel_(channel), cq_(cq), call_(call) {}
+
void Call::PerformOps(CallOpBuffer* buffer) {
channel_->PerformOpsOnCall(buffer, this);
}