From 50a7a68ca2a5ade22a97502389ec1e0d4dcb0a10 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 4 Jun 2015 12:53:40 -0700 Subject: Progress commit on fixing up C++ --- include/grpc++/byte_buffer.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'include/grpc++/byte_buffer.h') diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index ceb62622fd..80dedda94c 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include @@ -60,9 +62,6 @@ class ByteBuffer GRPC_FINAL { void Clear(); size_t Length(); - private: - friend class CallOpBuffer; - // takes ownership void set_buffer(grpc_byte_buffer* buf) { if (buffer_) { @@ -72,11 +71,23 @@ class ByteBuffer GRPC_FINAL { buffer_ = buf; } + private: + friend class CallOpBuffer; + grpc_byte_buffer* buffer() const { return buffer_; } grpc_byte_buffer* buffer_; }; +template <> +class SerializationTraits { + public: + static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, int max_message_size) { + dest->set_buffer(byte_buffer); + return Status::OK; + } +}; + } // namespace grpc #endif // GRPCXX_BYTE_BUFFER_H -- cgit v1.2.3 From 789471cfc64cd0200a53914939a0485846b5a80f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 4 Jun 2015 16:19:22 -0700 Subject: Client side compiles/links --- include/grpc++/async_unary_call.h | 10 +- include/grpc++/byte_buffer.h | 13 ++- include/grpc++/client_context.h | 4 +- include/grpc++/impl/call.h | 178 +++++++++++++++++++++++++++---- include/grpc++/impl/client_unary_call.h | 4 +- include/grpc++/impl/rpc_service_method.h | 8 +- include/grpc++/stream.h | 39 ++++--- src/cpp/common/call.cc | 41 +++++-- test/cpp/end2end/generic_end2end_test.cc | 2 +- 9 files changed, 243 insertions(+), 56 deletions(-) (limited to 'include/grpc++/byte_buffer.h') diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index d009ac6bbf..3d475d0668 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -63,7 +63,8 @@ class ClientAsyncResponseReader GRPC_FINAL const W& request) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.SendInitialMetadata(context->send_initial_metadata_); - init_buf_.SendMessage(request); + // TODO(ctiller): don't assert + GPR_ASSERT(init_buf_.SendMessage(request)); init_buf_.ClientSendClose(); call_.PerformOps(&init_buf_); } @@ -117,10 +118,11 @@ class ServerAsyncResponseWriter GRPC_FINAL ctx_->sent_initial_metadata_ = true; } // The response is dropped if the status is not OK. - if (status.IsOk()) { - finish_buf_.SendMessage(msg); + if (status.IsOk() && !finish_buf_.SendMessage(msg)) { + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, Status(INVALID_ARGUMENT, "Failed to serialize message")); + } else { + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); } - finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index 80dedda94c..618ec764df 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -62,6 +62,12 @@ class ByteBuffer GRPC_FINAL { void Clear(); size_t Length(); + private: + friend class SerializationTraits; + + ByteBuffer(const ByteBuffer&); + ByteBuffer& operator=(const ByteBuffer&); + // takes ownership void set_buffer(grpc_byte_buffer* buf) { if (buffer_) { @@ -71,9 +77,6 @@ class ByteBuffer GRPC_FINAL { buffer_ = buf; } - private: - friend class CallOpBuffer; - grpc_byte_buffer* buffer() const { return buffer_; } grpc_byte_buffer* buffer_; @@ -86,6 +89,10 @@ class SerializationTraits { dest->set_buffer(byte_buffer); return Status::OK; } + static bool Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer) { + *buffer = source.buffer(); + return true; + } }; } // namespace grpc diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index d444c9035f..0af797322f 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -48,7 +48,6 @@ struct grpc_completion_queue; namespace grpc { -class CallOpBuffer; class ChannelInterface; class CompletionQueue; class Credentials; @@ -115,7 +114,8 @@ class ClientContext { ClientContext(const ClientContext&); ClientContext& operator=(const ClientContext&); - friend class CallOpBuffer; + friend class CallOpClientRecvStatus; + friend class CallOpRecvInitialMetadata; friend class Channel; template friend class ::grpc::ClientReader; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 3701e403de..40dbf9e641 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -35,6 +35,7 @@ #define GRPCXX_IMPL_CALL_H #include +#include #include #include #include @@ -51,6 +52,10 @@ namespace grpc { class ByteBuffer; class Call; +void FillMetadataMap(grpc_metadata_array* arr, + std::multimap* metadata); +grpc_metadata* FillMetadataArray(const std::multimap& metadata); + class CallNoOp { protected: void AddOp(grpc_op* ops, size_t* nops) {} @@ -59,11 +64,29 @@ class CallNoOp { class CallOpSendInitialMetadata { public: - void SendInitialMetadata(const std::multimap& metadata); + CallOpSendInitialMetadata() : send_(false) {} + + void SendInitialMetadata(const std::multimap& metadata) { + send_ = true; + initial_metadata_count_ = metadata.size(); + initial_metadata_ = FillMetadataArray(metadata); + } protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + if (!send_) return; + grpc_op* op = &ops[(*nops)++]; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = initial_metadata_count_; + op->data.send_initial_metadata.metadata = initial_metadata_; + } + void FinishOp(void* tag, bool* status, int max_message_size) { + // nothing to do + } + + bool send_; + size_t initial_metadata_count_; + grpc_metadata* initial_metadata_; }; class CallOpSendMessage { @@ -71,7 +94,7 @@ class CallOpSendMessage { CallOpSendMessage() : send_buf_(nullptr) {} template - bool SendMessage(const M& message) { + bool SendMessage(const M& message) GRPC_MUST_USE_RESULT { return SerializationTraits::Serialize(message, &send_buf_); } @@ -132,50 +155,167 @@ class CallOpRecvMessage { class CallOpGenericRecvMessage { public: + CallOpGenericRecvMessage() : got_message(false) {} + template - void RecvMessage(R* message); + void RecvMessage(R* message) { + deserialize_ = [message](grpc_byte_buffer* buf, int max_message_size) -> Status { + return SerializationTraits::Deserialize(buf, message, max_message_size); + }; + } bool got_message; protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + if (!deserialize_) return; + grpc_op *op = &ops[(*nops)++]; + op->op = GRPC_OP_RECV_MESSAGE; + op->data.recv_message = &recv_buf_; + } + + void FinishOp(void* tag, bool* status, int max_message_size) { + if (!deserialize_) return; + if (recv_buf_) { + if (*status) { + got_message = true; + *status = deserialize_(recv_buf_, max_message_size).IsOk(); + } else { + got_message = false; + grpc_byte_buffer_destroy(recv_buf_); + } + } else { + got_message = false; + *status = false; + } + } + + private: + std::function deserialize_; + grpc_byte_buffer* recv_buf_; }; class CallOpClientSendClose { public: - void ClientSendClose(); + CallOpClientSendClose() : send_(false) {} + + void ClientSendClose() { send_ = true; } protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + if (!send_) return; + ops[(*nops)++].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + } + void FinishOp(void* tag, bool* status, int max_message_size) { + // nothing to do + } + + private: + bool send_; }; class CallOpServerSendStatus { public: - void ServerSendStatus(const std::multimap& trailing_metadata, const Status& status); + CallOpServerSendStatus() : send_status_available_(false) {} + + void ServerSendStatus(const std::multimap& trailing_metadata, const Status& status){ + trailing_metadata_count_ = trailing_metadata.size(); + trailing_metadata_ = FillMetadataArray(trailing_metadata); + send_status_available_ = true; + send_status_code_ = static_cast(status.code()); + send_status_details_ = status.details(); + } protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + grpc_op* op = &ops[(*nops)++]; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = + trailing_metadata_count_; + op->data.send_status_from_server.trailing_metadata = + trailing_metadata_; + op->data.send_status_from_server.status = send_status_code_; + op->data.send_status_from_server.status_details = + send_status_details_.empty() ? nullptr : send_status_details_.c_str(); + } + + void FinishOp(void* tag, bool* status, int max_message_size) { + // nothing to do + } + + private: + bool send_status_available_; + grpc_status_code send_status_code_; + grpc::string send_status_details_; + size_t trailing_metadata_count_; + grpc_metadata* trailing_metadata_; }; class CallOpRecvInitialMetadata { public: - void RecvInitialMetadata(ClientContext* context); + CallOpRecvInitialMetadata() : recv_initial_metadata_(nullptr) { + memset(&recv_initial_metadata_arr_, 0, sizeof(recv_initial_metadata_arr_)); + } + + void RecvInitialMetadata(ClientContext* context) { + context->initial_metadata_received_ = true; + recv_initial_metadata_ = &context->recv_initial_metadata_; + } protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + if (!recv_initial_metadata_) return; + grpc_op* op = &ops[(*nops)++]; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &recv_initial_metadata_arr_; + } + void FinishOp(void* tag, bool* status, int max_message_size) { + FillMetadataMap(&recv_initial_metadata_arr_, recv_initial_metadata_); + } + + private: + std::multimap* recv_initial_metadata_; + grpc_metadata_array recv_initial_metadata_arr_; }; class CallOpClientRecvStatus { public: - void ClientRecvStatus(ClientContext* context, Status* status); + CallOpClientRecvStatus() { + memset(this, 0, sizeof(*this)); + } + + void ClientRecvStatus(ClientContext* context, Status* status) { + recv_trailing_metadata_ = &context->trailing_metadata_; + recv_status_ = status; + } protected: - void AddOp(grpc_op* ops, size_t* nops); - void FinishOp(void* tag, bool* status, int max_message_size); + void AddOp(grpc_op* ops, size_t* nops) { + if (recv_status_ == nullptr) return; + grpc_op* op = &ops[(*nops)++]; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = + &recv_trailing_metadata_arr_; + op->data.recv_status_on_client.status = &status_code_; + op->data.recv_status_on_client.status_details = &status_details_; + op->data.recv_status_on_client.status_details_capacity = + &status_details_capacity_; + } + + void FinishOp(void* tag, bool* status, int max_message_size) { + FillMetadataMap(&recv_trailing_metadata_arr_, recv_trailing_metadata_); + *recv_status_ = Status( + static_cast(status_code_), + status_details_ ? grpc::string(status_details_) : grpc::string()); + } + + private: + std::multimap* recv_trailing_metadata_; + Status* recv_status_; + grpc_metadata_array recv_trailing_metadata_arr_; + grpc_status_code status_code_; + char* status_details_; + size_t status_details_capacity_; }; class CallOpSetInterface : public CompletionQueueTag { diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 8c42fb4792..5e37e63c6d 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -63,7 +63,9 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, CallOpClientRecvStatus> ops; Status status; ops.SendInitialMetadata(context->send_initial_metadata_); - ops.SendMessage(request); + if (!ops.SendMessage(request)) { + return Status(INVALID_ARGUMENT, "Failed to serialize message"); + } ops.RecvInitialMetadata(context); ops.RecvMessage(result); ops.ClientSendClose(); diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 05bba6ef7c..cd31b22323 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -89,7 +89,9 @@ class RpcMethodHandler : public MethodHandler { CallOpSet ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { - ops.SendMessage(rsp); + if (!ops.SendMessage(rsp)) { + status = Status(INTERNAL, "Failed to serialize response"); + } } ops.ServerSendStatus(param.server_context->trailing_metadata_, status); param.call->PerformOps(&ops); @@ -123,7 +125,9 @@ class ClientStreamingHandler : public MethodHandler { CallOpSet ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { - ops.SendMessage(rsp); + if (!ops.SendMessage(rsp)) { + status = Status(INTERNAL, "Failed to serialize response"); + } } ops.ServerSendStatus(param.server_context->trailing_metadata_, status); param.call->PerformOps(&ops); diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 39a1cc8595..eb2bce678f 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -99,7 +99,8 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_); - ops.SendMessage(request); + // TODO(ctiller): don't assert + GPR_ASSERT(ops.SendMessage(request)); ops.ClientSendClose(); call_.PerformOps(&ops); cq_.Pluck(&ops); @@ -169,7 +170,9 @@ class ClientWriter : public ClientWriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - ops.SendMessage(msg); + if (!ops.SendMessage(msg)) { + return false; + } call_.PerformOps(&ops); return cq_.Pluck(&ops); } @@ -245,7 +248,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - ops.SendMessage(msg); + if (!ops.SendMessage(msg)) return false; call_.PerformOps(&ops); return cq_.Pluck(&ops); } @@ -316,11 +319,13 @@ class ServerWriter GRPC_FINAL : public WriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; + if (!ops.SendMessage(msg)) { + return false; + } if (!ctx_->sent_initial_metadata_) { ops.SendInitialMetadata(ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - ops.SendMessage(msg); call_->PerformOps(&ops); return call_->cq()->Pluck(&ops); } @@ -356,11 +361,13 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface, bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; + if (!ops.SendMessage(msg)) { + return false; + } if (!ctx_->sent_initial_metadata_) { ops.SendInitialMetadata(ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - ops.SendMessage(msg); call_->PerformOps(&ops); return call_->cq()->Pluck(&ops); } @@ -415,7 +422,8 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { : context_(context), call_(channel->CreateCall(method, context, cq)) { init_ops_.set_output_tag(tag); init_ops_.SendInitialMetadata(context->send_initial_metadata_); - init_ops_.SendMessage(request); + // TODO(ctiller): don't assert + GPR_ASSERT(init_ops_.SendMessage(request)); init_ops_.ClientSendClose(); call_.PerformOps(&init_ops_); } @@ -488,7 +496,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_ops_.set_output_tag(tag); - write_ops_.SendMessage(msg); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg)); call_.PerformOps(&write_ops_); } @@ -558,7 +567,8 @@ class ClientAsyncReaderWriter GRPC_FINAL void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_ops_.set_output_tag(tag); - write_ops_.SendMessage(msg); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg)); call_.PerformOps(&write_ops_); } @@ -617,10 +627,11 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } // The response is dropped if the status is not OK. - if (status.IsOk()) { - finish_ops_.SendMessage(msg); + if (status.IsOk() && !finish_ops_.SendMessage(msg)) { + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, Status(INTERNAL, "Failed to serialize response")); + } else { + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); } - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); call_.PerformOps(&finish_ops_); } @@ -667,7 +678,8 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, write_ops_.SendInitialMetadata(ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - write_ops_.SendMessage(msg); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg)); call_.PerformOps(&write_ops_); } @@ -721,7 +733,8 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, write_ops_.SendInitialMetadata(ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - write_ops_.SendMessage(msg); + // TODO(ctiller): don't assert + GPR_ASSERT(write_ops_.SendMessage(msg)); call_.PerformOps(&write_ops_); } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index dc3d36faa2..3f3f5279ee 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -42,6 +42,36 @@ namespace grpc { +void FillMetadataMap(grpc_metadata_array* arr, + std::multimap* metadata) { + for (size_t i = 0; i < arr->count; i++) { + // TODO(yangg) handle duplicates? + metadata->insert(std::pair( + arr->metadata[i].key, + grpc::string(arr->metadata[i].value, arr->metadata[i].value_length))); + } + grpc_metadata_array_destroy(arr); + grpc_metadata_array_init(arr); +} + +// TODO(yangg) if the map is changed before we send, the pointers will be a +// mess. Make sure it does not happen. +grpc_metadata* FillMetadataArray( + const std::multimap& metadata) { + if (metadata.empty()) { + return nullptr; + } + grpc_metadata* metadata_array = + (grpc_metadata*)gpr_malloc(metadata.size() * sizeof(grpc_metadata)); + size_t i = 0; + for (auto iter = metadata.cbegin(); iter != metadata.cend(); ++iter, ++i) { + metadata_array[i].key = iter->first.c_str(); + metadata_array[i].value = iter->second.c_str(); + metadata_array[i].value_length = iter->second.size(); + } + return metadata_array; +} + #if 0 CallOpBuffer::CallOpBuffer() : return_tag_(this), @@ -147,17 +177,6 @@ grpc_metadata* FillMetadataArray( return metadata_array; } -void FillMetadataMap(grpc_metadata_array* arr, - std::multimap* metadata) { - for (size_t i = 0; i < arr->count; i++) { - // TODO(yangg) handle duplicates? - metadata->insert(std::pair( - arr->metadata[i].key, - grpc::string(arr->metadata[i].value, arr->metadata[i].value_length))); - } - grpc_metadata_array_destroy(arr); - grpc_metadata_array_init(arr); -} } // namespace void CallOpBuffer::AddSendInitialMetadata( diff --git a/test/cpp/end2end/generic_end2end_test.cc b/test/cpp/end2end/generic_end2end_test.cc index 80e43fd854..5a26834df9 100644 --- a/test/cpp/end2end/generic_end2end_test.cc +++ b/test/cpp/end2end/generic_end2end_test.cc @@ -33,10 +33,10 @@ #include -#include "src/cpp/proto/proto_utils.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" #include "test/cpp/util/echo.grpc.pb.h" +#include #include #include #include -- cgit v1.2.3 From ce40de58da69dc5fb1569d4dca934ef7eea4d3b1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 5 Jun 2015 07:14:58 -0700 Subject: clang-format --- include/grpc++/async_unary_call.h | 13 ++- include/grpc++/byte_buffer.h | 3 +- include/grpc++/completion_queue.h | 2 +- include/grpc++/config.h | 20 ++-- include/grpc++/config_protobuf.h | 3 +- include/grpc++/impl/call.h | 68 ++++++----- include/grpc++/impl/client_unary_call.h | 13 +-- include/grpc++/impl/proto_utils.h | 18 +-- include/grpc++/impl/rpc_service_method.h | 24 ++-- include/grpc++/impl/serialization_traits.h | 5 +- include/grpc++/impl/service_type.h | 19 ++- include/grpc++/server.h | 67 ++++++----- include/grpc++/stream.h | 25 ++-- include/grpc/support/port_platform.h | 20 +++- src/compiler/config.h | 6 +- src/compiler/cpp_generator.cc | 181 ++++++++++++++--------------- src/cpp/client/channel.h | 8 +- src/cpp/proto/proto_utils.cc | 8 +- src/cpp/server/server.cc | 58 ++++----- 19 files changed, 303 insertions(+), 258 deletions(-) (limited to 'include/grpc++/byte_buffer.h') diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 3d475d0668..a3c9e20213 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -90,9 +90,11 @@ class ClientAsyncResponseReader GRPC_FINAL private: ClientContext* context_; Call call_; - SneakyCallOpSet init_buf_; + SneakyCallOpSet init_buf_; CallOpSet meta_buf_; - CallOpSet, CallOpClientRecvStatus> finish_buf_; + CallOpSet, + CallOpClientRecvStatus> finish_buf_; }; template @@ -119,7 +121,9 @@ class ServerAsyncResponseWriter GRPC_FINAL } // The response is dropped if the status is not OK. if (status.IsOk() && !finish_buf_.SendMessage(msg)) { - finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, Status(INVALID_ARGUMENT, "Failed to serialize message")); + finish_buf_.ServerSendStatus( + ctx_->trailing_metadata_, + Status(INVALID_ARGUMENT, "Failed to serialize message")); } else { finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); } @@ -143,7 +147,8 @@ class ServerAsyncResponseWriter GRPC_FINAL Call call_; ServerContext* ctx_; CallOpSet meta_buf_; - CallOpSet finish_buf_; + CallOpSet finish_buf_; }; } // namespace grpc diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index 618ec764df..80b3397a2d 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -85,7 +85,8 @@ class ByteBuffer GRPC_FINAL { template <> class SerializationTraits { public: - static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, int max_message_size) { + static Status Deserialize(grpc_byte_buffer* byte_buffer, ByteBuffer* dest, + int max_message_size) { dest->set_buffer(byte_buffer); return Status::OK; } diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 0490073937..a3e7a9c9f4 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -95,7 +95,7 @@ class CompletionQueue : public GrpcLibrary { // Nonblocking (until deadline) read from queue. // Cannot rely on result of tag or ok if return is TIMEOUT - template + template NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) { TimePoint deadline_tp(deadline); return AsyncNextInternal(tag, ok, deadline_tp.raw_time()); diff --git a/include/grpc++/config.h b/include/grpc++/config.h index af248b66e3..1362c0a1fa 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -46,7 +46,7 @@ #define GRPC_CXX0X_NO_OVERRIDE 1 #define GRPC_CXX0X_NO_CHRONO 1 #define GRPC_CXX0X_NO_THREAD 1 -#endif +#endif #endif // Visual Studio #ifndef __clang__ @@ -80,16 +80,22 @@ #ifdef GRPC_CXX0X_NO_NULLPTR #include const class { -public: - template operator T*() const {return static_cast(0);} - template operator std::unique_ptr() const { + public: + template + operator T *() const { + return static_cast(0); + } + template + operator std::unique_ptr() const { return std::unique_ptr(static_cast(0)); } - template operator std::shared_ptr() const { + template + operator std::shared_ptr() const { return std::shared_ptr(static_cast(0)); } - operator bool() const {return false;} -private: + operator bool() const { return false; } + + private: void operator&() const = delete; } nullptr = {}; #endif diff --git a/include/grpc++/config_protobuf.h b/include/grpc++/config_protobuf.h index f6938b02ce..3afc7a58e2 100644 --- a/include/grpc++/config_protobuf.h +++ b/include/grpc++/config_protobuf.h @@ -51,8 +51,7 @@ ::google::protobuf::io::ZeroCopyOutputStream #define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ ::google::protobuf::io::ZeroCopyInputStream -#define GRPC_CUSTOM_CODEDINPUTSTREAM \ - ::google::protobuf::io::CodedInputStream +#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream #endif namespace grpc { diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 40dbf9e641..88056470e3 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -54,7 +54,8 @@ class Call; void FillMetadataMap(grpc_metadata_array* arr, std::multimap* metadata); -grpc_metadata* FillMetadataArray(const std::multimap& metadata); +grpc_metadata* FillMetadataArray( + const std::multimap& metadata); class CallNoOp { protected: @@ -66,7 +67,8 @@ class CallOpSendInitialMetadata { public: CallOpSendInitialMetadata() : send_(false) {} - void SendInitialMetadata(const std::multimap& metadata) { + void SendInitialMetadata( + const std::multimap& metadata) { send_ = true; initial_metadata_count_ = metadata.size(); initial_metadata_ = FillMetadataArray(metadata); @@ -118,16 +120,14 @@ class CallOpRecvMessage { public: CallOpRecvMessage() : got_message(false), message_(nullptr) {} - void RecvMessage(R* message) { - message_ = message; - } + void RecvMessage(R* message) { message_ = message; } bool got_message; protected: void AddOp(grpc_op* ops, size_t* nops) { if (message_ == nullptr) return; - grpc_op *op = &ops[(*nops)++]; + grpc_op* op = &ops[(*nops)++]; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &recv_buf_; } @@ -137,7 +137,9 @@ class CallOpRecvMessage { if (recv_buf_) { if (*status) { got_message = true; - *status = SerializationTraits::Deserialize(recv_buf_, message_, max_message_size).IsOk(); + *status = SerializationTraits::Deserialize(recv_buf_, message_, + max_message_size) + .IsOk(); } else { got_message = false; grpc_byte_buffer_destroy(recv_buf_); @@ -159,8 +161,10 @@ class CallOpGenericRecvMessage { template void RecvMessage(R* message) { - deserialize_ = [message](grpc_byte_buffer* buf, int max_message_size) -> Status { - return SerializationTraits::Deserialize(buf, message, max_message_size); + deserialize_ = [message](grpc_byte_buffer* buf, + int max_message_size) -> Status { + return SerializationTraits::Deserialize(buf, message, + max_message_size); }; } @@ -169,7 +173,7 @@ class CallOpGenericRecvMessage { protected: void AddOp(grpc_op* ops, size_t* nops) { if (!deserialize_) return; - grpc_op *op = &ops[(*nops)++]; + grpc_op* op = &ops[(*nops)++]; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message = &recv_buf_; } @@ -218,7 +222,9 @@ class CallOpServerSendStatus { public: CallOpServerSendStatus() : send_status_available_(false) {} - void ServerSendStatus(const std::multimap& trailing_metadata, const Status& status){ + void ServerSendStatus( + const std::multimap& trailing_metadata, + const Status& status) { trailing_metadata_count_ = trailing_metadata.size(); trailing_metadata_ = FillMetadataArray(trailing_metadata); send_status_available_ = true; @@ -232,8 +238,7 @@ class CallOpServerSendStatus { op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = trailing_metadata_count_; - op->data.send_status_from_server.trailing_metadata = - trailing_metadata_; + op->data.send_status_from_server.trailing_metadata = trailing_metadata_; op->data.send_status_from_server.status = send_status_code_; op->data.send_status_from_server.status_details = send_status_details_.empty() ? nullptr : send_status_details_.c_str(); @@ -280,9 +285,7 @@ class CallOpRecvInitialMetadata { class CallOpClientRecvStatus { public: - CallOpClientRecvStatus() { - memset(this, 0, sizeof(*this)); - } + CallOpClientRecvStatus() { memset(this, 0, sizeof(*this)); } void ClientRecvStatus(ClientContext* context, Status* status) { recv_trailing_metadata_ = &context->trailing_metadata_; @@ -323,7 +326,9 @@ class CallOpSetInterface : public CompletionQueueTag { CallOpSetInterface() : max_message_size_(0) {} virtual void FillOps(grpc_op* ops, size_t* nops) = 0; - void set_max_message_size(int max_message_size) { max_message_size_ = max_message_size; } + void set_max_message_size(int max_message_size) { + max_message_size_ = max_message_size; + } protected: int max_message_size_; @@ -332,14 +337,15 @@ class CallOpSetInterface : public CompletionQueueTag { template class WrapAndDerive : public T {}; -template -class CallOpSet : public CallOpSetInterface, -public WrapAndDerive, -public WrapAndDerive, -public WrapAndDerive, -public WrapAndDerive, -public WrapAndDerive, -public WrapAndDerive { +template +class CallOpSet : public CallOpSetInterface, + public WrapAndDerive, + public WrapAndDerive, + public WrapAndDerive, + public WrapAndDerive, + public WrapAndDerive, + public WrapAndDerive { public: CallOpSet() : return_tag_(this) {} void FillOps(grpc_op* ops, size_t* nops) GRPC_OVERRIDE { @@ -365,7 +371,7 @@ public WrapAndDerive { void set_output_tag(void* return_tag) { return_tag_ = return_tag; } private: - void *return_tag_; + void* return_tag_; }; #if 0 @@ -444,11 +450,15 @@ class CallOpBuffer : public CompletionQueueTag { #endif // SneakyCallOpBuffer does not post completions to the completion queue -template -class SneakyCallOpSet GRPC_FINAL : public CallOpSet { +template +class SneakyCallOpSet GRPC_FINAL + : public CallOpSet { public: bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { - return CallOpSet::FinalizeResult(tag, status) && false; + return CallOpSet::FinalizeResult(tag, + status) && + false; } }; diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 5e37e63c6d..c1832f9eb8 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -49,18 +49,13 @@ class Status; // Wrapper that performs a blocking unary call template Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, - ClientContext* context, - const InputMessage& request, + ClientContext* context, const InputMessage& request, OutputMessage* result) { CompletionQueue cq; Call call(channel->CreateCall(method, context, &cq)); - CallOpSet< - CallOpSendInitialMetadata, - CallOpSendMessage, - CallOpRecvInitialMetadata, - CallOpRecvMessage, - CallOpClientSendClose, - CallOpClientRecvStatus> ops; + CallOpSet, + CallOpClientSendClose, CallOpClientRecvStatus> ops; Status status; ops.SendInitialMetadata(context->send_initial_metadata_); if (!ops.SendMessage(request)) { diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h index 1a0cc31a8a..ee19859198 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/impl/proto_utils.h @@ -55,14 +55,18 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size); template -class SerializationTraits::value>::type> { +class SerializationTraits::value>::type> { public: - static bool Serialize(const grpc::protobuf::Message& msg, grpc_byte_buffer** buffer) { - return SerializeProto(msg, buffer); - } - static Status Deserialize(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, int max_message_size) { - return DeserializeProto(buffer, msg, max_message_size); - } + static bool Serialize(const grpc::protobuf::Message& msg, + grpc_byte_buffer** buffer) { + return SerializeProto(msg, buffer); + } + static Status Deserialize(grpc_byte_buffer* buffer, + grpc::protobuf::Message* msg, + int max_message_size) { + return DeserializeProto(buffer, msg, max_message_size); + } }; } // namespace grpc diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index cd31b22323..1bf39fca3b 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -55,9 +55,12 @@ class MethodHandler { public: virtual ~MethodHandler() {} struct HandlerParameter { - HandlerParameter(Call* c, ServerContext* context, - grpc_byte_buffer* req, int max_size) - : call(c), server_context(context), request(req), max_message_size(max_size) {} + HandlerParameter(Call* c, ServerContext* context, grpc_byte_buffer* req, + int max_size) + : call(c), + server_context(context), + request(req), + max_message_size(max_size) {} Call* call; ServerContext* server_context; // Handler required to grpc_byte_buffer_destroy this @@ -79,14 +82,16 @@ class RpcMethodHandler : public MethodHandler { void RunHandler(const HandlerParameter& param) GRPC_FINAL { RequestType req; - Status status = SerializationTraits::Deserialize(param.request, &req, param.max_message_size); + Status status = SerializationTraits::Deserialize( + param.request, &req, param.max_message_size); ResponseType rsp; if (status.IsOk()) { status = func_(service_, param.server_context, &req, &rsp); } GPR_ASSERT(!param.server_context->sent_initial_metadata_); - CallOpSet ops; + CallOpSet ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { if (!ops.SendMessage(rsp)) { @@ -122,7 +127,8 @@ class ClientStreamingHandler : public MethodHandler { Status status = func_(service_, param.server_context, &reader, &rsp); GPR_ASSERT(!param.server_context->sent_initial_metadata_); - CallOpSet ops; + CallOpSet ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { if (!ops.SendMessage(rsp)) { @@ -152,7 +158,8 @@ class ServerStreamingHandler : public MethodHandler { void RunHandler(const HandlerParameter& param) GRPC_FINAL { RequestType req; - Status status = SerializationTraits::Deserialize(param.request, &req, param.max_message_size); + Status status = SerializationTraits::Deserialize( + param.request, &req, param.max_message_size); if (status.IsOk()) { ServerWriter writer(param.call, param.server_context); @@ -211,8 +218,7 @@ class RpcServiceMethod : public RpcMethod { // Takes ownership of the handler RpcServiceMethod(const char* name, RpcMethod::RpcType type, MethodHandler* handler) - : RpcMethod(name, type, nullptr), - handler_(handler) {} + : RpcMethod(name, type, nullptr), handler_(handler) {} MethodHandler* handler() { return handler_.get(); } diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h index 4648bbfc33..e4f086e08d 100644 --- a/include/grpc++/impl/serialization_traits.h +++ b/include/grpc++/impl/serialization_traits.h @@ -38,9 +38,10 @@ struct grpc_byte_buffer; namespace grpc { -template +template class SerializationTraits; } // namespace grpc -#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H +#endif // GRPCXX_IMPL_SERIALIZATION_TRAITS_H diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index af21d9b8cf..8f9f38f193 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -77,21 +77,20 @@ class AsynchronousService { protected: template - void RequestAsyncUnary(int index, ServerContext* context, - Message* request, + void RequestAsyncUnary(int index, ServerContext* context, Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) { - server_->RequestAsyncCall(request_args_[index], context, - stream, call_cq, notification_cq, tag, request); + server_->RequestAsyncCall(request_args_[index], context, stream, call_cq, + notification_cq, tag, request); } void RequestClientStreaming(int index, ServerContext* context, ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) { - server_->RequestAsyncCall(request_args_[index], context, - stream, call_cq, notification_cq, tag); + server_->RequestAsyncCall(request_args_[index], context, stream, call_cq, + notification_cq, tag); } template void RequestServerStreaming(int index, ServerContext* context, @@ -100,15 +99,15 @@ class AsynchronousService { CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) { - server_->RequestAsyncCall(request_args_[index], context, - stream, call_cq, notification_cq, tag, request); + server_->RequestAsyncCall(request_args_[index], context, stream, call_cq, + notification_cq, tag, request); } void RequestBidiStreaming(int index, ServerContext* context, ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) { - server_->RequestAsyncCall(request_args_[index], context, - stream, call_cq, notification_cq, tag); + server_->RequestAsyncCall(request_args_[index], context, stream, call_cq, + notification_cq, tag); } private: diff --git a/include/grpc++/server.h b/include/grpc++/server.h index a6883e24e6..8c7551ccf1 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -58,8 +58,7 @@ class ServerCredentials; class ThreadPoolInterface; // Currently it only supports handling rpcs in a single thread. -class Server GRPC_FINAL : public GrpcLibrary, - private CallHook { +class Server GRPC_FINAL : public GrpcLibrary, private CallHook { public: ~Server(); @@ -97,14 +96,13 @@ class Server GRPC_FINAL : public GrpcLibrary, void RunRpc(); void ScheduleCallback(); - void PerformOpsOnCall(CallOpSetInterface *ops, Call* call) GRPC_OVERRIDE; + void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; class BaseAsyncRequest : public CompletionQueueTag { public: BaseAsyncRequest(Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, - CompletionQueue* call_cq, - void* tag); + ServerAsyncStreamingInterface* stream, + CompletionQueue* call_cq, void* tag); virtual ~BaseAsyncRequest(); bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; @@ -123,20 +121,24 @@ class Server GRPC_FINAL : public GrpcLibrary, class RegisteredAsyncRequest : public BaseAsyncRequest { public: RegisteredAsyncRequest(Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag); + ServerAsyncStreamingInterface* stream, + CompletionQueue* call_cq, void* tag); // uses BaseAsyncRequest::FinalizeResult protected: - void IssueRequest(void* registered_method, grpc_byte_buffer** payload, ServerCompletionQueue *notification_cq); + void IssueRequest(void* registered_method, grpc_byte_buffer** payload, + ServerCompletionQueue* notification_cq); }; class NoPayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { public: - NoPayloadAsyncRequest(void* registered_method, Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, void* tag) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag) { + NoPayloadAsyncRequest(void* registered_method, Server* server, + ServerContext* context, + ServerAsyncStreamingInterface* stream, + CompletionQueue* call_cq, + ServerCompletionQueue* notification_cq, void* tag) + : RegisteredAsyncRequest(server, context, stream, call_cq, tag) { IssueRequest(registered_method, nullptr, notification_cq); } @@ -146,15 +148,23 @@ class Server GRPC_FINAL : public GrpcLibrary, template class PayloadAsyncRequest GRPC_FINAL : public RegisteredAsyncRequest { public: - PayloadAsyncRequest(void* registered_method, Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, void* tag, Message* request) - : RegisteredAsyncRequest(server, context, stream, call_cq, tag), request_(request) { + PayloadAsyncRequest(void* registered_method, Server* server, + ServerContext* context, + ServerAsyncStreamingInterface* stream, + CompletionQueue* call_cq, + ServerCompletionQueue* notification_cq, void* tag, + Message* request) + : RegisteredAsyncRequest(server, context, stream, call_cq, tag), + request_(request) { IssueRequest(registered_method, &payload_, notification_cq); } bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { - bool serialization_status = *status && payload_ && SerializationTraits::Deserialize(payload_, request_, server_->max_message_size_).IsOk(); + bool serialization_status = + *status && payload_ && + SerializationTraits::Deserialize(payload_, request_, + server_->max_message_size_) + .IsOk(); bool ret = RegisteredAsyncRequest::FinalizeResult(tag, status); *status = serialization_status && *status; return ret; @@ -168,10 +178,9 @@ class Server GRPC_FINAL : public GrpcLibrary, class GenericAsyncRequest GRPC_FINAL : public BaseAsyncRequest { public: GenericAsyncRequest(Server* server, GenericServerContext* context, - ServerAsyncStreamingInterface* stream, - CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, - void* tag); + ServerAsyncStreamingInterface* stream, + CompletionQueue* call_cq, + ServerCompletionQueue* notification_cq, void* tag); bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE; @@ -183,17 +192,18 @@ class Server GRPC_FINAL : public GrpcLibrary, void RequestAsyncCall(void* registered_method, ServerContext* context, ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, - void* tag, Message *message) { - new PayloadAsyncRequest(registered_method, this, context, stream, call_cq, notification_cq, tag, message); + ServerCompletionQueue* notification_cq, void* tag, + Message* message) { + new PayloadAsyncRequest(registered_method, this, context, stream, + call_cq, notification_cq, tag, message); } void RequestAsyncCall(void* registered_method, ServerContext* context, ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, - void* tag) { - new NoPayloadAsyncRequest(registered_method, this, context, stream, call_cq, notification_cq, tag); + ServerCompletionQueue* notification_cq, void* tag) { + new NoPayloadAsyncRequest(registered_method, this, context, stream, call_cq, + notification_cq, tag); } void RequestAsyncGenericCall(GenericServerContext* context, @@ -201,7 +211,8 @@ class Server GRPC_FINAL : public GrpcLibrary, CompletionQueue* call_cq, ServerCompletionQueue* notification_cq, void* tag) { - new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, tag); + new GenericAsyncRequest(this, context, stream, call_cq, notification_cq, + tag); } const int max_message_size_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index eb2bce678f..2495f96abf 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -97,7 +97,8 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { ClientReader(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { - CallOpSet ops; + CallOpSet ops; ops.SendInitialMetadata(context->send_initial_metadata_); // TODO(ctiller): don't assert GPR_ASSERT(ops.SendMessage(request)); @@ -158,8 +159,7 @@ class ClientWriter : public ClientWriterInterface { template ClientWriter(ChannelInterface* channel, const RpcMethod& method, ClientContext* context, R* response) - : context_(context), - call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { finish_ops_.RecvMessage(response); CallOpSet ops; @@ -408,8 +408,7 @@ class AsyncWriterInterface { template class ClientAsyncReaderInterface : public ClientAsyncStreamingInterface, - public AsyncReaderInterface { -}; + public AsyncReaderInterface {}; template class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { @@ -457,7 +456,8 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { private: ClientContext* context_; Call call_; - CallOpSet init_ops_; + CallOpSet + init_ops_; CallOpSet meta_ops_; CallOpSet> read_ops_; CallOpSet finish_ops_; @@ -477,8 +477,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, const RpcMethod& method, ClientContext* context, R* response, void* tag) - : context_(context), - call_(channel->CreateCall(method, context, cq)) { + : context_(context), call_(channel->CreateCall(method, context, cq)) { finish_ops_.RecvMessage(response); init_ops_.set_output_tag(tag); @@ -523,7 +522,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { CallOpSet meta_ops_; CallOpSet write_ops_; CallOpSet writes_done_ops_; - CallOpSet finish_ops_; + CallOpSet finish_ops_; }; // Client-side interface for bi-directional streaming. @@ -628,7 +628,9 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, } // The response is dropped if the status is not OK. if (status.IsOk() && !finish_ops_.SendMessage(msg)) { - finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, Status(INTERNAL, "Failed to serialize response")); + finish_ops_.ServerSendStatus( + ctx_->trailing_metadata_, + Status(INTERNAL, "Failed to serialize response")); } else { finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); } @@ -653,7 +655,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, ServerContext* ctx_; CallOpSet meta_ops_; CallOpSet> read_ops_; - CallOpSet finish_ops_; + CallOpSet finish_ops_; }; template diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 077eeb1c07..4fbce9c8d9 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -223,7 +223,9 @@ #endif /* Validate platform combinations */ -#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + defined(GPR_WIN32_ATOMIC) != 1 +#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \ + defined(GPR_WIN32_ATOMIC) != \ + 1 #error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC #endif @@ -231,7 +233,9 @@ #error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64 #endif -#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != 1 +#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \ + defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \ + 1 #error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM #endif @@ -239,11 +243,15 @@ #error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL #endif -#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + defined(GPR_CUSTOM_SOCKET) != 1 +#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \ + defined(GPR_CUSTOM_SOCKET) != \ + 1 #error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET #endif -#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + defined(GPR_CUSTOM_TLS) != 1 +#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \ + defined(GPR_CUSTOM_TLS) != \ + 1 #error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS #endif @@ -268,10 +276,10 @@ typedef uintptr_t gpr_uintptr; #ifndef GRPC_MUST_USE_RESULT #ifdef __GNUC__ -#define GRPC_MUST_USE_RESULT __attribute__ ((warn_unused_result)) +#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result)) #else #define GRPC_MUST_USE_RESULT #endif #endif -#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */ +#endif /* GRPC_SUPPORT_PORT_PLATFORM_H */ diff --git a/src/compiler/config.h b/src/compiler/config.h index 06ccd8530c..cd52aca57d 100644 --- a/src/compiler/config.h +++ b/src/compiler/config.h @@ -49,7 +49,8 @@ #ifndef GRPC_CUSTOM_CODEGENERATOR #include #define GRPC_CUSTOM_CODEGENERATOR ::google::protobuf::compiler::CodeGenerator -#define GRPC_CUSTOM_GENERATORCONTEXT ::google::protobuf::compiler::GeneratorContext +#define GRPC_CUSTOM_GENERATORCONTEXT \ + ::google::protobuf::compiler::GeneratorContext #endif #ifndef GRPC_CUSTOM_PRINTER @@ -58,7 +59,8 @@ #include #define GRPC_CUSTOM_PRINTER ::google::protobuf::io::Printer #define GRPC_CUSTOM_CODEDOUTPUTSTREAM ::google::protobuf::io::CodedOutputStream -#define GRPC_CUSTOM_STRINGOUTPUTSTREAM ::google::protobuf::io::StringOutputStream +#define GRPC_CUSTOM_STRINGOUTPUTSTREAM \ + ::google::protobuf::io::StringOutputStream #endif #ifndef GRPC_CUSTOM_PLUGINMAIN diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index d03eaddf40..0b69848f7d 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -97,7 +97,8 @@ grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file, vars["filename_base"] = grpc_generator::StripProto(file->name()); printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n"); - printer.Print(vars, "// If you make any local change, they will be lost.\n"); + printer.Print(vars, + "// If you make any local change, they will be lost.\n"); printer.Print(vars, "// source: $filename$\n"); printer.Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n"); printer.Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n"); @@ -142,10 +143,10 @@ grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file, return temp; } -void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, - const grpc::protobuf::MethodDescriptor *method, - std::map *vars, - bool is_public) { +void PrintHeaderClientMethodInterfaces( + grpc::protobuf::io::Printer *printer, + const grpc::protobuf::MethodDescriptor *method, + std::map *vars, bool is_public) { (*vars)["Method"] = method->name(); (*vars)["Request"] = grpc_cpp_generator::ClassName(method->input_type(), true); @@ -158,19 +159,17 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, *vars, "virtual ::grpc::Status $Method$(::grpc::ClientContext* context, " "const $Request$& request, $Response$* response) = 0;\n"); - printer->Print( - *vars, - "std::unique_ptr< " - "::grpc::ClientAsyncResponseReaderInterface< $Response$>> " - "Async$Method$(::grpc::ClientContext* context, " - "const $Request$& request, " - "::grpc::CompletionQueue* cq) {\n"); + printer->Print(*vars, + "std::unique_ptr< " + "::grpc::ClientAsyncResponseReaderInterface< $Response$>> " + "Async$Method$(::grpc::ClientContext* context, " + "const $Request$& request, " + "::grpc::CompletionQueue* cq) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientAsyncResponseReaderInterface< $Response$>>(" - "Async$Method$Raw(context, request, cq));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientAsyncResponseReaderInterface< $Response$>>(" + "Async$Method$Raw(context, request, cq));\n"); printer->Outdent(); printer->Print("}\n"); } else if (ClientOnlyStreaming(method)) { @@ -189,14 +188,14 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, printer->Print( *vars, "std::unique_ptr< ::grpc::ClientAsyncWriterInterface< $Request$>>" - " Async$Method$(::grpc::ClientContext* context, $Response$* response, " + " Async$Method$(::grpc::ClientContext* context, $Response$* " + "response, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientAsyncWriterInterface< $Request$>>(" - "Async$Method$Raw(context, response, cq, tag));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientAsyncWriterInterface< $Request$>>(" + "Async$Method$Raw(context, response, cq, tag));\n"); printer->Outdent(); printer->Print("}\n"); } else if (ServerOnlyStreaming(method)) { @@ -219,18 +218,17 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientAsyncReaderInterface< $Response$>>(" - "Async$Method$Raw(context, request, cq, tag));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientAsyncReaderInterface< $Response$>>(" + "Async$Method$Raw(context, request, cq, tag));\n"); printer->Outdent(); printer->Print("}\n"); } else if (BidiStreaming(method)) { - printer->Print( - *vars, - "std::unique_ptr< ::grpc::ClientReaderWriterInterface< $Request$, $Response$>> " - "$Method$(::grpc::ClientContext* context) {\n"); + printer->Print(*vars, + "std::unique_ptr< ::grpc::ClientReaderWriterInterface< " + "$Request$, $Response$>> " + "$Method$(::grpc::ClientContext* context) {\n"); printer->Indent(); printer->Print( *vars, @@ -268,12 +266,11 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, "virtual ::grpc::ClientWriterInterface< $Request$>*" " $Method$Raw(" "::grpc::ClientContext* context, $Response$* response) = 0;\n"); - printer->Print( - *vars, - "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*" - " Async$Method$Raw(::grpc::ClientContext* context, " - "$Response$* response, " - "::grpc::CompletionQueue* cq, void* tag) = 0;\n"); + printer->Print(*vars, + "virtual ::grpc::ClientAsyncWriterInterface< $Request$>*" + " Async$Method$Raw(::grpc::ClientContext* context, " + "$Response$* response, " + "::grpc::CompletionQueue* cq, void* tag) = 0;\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, @@ -286,16 +283,15 @@ void PrintHeaderClientMethodInterfaces(grpc::protobuf::io::Printer *printer, "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) = 0;\n"); } else if (BidiStreaming(method)) { - printer->Print( - *vars, - "virtual ::grpc::ClientReaderWriterInterface< $Request$, $Response$>* " - "$Method$Raw(::grpc::ClientContext* context) = 0;\n"); - printer->Print( - *vars, - "virtual ::grpc::ClientAsyncReaderWriterInterface< " - "$Request$, $Response$>* " - "Async$Method$Raw(::grpc::ClientContext* context, " - "::grpc::CompletionQueue* cq, void* tag) = 0;\n"); + printer->Print(*vars, + "virtual ::grpc::ClientReaderWriterInterface< $Request$, " + "$Response$>* " + "$Method$Raw(::grpc::ClientContext* context) = 0;\n"); + printer->Print(*vars, + "virtual ::grpc::ClientAsyncReaderWriterInterface< " + "$Request$, $Response$>* " + "Async$Method$Raw(::grpc::ClientContext* context, " + "::grpc::CompletionQueue* cq, void* tag) = 0;\n"); } } } @@ -322,11 +318,10 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer, "const $Request$& request, " "::grpc::CompletionQueue* cq) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientAsyncResponseReader< $Response$>>(" - "Async$Method$Raw(context, request, cq));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientAsyncResponseReader< $Response$>>(" + "Async$Method$Raw(context, request, cq));\n"); printer->Outdent(); printer->Print("}\n"); } else if (ClientOnlyStreaming(method)) { @@ -336,17 +331,16 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer, " $Method$(" "::grpc::ClientContext* context, $Response$* response) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>" - "($Method$Raw(context, response));\n"); + printer->Print(*vars, + "return std::unique_ptr< ::grpc::ClientWriter< $Request$>>" + "($Method$Raw(context, response));\n"); printer->Outdent(); printer->Print("}\n"); - printer->Print( - *vars, - "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>" - " Async$Method$(::grpc::ClientContext* context, $Response$* response, " - "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print(*vars, + "std::unique_ptr< ::grpc::ClientAsyncWriter< $Request$>>" + " Async$Method$(::grpc::ClientContext* context, " + "$Response$* response, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Indent(); printer->Print( *vars, @@ -386,53 +380,47 @@ void PrintHeaderClientMethod(grpc::protobuf::io::Printer *printer, "std::unique_ptr< ::grpc::ClientReaderWriter< $Request$, $Response$>>" " $Method$(::grpc::ClientContext* context) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientReaderWriter< $Request$, $Response$>>(" - "$Method$Raw(context));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientReaderWriter< $Request$, $Response$>>(" + "$Method$Raw(context));\n"); printer->Outdent(); printer->Print("}\n"); - printer->Print( - *vars, - "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " - "$Request$, $Response$>> " - "Async$Method$(::grpc::ClientContext* context, " - "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print(*vars, + "std::unique_ptr< ::grpc::ClientAsyncReaderWriter< " + "$Request$, $Response$>> " + "Async$Method$(::grpc::ClientContext* context, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Indent(); - printer->Print( - *vars, - "return std::unique_ptr< " - "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>(" - "Async$Method$Raw(context, cq, tag));\n"); + printer->Print(*vars, + "return std::unique_ptr< " + "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>>(" + "Async$Method$Raw(context, cq, tag));\n"); printer->Outdent(); printer->Print("}\n"); } } else { if (NoStreaming(method)) { - printer->Print( - *vars, - "::grpc::ClientAsyncResponseReader< $Response$>* " - "Async$Method$Raw(::grpc::ClientContext* context, " - "const $Request$& request, " - "::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n"); + printer->Print(*vars, + "::grpc::ClientAsyncResponseReader< $Response$>* " + "Async$Method$Raw(::grpc::ClientContext* context, " + "const $Request$& request, " + "::grpc::CompletionQueue* cq) GRPC_OVERRIDE;\n"); } else if (ClientOnlyStreaming(method)) { - printer->Print( - *vars, - "::grpc::ClientWriter< $Request$>* $Method$Raw(" - "::grpc::ClientContext* context, $Response$* response) " - "GRPC_OVERRIDE;\n"); + printer->Print(*vars, + "::grpc::ClientWriter< $Request$>* $Method$Raw(" + "::grpc::ClientContext* context, $Response$* response) " + "GRPC_OVERRIDE;\n"); printer->Print( *vars, "::grpc::ClientAsyncWriter< $Request$>* Async$Method$Raw(" "::grpc::ClientContext* context, $Response$* response, " "::grpc::CompletionQueue* cq, void* tag) GRPC_OVERRIDE;\n"); } else if (ServerOnlyStreaming(method)) { - printer->Print( - *vars, - "::grpc::ClientReader< $Response$>* $Method$Raw(" - "::grpc::ClientContext* context, const $Request$& request)" - " GRPC_OVERRIDE;\n"); + printer->Print(*vars, + "::grpc::ClientReader< $Response$>* $Method$Raw(" + "::grpc::ClientContext* context, const $Request$& request)" + " GRPC_OVERRIDE;\n"); printer->Print( *vars, "::grpc::ClientAsyncReader< $Response$>* Async$Method$Raw(" @@ -630,7 +618,7 @@ grpc::string GetHeaderServices(const grpc::protobuf::FileDescriptor *file, const Parameters ¶ms) { grpc::string output; { - // Scope the output stream so it closes and finalizes output to the string. + // Scope the output stream so it closes and finalizes output to the string. grpc::protobuf::io::StringOutputStream output_stream(&output); grpc::protobuf::io::Printer printer(&output_stream, '$'); std::map vars; @@ -694,7 +682,8 @@ grpc::string GetSourcePrologue(const grpc::protobuf::FileDescriptor *file, vars["filename_base"] = grpc_generator::StripProto(file->name()); printer.Print(vars, "// Generated by the gRPC protobuf plugin.\n"); - printer.Print(vars, "// If you make any local change, they will be lost.\n"); + printer.Print(vars, + "// If you make any local change, they will be lost.\n"); printer.Print(vars, "// source: $filename$\n\n"); printer.Print(vars, "#include \"$filename_base$.pb.h\"\n"); printer.Print(vars, "#include \"$filename_base$.grpc.pb.h\"\n"); diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 69baa419a6..9108713c58 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -50,16 +50,16 @@ class CompletionQueue; class Credentials; class StreamContextInterface; -class Channel GRPC_FINAL : public GrpcLibrary, - public ChannelInterface { +class Channel GRPC_FINAL : public GrpcLibrary, public ChannelInterface { public: Channel(const grpc::string& target, grpc_channel* c_channel); ~Channel() GRPC_OVERRIDE; - virtual void *RegisterMethod(const char *method) GRPC_OVERRIDE; + virtual void* RegisterMethod(const char* method) GRPC_OVERRIDE; virtual Call CreateCall(const RpcMethod& method, ClientContext* context, CompletionQueue* cq) GRPC_OVERRIDE; - virtual void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) GRPC_OVERRIDE; + virtual void PerformOpsOnCall(CallOpSetInterface* ops, + Call* call) GRPC_OVERRIDE; private: const grpc::string target_; diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index a4a37c7000..9e8bf1a631 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -67,7 +67,7 @@ class GrpcBufferWriter GRPC_FINAL slice_ = gpr_slice_malloc(block_size_); } *data = GPR_SLICE_START_PTR(slice_); - byte_count_ += *size = GPR_SLICE_LENGTH(slice_); + byte_count_ += * size = GPR_SLICE_LENGTH(slice_); gpr_slice_buffer_add(slice_buffer_, slice_); return true; } @@ -118,7 +118,7 @@ class GrpcBufferReader GRPC_FINAL } gpr_slice_unref(slice_); *data = GPR_SLICE_START_PTR(slice_); - byte_count_ += *size = GPR_SLICE_LENGTH(slice_); + byte_count_ += * size = GPR_SLICE_LENGTH(slice_); return true; } @@ -158,7 +158,7 @@ bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) { } Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, - int max_message_size) { + int max_message_size) { if (!buffer) { return Status(INVALID_ARGUMENT, "No payload"); } @@ -169,7 +169,7 @@ Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, } if (!msg->ParseFromCodedStream(&decoder)) { return Status(INVALID_ARGUMENT, msg->InitializationErrorString()); - } + } if (!decoder.ConsumedEntireMessage()) { return Status(INVALID_ARGUMENT, "Did not read entire message"); } diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index bd97d707a7..b750868607 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -71,9 +71,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { grpc_metadata_array_init(&request_metadata_); } - ~SyncRequest() { - grpc_metadata_array_destroy(&request_metadata_); - } + ~SyncRequest() { grpc_metadata_array_destroy(&request_metadata_); } static SyncRequest* Wait(CompletionQueue* cq, bool* ok) { void* tag = nullptr; @@ -129,8 +127,8 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { void Run() { ctx_.BeginCompletionOp(&call_); - method_->handler()->RunHandler( - MethodHandler::HandlerParameter(&call_, &ctx_, request_payload_, call_.max_message_size())); + method_->handler()->RunHandler(MethodHandler::HandlerParameter( + &call_, &ctx_, request_payload_, call_.max_message_size())); void* ignored_tag; bool ignored_ok; cq_.Shutdown(); @@ -422,23 +420,27 @@ void Server::RequestAsyncGenericCall(GenericServerContext* context, } #endif -Server::BaseAsyncRequest::BaseAsyncRequest(Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) -: server_(server), context_(context), stream_(stream), call_cq_(call_cq), call_(nullptr) { +Server::BaseAsyncRequest::BaseAsyncRequest( + Server* server, ServerContext* context, + ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) + : server_(server), + context_(context), + stream_(stream), + call_cq_(call_cq), + call_(nullptr) { memset(&initial_metadata_array_, 0, sizeof(initial_metadata_array_)); } -Server::BaseAsyncRequest::~BaseAsyncRequest() { -} +Server::BaseAsyncRequest::~BaseAsyncRequest() {} bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) { if (*status) { for (size_t i = 0; i < initial_metadata_array_.count; i++) { context_->client_metadata_.insert(std::make_pair( grpc::string(initial_metadata_array_.metadata[i].key), - grpc::string( - initial_metadata_array_.metadata[i].value, - initial_metadata_array_.metadata[i].value + initial_metadata_array_.metadata[i].value_length))); + grpc::string(initial_metadata_array_.metadata[i].value, + initial_metadata_array_.metadata[i].value + + initial_metadata_array_.metadata[i].value_length))); } } context_->call_ = call_; @@ -453,27 +455,31 @@ bool Server::BaseAsyncRequest::FinalizeResult(void** tag, bool* status) { return true; } -Server::RegisteredAsyncRequest::RegisteredAsyncRequest(Server* server, ServerContext* context, - ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) +Server::RegisteredAsyncRequest::RegisteredAsyncRequest( + Server* server, ServerContext* context, + ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, void* tag) : BaseAsyncRequest(server, context, stream, call_cq, tag) {} - -void Server::RegisteredAsyncRequest::IssueRequest(void* registered_method, grpc_byte_buffer** payload, ServerCompletionQueue *notification_cq) { +void Server::RegisteredAsyncRequest::IssueRequest( + void* registered_method, grpc_byte_buffer** payload, + ServerCompletionQueue* notification_cq) { grpc_server_request_registered_call( - server_->server_, registered_method, &call_, &context_->deadline_, &initial_metadata_array_, payload, call_cq_->cq(), notification_cq->cq(), this); + server_->server_, registered_method, &call_, &context_->deadline_, + &initial_metadata_array_, payload, call_cq_->cq(), notification_cq->cq(), + this); } -Server::GenericAsyncRequest::GenericAsyncRequest(Server* server, GenericServerContext* context, - ServerAsyncStreamingInterface* stream, - CompletionQueue* call_cq, - ServerCompletionQueue* notification_cq, - void* tag) -: BaseAsyncRequest(server, context, stream, call_cq, tag) { +Server::GenericAsyncRequest::GenericAsyncRequest( + Server* server, GenericServerContext* context, + ServerAsyncStreamingInterface* stream, CompletionQueue* call_cq, + ServerCompletionQueue* notification_cq, void* tag) + : BaseAsyncRequest(server, context, stream, call_cq, tag) { grpc_call_details_init(&call_details_); GPR_ASSERT(notification_cq); GPR_ASSERT(call_cq); - grpc_server_request_call(server->server_, &call_, &call_details_, &initial_metadata_array_, - call_cq->cq(), notification_cq->cq(), this); + grpc_server_request_call(server->server_, &call_, &call_details_, + &initial_metadata_array_, call_cq->cq(), + notification_cq->cq(), this); } bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) { -- cgit v1.2.3 From 4beef422642144fdfbf0afa892ebef659d156d00 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 5 Jun 2015 07:48:27 -0700 Subject: Clarify ownership --- include/grpc++/byte_buffer.h | 4 +++- include/grpc++/impl/call.h | 7 ++++--- include/grpc++/impl/proto_utils.h | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'include/grpc++/byte_buffer.h') diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index 80b3397a2d..5f419764a5 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -90,8 +90,10 @@ class SerializationTraits { dest->set_buffer(byte_buffer); return Status::OK; } - static bool Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer) { + static bool Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, + bool* own_buffer) { *buffer = source.buffer(); + *own_buffer = false; return true; } }; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index eb8027cef5..43d3805827 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -95,11 +95,11 @@ class CallOpSendInitialMetadata { class CallOpSendMessage { public: - CallOpSendMessage() : send_buf_(nullptr) {} + CallOpSendMessage() : send_buf_(nullptr), own_buf_(false) {} template bool SendMessage(const M& message) GRPC_MUST_USE_RESULT { - return SerializationTraits::Serialize(message, &send_buf_); + return SerializationTraits::Serialize(message, &send_buf_, &own_buf_); } protected: @@ -110,11 +110,12 @@ class CallOpSendMessage { op->data.send_message = send_buf_; } void FinishOp(void* tag, bool* status, int max_message_size) { - grpc_byte_buffer_destroy(send_buf_); + if (own_buf_) grpc_byte_buffer_destroy(send_buf_); } private: grpc_byte_buffer* send_buf_; + bool own_buf_; }; template diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h index ee19859198..bf82f2b23d 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/impl/proto_utils.h @@ -59,7 +59,8 @@ class SerializationTraits::value>::type> { public: static bool Serialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer) { + grpc_byte_buffer** buffer, bool* own_buffer) { + *own_buffer = true; return SerializeProto(msg, buffer); } static Status Deserialize(grpc_byte_buffer* buffer, -- cgit v1.2.3 From bd277cb3cb7d9e39844c82e0078c24c906156add Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 5 Jun 2015 10:43:43 -0700 Subject: Clarify serialization traits interface --- include/grpc++/async_unary_call.h | 7 +++---- include/grpc++/byte_buffer.h | 4 ++-- include/grpc++/impl/call.h | 4 ++-- include/grpc++/impl/client_unary_call.h | 8 ++++---- include/grpc++/impl/proto_utils.h | 8 ++++---- include/grpc++/impl/rpc_service_method.h | 8 ++------ include/grpc++/impl/serialization_traits.h | 23 +++++++++++++++++++++++ include/grpc++/stream.h | 24 ++++++++++++------------ src/cpp/proto/proto_utils.cc | 4 ++-- 9 files changed, 54 insertions(+), 36 deletions(-) (limited to 'include/grpc++/byte_buffer.h') diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index a3c9e20213..911092b70e 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -64,7 +64,7 @@ class ClientAsyncResponseReader GRPC_FINAL : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.SendInitialMetadata(context->send_initial_metadata_); // TODO(ctiller): don't assert - GPR_ASSERT(init_buf_.SendMessage(request)); + GPR_ASSERT(init_buf_.SendMessage(request).IsOk()); init_buf_.ClientSendClose(); call_.PerformOps(&init_buf_); } @@ -120,10 +120,9 @@ class ServerAsyncResponseWriter GRPC_FINAL ctx_->sent_initial_metadata_ = true; } // The response is dropped if the status is not OK. - if (status.IsOk() && !finish_buf_.SendMessage(msg)) { + if (status.IsOk()) { finish_buf_.ServerSendStatus( - ctx_->trailing_metadata_, - Status(INVALID_ARGUMENT, "Failed to serialize message")); + ctx_->trailing_metadata_, finish_buf_.SendMessage(msg)); } else { finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); } diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index 5f419764a5..a90f4c90b3 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -90,11 +90,11 @@ class SerializationTraits { dest->set_buffer(byte_buffer); return Status::OK; } - static bool Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, + static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, bool* own_buffer) { *buffer = source.buffer(); *own_buffer = false; - return true; + return Status::OK; } }; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 94b0f915c6..7a60ec6587 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -98,7 +98,7 @@ class CallOpSendMessage { CallOpSendMessage() : send_buf_(nullptr), own_buf_(false) {} template - bool SendMessage(const M& message) GRPC_MUST_USE_RESULT; + Status SendMessage(const M& message) GRPC_MUST_USE_RESULT; protected: void AddOp(grpc_op* ops, size_t* nops) { @@ -118,7 +118,7 @@ class CallOpSendMessage { }; template -bool CallOpSendMessage::SendMessage(const M& message) { +Status CallOpSendMessage::SendMessage(const M& message) { return SerializationTraits::Serialize(message, &send_buf_, &own_buf_); } diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index c1832f9eb8..15db89d3f6 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -56,11 +56,11 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, CallOpSet, CallOpClientSendClose, CallOpClientRecvStatus> ops; - Status status; - ops.SendInitialMetadata(context->send_initial_metadata_); - if (!ops.SendMessage(request)) { - return Status(INVALID_ARGUMENT, "Failed to serialize message"); + Status status = ops.SendMessage(request); + if (!status.IsOk()) { + return status; } + ops.SendInitialMetadata(context->send_initial_metadata_); ops.RecvInitialMetadata(context); ops.RecvMessage(result); ops.ClientSendClose(); diff --git a/include/grpc++/impl/proto_utils.h b/include/grpc++/impl/proto_utils.h index bf82f2b23d..3097a8da5a 100644 --- a/include/grpc++/impl/proto_utils.h +++ b/include/grpc++/impl/proto_utils.h @@ -47,8 +47,8 @@ namespace grpc { // Serialize the msg into a buffer created inside the function. The caller // should destroy the returned buffer when done with it. If serialization fails, // false is returned and buffer is left unchanged. -bool SerializeProto(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer); +Status SerializeProto(const grpc::protobuf::Message& msg, + grpc_byte_buffer** buffer); // The caller keeps ownership of buffer and msg. Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, @@ -58,8 +58,8 @@ template class SerializationTraits::value>::type> { public: - static bool Serialize(const grpc::protobuf::Message& msg, - grpc_byte_buffer** buffer, bool* own_buffer) { + static Status Serialize(const grpc::protobuf::Message& msg, + grpc_byte_buffer** buffer, bool* own_buffer) { *own_buffer = true; return SerializeProto(msg, buffer); } diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 1bf39fca3b..a5e25f9651 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -94,9 +94,7 @@ class RpcMethodHandler : public MethodHandler { CallOpServerSendStatus> ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { - if (!ops.SendMessage(rsp)) { - status = Status(INTERNAL, "Failed to serialize response"); - } + status = ops.SendMessage(rsp); } ops.ServerSendStatus(param.server_context->trailing_metadata_, status); param.call->PerformOps(&ops); @@ -131,9 +129,7 @@ class ClientStreamingHandler : public MethodHandler { CallOpServerSendStatus> ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.IsOk()) { - if (!ops.SendMessage(rsp)) { - status = Status(INTERNAL, "Failed to serialize response"); - } + status = ops.SendMessage(rsp); } ops.ServerSendStatus(param.server_context->trailing_metadata_, status); param.call->PerformOps(&ops); diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h index e4f086e08d..ad61dc2f6a 100644 --- a/include/grpc++/impl/serialization_traits.h +++ b/include/grpc++/impl/serialization_traits.h @@ -38,6 +38,29 @@ struct grpc_byte_buffer; namespace grpc { +/// Defines how to serialize and deserialize some type. +/// +/// Used for hooking different message serialization API's into GRPC. +/// Each SerializationTraits implementation must provide the following +/// functions: +/// static Status Serialize(const Message& msg, +/// grpc_byte_buffer** buffer, +// bool* own_buffer); +/// static Status Deserialize(grpc_byte_buffer* buffer, +/// Message* msg, +/// int max_message_size); +/// +/// Serialize is required to convert message to a grpc_byte_buffer, and +/// to store a pointer to that byte buffer at *buffer. *own_buffer should +/// be set to true if the caller owns said byte buffer, or false if +/// ownership is retained elsewhere. +/// +/// Deserialize is required to convert buffer into the message stored at +/// msg. max_message_size is passed in as a bound on the maximum number of +/// message bytes Deserialize should accept. +/// +/// Both functions return a Status, allowing them to explain what went +/// wrong if required. template class SerializationTraits; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 2495f96abf..aebfdbf1f9 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -101,7 +101,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface { CallOpClientSendClose> ops; ops.SendInitialMetadata(context->send_initial_metadata_); // TODO(ctiller): don't assert - GPR_ASSERT(ops.SendMessage(request)); + GPR_ASSERT(ops.SendMessage(request).IsOk()); ops.ClientSendClose(); call_.PerformOps(&ops); cq_.Pluck(&ops); @@ -170,7 +170,7 @@ class ClientWriter : public ClientWriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - if (!ops.SendMessage(msg)) { + if (!ops.SendMessage(msg).IsOk()) { return false; } call_.PerformOps(&ops); @@ -248,7 +248,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - if (!ops.SendMessage(msg)) return false; + if (!ops.SendMessage(msg).IsOk()) return false; call_.PerformOps(&ops); return cq_.Pluck(&ops); } @@ -319,7 +319,7 @@ class ServerWriter GRPC_FINAL : public WriterInterface { bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - if (!ops.SendMessage(msg)) { + if (!ops.SendMessage(msg).IsOk()) { return false; } if (!ctx_->sent_initial_metadata_) { @@ -361,7 +361,7 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface, bool Write(const W& msg) GRPC_OVERRIDE { CallOpSet ops; - if (!ops.SendMessage(msg)) { + if (!ops.SendMessage(msg).IsOk()) { return false; } if (!ctx_->sent_initial_metadata_) { @@ -422,7 +422,7 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface { init_ops_.set_output_tag(tag); init_ops_.SendInitialMetadata(context->send_initial_metadata_); // TODO(ctiller): don't assert - GPR_ASSERT(init_ops_.SendMessage(request)); + GPR_ASSERT(init_ops_.SendMessage(request).IsOk()); init_ops_.ClientSendClose(); call_.PerformOps(&init_ops_); } @@ -496,7 +496,7 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface { void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg)); + GPR_ASSERT(write_ops_.SendMessage(msg).IsOk()); call_.PerformOps(&write_ops_); } @@ -568,7 +568,7 @@ class ClientAsyncReaderWriter GRPC_FINAL void Write(const W& msg, void* tag) GRPC_OVERRIDE { write_ops_.set_output_tag(tag); // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg)); + GPR_ASSERT(write_ops_.SendMessage(msg).IsOk()); call_.PerformOps(&write_ops_); } @@ -627,10 +627,10 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } // The response is dropped if the status is not OK. - if (status.IsOk() && !finish_ops_.SendMessage(msg)) { + if (status.IsOk()) { finish_ops_.ServerSendStatus( ctx_->trailing_metadata_, - Status(INTERNAL, "Failed to serialize response")); + finish_ops_.SendMessage(msg)); } else { finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); } @@ -682,7 +682,7 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg)); + GPR_ASSERT(write_ops_.SendMessage(msg).IsOk()); call_.PerformOps(&write_ops_); } @@ -737,7 +737,7 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } // TODO(ctiller): don't assert - GPR_ASSERT(write_ops_.SendMessage(msg)); + GPR_ASSERT(write_ops_.SendMessage(msg).IsOk()); call_.PerformOps(&write_ops_); } diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 9e8bf1a631..48bc399549 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -152,9 +152,9 @@ class GrpcBufferReader GRPC_FINAL namespace grpc { -bool SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) { +Status SerializeProto(const grpc::protobuf::Message& msg, grpc_byte_buffer** bp) { GrpcBufferWriter writer(bp); - return msg.SerializeToZeroCopyStream(&writer); + return msg.SerializeToZeroCopyStream(&writer) ? Status::OK : Status(INVALID_ARGUMENT, "Failed to serialize message"); } Status DeserializeProto(grpc_byte_buffer* buffer, grpc::protobuf::Message* msg, -- cgit v1.2.3 From 89c5a5623377e7d4d253c7a304bc726357c6ef0e Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 22 Jun 2015 16:31:11 -0700 Subject: Add const to ByteBuffer methods and add tests --- Makefile | 88 ++++++++++++++++++++++++++++- build.json | 30 ++++++++++ include/grpc++/byte_buffer.h | 6 +- src/cpp/util/byte_buffer.cc | 8 +-- test/cpp/util/byte_buffer_test.cc | 115 ++++++++++++++++++++++++++++++++++++++ test/cpp/util/slice_test.cc | 77 +++++++++++++++++++++++++ tools/run_tests/tests.json | 18 ++++++ 7 files changed, 334 insertions(+), 8 deletions(-) create mode 100644 test/cpp/util/byte_buffer_test.cc create mode 100644 test/cpp/util/slice_test.cc (limited to 'include/grpc++/byte_buffer.h') diff --git a/Makefile b/Makefile index 53364dc291..b8c58b1b45 100644 --- a/Makefile +++ b/Makefile @@ -669,6 +669,8 @@ cli_call_test: $(BINDIR)/$(CONFIG)/cli_call_test client_crash_test: $(BINDIR)/$(CONFIG)/client_crash_test client_crash_test_server: $(BINDIR)/$(CONFIG)/client_crash_test_server credentials_test: $(BINDIR)/$(CONFIG)/credentials_test +cxx_byte_buffer_test: $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test +cxx_slice_test: $(BINDIR)/$(CONFIG)/cxx_slice_test cxx_time_test: $(BINDIR)/$(CONFIG)/cxx_time_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test @@ -1263,7 +1265,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_tls_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_auth_context_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_security_connector_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/timers_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_with_poll_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_payload_and_call_creds_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_flags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_server_finishes_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_posix_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_with_poll_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_flags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_server_finishes_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_with_grpc_trace_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/connection_prefix_bad_client_test $(BINDIR)/$(CONFIG)/initial_settings_frame_bad_client_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/async_streaming_ping_pong_test $(BINDIR)/$(CONFIG)/async_unary_ping_pong_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/client_crash_test $(BINDIR)/$(CONFIG)/client_crash_test_server $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/mock_test $(BINDIR)/$(CONFIG)/qps_interarrival_test $(BINDIR)/$(CONFIG)/qps_test $(BINDIR)/$(CONFIG)/qps_test_openloop $(BINDIR)/$(CONFIG)/server_crash_test $(BINDIR)/$(CONFIG)/server_crash_test_client $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/sync_streaming_ping_pong_test $(BINDIR)/$(CONFIG)/sync_unary_ping_pong_test $(BINDIR)/$(CONFIG)/thread_pool_test $(BINDIR)/$(CONFIG)/thread_stress_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/async_streaming_ping_pong_test $(BINDIR)/$(CONFIG)/async_unary_ping_pong_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/client_crash_test $(BINDIR)/$(CONFIG)/client_crash_test_server $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test $(BINDIR)/$(CONFIG)/cxx_slice_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/mock_test $(BINDIR)/$(CONFIG)/qps_interarrival_test $(BINDIR)/$(CONFIG)/qps_test $(BINDIR)/$(CONFIG)/qps_test_openloop $(BINDIR)/$(CONFIG)/server_crash_test $(BINDIR)/$(CONFIG)/server_crash_test_client $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/sync_streaming_ping_pong_test $(BINDIR)/$(CONFIG)/sync_unary_ping_pong_test $(BINDIR)/$(CONFIG)/thread_pool_test $(BINDIR)/$(CONFIG)/thread_stress_test test: test_c test_cxx @@ -2364,6 +2366,10 @@ test_cxx: buildtests_cxx $(Q) $(BINDIR)/$(CONFIG)/client_crash_test || ( echo test client_crash_test failed ; exit 1 ) $(E) "[RUN] Testing credentials_test" $(Q) $(BINDIR)/$(CONFIG)/credentials_test || ( echo test credentials_test failed ; exit 1 ) + $(E) "[RUN] Testing cxx_byte_buffer_test" + $(Q) $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test || ( echo test cxx_byte_buffer_test failed ; exit 1 ) + $(E) "[RUN] Testing cxx_slice_test" + $(Q) $(BINDIR)/$(CONFIG)/cxx_slice_test || ( echo test cxx_slice_test failed ; exit 1 ) $(E) "[RUN] Testing cxx_time_test" $(Q) $(BINDIR)/$(CONFIG)/cxx_time_test || ( echo test cxx_time_test failed ; exit 1 ) $(E) "[RUN] Testing end2end_test" @@ -7593,6 +7599,86 @@ endif endif +CXX_BYTE_BUFFER_TEST_SRC = \ + test/cpp/util/byte_buffer_test.cc \ + +CXX_BYTE_BUFFER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CXX_BYTE_BUFFER_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/cxx_byte_buffer_test: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/cxx_byte_buffer_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/cxx_byte_buffer_test: $(PROTOBUF_DEP) $(CXX_BYTE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(CXX_BYTE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/cxx_byte_buffer_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/byte_buffer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +deps_cxx_byte_buffer_test: $(CXX_BYTE_BUFFER_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(CXX_BYTE_BUFFER_TEST_OBJS:.o=.dep) +endif +endif + + +CXX_SLICE_TEST_SRC = \ + test/cpp/util/slice_test.cc \ + +CXX_SLICE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CXX_SLICE_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/cxx_slice_test: openssl_dep_error + +else + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/cxx_slice_test: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/cxx_slice_test: $(PROTOBUF_DEP) $(CXX_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(CXX_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/cxx_slice_test + +endif + +endif + +$(OBJDIR)/$(CONFIG)/test/cpp/util/slice_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a +deps_cxx_slice_test: $(CXX_SLICE_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(CXX_SLICE_TEST_OBJS:.o=.dep) +endif +endif + + CXX_TIME_TEST_SRC = \ test/cpp/util/time_test.cc \ diff --git a/build.json b/build.json index 8b36abf0b4..71fe389e80 100644 --- a/build.json +++ b/build.json @@ -1828,6 +1828,36 @@ "gpr" ] }, + { + "name": "cxx_byte_buffer_test", + "build": "test", + "language": "c++", + "src": [ + "test/cpp/util/byte_buffer_test.cc" + ], + "deps": [ + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, + { + "name": "cxx_slice_test", + "build": "test", + "language": "c++", + "src": [ + "test/cpp/util/slice_test.cc" + ], + "deps": [ + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "cxx_time_test", "build": "test", diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index 3e40eaed1d..2c0f2e6944 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -48,7 +48,7 @@ class ByteBuffer GRPC_FINAL { public: ByteBuffer() : buffer_(nullptr) {} - ByteBuffer(Slice* slices, size_t nslices); + ByteBuffer(const Slice* slices, size_t nslices); ~ByteBuffer() { if (buffer_) { @@ -56,10 +56,10 @@ class ByteBuffer GRPC_FINAL { } } - void Dump(std::vector* slices); + void Dump(std::vector* slices) const; void Clear(); - size_t Length(); + size_t Length() const; private: friend class CallOpBuffer; diff --git a/src/cpp/util/byte_buffer.cc b/src/cpp/util/byte_buffer.cc index a78e4226d2..a66c92c3e1 100644 --- a/src/cpp/util/byte_buffer.cc +++ b/src/cpp/util/byte_buffer.cc @@ -36,7 +36,7 @@ namespace grpc { -ByteBuffer::ByteBuffer(Slice* slices, size_t nslices) { +ByteBuffer::ByteBuffer(const Slice* slices, size_t nslices) { // TODO(yangg) maybe expose some core API to simplify this std::vector c_slices(nslices); for (size_t i = 0; i < nslices; i++) { @@ -52,20 +52,20 @@ void ByteBuffer::Clear() { } } -void ByteBuffer::Dump(std::vector* slices) { +void ByteBuffer::Dump(std::vector* slices) const { slices->clear(); if (!buffer_) { return; } grpc_byte_buffer_reader reader; - grpc_byte_buffer_reader_init(&reader,buffer_); + grpc_byte_buffer_reader_init(&reader, buffer_); gpr_slice s; while (grpc_byte_buffer_reader_next(&reader, &s)) { slices->push_back(Slice(s, Slice::STEAL_REF)); } } -size_t ByteBuffer::Length() { +size_t ByteBuffer::Length() const { if (buffer_) { return grpc_byte_buffer_length(buffer_); } else { diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc new file mode 100644 index 0000000000..8ad2fad505 --- /dev/null +++ b/test/cpp/util/byte_buffer_test.cc @@ -0,0 +1,115 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +#include +#include +#include + +namespace grpc { +namespace { + +class ByteBufferTest : public ::testing::Test { + protected: + const char* kContent1_ = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + const char* kContent2_ = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world"; +}; + +TEST_F(ByteBufferTest, CreateFromSingleSlice) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1_); + Slice s(hello, Slice::STEAL_REF); + ByteBuffer buffer(&s, 1); +} + +TEST_F(ByteBufferTest, CreateFromVector) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1_); + gpr_slice world = gpr_slice_from_copied_string(kContent2_); + std::vector slices; + slices.push_back(Slice(hello, Slice::STEAL_REF)); + slices.push_back(Slice(world, Slice::STEAL_REF)); + ByteBuffer buffer(&slices[0], 2); +} + +TEST_F(ByteBufferTest, Clear) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1_); + Slice s(hello, Slice::STEAL_REF); + ByteBuffer buffer(&s, 1); + buffer.Clear(); +} + +TEST_F(ByteBufferTest, Length) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1_); + gpr_slice world = gpr_slice_from_copied_string(kContent2_); + std::vector slices; + slices.push_back(Slice(hello, Slice::STEAL_REF)); + slices.push_back(Slice(world, Slice::STEAL_REF)); + ByteBuffer buffer(&slices[0], 2); + EXPECT_EQ(strlen(kContent1_) + strlen(kContent2_), buffer.Length()); +} + +bool SliceEqual(const Slice& a, gpr_slice b) { + if (a.size() != GPR_SLICE_LENGTH(b)) { + return false; + } + for (size_t i = 0; i < a.size(); i++) { + if (a.begin()[i] != GPR_SLICE_START_PTR(b)[i]) { + return false; + } + } + return true; +} + +TEST_F(ByteBufferTest, Dump) { + gpr_slice hello = gpr_slice_from_copied_string(kContent1_); + gpr_slice world = gpr_slice_from_copied_string(kContent2_); + std::vector slices; + slices.push_back(Slice(hello, Slice::STEAL_REF)); + slices.push_back(Slice(world, Slice::STEAL_REF)); + ByteBuffer buffer(&slices[0], 2); + slices.clear(); + buffer.Dump(&slices); + EXPECT_TRUE(SliceEqual(slices[0], hello)); + EXPECT_TRUE(SliceEqual(slices[1], world)); +} + +} // namespace +} // namespace grpc + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc new file mode 100644 index 0000000000..36ffeb66bd --- /dev/null +++ b/test/cpp/util/slice_test.cc @@ -0,0 +1,77 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include + +namespace grpc { +namespace { + +class SliceTest : public ::testing::Test { + protected: + void CheckSlice(const Slice& s, const grpc::string& content) { + EXPECT_EQ(content.size(), s.size()); + EXPECT_EQ(content, + grpc::string(reinterpret_cast(s.begin()), s.size())); + } + + const char* kContent = "hello xxxxxxxxxxxxxxxxxxxx world"; +}; + +TEST_F(SliceTest, Steal) { + gpr_slice s = gpr_slice_from_copied_string(kContent); + Slice spp(s, Slice::STEAL_REF); + CheckSlice(spp, kContent); +} + +TEST_F(SliceTest, Add) { + gpr_slice s = gpr_slice_from_copied_string(kContent); + Slice spp(s, Slice::ADD_REF); + gpr_slice_unref(s); + CheckSlice(spp, kContent); +} + +TEST_F(SliceTest, Empty) { + Slice empty_slice; + CheckSlice(empty_slice, ""); +} + +} // namespace +} // namespace grpc + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6a22a66a5f..2da8b56d4f 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -604,6 +604,24 @@ "posix" ] }, + { + "flaky": false, + "language": "c++", + "name": "cxx_byte_buffer_test", + "platforms": [ + "windows", + "posix" + ] + }, + { + "flaky": false, + "language": "c++", + "name": "cxx_slice_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c++", -- cgit v1.2.3