diff options
Diffstat (limited to 'src/cpp')
-rw-r--r-- | src/cpp/client/channel.h | 8 | ||||
-rw-r--r-- | src/cpp/proto/proto_utils.cc | 8 | ||||
-rw-r--r-- | src/cpp/server/server.cc | 58 |
3 files changed, 40 insertions, 34 deletions
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) { |