diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/client_context.h | 7 | ||||
-rw-r--r-- | include/grpc++/impl/call.h | 23 |
2 files changed, 18 insertions, 12 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 0cf6bdc647..a6e8ccc67c 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -35,8 +35,8 @@ #define __GRPCPP_CLIENT_CONTEXT_H__ #include <chrono> +#include <map> #include <string> -#include <vector> #include <grpc/support/log.h> #include <grpc/support/time.h> @@ -49,6 +49,8 @@ struct grpc_completion_queue; namespace grpc { +class CallOpBuffer; + class ClientContext { public: ClientContext(); @@ -67,6 +69,7 @@ class ClientContext { ClientContext(const ClientContext &); ClientContext &operator=(const ClientContext &); + friend class CallOpBuffer; friend class Channel; friend class StreamContext; @@ -84,7 +87,7 @@ class ClientContext { grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; - std::vector<std::pair<grpc::string, grpc::string> > metadata_; + std::multimap<grpc::string, grpc::string> metadata_; }; } // namespace grpc diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 141b16ab5b..d0cb9024ba 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -63,11 +63,13 @@ class CallOpBuffer final : public CompletionQueueTag { // Does not take ownership. void AddSendInitialMetadata( std::multimap<grpc::string, grpc::string> *metadata); + void AddSendInitialMetadata(ClientContext *ctx); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(Status *status); - void AddServerSendStatus(std::multimap<grpc::string, grpc::string> *metadata, const Status& status); + void AddServerSendStatus(std::multimap<grpc::string, grpc::string> *metadata, + const Status &status); // INTERNAL API: @@ -79,20 +81,21 @@ class CallOpBuffer final : public CompletionQueueTag { private: void *return_tag_ = nullptr; + bool send_initial_metadata_ = false; size_t initial_metadata_count_ = 0; - grpc_metadata* initial_metadata_ = nullptr; - const google::protobuf::Message* send_message_ = nullptr; - grpc_byte_buffer* send_message_buf_ = nullptr; - google::protobuf::Message* recv_message_ = nullptr; - grpc_byte_buffer* recv_message_buf_ = nullptr; + grpc_metadata *initial_metadata_ = nullptr; + const google::protobuf::Message *send_message_ = nullptr; + grpc_byte_buffer *send_message_buf_ = nullptr; + google::protobuf::Message *recv_message_ = nullptr; + grpc_byte_buffer *recv_message_buf_ = nullptr; bool client_send_close_ = false; - Status* recv_status_ = nullptr; + Status *recv_status_ = nullptr; grpc_status_code status_code_ = GRPC_STATUS_OK; - char* status_details_ = nullptr; + char *status_details_ = nullptr; size_t status_details_capacity_ = 0; - Status* send_status_ = nullptr; + Status *send_status_ = nullptr; size_t trailing_metadata_count_ = 0; - grpc_metadata* trailing_metadata_ = nullptr; + grpc_metadata *trailing_metadata_ = nullptr; }; class CCallDeleter { |