From 6135107e4a899ec934f11abbb6bf4a804b5dee8f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 6 Feb 2015 17:17:24 -0800 Subject: [PATCH 001/232] New completion queue --- include/grpc++/completion_queue.h | 52 +++++++++++----------- src/cpp/common/completion_queue.cc | 70 +++++++----------------------- 2 files changed, 41 insertions(+), 81 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 72f6253f8e8..4e8c1071c03 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -34,6 +34,8 @@ #ifndef __GRPCPP_COMPLETION_QUEUE_H__ #define __GRPCPP_COMPLETION_QUEUE_H__ +#include + struct grpc_completion_queue; namespace grpc { @@ -44,41 +46,37 @@ class CompletionQueue { CompletionQueue(); ~CompletionQueue(); - enum CompletionType { - QUEUE_CLOSED = 0, // Shutting down. - RPC_END = 1, // An RPC finished. Either at client or server. - CLIENT_READ_OK = 2, // A client-side read has finished successfully. - CLIENT_READ_ERROR = 3, // A client-side read has finished with error. - CLIENT_WRITE_OK = 4, - CLIENT_WRITE_ERROR = 5, - SERVER_RPC_NEW = 6, // A new RPC just arrived at the server. - SERVER_READ_OK = 7, // A server-side read has finished successfully. - SERVER_READ_ERROR = 8, // A server-side read has finished with error. - SERVER_WRITE_OK = 9, - SERVER_WRITE_ERROR = 10, - // Client or server has sent half close successfully. - HALFCLOSE_OK = 11, - // New CompletionTypes may be added in the future, so user code should - // always - // handle the default case of a CompletionType that appears after such code - // was - // written. - DO_NOT_USE = 20, - }; - // Blocking read from queue. - // For QUEUE_CLOSED, *tag is not changed. - // For SERVER_RPC_NEW, *tag will be a newly allocated AsyncServerContext. - // For others, *tag will be the AsyncServerContext of this rpc. - CompletionType Next(void** tag); + // Returns true if an event was received, false if the queue is ready + // for destruction. + bool Next(void** tag); + + // Prepare a tag for the C api + // Given a tag we'd like to receive from Next, what tag should we pass + // down to the C api? + // Usage example: + // grpc_call_start_batch(..., cq.PrepareTagForC(tag)); + // Allows attaching some work to be executed before the original tag + // is returned. + // MUST be used for all events that could be surfaced through this + // wrapping API + template + void *PrepareTagForC(void *user_tag, F on_ready) { + return new std::function([user_tag, on_ready]() { + on_ready(); + return user_tag; + }); + } // Shutdown has to be called, and the CompletionQueue can only be - // destructed when the QUEUE_CLOSED message has been read with Next(). + // destructed when false is returned from Next(). void Shutdown(); grpc_completion_queue* cq() { return cq_; } private: + typedef std::function FinishFunc; + grpc_completion_queue* cq_; // owned }; diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index f06da9b04fe..a1a858ae2e0 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -33,6 +33,8 @@ #include +#include + #include #include #include @@ -47,66 +49,26 @@ CompletionQueue::~CompletionQueue() { grpc_completion_queue_destroy(cq_); } void CompletionQueue::Shutdown() { grpc_completion_queue_shutdown(cq_); } -CompletionQueue::CompletionType CompletionQueue::Next(void **tag) { - grpc_event *ev; - CompletionType return_type; - bool success; +// Helper class so we can declare a unique_ptr with grpc_event +class EventDeleter { + public: + void operator()(grpc_event *ev) { if (ev) grpc_event_finish(ev); } +}; + +bool CompletionQueue::Next(void **tag) { + std::unique_ptr ev; - ev = grpc_completion_queue_next(cq_, gpr_inf_future); + ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); if (!ev) { gpr_log(GPR_ERROR, "no next event in queue"); abort(); } - switch (ev->type) { - case GRPC_QUEUE_SHUTDOWN: - return_type = QUEUE_CLOSED; - break; - case GRPC_READ: - *tag = ev->tag; - if (ev->data.read) { - success = static_cast(ev->tag) - ->ParseRead(ev->data.read); - return_type = success ? SERVER_READ_OK : SERVER_READ_ERROR; - } else { - return_type = SERVER_READ_ERROR; - } - break; - case GRPC_WRITE_ACCEPTED: - *tag = ev->tag; - if (ev->data.write_accepted != GRPC_OP_ERROR) { - return_type = SERVER_WRITE_OK; - } else { - return_type = SERVER_WRITE_ERROR; - } - break; - case GRPC_SERVER_RPC_NEW: - GPR_ASSERT(!ev->tag); - // Finishing the pending new rpcs after the server has been shutdown. - if (!ev->call) { - *tag = nullptr; - } else { - *tag = new AsyncServerContext( - ev->call, ev->data.server_rpc_new.method, - ev->data.server_rpc_new.host, - Timespec2Timepoint(ev->data.server_rpc_new.deadline)); - } - return_type = SERVER_RPC_NEW; - break; - case GRPC_FINISHED: - *tag = ev->tag; - return_type = RPC_END; - break; - case GRPC_FINISH_ACCEPTED: - *tag = ev->tag; - return_type = HALFCLOSE_OK; - break; - default: - // We do not handle client side messages now - gpr_log(GPR_ERROR, "client-side messages aren't supported yet"); - abort(); + if (ev->type == GRPC_QUEUE_SHUTDOWN) { + return false; } - grpc_event_finish(ev); - return return_type; + std::unique_ptr func(static_cast(ev->tag)); + *tag = (*func)(); + return true; } } // namespace grpc From c4965751a05bd9bf8e309275964623ced7583f1b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 09:51:00 -0800 Subject: [PATCH 002/232] Starting to scratch out the API --- build.json | 1 + include/grpc++/call.h | 80 +++++++++++++++ include/grpc++/channel_interface.h | 32 ++++-- include/grpc++/completion_queue.h | 4 +- include/grpc++/server.h | 4 +- include/grpc++/stream.h | 149 +++++++++++++++++----------- src/compiler/cpp_generator.cc | 14 +-- src/cpp/client/channel.cc | 104 ++----------------- src/cpp/client/channel.h | 13 +-- src/cpp/common/call.cc | 42 ++++++++ src/cpp/common/completion_queue.cc | 7 +- src/cpp/server/server_rpc_handler.h | 1 - 12 files changed, 259 insertions(+), 192 deletions(-) create mode 100644 include/grpc++/call.h create mode 100644 src/cpp/common/call.cc diff --git a/build.json b/build.json index 68110e47020..7d35f79af09 100644 --- a/build.json +++ b/build.json @@ -413,6 +413,7 @@ "src/cpp/client/create_channel.cc", "src/cpp/client/credentials.cc", "src/cpp/client/internal_stub.cc", + "src/cpp/common/call.cc", "src/cpp/common/completion_queue.cc", "src/cpp/common/rpc_method.cc", "src/cpp/proto/proto_utils.cc", diff --git a/include/grpc++/call.h b/include/grpc++/call.h new file mode 100644 index 00000000000..704cd47daec --- /dev/null +++ b/include/grpc++/call.h @@ -0,0 +1,80 @@ +/* + * + * Copyright 2014, 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. + * + */ + +#ifndef __GRPCPP_CALL_H__ +#define __GRPCPP_CALL_H__ + +#include +#include + +namespace google { +namespace protobuf { +class Message; +} // namespace protobuf +} // namespace google + +struct grpc_call; + +namespace grpc { + +class ChannelInterface; + +class CallOpBuffer final { + public: + void AddSendMessage(const google::protobuf::Message &message); + void AddRecvMessage(google::protobuf::Message *message); + void AddClientSendClose(); + void AddClientRecvStatus(Status *status); + + void FinalizeResult(); + + private: + static const size_t MAX_OPS = 6; + grpc_op ops_[MAX_OPS]; + int num_ops_ = 0; +}; + +// Straightforward wrapping of the C call object +class Call final { + public: + Call(grpc_call *call, ChannelInterface *channel); + + void PerformOps(const CallOpBuffer &buffer, void *tag); + + private: + ChannelInterface *const channel_; +}; + +} // namespace grpc + +#endif // __GRPCPP_CALL_INTERFACE_H__ diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 9ed35422b85..4f1e1911e6a 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -39,30 +39,40 @@ namespace google { namespace protobuf { class Message; -} -} +} // namespace protobuf +} // namespace google + +struct grpc_call; namespace grpc { class ClientContext; +class CompletionQueue; class RpcMethod; class StreamContextInterface; +class CallInterface; class ChannelInterface { public: virtual ~ChannelInterface() {} - virtual Status StartBlockingRpc(const RpcMethod& method, - ClientContext* context, - const google::protobuf::Message& request, - google::protobuf::Message* result) = 0; - - virtual StreamContextInterface* CreateStream( - const RpcMethod& method, ClientContext* context, - const google::protobuf::Message* request, - google::protobuf::Message* result) = 0; + virtual grpc_call *CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq); }; +// Wrapper that begins an asynchronous unary call +void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result, Status *status, + CompletionQueue *cq, void *tag); + +// Wrapper that performs a blocking unary call +Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); + } // namespace grpc #endif // __GRPCPP_CHANNEL_INTERFACE_H__ diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 4e8c1071c03..a60d27f4382 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -49,7 +49,9 @@ class CompletionQueue { // Blocking read from queue. // Returns true if an event was received, false if the queue is ready // for destruction. - bool Next(void** tag); + bool Next(void **tag, bool *ok); + + bool Pluck(void *tag); // Prepare a tag for the C api // Given a tag we'd like to receive from Next, what tag should we pass diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 5fa371ba626..3931d9a1bce 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -48,8 +48,8 @@ struct grpc_server; namespace google { namespace protobuf { class Message; -} -} +} // namespace protobuf +} // namespace google namespace grpc { class AsyncServerContext; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index b8982f4d93d..5c538431f54 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -34,6 +34,9 @@ #ifndef __GRPCPP_STREAM_H__ #define __GRPCPP_STREAM_H__ +#include +#include +#include #include #include #include @@ -45,16 +48,12 @@ class ClientStreamingInterface { public: virtual ~ClientStreamingInterface() {} - // Try to cancel the stream. Wait() still needs to be called to get the final - // status. Cancelling after the stream has finished has no effects. - virtual void Cancel() = 0; - // Wait until the stream finishes, and return the final status. When the // client side declares it has no more message to send, either implicitly or // by calling WritesDone, it needs to make sure there is no more message to // be received from the server, either implicitly or by getting a false from // a Read(). Otherwise, this implicitly cancels the stream. - virtual const Status& Wait() = 0; + virtual Status Finish() = 0; }; // An interface that yields a sequence of R messages. @@ -82,95 +81,127 @@ class WriterInterface { }; template -class ClientReader : public ClientStreamingInterface, - public ReaderInterface { +class ClientReader final : public ClientStreamingInterface, + public ReaderInterface { public: // Blocking create a stream and write the first request out. - explicit ClientReader(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - context_->Write(context_->request(), true); + explicit ClientReader(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request) + : call_(channel->CreateCall(method, context, &cq_), channel) { + CallOpBuffer buf; + buf.AddSendMessage(request); + buf.AddClientSendClose(); + call_.PerformOps(buf, (void *)1); + cq_.Pluck((void *)1); } - ~ClientReader() { delete context_; } - - virtual bool Read(R* msg) { return context_->Read(msg); } - - virtual void Cancel() { context_->Cancel(); } + virtual bool Read(R *msg) { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_.PerformOps(buf, (void *)2); + return cq_.Pluck((void *)2); + } - virtual const Status& Wait() { return context_->Wait(); } + virtual Status Finish() override { + CallOpBuffer buf; + Status status; + buf.AddClientRecvStatus(&status); + call_.PerformOps(buf, (void *)3); + GPR_ASSERT(cq_.Pluck((void *)3)); + return status; + } private: - StreamContextInterface* const context_; + CompletionQueue cq_; + Call call_; }; template -class ClientWriter : public ClientStreamingInterface, - public WriterInterface { +class ClientWriter final : public ClientStreamingInterface, + public WriterInterface { public: // Blocking create a stream. - explicit ClientWriter(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(false); - } - - ~ClientWriter() { delete context_; } + explicit ClientWriter(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + google::protobuf::Message *response) + : response_(response), + call_(channel->CreateCall(method, context, &cq_), channel) {} virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_.PerformOps(buf, (void *)2); + return cq_.Pluck((void *)2); } - virtual void WritesDone() { context_->Write(nullptr, true); } - - virtual void Cancel() { context_->Cancel(); } + virtual bool WritesDone() { + CallOpBuffer buf; + buf.AddClientSendClose(); + call_.PerformOps(buf, (void *)3); + return cq_.Pluck((void *)3); + } // Read the final response and wait for the final status. - virtual const Status& Wait() { - bool success = context_->Read(context_->response()); - if (!success) { - Cancel(); - } else { - success = context_->Read(nullptr); - if (success) { - Cancel(); - } - } - return context_->Wait(); + virtual Status Finish() override { + CallOpBuffer buf; + Status status; + buf.AddClientRecvStatus(&status); + call_.PerformOps(buf, (void *)4); + GPR_ASSERT(cq_.Pluck((void *)4)); + return status; } private: - StreamContextInterface* const context_; + google::protobuf::Message *const response_; + CompletionQueue cq_; + Call call_; }; // Client-side interface for bi-directional streaming. template -class ClientReaderWriter : public ClientStreamingInterface, - public WriterInterface, - public ReaderInterface { +class ClientReaderWriter final : public ClientStreamingInterface, + public WriterInterface, + public ReaderInterface { public: // Blocking create a stream. - explicit ClientReaderWriter(StreamContextInterface* context) - : context_(context) { - GPR_ASSERT(context_); - context_->Start(false); + explicit ClientReaderWriter(ChannelInterface *channel, + const RpcMethod &method, ClientContext *context) + : call_(channel->CreateCall(method, context, &cq_), channel) {} + + virtual bool Read(R *msg) { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_.PerformOps(buf, (void *)2); + return cq_.Pluck((void *)2); } - ~ClientReaderWriter() { delete context_; } - - virtual bool Read(R* msg) { return context_->Read(msg); } - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_.PerformOps(buf, (void *)3); + return cq_.Pluck((void *)3); } - virtual void WritesDone() { context_->Write(nullptr, true); } - - virtual void Cancel() { context_->Cancel(); } + virtual bool WritesDone() { + CallOpBuffer buf; + buf.AddClientSendClose(); + call_.PerformOps(buf, (void *)4); + return cq_.Pluck((void *)4); + } - virtual const Status& Wait() { return context_->Wait(); } + virtual Status Finish() override { + CallOpBuffer buf; + Status status; + buf.AddClientRecvStatus(&status); + call_.PerformOps(buf, (void *)5); + GPR_ASSERT(cq_.Pluck((void *)5)); + return status; + } private: - StreamContextInterface* const context_; + CompletionQueue cq_; + Call call_; }; template diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 8724f97e8be..cd537f9e8c3 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -268,7 +268,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientContext* context, " "const $Request$& request, $Response$* response) {\n"); printer->Print(*vars, - " return channel()->StartBlockingRpc(" + "return ::grpc::BlockingUnaryCall(channel()," "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\"), " "context, request, response);\n" "}\n\n"); @@ -279,10 +279,10 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientContext* context, $Response$* response) {\n"); printer->Print(*vars, " return new ::grpc::ClientWriter< $Request$>(" - "channel()->CreateStream(" + "channel()," "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " - "context, nullptr, response));\n" + "context, response);\n" "}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( @@ -291,10 +291,10 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientContext* context, const $Request$* request) {\n"); printer->Print(*vars, " return new ::grpc::ClientReader< $Response$>(" - "channel()->CreateStream(" + "channel()," "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " - "context, request, nullptr));\n" + "context, *request);\n" "}\n\n"); } else if (BidiStreaming(method)) { printer->Print( @@ -304,10 +304,10 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, printer->Print( *vars, " return new ::grpc::ClientReaderWriter< $Request$, $Response$>(" - "channel()->CreateStream(" + "channel()," "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " - "context, nullptr, nullptr));\n" + "context);\n" "}\n\n"); } } diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 3f39364bda2..2bc1001935c 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -77,103 +77,13 @@ Channel::Channel(const grpc::string &target, Channel::~Channel() { grpc_channel_destroy(c_channel_); } -namespace { -// Pluck the finished event and set to status when it is not nullptr. -void GetFinalStatus(grpc_completion_queue *cq, void *finished_tag, - Status *status) { - grpc_event *ev = - grpc_completion_queue_pluck(cq, finished_tag, gpr_inf_future); - if (status) { - StatusCode error_code = static_cast(ev->data.finished.status); - grpc::string details(ev->data.finished.details ? ev->data.finished.details - : ""); - *status = Status(error_code, details); - } - grpc_event_finish(ev); -} -} // namespace - -// TODO(yangg) more error handling -Status Channel::StartBlockingRpc(const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result) { - Status status; - grpc_call *call = grpc_channel_create_call_old( - c_channel_, method.name(), target_.c_str(), context->RawDeadline()); - context->set_call(call); - - grpc_event *ev; - void *finished_tag = reinterpret_cast(call); - void *metadata_read_tag = reinterpret_cast(call) + 2; - void *write_tag = reinterpret_cast(call) + 3; - void *halfclose_tag = reinterpret_cast(call) + 4; - void *read_tag = reinterpret_cast(call) + 5; - - grpc_completion_queue *cq = grpc_completion_queue_create(); - context->set_cq(cq); - // add_metadata from context - // - // invoke - GPR_ASSERT(grpc_call_invoke_old(call, cq, metadata_read_tag, finished_tag, - GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); - // write request - grpc_byte_buffer *write_buffer = nullptr; - bool success = SerializeProto(request, &write_buffer); - if (!success) { - grpc_call_cancel(call); - status = - Status(StatusCode::DATA_LOSS, "Failed to serialize request proto."); - GetFinalStatus(cq, finished_tag, nullptr); - return status; - } - GPR_ASSERT(grpc_call_start_write_old(call, write_buffer, write_tag, - GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); - grpc_byte_buffer_destroy(write_buffer); - ev = grpc_completion_queue_pluck(cq, write_tag, gpr_inf_future); - - success = ev->data.write_accepted == GRPC_OP_OK; - grpc_event_finish(ev); - if (!success) { - GetFinalStatus(cq, finished_tag, &status); - return status; - } - // writes done - GPR_ASSERT(grpc_call_writes_done_old(call, halfclose_tag) == GRPC_CALL_OK); - ev = grpc_completion_queue_pluck(cq, halfclose_tag, gpr_inf_future); - grpc_event_finish(ev); - // start read metadata - // - ev = grpc_completion_queue_pluck(cq, metadata_read_tag, gpr_inf_future); - grpc_event_finish(ev); - // start read - GPR_ASSERT(grpc_call_start_read_old(call, read_tag) == GRPC_CALL_OK); - ev = grpc_completion_queue_pluck(cq, read_tag, gpr_inf_future); - if (ev->data.read) { - if (!DeserializeProto(ev->data.read, result)) { - grpc_event_finish(ev); - status = Status(StatusCode::DATA_LOSS, "Failed to parse response proto."); - GetFinalStatus(cq, finished_tag, nullptr); - return status; - } - } - grpc_event_finish(ev); - - // wait status - GetFinalStatus(cq, finished_tag, &status); - return status; -} - -StreamContextInterface *Channel::CreateStream( - const RpcMethod &method, ClientContext *context, - const google::protobuf::Message *request, - google::protobuf::Message *result) { - grpc_call *call = grpc_channel_create_call_old( - c_channel_, method.name(), target_.c_str(), context->RawDeadline()); - context->set_call(call); - grpc_completion_queue *cq = grpc_completion_queue_create(); - context->set_cq(cq); - return new StreamContext(method, context, request, result); +grpc_call *Channel::CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq) { + auto c_call = + grpc_channel_create_call(c_channel_, cq->cq(), method.name(), + target_.c_str(), context->RawDeadline()); + context->set_call(c_call); + return c_call; } } // namespace grpc diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 67d18bf4c89..84014b3cea7 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -43,10 +43,11 @@ struct grpc_channel; namespace grpc { class ChannelArguments; +class CompletionQueue; class Credentials; class StreamContextInterface; -class Channel : public ChannelInterface { +class Channel final : public ChannelInterface { public: Channel(const grpc::string &target, const ChannelArguments &args); Channel(const grpc::string &target, const std::unique_ptr &creds, @@ -54,14 +55,8 @@ class Channel : public ChannelInterface { ~Channel() override; - Status StartBlockingRpc(const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result) override; - - StreamContextInterface *CreateStream( - const RpcMethod &method, ClientContext *context, - const google::protobuf::Message *request, - google::protobuf::Message *result) override; + virtual grpc_call *CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq); private: const grpc::string target_; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc new file mode 100644 index 00000000000..f415f7e72ff --- /dev/null +++ b/src/cpp/common/call.cc @@ -0,0 +1,42 @@ +/* + * + * Copyright 2014, 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 + +namespace grpc { + +void Call::PerformOps(const CallOpBuffer& buffer, void* tag) { + channel_->PerformOpsOnCall(buffer, tag, call_); +} + +} // namespace grpc diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index a1a858ae2e0..72edfeb14e4 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -55,19 +55,16 @@ class EventDeleter { void operator()(grpc_event *ev) { if (ev) grpc_event_finish(ev); } }; -bool CompletionQueue::Next(void **tag) { +bool CompletionQueue::Next(void **tag, bool *ok) { std::unique_ptr ev; ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); - if (!ev) { - gpr_log(GPR_ERROR, "no next event in queue"); - abort(); - } if (ev->type == GRPC_QUEUE_SHUTDOWN) { return false; } std::unique_ptr func(static_cast(ev->tag)); *tag = (*func)(); + *ok = (ev->data.op_complete == GRPC_OP_OK); return true; } diff --git a/src/cpp/server/server_rpc_handler.h b/src/cpp/server/server_rpc_handler.h index a43e07dc5f9..ec8ec2c330b 100644 --- a/src/cpp/server/server_rpc_handler.h +++ b/src/cpp/server/server_rpc_handler.h @@ -53,7 +53,6 @@ class ServerRpcHandler { void StartRpc(); private: - CompletionQueue::CompletionType WaitForNextEvent(); void FinishRpc(const Status &status); std::unique_ptr async_server_context_; From 50950712c1f16d5a9b3e44878c7215e4bee0944c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 10:38:38 -0800 Subject: [PATCH 003/232] Further progress --- include/grpc++/call.h | 34 +++++++++++++++++++++--------- include/grpc++/channel_interface.h | 8 ++++--- include/grpc++/completion_queue.h | 24 ++++++++++++--------- include/grpc++/stream.h | 26 +++++++++++------------ src/cpp/client/channel.cc | 18 +++++++++++++--- src/cpp/client/channel.h | 8 +++++-- src/cpp/common/call.cc | 3 ++- src/cpp/common/completion_queue.cc | 7 +++--- 8 files changed, 83 insertions(+), 45 deletions(-) diff --git a/include/grpc++/call.h b/include/grpc++/call.h index 704cd47daec..8cddf78a6be 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -35,7 +35,9 @@ #define __GRPCPP_CALL_H__ #include -#include +#include + +#include namespace google { namespace protobuf { @@ -44,35 +46,47 @@ class Message; } // namespace google struct grpc_call; +struct grpc_op; namespace grpc { class ChannelInterface; -class CallOpBuffer final { +class CallOpBuffer final : public CompletionQueueTag { public: void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(Status *status); - void FinalizeResult(); + // INTERNAL API: - private: - static const size_t MAX_OPS = 6; - grpc_op ops_[MAX_OPS]; - int num_ops_ = 0; + // Convert to an array of grpc_op elements + void FillOps(grpc_op *ops, size_t *nops); + + // Called by completion queue just prior to returning from Next() or Pluck() + void FinalizeResult() override; +}; + +class CCallDeleter { + public: + void operator()(grpc_call *c); }; // Straightforward wrapping of the C call object class Call final { public: - Call(grpc_call *call, ChannelInterface *channel); + Call(grpc_call *call, ChannelInterface *channel, CompletionQueue *cq); + + void PerformOps(CallOpBuffer *buffer, void *tag); - void PerformOps(const CallOpBuffer &buffer, void *tag); + grpc_call *call() { return call_.get(); } + CompletionQueue *cq() { return cq_; } private: - ChannelInterface *const channel_; + ChannelInterface *channel_; + CompletionQueue *cq_; + std::unique_ptr call_; }; } // namespace grpc diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 4f1e1911e6a..452c7857339 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -45,7 +45,8 @@ class Message; struct grpc_call; namespace grpc { - +class Call; +class CallOpBuffer; class ClientContext; class CompletionQueue; class RpcMethod; @@ -56,8 +57,9 @@ class ChannelInterface { public: virtual ~ChannelInterface() {} - virtual grpc_call *CreateCall(const RpcMethod &method, ClientContext *context, - CompletionQueue *cq); + virtual Call CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq) = 0; + virtual void PerformOpsOnCall(CallOpBuffer *ops, void *tag, Call *call) = 0; }; // Wrapper that begins an asynchronous unary call diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index a60d27f4382..4bc707e5536 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -34,12 +34,21 @@ #ifndef __GRPCPP_COMPLETION_QUEUE_H__ #define __GRPCPP_COMPLETION_QUEUE_H__ -#include - struct grpc_completion_queue; namespace grpc { +class CompletionQueue; + +class CompletionQueueTag { + public: + virtual void FinalizeResult() = 0; + + private: + friend class CompletionQueue; + void *user_tag_; +}; + // grpc_completion_queue wrapper class class CompletionQueue { public: @@ -62,12 +71,9 @@ class CompletionQueue { // is returned. // MUST be used for all events that could be surfaced through this // wrapping API - template - void *PrepareTagForC(void *user_tag, F on_ready) { - return new std::function([user_tag, on_ready]() { - on_ready(); - return user_tag; - }); + void *PrepareTagForC(CompletionQueueTag *cq_tag, void *user_tag) { + cq_tag->user_tag_ = user_tag; + return cq_tag; } // Shutdown has to be called, and the CompletionQueue can only be @@ -77,8 +83,6 @@ class CompletionQueue { grpc_completion_queue* cq() { return cq_; } private: - typedef std::function FinishFunc; - grpc_completion_queue* cq_; // owned }; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 5c538431f54..dce07b69592 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -88,18 +88,18 @@ class ClientReader final : public ClientStreamingInterface, explicit ClientReader(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request) - : call_(channel->CreateCall(method, context, &cq_), channel) { + : call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendMessage(request); buf.AddClientSendClose(); - call_.PerformOps(buf, (void *)1); + call_.PerformOps(&buf, (void *)1); cq_.Pluck((void *)1); } virtual bool Read(R *msg) { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(buf, (void *)2); + call_.PerformOps(&buf, (void *)2); return cq_.Pluck((void *)2); } @@ -107,7 +107,7 @@ class ClientReader final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddClientRecvStatus(&status); - call_.PerformOps(buf, (void *)3); + call_.PerformOps(&buf, (void *)3); GPR_ASSERT(cq_.Pluck((void *)3)); return status; } @@ -126,19 +126,19 @@ class ClientWriter final : public ClientStreamingInterface, ClientContext *context, google::protobuf::Message *response) : response_(response), - call_(channel->CreateCall(method, context, &cq_), channel) {} + call_(channel->CreateCall(method, context, &cq_)) {} virtual bool Write(const W& msg) { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(buf, (void *)2); + call_.PerformOps(&buf, (void *)2); return cq_.Pluck((void *)2); } virtual bool WritesDone() { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(buf, (void *)3); + call_.PerformOps(&buf, (void *)3); return cq_.Pluck((void *)3); } @@ -147,7 +147,7 @@ class ClientWriter final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddClientRecvStatus(&status); - call_.PerformOps(buf, (void *)4); + call_.PerformOps(&buf, (void *)4); GPR_ASSERT(cq_.Pluck((void *)4)); return status; } @@ -167,26 +167,26 @@ class ClientReaderWriter final : public ClientStreamingInterface, // Blocking create a stream. explicit ClientReaderWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context) - : call_(channel->CreateCall(method, context, &cq_), channel) {} + : call_(channel->CreateCall(method, context, &cq_)) {} virtual bool Read(R *msg) { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(buf, (void *)2); + call_.PerformOps(&buf, (void *)2); return cq_.Pluck((void *)2); } virtual bool Write(const W& msg) { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(buf, (void *)3); + call_.PerformOps(&buf, (void *)3); return cq_.Pluck((void *)3); } virtual bool WritesDone() { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(buf, (void *)4); + call_.PerformOps(&buf, (void *)4); return cq_.Pluck((void *)4); } @@ -194,7 +194,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddClientRecvStatus(&status); - call_.PerformOps(buf, (void *)5); + call_.PerformOps(&buf, (void *)5); GPR_ASSERT(cq_.Pluck((void *)5)); return status; } diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 2bc1001935c..b5132129033 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -43,8 +43,10 @@ #include "src/cpp/proto/proto_utils.h" #include "src/cpp/stream/stream_context.h" +#include #include #include +#include #include #include #include @@ -77,13 +79,23 @@ Channel::Channel(const grpc::string &target, Channel::~Channel() { grpc_channel_destroy(c_channel_); } -grpc_call *Channel::CreateCall(const RpcMethod &method, ClientContext *context, - CompletionQueue *cq) { +Call Channel::CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq) { auto c_call = grpc_channel_create_call(c_channel_, cq->cq(), method.name(), target_.c_str(), context->RawDeadline()); context->set_call(c_call); - return c_call; + return Call(c_call, this, cq); +} + +void Channel::PerformOpsOnCall(CallOpBuffer *buf, void *tag, Call *call) { + static const size_t MAX_OPS = 8; + size_t nops = MAX_OPS; + grpc_op ops[MAX_OPS]; + buf->FillOps(ops, &nops); + GPR_ASSERT(GRPC_CALL_OK == + grpc_call_start_batch(call->call(), ops, nops, + call->cq()->PrepareTagForC(buf, tag))); } } // namespace grpc diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 84014b3cea7..6cf222883c2 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -42,6 +42,8 @@ struct grpc_channel; namespace grpc { +class Call; +class CallOpBuffer; class ChannelArguments; class CompletionQueue; class Credentials; @@ -55,8 +57,10 @@ class Channel final : public ChannelInterface { ~Channel() override; - virtual grpc_call *CreateCall(const RpcMethod &method, ClientContext *context, - CompletionQueue *cq); + virtual Call CreateCall(const RpcMethod &method, ClientContext *context, + CompletionQueue *cq) override; + virtual void PerformOpsOnCall(CallOpBuffer *ops, void *tag, + Call *call) override; private: const grpc::string target_; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index f415f7e72ff..6ae6c6cdb8d 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -32,10 +32,11 @@ */ #include +#include namespace grpc { -void Call::PerformOps(const CallOpBuffer& buffer, void* tag) { +void Call::PerformOps(CallOpBuffer* buffer, void* tag) { channel_->PerformOpsOnCall(buffer, tag, call_); } diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 72edfeb14e4..383b66c519d 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -62,9 +62,10 @@ bool CompletionQueue::Next(void **tag, bool *ok) { if (ev->type == GRPC_QUEUE_SHUTDOWN) { return false; } - std::unique_ptr func(static_cast(ev->tag)); - *tag = (*func)(); - *ok = (ev->data.op_complete == GRPC_OP_OK); + auto cq_tag = static_cast(ev->tag); + cq_tag->FinalizeResult(); + *tag = cq_tag->user_tag_; + *ok = ev->status.op_complete == GRPC_OP_OK; return true; } From a24496716aadf404c30e4ff08383148f29468d07 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 10:44:18 -0800 Subject: [PATCH 004/232] Add call.cc --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index ab66b6f652e..29f8d7c24f9 100644 --- a/Makefile +++ b/Makefile @@ -2632,6 +2632,7 @@ LIBGRPC++_SRC = \ src/cpp/client/create_channel.cc \ src/cpp/client/credentials.cc \ src/cpp/client/internal_stub.cc \ + src/cpp/common/call.cc \ src/cpp/common/completion_queue.cc \ src/cpp/common/rpc_method.cc \ src/cpp/proto/proto_utils.cc \ @@ -2691,6 +2692,7 @@ src/cpp/client/client_context.cc: $(OPENSSL_DEP) src/cpp/client/create_channel.cc: $(OPENSSL_DEP) src/cpp/client/credentials.cc: $(OPENSSL_DEP) src/cpp/client/internal_stub.cc: $(OPENSSL_DEP) +src/cpp/common/call.cc: $(OPENSSL_DEP) src/cpp/common/completion_queue.cc: $(OPENSSL_DEP) src/cpp/common/rpc_method.cc: $(OPENSSL_DEP) src/cpp/proto/proto_utils.cc: $(OPENSSL_DEP) @@ -2751,6 +2753,7 @@ objs/$(CONFIG)/src/cpp/client/client_context.o: objs/$(CONFIG)/src/cpp/client/create_channel.o: objs/$(CONFIG)/src/cpp/client/credentials.o: objs/$(CONFIG)/src/cpp/client/internal_stub.o: +objs/$(CONFIG)/src/cpp/common/call.o: objs/$(CONFIG)/src/cpp/common/completion_queue.o: objs/$(CONFIG)/src/cpp/common/rpc_method.o: objs/$(CONFIG)/src/cpp/proto/proto_utils.o: From 7f78d71b8dfe1b9433b733d2aec5e26a63c5341b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 10:47:32 -0800 Subject: [PATCH 005/232] Add initial metadata stub --- include/grpc++/call.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/grpc++/call.h b/include/grpc++/call.h index 8cddf78a6be..fe9175625d7 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -54,6 +54,7 @@ class ChannelInterface; class CallOpBuffer final : public CompletionQueueTag { public: + void AddSendInitialMetadata(std::vector > *metadata); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); From df2c957eee7f5906dcbb174bee2ae4652c268d3b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 10:49:38 -0800 Subject: [PATCH 006/232] Fix compile error --- include/grpc++/call.h | 1 + include/grpc++/config.h | 3 ++- src/cpp/common/call.cc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/grpc++/call.h b/include/grpc++/call.h index fe9175625d7..8d9412c9b6a 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -38,6 +38,7 @@ #include #include +#include namespace google { namespace protobuf { diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 52913fbf0f9..1b4b463d359 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -39,6 +39,7 @@ namespace grpc { typedef std::string string; -} + +} // namespace grpc #endif // __GRPCPP_CONFIG_H__ diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 6ae6c6cdb8d..9f8d9364b18 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -37,7 +37,7 @@ namespace grpc { void Call::PerformOps(CallOpBuffer* buffer, void* tag) { - channel_->PerformOpsOnCall(buffer, tag, call_); + channel_->PerformOpsOnCall(buffer, tag, this); } } // namespace grpc From 82ee98cc0d1ecc89b6a9d697087c3348fad7f6d5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 10:50:20 -0800 Subject: [PATCH 007/232] Fix compile error --- src/cpp/common/completion_queue.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 383b66c519d..a68c807dd22 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -65,7 +65,7 @@ bool CompletionQueue::Next(void **tag, bool *ok) { auto cq_tag = static_cast(ev->tag); cq_tag->FinalizeResult(); *tag = cq_tag->user_tag_; - *ok = ev->status.op_complete == GRPC_OP_OK; + *ok = ev->data.op_complete == GRPC_OP_OK; return true; } From 2dff17d33bd1487365880f2123a46494ce69681c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 12:42:23 -0800 Subject: [PATCH 008/232] Async API declarations --- include/grpc++/stream.h | 69 +++++++++++++++++++++++ src/compiler/cpp_generator.cc | 90 +++++++++++++++++++++++++++--- src/cpp/common/completion_queue.cc | 1 - 3 files changed, 150 insertions(+), 10 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index dce07b69592..d0abd586ad1 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -256,6 +256,75 @@ class ServerReaderWriter : public WriterInterface, StreamContextInterface* const context_; // not owned }; +template +class ServerAsyncResponseWriter { + public: + explicit ServerAsyncResponseWriter(StreamContextInterface* context) : context_(context) { + GPR_ASSERT(context_); + context_->Start(true); + context_->Read(context_->request()); + } + + virtual bool Write(const W& msg) { + return context_->Write(const_cast(&msg), false); + } + + private: + StreamContextInterface* const context_; // not owned +}; + +template +class ServerAsyncReader : public ReaderInterface { + public: + explicit ServerAsyncReader(StreamContextInterface* context) : context_(context) { + GPR_ASSERT(context_); + context_->Start(true); + } + + virtual bool Read(R* msg) { return context_->Read(msg); } + + private: + StreamContextInterface* const context_; // not owned +}; + +template +class ServerAsyncWriter : public WriterInterface { + public: + explicit ServerAsyncWriter(StreamContextInterface* context) : context_(context) { + GPR_ASSERT(context_); + context_->Start(true); + context_->Read(context_->request()); + } + + virtual bool Write(const W& msg) { + return context_->Write(const_cast(&msg), false); + } + + private: + StreamContextInterface* const context_; // not owned +}; + +// Server-side interface for bi-directional streaming. +template +class ServerAsyncReaderWriter : public WriterInterface, + public ReaderInterface { + public: + explicit ServerAsyncReaderWriter(StreamContextInterface* context) + : context_(context) { + GPR_ASSERT(context_); + context_->Start(true); + } + + virtual bool Read(R* msg) { return context_->Read(msg); } + + virtual bool Write(const W& msg) { + return context_->Write(const_cast(&msg), false); + } + + private: + StreamContextInterface* const context_; // not owned +}; + } // namespace grpc #endif // __GRPCPP_STREAM_H__ diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index cd537f9e8c3..1814bfa4f7f 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -61,6 +61,17 @@ bool BidiStreaming(const google::protobuf::MethodDescriptor *method) { return method->client_streaming() && method->server_streaming(); } +bool HasUnaryCalls(const google::protobuf::FileDescriptor *file) { + for (int i = 0; i < file->service_count(); i++) { + for (int j = 0; j < file->service(i)->method_count(); j++) { + if (NoStreaming(file->service(i)->method(j))) { + return true; + } + } + } + return false; +} + bool HasClientOnlyStreaming(const google::protobuf::FileDescriptor *file) { for (int i = 0; i < file->service_count(); i++) { for (int j = 0; j < file->service(i)->method_count(); j++) { @@ -104,13 +115,20 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { "class ChannelInterface;\n" "class RpcService;\n" "class ServerContext;\n"; + if (HasUnaryCalls(file)) { + temp.append("template class ServerAsyncResponseWriter;\n"); + } if (HasClientOnlyStreaming(file)) { temp.append("template class ClientWriter;\n"); temp.append("template class ServerReader;\n"); + temp.append("template class ClientAsyncWriter;\n"); + temp.append("template class ServerAsyncReader;\n"); } if (HasServerOnlyStreaming(file)) { temp.append("template class ClientReader;\n"); temp.append("template class ServerWriter;\n"); + temp.append("template class ClientAsyncReader;\n"); + temp.append("template class ServerAsyncWriter;\n"); } if (HasBidiStreaming(file)) { temp.append( @@ -125,10 +143,10 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { } std::string GetSourceIncludes() { - return "#include \"grpc++/channel_interface.h\"\n" - "#include \"grpc++/impl/rpc_method.h\"\n" - "#include \"grpc++/impl/rpc_service_method.h\"\n" - "#include \"grpc++/stream.h\"\n"; + return "#include \n" + "#include \n" + "#include \n" + "#include \n"; } void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, @@ -160,7 +178,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, } } -void PrintHeaderServerMethod(google::protobuf::io::Printer *printer, +void PrintHeaderServerMethodSync(google::protobuf::io::Printer *printer, const google::protobuf::MethodDescriptor *method, std::map *vars) { (*vars)["Method"] = method->name(); @@ -194,19 +212,56 @@ void PrintHeaderServerMethod(google::protobuf::io::Printer *printer, } } +void PrintHeaderServerMethodAsync(google::protobuf::io::Printer *printer, + const google::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["Method"] = method->name(); + (*vars)["Request"] = + grpc_cpp_generator::ClassName(method->input_type(), true); + (*vars)["Response"] = + grpc_cpp_generator::ClassName(method->output_type(), true); + if (NoStreaming(method)) { + printer->Print(*vars, + "void $Method$(" + "::grpc::ServerContext* context, $Request$* request, " + "::grpc::ServerAsyncResponseWriter< $Response$>* response, " + "::grpc::CompletionQueue* cq, void *tag);\n"); + } else if (ClientOnlyStreaming(method)) { + printer->Print(*vars, + "void $Method$(" + "::grpc::ServerContext* context, " + "::grpc::ServerAsyncReader< $Request$>* reader, " + "$Response$* response, " + "::grpc::CompletionQueue* cq, void *tag);\n"); + } else if (ServerOnlyStreaming(method)) { + printer->Print(*vars, + "void $Method$(" + "::grpc::ServerContext* context, $Request$* request, " + "::grpc::ServerAsyncWriter< $Response$>* writer, " + "::grpc::CompletionQueue* cq, void *tag);\n"); + } else if (BidiStreaming(method)) { + printer->Print( + *vars, + "void $Method$(" + "::grpc::ServerContext* context, " + "::grpc::ServerReaderWriter< $Response$, $Request$>* stream, " + "::grpc::CompletionQueue* cq, void *tag);\n"); + } +} + void PrintHeaderService(google::protobuf::io::Printer *printer, const google::protobuf::ServiceDescriptor *service, std::map *vars) { (*vars)["Service"] = service->name(); printer->Print(*vars, - "class $Service$ {\n" + "class $Service$ final {\n" " public:\n"); printer->Indent(); // Client side printer->Print( - "class Stub : public ::grpc::InternalStub {\n" + "class Stub final : public ::grpc::InternalStub {\n" " public:\n"); printer->Indent(); for (int i = 0; i < service->method_count(); ++i) { @@ -220,7 +275,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, printer->Print("\n"); - // Server side + // Server side - Synchronous printer->Print( "class Service {\n" " public:\n"); @@ -228,7 +283,24 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, printer->Print("Service() : service_(nullptr) {}\n"); printer->Print("virtual ~Service();\n"); for (int i = 0; i < service->method_count(); ++i) { - PrintHeaderServerMethod(printer, service->method(i), vars); + PrintHeaderServerMethodSync(printer, service->method(i), vars); + } + printer->Print("::grpc::RpcService* service();\n"); + printer->Outdent(); + printer->Print( + " private:\n" + " ::grpc::RpcService* service_;\n"); + printer->Print("};\n"); + + // Server side - Asynchronous + printer->Print( + "class AsyncService final {\n" + " public:\n"); + printer->Indent(); + printer->Print("AsyncService() : service_(nullptr) {}\n"); + printer->Print("~AsyncService();\n"); + for (int i = 0; i < service->method_count(); ++i) { + PrintHeaderServerMethodAsync(printer, service->method(i), vars); } printer->Print("::grpc::RpcService* service();\n"); printer->Outdent(); diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index a68c807dd22..55adb5bea51 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -1,5 +1,4 @@ /* - * * Copyright 2014, Google Inc. * All rights reserved. * From 5ef5db1d463cf23b06357613387a6ec21915bbdc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 12:47:21 -0800 Subject: [PATCH 009/232] Async API declarations --- src/compiler/cpp_generator.cc | 50 ++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 15 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 1814bfa4f7f..37cde1af9a9 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -116,7 +116,8 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { "class RpcService;\n" "class ServerContext;\n"; if (HasUnaryCalls(file)) { - temp.append("template class ServerAsyncResponseWriter;\n"); + temp.append( + "template class ServerAsyncResponseWriter;\n"); } if (HasClientOnlyStreaming(file)) { temp.append("template class ClientWriter;\n"); @@ -160,27 +161,45 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, if (NoStreaming(method)) { printer->Print(*vars, "::grpc::Status $Method$(::grpc::ClientContext* context, " - "const $Request$& request, $Response$* response);\n\n"); + "const $Request$& request, $Response$* response);\n"); + printer->Print(*vars, + "void $Method$(::grpc::ClientContext* context, " + "const $Request$& request, $Response$* response, " + "Status *status, " + "CompletionQueue *cq, void *tag);\n"); } else if (ClientOnlyStreaming(method)) { - printer->Print( - *vars, - "::grpc::ClientWriter< $Request$>* $Method$(" - "::grpc::ClientContext* context, $Response$* response);\n\n"); + printer->Print(*vars, + "::grpc::ClientWriter< $Request$>* $Method$(" + "::grpc::ClientContext* context, $Response$* response);\n"); + printer->Print(*vars, + "::grpc::ClientWriter< $Request$>* $Method$(" + "::grpc::ClientContext* context, $Response$* response, " + "Status *status, " + "CompletionQueue *cq, void *tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, "::grpc::ClientReader< $Response$>* $Method$(" - "::grpc::ClientContext* context, const $Request$* request);\n\n"); + "::grpc::ClientContext* context, const $Request$* request);\n"); + printer->Print(*vars, + "::grpc::ClientReader< $Response$>* $Method$(" + "::grpc::ClientContext* context, const $Request$* request, " + "CompletionQueue *cq, void *tag);\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, "::grpc::ClientReaderWriter< $Request$, $Response$>* " - "$Method$(::grpc::ClientContext* context);\n\n"); + "$Method$(::grpc::ClientContext* context);\n"); + printer->Print(*vars, + "::grpc::ClientReaderWriter< $Request$, $Response$>* " + "$Method$(::grpc::ClientContext* context, " + "CompletionQueue *cq, void *tag);\n"); } } -void PrintHeaderServerMethodSync(google::protobuf::io::Printer *printer, - const google::protobuf::MethodDescriptor *method, - std::map *vars) { +void PrintHeaderServerMethodSync( + google::protobuf::io::Printer *printer, + const google::protobuf::MethodDescriptor *method, + std::map *vars) { (*vars)["Method"] = method->name(); (*vars)["Request"] = grpc_cpp_generator::ClassName(method->input_type(), true); @@ -212,9 +231,10 @@ void PrintHeaderServerMethodSync(google::protobuf::io::Printer *printer, } } -void PrintHeaderServerMethodAsync(google::protobuf::io::Printer *printer, - const google::protobuf::MethodDescriptor *method, - std::map *vars) { +void PrintHeaderServerMethodAsync( + google::protobuf::io::Printer *printer, + const google::protobuf::MethodDescriptor *method, + std::map *vars) { (*vars)["Method"] = method->name(); (*vars)["Request"] = grpc_cpp_generator::ClassName(method->input_type(), true); @@ -245,7 +265,7 @@ void PrintHeaderServerMethodAsync(google::protobuf::io::Printer *printer, "void $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerReaderWriter< $Response$, $Request$>* stream, " - "::grpc::CompletionQueue* cq, void *tag);\n"); + "::grpc::CompletionQueue* cq, void *tag);\n"); } } From 14a65f976060a68982b6e17a8cb76fb770579afb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 13:13:14 -0800 Subject: [PATCH 010/232] Further progress --- include/grpc++/impl/rpc_service_method.h | 2 +- include/grpc++/impl/service_type.h | 54 ++++++++++++++++++++++++ include/grpc++/server_builder.h | 7 ++- src/compiler/cpp_generator.cc | 22 +++++----- src/cpp/server/server_builder.cc | 9 +++- 5 files changed, 80 insertions(+), 14 deletions(-) create mode 100644 include/grpc++/impl/service_type.h diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 620de5e67fb..3077e0af66c 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -203,7 +203,7 @@ class RpcService { public: // Takes ownership. void AddMethod(RpcServiceMethod* method) { - methods_.push_back(std::unique_ptr(method)); + methods_.emplace_back(method); } RpcServiceMethod* GetMethod(int i) { return methods_[i].get(); } diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h new file mode 100644 index 00000000000..6e50c43493c --- /dev/null +++ b/include/grpc++/impl/service_type.h @@ -0,0 +1,54 @@ +/* + * + * Copyright 2014, 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. + * + */ + +#ifndef __GRPCPP_IMPL_SERVICE_TYPE_H__ +#define __GRPCPP_IMPL_SERVICE_TYPE_H__ + +namespace grpc { + +class RpcService; + +class SynchronousService { + public: + virtual ~SynchronousService() {} + virtual RpcService *service() = 0; +}; + +class AsynchronousService { + public: + virtual ~AsynchronousService() {} +}; + +} // namespace grpc + +#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index cf274520107..f9a40b302d3 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -41,9 +41,11 @@ namespace grpc { +class AsynchronousService; class RpcService; class Server; class ServerCredentials; +class SynchronousService; class ThreadPoolInterface; class ServerBuilder { @@ -53,7 +55,9 @@ class ServerBuilder { // Register a service. This call does not take ownership of the service. // The service must exist for the lifetime of the Server instance returned by // BuildAndStart(). - void RegisterService(RpcService* service); + void RegisterService(SynchronousService* service); + + void ReigsterAsyncService(AsynchronousService *service); // Add a listening port. Can be called multiple times. void AddPort(const grpc::string& addr); @@ -71,6 +75,7 @@ class ServerBuilder { private: std::vector services_; + std::vector async_services_; std::vector ports_; std::shared_ptr creds_; ThreadPoolInterface* thread_pool_; diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 37cde1af9a9..ecae429af50 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -108,8 +108,9 @@ bool HasBidiStreaming(const google::protobuf::FileDescriptor *file) { std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { std::string temp = - "#include \"grpc++/impl/internal_stub.h\"\n" - "#include \"grpc++/status.h\"\n" + "#include \n" + "#include \n" + "#include \n" "\n" "namespace grpc {\n" "class ChannelInterface;\n" @@ -147,6 +148,7 @@ std::string GetSourceIncludes() { return "#include \n" "#include \n" "#include \n" + "#include \n" "#include \n"; } @@ -165,8 +167,8 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "void $Method$(::grpc::ClientContext* context, " "const $Request$& request, $Response$* response, " - "Status *status, " - "CompletionQueue *cq, void *tag);\n"); + "::grpc::Status *status, " + "::grpc::CompletionQueue *cq, void *tag);\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, "::grpc::ClientWriter< $Request$>* $Method$(" @@ -174,8 +176,8 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientWriter< $Request$>* $Method$(" "::grpc::ClientContext* context, $Response$* response, " - "Status *status, " - "CompletionQueue *cq, void *tag);\n"); + "::grpc::Status *status, " + "::grpc::CompletionQueue *cq, void *tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, @@ -184,7 +186,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientReader< $Response$>* $Method$(" "::grpc::ClientContext* context, const $Request$* request, " - "CompletionQueue *cq, void *tag);\n"); + "::grpc::CompletionQueue *cq, void *tag);\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, "::grpc::ClientReaderWriter< $Request$, $Response$>* " @@ -192,7 +194,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientReaderWriter< $Request$, $Response$>* " "$Method$(::grpc::ClientContext* context, " - "CompletionQueue *cq, void *tag);\n"); + "::grpc::CompletionQueue *cq, void *tag);\n"); } } @@ -297,7 +299,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, // Server side - Synchronous printer->Print( - "class Service {\n" + "class Service : public ::grpc::SynchronousService {\n" " public:\n"); printer->Indent(); printer->Print("Service() : service_(nullptr) {}\n"); @@ -314,7 +316,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, // Server side - Asynchronous printer->Print( - "class AsyncService final {\n" + "class AsyncService final : public ::grpc::AsynchronousService {\n" " public:\n"); printer->Indent(); printer->Print("AsyncService() : service_(nullptr) {}\n"); diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index add22cc3d86..66e2055af09 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -34,14 +34,19 @@ #include #include +#include #include namespace grpc { ServerBuilder::ServerBuilder() : thread_pool_(nullptr) {} -void ServerBuilder::RegisterService(RpcService *service) { - services_.push_back(service); +void ServerBuilder::RegisterService(SynchronousService *service) { + services_.push_back(service->service()); +} + +void ServerBuilder::RegisterAsyncService(AsynchronousService *service) { + async_services_.push_back(service); } void ServerBuilder::AddPort(const grpc::string &addr) { From 5f4f0c3170941057b1243c78aae052004538888f Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 9 Feb 2015 13:45:28 -0800 Subject: [PATCH 011/232] remove explicit --- include/grpc++/stream.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index d0abd586ad1..fee70f4fdcf 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -85,9 +85,9 @@ class ClientReader final : public ClientStreamingInterface, public ReaderInterface { public: // Blocking create a stream and write the first request out. - explicit ClientReader(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request) + ClientReader(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request) : call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendMessage(request); From 0db1befae1a85c4a1d7a8ac09dd959555117827e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 13:47:39 -0800 Subject: [PATCH 012/232] Progress --- include/grpc++/server.h | 8 +++--- include/grpc++/server_builder.h | 4 +-- {src/core => include/grpc}/support/cpu.h | 0 src/cpp/server/server.cc | 33 ++++++++++++------------ src/cpp/server/server_builder.cc | 25 ++++++++++++++---- 5 files changed, 42 insertions(+), 28 deletions(-) rename {src/core => include/grpc}/support/cpu.h (100%) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 3931d9a1bce..ae86683f0b9 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -70,15 +70,15 @@ class Server { friend class ServerBuilder; // ServerBuilder use only - Server(ThreadPoolInterface* thread_pool, ServerCredentials* creds); + Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, ServerCredentials* creds); Server(); // Register a service. This call does not take ownership of the service. // The service must exist for the lifetime of the Server instance. - void RegisterService(RpcService* service); + bool RegisterService(RpcService* service); // Add a listening port. Can be called multiple times. - void AddPort(const grpc::string& addr); + int AddPort(const grpc::string& addr); // Start the server. - void Start(); + bool Start(); void AllowOneRpc(); void HandleQueueClosed(); diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index f9a40b302d3..8b4c81bc873 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -57,7 +57,7 @@ class ServerBuilder { // BuildAndStart(). void RegisterService(SynchronousService* service); - void ReigsterAsyncService(AsynchronousService *service); + void RegisterAsyncService(AsynchronousService *service); // Add a listening port. Can be called multiple times. void AddPort(const grpc::string& addr); @@ -78,7 +78,7 @@ class ServerBuilder { std::vector async_services_; std::vector ports_; std::shared_ptr creds_; - ThreadPoolInterface* thread_pool_; + ThreadPoolInterface* thread_pool_ = nullptr; }; } // namespace grpc diff --git a/src/core/support/cpu.h b/include/grpc/support/cpu.h similarity index 100% rename from src/core/support/cpu.h rename to include/grpc/support/cpu.h diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 1abdf702e21..ac1b9ddc505 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -38,24 +38,20 @@ #include #include #include "src/cpp/server/server_rpc_handler.h" -#include "src/cpp/server/thread_pool.h" #include #include #include #include +#include namespace grpc { -// TODO(rocking): consider a better default value like num of cores. -static const int kNumThreads = 4; - -Server::Server(ThreadPoolInterface *thread_pool, ServerCredentials *creds) +Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, ServerCredentials *creds) : started_(false), shutdown_(false), num_running_cb_(0), - thread_pool_(thread_pool == nullptr ? new ThreadPool(kNumThreads) - : thread_pool), - thread_pool_owned_(thread_pool == nullptr), + thread_pool_(thread_pool), + thread_pool_owned_(thread_pool_owned), secure_(creds != nullptr) { if (creds) { server_ = @@ -82,31 +78,35 @@ Server::~Server() { } } -void Server::RegisterService(RpcService *service) { +bool Server::RegisterService(RpcService *service) { for (int i = 0; i < service->GetMethodCount(); ++i) { RpcServiceMethod *method = service->GetMethod(i); + if (method_map_.find(method->name()) != method_map_.end()) { + gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); + return false; + } method_map_.insert(std::make_pair(method->name(), method)); } } -void Server::AddPort(const grpc::string &addr) { +int Server::AddPort(const grpc::string &addr) { GPR_ASSERT(!started_); - int success; if (secure_) { - success = grpc_server_add_secure_http2_port(server_, addr.c_str()); + return grpc_server_add_secure_http2_port(server_, addr.c_str()); } else { - success = grpc_server_add_http2_port(server_, addr.c_str()); + return grpc_server_add_http2_port(server_, addr.c_str()); } - GPR_ASSERT(success); } -void Server::Start() { +bool Server::Start() { GPR_ASSERT(!started_); started_ = true; grpc_server_start(server_); // Start processing rpcs. ScheduleCallback(); + + return true; } void Server::AllowOneRpc() { @@ -141,8 +141,7 @@ void Server::ScheduleCallback() { std::unique_lock lock(mu_); num_running_cb_++; } - std::function callback = std::bind(&Server::RunRpc, this); - thread_pool_->ScheduleCallback(callback); + thread_pool_->ScheduleCallback(std::bind(&Server::RunRpc, this)); } void Server::RunRpc() { diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 66e2055af09..8d8276ca002 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -33,13 +33,15 @@ #include +#include #include #include #include +#include "src/cpp/server/thread_pool.h" namespace grpc { -ServerBuilder::ServerBuilder() : thread_pool_(nullptr) {} +ServerBuilder::ServerBuilder() {} void ServerBuilder::RegisterService(SynchronousService *service) { services_.push_back(service->service()); @@ -64,14 +66,27 @@ void ServerBuilder::SetThreadPool(ThreadPoolInterface *thread_pool) { } std::unique_ptr ServerBuilder::BuildAndStart() { - std::unique_ptr server(new Server(thread_pool_, creds_.get())); + bool thread_pool_owned = false; + if (!thread_pool_ && services_.size()) { + int cores = gpr_cpu_num_cores(); + if (!cores) cores = 4; + thread_pool_ = new ThreadPool(cores); + thread_pool_owned = true; + } + std::unique_ptr server(new Server(thread_pool_, thread_pool_owned, creds_.get())); for (auto *service : services_) { - server->RegisterService(service); + if (!server->RegisterService(service)) { + return nullptr; + } } for (auto &port : ports_) { - server->AddPort(port); + if (!server->AddPort(port)) { + return nullptr; + } + } + if (!server->Start()) { + return nullptr; } - server->Start(); return server; } From 7c72adcdc76f07b16d6e5ce461d8bdfff6ca3bec Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 14:07:26 -0800 Subject: [PATCH 013/232] Make server.cc compile again --- src/cpp/server/server.cc | 40 ++++++++++++++++++++---------------- src/cpp/server/thread_pool.h | 4 ++-- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index ac1b9ddc505..4965f187087 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -87,6 +87,7 @@ bool Server::RegisterService(RpcService *service) { } method_map_.insert(std::make_pair(method->name(), method)); } + return true; } int Server::AddPort(const grpc::string &addr) { @@ -104,7 +105,9 @@ bool Server::Start() { grpc_server_start(server_); // Start processing rpcs. - ScheduleCallback(); + if (thread_pool_) { + ScheduleCallback(); + } return true; } @@ -132,8 +135,8 @@ void Server::Shutdown() { // Shutdown the completion queue. cq_.Shutdown(); void *tag = nullptr; - CompletionQueue::CompletionType t = cq_.Next(&tag); - GPR_ASSERT(t == CompletionQueue::QUEUE_CLOSED); + bool ok = false; + GPR_ASSERT(false == cq_.Next(&tag, &ok)); } void Server::ScheduleCallback() { @@ -148,22 +151,23 @@ void Server::RunRpc() { // Wait for one more incoming rpc. void *tag = nullptr; AllowOneRpc(); - CompletionQueue::CompletionType t = cq_.Next(&tag); - GPR_ASSERT(t == CompletionQueue::SERVER_RPC_NEW); - - AsyncServerContext *server_context = static_cast(tag); - // server_context could be nullptr during server shutdown. - if (server_context != nullptr) { - // Schedule a new callback to handle more rpcs. - ScheduleCallback(); - - RpcServiceMethod *method = nullptr; - auto iter = method_map_.find(server_context->method()); - if (iter != method_map_.end()) { - method = iter->second; + bool ok = false; + GPR_ASSERT(cq_.Next(&tag, &ok)); + if (ok) { + AsyncServerContext *server_context = static_cast(tag); + // server_context could be nullptr during server shutdown. + if (server_context != nullptr) { + // Schedule a new callback to handle more rpcs. + ScheduleCallback(); + + RpcServiceMethod *method = nullptr; + auto iter = method_map_.find(server_context->method()); + if (iter != method_map_.end()) { + method = iter->second; + } + ServerRpcHandler rpc_handler(server_context, method); + rpc_handler.StartRpc(); } - ServerRpcHandler rpc_handler(server_context, method); - rpc_handler.StartRpc(); } { diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index c53f7a7517a..8a28c877040 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -44,12 +44,12 @@ namespace grpc { -class ThreadPool : public ThreadPoolInterface { +class ThreadPool final : public ThreadPoolInterface { public: explicit ThreadPool(int num_threads); ~ThreadPool(); - void ScheduleCallback(const std::function &callback) final; + void ScheduleCallback(const std::function &callback) override; private: std::mutex mu_; From 8a3bbb5c55b00f5f46199641bba4a86f0b3a48ec Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 9 Feb 2015 14:10:59 -0800 Subject: [PATCH 014/232] ServerReader with new API --- include/grpc++/stream.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index fee70f4fdcf..4d4581d00f0 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -96,7 +96,7 @@ class ClientReader final : public ClientStreamingInterface, cq_.Pluck((void *)1); } - virtual bool Read(R *msg) { + virtual bool Read(R *msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); call_.PerformOps(&buf, (void *)2); @@ -122,13 +122,13 @@ class ClientWriter final : public ClientStreamingInterface, public WriterInterface { public: // Blocking create a stream. - explicit ClientWriter(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - google::protobuf::Message *response) + ClientWriter(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + google::protobuf::Message *response) : response_(response), call_(channel->CreateCall(method, context, &cq_)) {} - virtual bool Write(const W& msg) { + virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf, (void *)2); @@ -165,18 +165,18 @@ class ClientReaderWriter final : public ClientStreamingInterface, public ReaderInterface { public: // Blocking create a stream. - explicit ClientReaderWriter(ChannelInterface *channel, - const RpcMethod &method, ClientContext *context) + ClientReaderWriter(ChannelInterface *channel, + const RpcMethod &method, ClientContext *context) : call_(channel->CreateCall(method, context, &cq_)) {} - virtual bool Read(R *msg) { + virtual bool Read(R *msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); call_.PerformOps(&buf, (void *)2); return cq_.Pluck((void *)2); } - virtual bool Write(const W& msg) { + virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); call_.PerformOps(&buf, (void *)3); @@ -205,17 +205,20 @@ class ClientReaderWriter final : public ClientStreamingInterface, }; template -class ServerReader : public ReaderInterface { +class ServerReader final : public ReaderInterface { public: - explicit ServerReader(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - } + ServerReader(CompletionQueue* cq, Call* call) : cq_(cq), call_(call) {} - virtual bool Read(R* msg) { return context_->Read(msg); } + virtual bool Read(R* msg) override { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_->PerformOps(&buf, (void *)2); + return cq_->Pluck((void *)2); + } private: - StreamContextInterface* const context_; // not owned + CompletionQueue* cq_; + Call* call_; }; template From 1801e420de7c2e2dce8876aade7b9f010c0e0002 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 14:27:35 -0800 Subject: [PATCH 015/232] Fix include paths --- include/grpc/grpc.h | 8 ++++++++ src/core/statistics/census_log.c | 2 +- src/core/support/cpu_linux.c | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 982cd3b43e1..5c44d70fadb 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -542,6 +542,14 @@ grpc_call_error grpc_server_request_call( grpc_metadata_array *request_metadata, grpc_completion_queue *completion_queue, void *tag_new); +void *grpc_server_register_call(grpc_server *server, const char *method, const char *host); + +grpc_call_error grpc_server_request_specific_call( + grpc_server *server, grpc_call **call, + void *registered_call_tag, + grpc_metadata_array *request_metadata, + grpc_completion_queue *completion_queue, void *tag_new); + /* Create a server */ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); diff --git a/src/core/statistics/census_log.c b/src/core/statistics/census_log.c index aea0a33bad7..1504c027deb 100644 --- a/src/core/statistics/census_log.c +++ b/src/core/statistics/census_log.c @@ -91,9 +91,9 @@ */ #include "src/core/statistics/census_log.h" #include -#include "src/core/support/cpu.h" #include #include +#include #include #include #include diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c index ad82174894b..c8375e65b62 100644 --- a/src/core/support/cpu_linux.c +++ b/src/core/support/cpu_linux.c @@ -39,7 +39,7 @@ #ifdef GPR_CPU_LINUX -#include "src/core/support/cpu.h" +#include #include #include From 061754a483a1b56fe24649ae2be68ffa613a643f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 14:56:49 -0800 Subject: [PATCH 016/232] Cleanup some cruft --- include/grpc++/async_server.h | 70 ----------------- include/grpc++/async_server_context.h | 95 ----------------------- include/grpc++/call.h | 2 +- include/grpc++/completion_queue.h | 8 +- include/grpc++/stream_context_interface.h | 64 --------------- include/grpc/grpc.h | 8 -- src/cpp/common/completion_queue.cc | 20 +++-- src/cpp/server/async_server.cc | 89 --------------------- src/cpp/server/server.cc | 2 + 9 files changed, 22 insertions(+), 336 deletions(-) delete mode 100644 include/grpc++/async_server.h delete mode 100644 include/grpc++/async_server_context.h delete mode 100644 include/grpc++/stream_context_interface.h delete mode 100644 src/cpp/server/async_server.cc diff --git a/include/grpc++/async_server.h b/include/grpc++/async_server.h deleted file mode 100644 index fe2c5d93678..00000000000 --- a/include/grpc++/async_server.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_ASYNC_SERVER_H__ -#define __GRPCPP_ASYNC_SERVER_H__ - -#include - -#include - -struct grpc_server; - -namespace grpc { -class CompletionQueue; - -class AsyncServer { - public: - explicit AsyncServer(CompletionQueue* cc); - ~AsyncServer(); - - void AddPort(const grpc::string& addr); - - void Start(); - - // The user has to call this to get one new rpc on the completion - // queue. - void RequestOneRpc(); - - void Shutdown(); - - private: - bool started_; - std::mutex shutdown_mu_; - bool shutdown_; - grpc_server* server_; -}; - -} // namespace grpc - -#endif // __GRPCPP_ASYNC_SERVER_H__ diff --git a/include/grpc++/async_server_context.h b/include/grpc++/async_server_context.h deleted file mode 100644 index c038286ac13..00000000000 --- a/include/grpc++/async_server_context.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_ASYNC_SERVER_CONTEXT_H__ -#define __GRPCPP_ASYNC_SERVER_CONTEXT_H__ - -#include - -#include - -struct grpc_byte_buffer; -struct grpc_call; -struct grpc_completion_queue; - -namespace google { -namespace protobuf { -class Message; -} -} - -using std::chrono::system_clock; - -namespace grpc { -class Status; - -// TODO(rocking): wrap grpc c structures. -class AsyncServerContext { - public: - AsyncServerContext(grpc_call* call, const grpc::string& method, - const grpc::string& host, - system_clock::time_point absolute_deadline); - ~AsyncServerContext(); - - // Accept this rpc, bind it to a completion queue. - void Accept(grpc_completion_queue* cq); - - // Read and write calls, all async. Return true for success. - bool StartRead(google::protobuf::Message* request); - bool StartWrite(const google::protobuf::Message& response, int flags); - bool StartWriteStatus(const Status& status); - - bool ParseRead(grpc_byte_buffer* read_buffer); - - grpc::string method() const { return method_; } - grpc::string host() const { return host_; } - system_clock::time_point absolute_deadline() { return absolute_deadline_; } - - grpc_call* call() { return call_; } - - private: - AsyncServerContext(const AsyncServerContext&); - AsyncServerContext& operator=(const AsyncServerContext&); - - // These properties may be moved to a ServerContext class. - const grpc::string method_; - const grpc::string host_; - system_clock::time_point absolute_deadline_; - - google::protobuf::Message* request_; // not owned - grpc_call* call_; // owned -}; - -} // namespace grpc - -#endif // __GRPCPP_ASYNC_SERVER_CONTEXT_H__ diff --git a/include/grpc++/call.h b/include/grpc++/call.h index 8d9412c9b6a..5aa96d33b96 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -67,7 +67,7 @@ class CallOpBuffer final : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - void FinalizeResult() override; + FinalizeResultOutput FinalizeResult(bool status) override; }; class CCallDeleter { diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 4bc707e5536..8033fd12058 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -42,7 +42,13 @@ class CompletionQueue; class CompletionQueueTag { public: - virtual void FinalizeResult() = 0; + enum FinalizeResultOutput { + SUCCEED, + FAIL, + SWALLOW, + }; + + virtual FinalizeResultOutput FinalizeResult(bool status) = 0; private: friend class CompletionQueue; diff --git a/include/grpc++/stream_context_interface.h b/include/grpc++/stream_context_interface.h deleted file mode 100644 index a84119800b7..00000000000 --- a/include/grpc++/stream_context_interface.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_STREAM_CONTEXT_INTERFACE_H__ -#define __GRPCPP_STREAM_CONTEXT_INTERFACE_H__ - -namespace google { -namespace protobuf { -class Message; -} -} - -namespace grpc { -class Status; - -// An interface to avoid dependency on internal implementation. -class StreamContextInterface { - public: - virtual ~StreamContextInterface() {} - - virtual void Start(bool buffered) = 0; - - virtual bool Read(google::protobuf::Message* msg) = 0; - virtual bool Write(const google::protobuf::Message* msg, bool is_last) = 0; - virtual const Status& Wait() = 0; - virtual void Cancel() = 0; - - virtual google::protobuf::Message* request() = 0; - virtual google::protobuf::Message* response() = 0; -}; - -} // namespace grpc - -#endif // __GRPCPP_STREAM_CONTEXT_INTERFACE_H__ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 5c44d70fadb..982cd3b43e1 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -542,14 +542,6 @@ grpc_call_error grpc_server_request_call( grpc_metadata_array *request_metadata, grpc_completion_queue *completion_queue, void *tag_new); -void *grpc_server_register_call(grpc_server *server, const char *method, const char *host); - -grpc_call_error grpc_server_request_specific_call( - grpc_server *server, grpc_call **call, - void *registered_call_tag, - grpc_metadata_array *request_metadata, - grpc_completion_queue *completion_queue, void *tag_new); - /* Create a server */ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 55adb5bea51..31c1fb92869 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -57,15 +57,19 @@ class EventDeleter { bool CompletionQueue::Next(void **tag, bool *ok) { std::unique_ptr ev; - ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); - if (ev->type == GRPC_QUEUE_SHUTDOWN) { - return false; + while (true) { + ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); + if (ev->type == GRPC_QUEUE_SHUTDOWN) { + return false; + } + auto cq_tag = static_cast(ev->tag); + switch (cq_tag->FinalizeResult(ev->data.op_complete == GRPC_OP_OK)) { + case CompletionQueueTag::SUCCEED: *ok = true; break; + case CompletionQueueTag::FAIL: *ok = false; break; + case CompletionQueueTag::SWALLOW: continue; + } + return true; } - auto cq_tag = static_cast(ev->tag); - cq_tag->FinalizeResult(); - *tag = cq_tag->user_tag_; - *ok = ev->data.op_complete == GRPC_OP_OK; - return true; } } // namespace grpc diff --git a/src/cpp/server/async_server.cc b/src/cpp/server/async_server.cc deleted file mode 100644 index 86faa07b317..00000000000 --- a/src/cpp/server/async_server.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* - * - * Copyright 2014, 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 - -namespace grpc { - -AsyncServer::AsyncServer(CompletionQueue *cc) - : started_(false), shutdown_(false) { - server_ = grpc_server_create(cc->cq(), nullptr); -} - -AsyncServer::~AsyncServer() { - std::unique_lock lock(shutdown_mu_); - if (started_ && !shutdown_) { - lock.unlock(); - Shutdown(); - } - grpc_server_destroy(server_); -} - -void AsyncServer::AddPort(const grpc::string &addr) { - GPR_ASSERT(!started_); - int success = grpc_server_add_http2_port(server_, addr.c_str()); - GPR_ASSERT(success); -} - -void AsyncServer::Start() { - GPR_ASSERT(!started_); - started_ = true; - grpc_server_start(server_); -} - -void AsyncServer::RequestOneRpc() { - GPR_ASSERT(started_); - std::unique_lock lock(shutdown_mu_); - if (shutdown_) { - return; - } - lock.unlock(); - grpc_call_error err = grpc_server_request_call_old(server_, nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); -} - -void AsyncServer::Shutdown() { - std::unique_lock lock(shutdown_mu_); - if (started_ && !shutdown_) { - shutdown_ = true; - lock.unlock(); - // TODO(yangg) should we shutdown without start? - grpc_server_shutdown(server_); - } -} - -} // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 4965f187087..18c063bb381 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -71,6 +71,8 @@ Server::~Server() { if (started_ && !shutdown_) { lock.unlock(); Shutdown(); + } else { + lock.unlock(); } grpc_server_destroy(server_); if (thread_pool_owned_) { From 1d2e21962ea2e70ab17c10868f1bf2acec2fde33 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 15:25:21 -0800 Subject: [PATCH 017/232] Server progress --- Makefile | 11 -- build.json | 5 - include/grpc++/channel_interface.h | 1 - include/grpc++/impl/rpc_method.h | 4 +- include/grpc++/impl/rpc_service_method.h | 25 ++-- include/grpc++/server.h | 1 - include/grpc++/server_context.h | 3 + include/grpc++/stream.h | 38 +++++- src/cpp/server/server.cc | 40 +++--- src/cpp/server/server_rpc_handler.h | 10 +- test/core/statistics/census_log_tests.c | 2 +- test/cpp/end2end/async_test_server.cc | 154 ----------------------- test/cpp/end2end/async_test_server.h | 75 ----------- 13 files changed, 75 insertions(+), 294 deletions(-) delete mode 100644 test/cpp/end2end/async_test_server.cc delete mode 100644 test/cpp/end2end/async_test_server.h diff --git a/Makefile b/Makefile index 6d382ca3db2..1ab1fdaefcd 100644 --- a/Makefile +++ b/Makefile @@ -2618,8 +2618,6 @@ LIBGRPC++_SRC = \ src/cpp/common/completion_queue.cc \ src/cpp/common/rpc_method.cc \ src/cpp/proto/proto_utils.cc \ - src/cpp/server/async_server.cc \ - src/cpp/server/async_server_context.cc \ src/cpp/server/server.cc \ src/cpp/server/server_builder.cc \ src/cpp/server/server_context_impl.cc \ @@ -2631,8 +2629,6 @@ LIBGRPC++_SRC = \ src/cpp/util/time.cc \ PUBLIC_HEADERS_CXX += \ - include/grpc++/async_server.h \ - include/grpc++/async_server_context.h \ include/grpc++/channel_arguments.h \ include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ @@ -2678,8 +2674,6 @@ src/cpp/common/call.cc: $(OPENSSL_DEP) src/cpp/common/completion_queue.cc: $(OPENSSL_DEP) src/cpp/common/rpc_method.cc: $(OPENSSL_DEP) src/cpp/proto/proto_utils.cc: $(OPENSSL_DEP) -src/cpp/server/async_server.cc: $(OPENSSL_DEP) -src/cpp/server/async_server_context.cc: $(OPENSSL_DEP) src/cpp/server/server.cc: $(OPENSSL_DEP) src/cpp/server/server_builder.cc: $(OPENSSL_DEP) src/cpp/server/server_context_impl.cc: $(OPENSSL_DEP) @@ -2739,8 +2733,6 @@ objs/$(CONFIG)/src/cpp/common/call.o: objs/$(CONFIG)/src/cpp/common/completion_queue.o: objs/$(CONFIG)/src/cpp/common/rpc_method.o: objs/$(CONFIG)/src/cpp/proto/proto_utils.o: -objs/$(CONFIG)/src/cpp/server/async_server.o: -objs/$(CONFIG)/src/cpp/server/async_server_context.o: objs/$(CONFIG)/src/cpp/server/server.o: objs/$(CONFIG)/src/cpp/server/server_builder.o: objs/$(CONFIG)/src/cpp/server/server_context_impl.o: @@ -2756,7 +2748,6 @@ LIBGRPC++_TEST_UTIL_SRC = \ gens/test/cpp/util/messages.pb.cc \ gens/test/cpp/util/echo.pb.cc \ gens/test/cpp/util/echo_duplicate.pb.cc \ - test/cpp/end2end/async_test_server.cc \ test/cpp/util/create_test_channel.cc \ @@ -2775,7 +2766,6 @@ ifneq ($(OPENSSL_DEP),) test/cpp/util/messages.proto: $(OPENSSL_DEP) test/cpp/util/echo.proto: $(OPENSSL_DEP) test/cpp/util/echo_duplicate.proto: $(OPENSSL_DEP) -test/cpp/end2end/async_test_server.cc: $(OPENSSL_DEP) test/cpp/util/create_test_channel.cc: $(OPENSSL_DEP) endif @@ -2803,7 +2793,6 @@ endif -objs/$(CONFIG)/test/cpp/end2end/async_test_server.o: gens/test/cpp/util/messages.pb.cc gens/test/cpp/util/echo.pb.cc gens/test/cpp/util/echo_duplicate.pb.cc objs/$(CONFIG)/test/cpp/util/create_test_channel.o: gens/test/cpp/util/messages.pb.cc gens/test/cpp/util/echo.pb.cc gens/test/cpp/util/echo_duplicate.pb.cc diff --git a/build.json b/build.json index 7d35f79af09..e3fc12cc66b 100644 --- a/build.json +++ b/build.json @@ -378,8 +378,6 @@ "build": "all", "language": "c++", "public_headers": [ - "include/grpc++/async_server.h", - "include/grpc++/async_server_context.h", "include/grpc++/channel_arguments.h", "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", @@ -417,8 +415,6 @@ "src/cpp/common/completion_queue.cc", "src/cpp/common/rpc_method.cc", "src/cpp/proto/proto_utils.cc", - "src/cpp/server/async_server.cc", - "src/cpp/server/async_server_context.cc", "src/cpp/server/server.cc", "src/cpp/server/server_builder.cc", "src/cpp/server/server_context_impl.cc", @@ -443,7 +439,6 @@ "test/cpp/util/messages.proto", "test/cpp/util/echo.proto", "test/cpp/util/echo_duplicate.proto", - "test/cpp/end2end/async_test_server.cc", "test/cpp/util/create_test_channel.cc" ] }, diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 452c7857339..79466c9fda0 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -50,7 +50,6 @@ class CallOpBuffer; class ClientContext; class CompletionQueue; class RpcMethod; -class StreamContextInterface; class CallInterface; class ChannelInterface { diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index 75fec356dd4..bb16e64c969 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -37,8 +37,8 @@ namespace google { namespace protobuf { class Message; -} -} +} // namespace protobuf +} // namespace google namespace grpc { diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 3077e0af66c..0fb4f79b595 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -55,25 +55,18 @@ class MethodHandler { public: virtual ~MethodHandler() {} struct HandlerParameter { - HandlerParameter(ServerContext* context, + HandlerParameter(Call *c, + ServerContext* context, const google::protobuf::Message* req, google::protobuf::Message* resp) - : server_context(context), + : call(c), + server_context(context), request(req), - response(resp), - stream_context(nullptr) {} - HandlerParameter(ServerContext* context, - const google::protobuf::Message* req, - google::protobuf::Message* resp, - StreamContextInterface* stream) - : server_context(context), - request(req), - response(resp), - stream_context(stream) {} + response(resp) {} + Call* call; ServerContext* server_context; const google::protobuf::Message* request; google::protobuf::Message* response; - StreamContextInterface* stream_context; }; virtual Status RunHandler(const HandlerParameter& param) = 0; }; @@ -114,7 +107,7 @@ class ClientStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerReader reader(param.stream_context); + ServerReader reader(param.call); return func_(service_, param.server_context, &reader, dynamic_cast(param.response)); } @@ -136,7 +129,7 @@ class ServerStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerWriter writer(param.stream_context); + ServerWriter writer(param.call); return func_(service_, param.server_context, dynamic_cast(param.request), &writer); } @@ -159,7 +152,7 @@ class BidiStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerReaderWriter stream(param.stream_context); + ServerReaderWriter stream(param.call); return func_(service_, param.server_context, &stream); } diff --git a/include/grpc++/server.h b/include/grpc++/server.h index ae86683f0b9..670ffa78154 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -80,7 +80,6 @@ class Server { // Start the server. bool Start(); - void AllowOneRpc(); void HandleQueueClosed(); void RunRpc(); void ScheduleCallback(); diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 47fd6cf1c85..9fd3ab1689f 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -44,6 +44,9 @@ class ServerContext { virtual ~ServerContext() {} virtual std::chrono::system_clock::time_point absolute_deadline() const = 0; + + private: + std::vector > metadata_; }; } // namespace grpc diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 4d4581d00f0..30af678c69d 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -37,12 +37,43 @@ #include #include #include -#include #include #include namespace grpc { +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE +// DELETE DELETE DELETE + class StreamContextInterface { + public: + template bool Write(T, bool); + template void Start(T); + template bool Read(T); + google::protobuf::Message *request(); + }; + // Common interface for all client side streaming. class ClientStreamingInterface { public: @@ -207,17 +238,16 @@ class ClientReaderWriter final : public ClientStreamingInterface, template class ServerReader final : public ReaderInterface { public: - ServerReader(CompletionQueue* cq, Call* call) : cq_(cq), call_(call) {} + explicit ServerReader(Call* call) : call_(call) {} virtual bool Read(R* msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf, (void *)2); - return cq_->Pluck((void *)2); + return call_->cq()->Pluck((void *)2); } private: - CompletionQueue* cq_; Call* call_; }; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 18c063bb381..1f48e83b880 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -114,12 +114,6 @@ bool Server::Start() { return true; } -void Server::AllowOneRpc() { - GPR_ASSERT(started_); - grpc_call_error err = grpc_server_request_call_old(server_, nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); -} - void Server::Shutdown() { { std::unique_lock lock(mu_); @@ -152,25 +146,31 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. void *tag = nullptr; - AllowOneRpc(); + GPR_ASSERT(started_); + grpc_call *c_call = NULL; + grpc_call_details details; + grpc_call_details_init(&details); + grpc_metadata_array initial_metadata; + grpc_metadata_array_init(&initial_metadata); + CompletionQueue cq; + grpc_call_error err = grpc_server_request_call(server_, &call, &details, &initial_metadata, cq.cq(), nullptr); + GPR_ASSERT(err == GRPC_CALL_OK); bool ok = false; GPR_ASSERT(cq_.Next(&tag, &ok)); if (ok) { - AsyncServerContext *server_context = static_cast(tag); - // server_context could be nullptr during server shutdown. - if (server_context != nullptr) { - // Schedule a new callback to handle more rpcs. - ScheduleCallback(); - - RpcServiceMethod *method = nullptr; - auto iter = method_map_.find(server_context->method()); - if (iter != method_map_.end()) { - method = iter->second; - } - ServerRpcHandler rpc_handler(server_context, method); - rpc_handler.StartRpc(); + ServerContext context; + Call call(c_call, nullptr, &cq); + ScheduleCallback(); + RpcServiceMethod *method = nullptr; + auto iter = method_map_.find(call_details.method); + if (iter != method_map_.end()) { + method = iter->second; } + ServerRpcHandler rpc_handler(&call, context, method); + rpc_handler.StartRpc(); } + grpc_call_details_destroy(&details); + grpc_metadata_array_destroy(&initial_metadata); { std::unique_lock lock(mu_); diff --git a/src/cpp/server/server_rpc_handler.h b/src/cpp/server/server_rpc_handler.h index ec8ec2c330b..15efd1892dc 100644 --- a/src/cpp/server/server_rpc_handler.h +++ b/src/cpp/server/server_rpc_handler.h @@ -41,13 +41,14 @@ namespace grpc { -class AsyncServerContext; +class +class ServerContext; class RpcServiceMethod; class ServerRpcHandler { public: - // Takes ownership of async_server_context. - ServerRpcHandler(AsyncServerContext *async_server_context, + ServerRpcHandler(Call *call, + ServerContext *server_context, RpcServiceMethod *method); void StartRpc(); @@ -55,7 +56,8 @@ class ServerRpcHandler { private: void FinishRpc(const Status &status); - std::unique_ptr async_server_context_; + Call *call_; + ServerContext* server_context_; RpcServiceMethod *method_; CompletionQueue cq_; }; diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index c7b2b2e46dc..e2ad78a6f2b 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -35,7 +35,7 @@ #include #include #include -#include "src/core/support/cpu.h" +#include #include #include #include diff --git a/test/cpp/end2end/async_test_server.cc b/test/cpp/end2end/async_test_server.cc deleted file mode 100644 index f18b6c00bce..00000000000 --- a/test/cpp/end2end/async_test_server.cc +++ /dev/null @@ -1,154 +0,0 @@ -/* - * - * Copyright 2014, 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 "test/cpp/end2end/async_test_server.h" - -#include - -#include -#include "src/cpp/proto/proto_utils.h" -#include "test/cpp/util/echo.pb.h" -#include -#include -#include -#include -#include - -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; - -using std::chrono::duration_cast; -using std::chrono::microseconds; -using std::chrono::seconds; -using std::chrono::system_clock; - -namespace grpc { -namespace testing { - -AsyncTestServer::AsyncTestServer() : server_(&cq_), cq_drained_(false) {} - -AsyncTestServer::~AsyncTestServer() {} - -void AsyncTestServer::AddPort(const grpc::string& addr) { - server_.AddPort(addr); -} - -void AsyncTestServer::Start() { server_.Start(); } - -// Return true if deadline actual is within 0.5s from expected. -bool DeadlineMatched(const system_clock::time_point& actual, - const system_clock::time_point& expected) { - microseconds diff_usecs = duration_cast(expected - actual); - gpr_log(GPR_INFO, "diff_usecs= %d", diff_usecs.count()); - return diff_usecs.count() < 500000 && diff_usecs.count() > -500000; -} - -void AsyncTestServer::RequestOneRpc() { server_.RequestOneRpc(); } - -void AsyncTestServer::MainLoop() { - EchoRequest request; - EchoResponse response; - void* tag = nullptr; - - RequestOneRpc(); - - while (true) { - CompletionQueue::CompletionType t = cq_.Next(&tag); - AsyncServerContext* server_context = static_cast(tag); - switch (t) { - case CompletionQueue::SERVER_RPC_NEW: - gpr_log(GPR_INFO, "SERVER_RPC_NEW %p", server_context); - if (server_context) { - EXPECT_EQ(server_context->method(), "/foo"); - // TODO(ctiller): verify deadline - server_context->Accept(cq_.cq()); - // Handle only one rpc at a time. - RequestOneRpc(); - server_context->StartRead(&request); - } - break; - case CompletionQueue::RPC_END: - gpr_log(GPR_INFO, "RPC_END %p", server_context); - delete server_context; - break; - case CompletionQueue::SERVER_READ_OK: - gpr_log(GPR_INFO, "SERVER_READ_OK %p", server_context); - response.set_message(request.message()); - server_context->StartWrite(response, 0); - break; - case CompletionQueue::SERVER_READ_ERROR: - gpr_log(GPR_INFO, "SERVER_READ_ERROR %p", server_context); - server_context->StartWriteStatus(Status::OK); - break; - case CompletionQueue::HALFCLOSE_OK: - gpr_log(GPR_INFO, "HALFCLOSE_OK %p", server_context); - // Do nothing, just wait for RPC_END. - break; - case CompletionQueue::SERVER_WRITE_OK: - gpr_log(GPR_INFO, "SERVER_WRITE_OK %p", server_context); - server_context->StartRead(&request); - break; - case CompletionQueue::SERVER_WRITE_ERROR: - EXPECT_TRUE(0); - break; - case CompletionQueue::QUEUE_CLOSED: { - gpr_log(GPR_INFO, "QUEUE_CLOSED"); - HandleQueueClosed(); - return; - } - default: - EXPECT_TRUE(0); - break; - } - } -} - -void AsyncTestServer::HandleQueueClosed() { - std::unique_lock lock(cq_drained_mu_); - cq_drained_ = true; - cq_drained_cv_.notify_all(); -} - -void AsyncTestServer::Shutdown() { - // The server need to be shut down before cq_ as grpc_server flushes all - // pending requested calls to the completion queue at shutdown. - server_.Shutdown(); - cq_.Shutdown(); - std::unique_lock lock(cq_drained_mu_); - while (!cq_drained_) { - cq_drained_cv_.wait(lock); - } -} - -} // namespace testing -} // namespace grpc diff --git a/test/cpp/end2end/async_test_server.h b/test/cpp/end2end/async_test_server.h deleted file mode 100644 index a277061acec..00000000000 --- a/test/cpp/end2end/async_test_server.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_TEST_END2END_ASYNC_TEST_SERVER_H__ -#define __GRPCPP_TEST_END2END_ASYNC_TEST_SERVER_H__ - -#include -#include -#include - -#include -#include - -namespace grpc { - -namespace testing { - -class AsyncTestServer { - public: - AsyncTestServer(); - virtual ~AsyncTestServer(); - - void AddPort(const grpc::string& addr); - void Start(); - void RequestOneRpc(); - virtual void MainLoop(); - void Shutdown(); - - CompletionQueue* completion_queue() { return &cq_; } - - protected: - void HandleQueueClosed(); - - private: - CompletionQueue cq_; - AsyncServer server_; - bool cq_drained_; - std::mutex cq_drained_mu_; - std::condition_variable cq_drained_cv_; -}; - -} // namespace testing -} // namespace grpc - -#endif // __GRPCPP_TEST_END2END_ASYNC_TEST_SERVER_H__ From 40fcdaff0ae9db85953c4c2e32bd2a6534bdb72e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 15:43:34 -0800 Subject: [PATCH 018/232] Remove stream_context --- Makefile | 3 - build.json | 2 - include/grpc++/impl/service_type.h | 1 + src/compiler/cpp_generator.cc | 4 +- src/cpp/server/server_builder.cc | 4 + src/cpp/stream/stream_context.cc | 179 ----------------------------- src/cpp/stream/stream_context.h | 99 ---------------- 7 files changed, 7 insertions(+), 285 deletions(-) delete mode 100644 src/cpp/stream/stream_context.cc delete mode 100644 src/cpp/stream/stream_context.h diff --git a/Makefile b/Makefile index 1ab1fdaefcd..4918fbc19af 100644 --- a/Makefile +++ b/Makefile @@ -2624,7 +2624,6 @@ LIBGRPC++_SRC = \ src/cpp/server/server_credentials.cc \ src/cpp/server/server_rpc_handler.cc \ src/cpp/server/thread_pool.cc \ - src/cpp/stream/stream_context.cc \ src/cpp/util/status.cc \ src/cpp/util/time.cc \ @@ -2680,7 +2679,6 @@ src/cpp/server/server_context_impl.cc: $(OPENSSL_DEP) src/cpp/server/server_credentials.cc: $(OPENSSL_DEP) src/cpp/server/server_rpc_handler.cc: $(OPENSSL_DEP) src/cpp/server/thread_pool.cc: $(OPENSSL_DEP) -src/cpp/stream/stream_context.cc: $(OPENSSL_DEP) src/cpp/util/status.cc: $(OPENSSL_DEP) src/cpp/util/time.cc: $(OPENSSL_DEP) endif @@ -2739,7 +2737,6 @@ objs/$(CONFIG)/src/cpp/server/server_context_impl.o: objs/$(CONFIG)/src/cpp/server/server_credentials.o: objs/$(CONFIG)/src/cpp/server/server_rpc_handler.o: objs/$(CONFIG)/src/cpp/server/thread_pool.o: -objs/$(CONFIG)/src/cpp/stream/stream_context.o: objs/$(CONFIG)/src/cpp/util/status.o: objs/$(CONFIG)/src/cpp/util/time.o: diff --git a/build.json b/build.json index e3fc12cc66b..3bedddfcd1f 100644 --- a/build.json +++ b/build.json @@ -401,7 +401,6 @@ "src/cpp/proto/proto_utils.h", "src/cpp/server/server_rpc_handler.h", "src/cpp/server/thread_pool.h", - "src/cpp/stream/stream_context.h", "src/cpp/util/time.h" ], "src": [ @@ -421,7 +420,6 @@ "src/cpp/server/server_credentials.cc", "src/cpp/server/server_rpc_handler.cc", "src/cpp/server/thread_pool.cc", - "src/cpp/stream/stream_context.cc", "src/cpp/util/status.cc", "src/cpp/util/time.cc" ], diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 6e50c43493c..0684f322d8d 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -47,6 +47,7 @@ class SynchronousService { class AsynchronousService { public: virtual ~AsynchronousService() {} + virtual RpcService *service() = 0; }; } // namespace grpc diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index ecae429af50..908b38f88e1 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -307,7 +307,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, for (int i = 0; i < service->method_count(); ++i) { PrintHeaderServerMethodSync(printer, service->method(i), vars); } - printer->Print("::grpc::RpcService* service();\n"); + printer->Print("::grpc::RpcService* service() override final;\n"); printer->Outdent(); printer->Print( " private:\n" @@ -324,7 +324,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, for (int i = 0; i < service->method_count(); ++i) { PrintHeaderServerMethodAsync(printer, service->method(i), vars); } - printer->Print("::grpc::RpcService* service();\n"); + printer->Print("::grpc::RpcService* service() override;\n"); printer->Outdent(); printer->Print( " private:\n" diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 8d8276ca002..d6bcb9313aa 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -67,6 +67,10 @@ void ServerBuilder::SetThreadPool(ThreadPoolInterface *thread_pool) { std::unique_ptr ServerBuilder::BuildAndStart() { bool thread_pool_owned = false; + if (!async_services_.empty() && !services_.empty()) { + gpr_log(GPR_ERROR, "Mixing async and sync services is unsupported for now"); + return nullptr; + } if (!thread_pool_ && services_.size()) { int cores = gpr_cpu_num_cores(); if (!cores) cores = 4; diff --git a/src/cpp/stream/stream_context.cc b/src/cpp/stream/stream_context.cc deleted file mode 100644 index e4f344dbb93..00000000000 --- a/src/cpp/stream/stream_context.cc +++ /dev/null @@ -1,179 +0,0 @@ -/* - * - * Copyright 2014, 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 "src/cpp/stream/stream_context.h" - -#include -#include "src/cpp/proto/proto_utils.h" -#include "src/cpp/util/time.h" -#include -#include -#include -#include - -namespace grpc { - -// Client only ctor -StreamContext::StreamContext(const RpcMethod &method, ClientContext *context, - const google::protobuf::Message *request, - google::protobuf::Message *result) - : is_client_(true), - method_(&method), - call_(context->call()), - cq_(context->cq()), - request_(const_cast(request)), - result_(result), - peer_halfclosed_(false), - self_halfclosed_(false) { - GPR_ASSERT(method_->method_type() != RpcMethod::RpcType::NORMAL_RPC); -} - -// Server only ctor -StreamContext::StreamContext(const RpcMethod &method, grpc_call *call, - grpc_completion_queue *cq, - google::protobuf::Message *request, - google::protobuf::Message *result) - : is_client_(false), - method_(&method), - call_(call), - cq_(cq), - request_(request), - result_(result), - peer_halfclosed_(false), - self_halfclosed_(false) { - GPR_ASSERT(method_->method_type() != RpcMethod::RpcType::NORMAL_RPC); -} - -StreamContext::~StreamContext() {} - -void StreamContext::Start(bool buffered) { - if (is_client_) { - // TODO(yangg) handle metadata send path - int flag = buffered ? GRPC_WRITE_BUFFER_HINT : 0; - grpc_call_error error = grpc_call_invoke_old( - call(), cq(), client_metadata_read_tag(), finished_tag(), flag); - GPR_ASSERT(GRPC_CALL_OK == error); - } else { - // TODO(yangg) metadata needs to be added before accept - // TODO(yangg) correctly set flag to accept - GPR_ASSERT(grpc_call_server_accept_old(call(), cq(), finished_tag()) == - GRPC_CALL_OK); - GPR_ASSERT(grpc_call_server_end_initial_metadata_old(call(), 0) == - GRPC_CALL_OK); - } -} - -bool StreamContext::Read(google::protobuf::Message *msg) { - // TODO(yangg) check peer_halfclosed_ here for possible early return. - grpc_call_error err = grpc_call_start_read_old(call(), read_tag()); - GPR_ASSERT(err == GRPC_CALL_OK); - grpc_event *read_ev = - grpc_completion_queue_pluck(cq(), read_tag(), gpr_inf_future); - GPR_ASSERT(read_ev->type == GRPC_READ); - bool ret = true; - if (read_ev->data.read) { - if (!DeserializeProto(read_ev->data.read, msg)) { - ret = false; - grpc_call_cancel_with_status(call(), GRPC_STATUS_DATA_LOSS, - "Failed to parse incoming proto"); - } - } else { - ret = false; - peer_halfclosed_ = true; - } - grpc_event_finish(read_ev); - return ret; -} - -bool StreamContext::Write(const google::protobuf::Message *msg, bool is_last) { - // TODO(yangg) check self_halfclosed_ for possible early return. - bool ret = true; - grpc_event *ev = nullptr; - - if (msg) { - grpc_byte_buffer *out_buf = nullptr; - if (!SerializeProto(*msg, &out_buf)) { - grpc_call_cancel_with_status(call(), GRPC_STATUS_INVALID_ARGUMENT, - "Failed to serialize outgoing proto"); - return false; - } - int flag = is_last ? GRPC_WRITE_BUFFER_HINT : 0; - grpc_call_error err = - grpc_call_start_write_old(call(), out_buf, write_tag(), flag); - grpc_byte_buffer_destroy(out_buf); - GPR_ASSERT(err == GRPC_CALL_OK); - - ev = grpc_completion_queue_pluck(cq(), write_tag(), gpr_inf_future); - GPR_ASSERT(ev->type == GRPC_WRITE_ACCEPTED); - - ret = ev->data.write_accepted == GRPC_OP_OK; - grpc_event_finish(ev); - } - if (ret && is_last) { - grpc_call_error err = grpc_call_writes_done_old(call(), halfclose_tag()); - GPR_ASSERT(err == GRPC_CALL_OK); - ev = grpc_completion_queue_pluck(cq(), halfclose_tag(), gpr_inf_future); - GPR_ASSERT(ev->type == GRPC_FINISH_ACCEPTED); - grpc_event_finish(ev); - - self_halfclosed_ = true; - } else if (!ret) { // Stream broken - self_halfclosed_ = true; - peer_halfclosed_ = true; - } - - return ret; -} - -const Status &StreamContext::Wait() { - // TODO(yangg) properly support metadata - grpc_event *metadata_ev = grpc_completion_queue_pluck( - cq(), client_metadata_read_tag(), gpr_inf_future); - grpc_event_finish(metadata_ev); - // TODO(yangg) protect states by a mutex, including other places. - if (!self_halfclosed_ || !peer_halfclosed_) { - Cancel(); - } - grpc_event *finish_ev = - grpc_completion_queue_pluck(cq(), finished_tag(), gpr_inf_future); - GPR_ASSERT(finish_ev->type == GRPC_FINISHED); - final_status_ = Status( - static_cast(finish_ev->data.finished.status), - finish_ev->data.finished.details ? finish_ev->data.finished.details : ""); - grpc_event_finish(finish_ev); - return final_status_; -} - -void StreamContext::Cancel() { grpc_call_cancel(call()); } - -} // namespace grpc diff --git a/src/cpp/stream/stream_context.h b/src/cpp/stream/stream_context.h deleted file mode 100644 index 8def589841b..00000000000 --- a/src/cpp/stream/stream_context.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_INTERNAL_STREAM_STREAM_CONTEXT_H__ -#define __GRPCPP_INTERNAL_STREAM_STREAM_CONTEXT_H__ - -#include -#include -#include - -namespace google { -namespace protobuf { -class Message; -} -} - -namespace grpc { -class ClientContext; -class RpcMethod; - -class StreamContext final : public StreamContextInterface { - public: - StreamContext(const RpcMethod &method, ClientContext *context, - const google::protobuf::Message *request, - google::protobuf::Message *result); - StreamContext(const RpcMethod &method, grpc_call *call, - grpc_completion_queue *cq, google::protobuf::Message *request, - google::protobuf::Message *result); - ~StreamContext(); - // Start the stream, if there is a final write following immediately, set - // buffered so that the messages can be sent in batch. - void Start(bool buffered) override; - bool Read(google::protobuf::Message *msg) override; - bool Write(const google::protobuf::Message *msg, bool is_last) override; - const Status &Wait() override; - void Cancel() override; - - google::protobuf::Message *request() override { return request_; } - google::protobuf::Message *response() override { return result_; } - - private: - // Unique tags for plucking events from the c layer. this pointer is casted - // to char* to create single byte step between tags. It implicitly relies on - // that StreamContext is large enough to contain all the pointers. - void *finished_tag() { return reinterpret_cast(this); } - void *read_tag() { return reinterpret_cast(this) + 1; } - void *write_tag() { return reinterpret_cast(this) + 2; } - void *halfclose_tag() { return reinterpret_cast(this) + 3; } - void *client_metadata_read_tag() { - return reinterpret_cast(this) + 5; - } - grpc_call *call() { return call_; } - grpc_completion_queue *cq() { return cq_; } - - bool is_client_; - const RpcMethod *method_; // not owned - grpc_call *call_; // not owned - grpc_completion_queue *cq_; // not owned - google::protobuf::Message *request_; // first request, not owned - google::protobuf::Message *result_; // last response, not owned - - bool peer_halfclosed_; - bool self_halfclosed_; - Status final_status_; -}; - -} // namespace grpc - -#endif // __GRPCPP_INTERNAL_STREAM_STREAM_CONTEXT_H__ From 75ec2b191cbd94ff0eb3f1247d66e3991aa97000 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Mon, 9 Feb 2015 16:03:41 -0800 Subject: [PATCH 019/232] more implementation and all async signatures --- include/grpc++/stream.h | 241 +++++++++++++++++++++++++++++++--------- 1 file changed, 186 insertions(+), 55 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 4d4581d00f0..cd416f853b3 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -146,6 +146,7 @@ class ClientWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; + buf.AddRecvMessage(response_); buf.AddClientRecvStatus(&status); call_.PerformOps(&buf, (void *)4); GPR_ASSERT(cq_.Pluck((void *)4)); @@ -207,125 +208,255 @@ class ClientReaderWriter final : public ClientStreamingInterface, template class ServerReader final : public ReaderInterface { public: - ServerReader(CompletionQueue* cq, Call* call) : cq_(cq), call_(call) {} + explicit ServerReader(Call* call) : call_(call) {} virtual bool Read(R* msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); call_->PerformOps(&buf, (void *)2); - return cq_->Pluck((void *)2); + return call_->cq()->Pluck((void *)2); } private: - CompletionQueue* cq_; Call* call_; }; template -class ServerWriter : public WriterInterface { +class ServerWriter final : public WriterInterface { public: - explicit ServerWriter(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - context_->Read(context_->request()); - } + explicit ServerWriter(Call* call) : call_(call) {} - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + virtual bool Write(const W& msg) override { + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_->PerformOps(&buf, (void *)2); + return call_->cq()->Pluck((void *)2); } private: - StreamContextInterface* const context_; // not owned + Call* call_; }; // Server-side interface for bi-directional streaming. template -class ServerReaderWriter : public WriterInterface, +class ServerReaderWriter final : public WriterInterface, public ReaderInterface { public: - explicit ServerReaderWriter(StreamContextInterface* context) - : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); + explicit ServerReaderWriter(Call* call) : call_(call) {} + + virtual bool Read(R* msg) override { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_->PerformOps(&buf, (void *)2); + return call_->cq()->Pluck((void *)2); + } + + virtual bool Write(const W& msg) override { + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_->PerformOps(&buf, (void *)3); + return call_->cq()->Pluck((void *)3); } - virtual bool Read(R* msg) { return context_->Read(msg); } + private: + CompletionQueue* cq_; + Call* call_; +}; + +// Async interfaces +// Common interface for all client side streaming. +class ClientAsyncStreamingInterface { + public: + virtual ~ClientAsyncStreamingInterface() {} + + virtual void Finish(Status* status, void* tag) = 0; +}; + +// An interface that yields a sequence of R messages. +template +class AsyncReaderInterface { + public: + virtual ~AsyncReaderInterface() {} - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + virtual void Read(R* msg, void* tag) = 0; +}; + +// An interface that can be fed a sequence of W messages. +template +class AsyncWriterInterface { + public: + virtual ~Async WriterInterface() {} + + virtual void Write(const W& msg, void* tag) = 0; +}; + +template +class ClientAsyncReader final : public ClientAsyncStreamingInterface, + public AsyncReaderInterface { + public: + // Blocking create a stream and write the first request out. + ClientAsyncReader(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, void* tag) + : call_(channel->CreateCall(method, context, &cq_)) { + CallOpBuffer buf; + buf.AddSendMessage(request); + buf.AddClientSendClose(); + call_.PerformOps(&buf, tag); + } + + virtual void Read(R *msg, void* tag) override { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_.PerformOps(&buf, tag); + } + + virtual void Finish(Status* status, void* tag) override { + CallOpBuffer buf; + buf.AddClientRecvStatus(status); + call_.PerformOps(&buf, tag); } private: - StreamContextInterface* const context_; // not owned + CompletionQueue cq_; + Call call_; }; template -class ServerAsyncResponseWriter { +class ClientWriter final : public ClientAsyncStreamingInterface, + public WriterInterface { public: - explicit ServerAsyncResponseWriter(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - context_->Read(context_->request()); + // Blocking create a stream. + ClientAsyncWriter(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + google::protobuf::Message *response) + : response_(response), + call_(channel->CreateCall(method, context, &cq_)) {} + + virtual void Write(const W& msg, void* tag) override { + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_.PerformOps(&buf, tag); } - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + virtual void WritesDone(void* tag) { + CallOpBuffer buf; + buf.AddClientSendClose(); + call_.PerformOps(&buf, tag); + } + + virtual void Finish(Status* status, void* tag) override { + CallOpBuffer buf; + buf.AddRecvMessage(response_); + buf.AddClientRecvStatus(status); + call_.PerformOps(&buf, tag); } private: - StreamContextInterface* const context_; // not owned + google::protobuf::Message *const response_; + CompletionQueue cq_; + Call call_; }; -template -class ServerAsyncReader : public ReaderInterface { +// Client-side interface for bi-directional streaming. +template +class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { public: - explicit ServerAsyncReader(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); + ClientAsyncReaderWriter(ChannelInterface *channel, + const RpcMethod &method, ClientContext *context) + : call_(channel->CreateCall(method, context, &cq_)) {} + + virtual void Read(R *msg, void* tag) override { + CallOpBuffer buf; + buf.AddRecvMessage(msg); + call_.PerformOps(&buf, tag); + } + + virtual void Write(const W& msg, void* tag) override { + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_.PerformOps(&buf, tag); + } + + virtual bool WritesDone(void* tag) { + CallOpBuffer buf; + buf.AddClientSendClose(); + call_.PerformOps(&buf, tag); } - virtual bool Read(R* msg) { return context_->Read(msg); } + virtual void Finish(Status* status, void* tag) override { + CallOpBuffer buf; + Status status; + buf.AddClientRecvStatus(status); + call_.PerformOps(&buf, tag); + } private: - StreamContextInterface* const context_; // not owned + CompletionQueue cq_; + Call call_; }; +// TODO(yangg) Move out of stream.h template -class ServerAsyncWriter : public WriterInterface { +class ServerAsyncResponseWriter final { public: - explicit ServerAsyncWriter(StreamContextInterface* context) : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - context_->Read(context_->request()); + explicit ServerAsyncResponseWriter(Call* call) : call_(call) {} + + virtual void Write(const W& msg, void* tag) override { + CallOpBuffer buf; + buf.AddSendMessage(msg); + call_->PerformOps(&buf, tag); } - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + private: + Call* call_; +}; + +template +class ServerAsyncReader : public AsyncReaderInterface { + public: + explicit ServerAsyncReader(Call* call) : call_(call) {} + + virtual void Read(R* msg, void* tag) { + // TODO } private: - StreamContextInterface* const context_; // not owned + Call* call_; +}; + +template +class ServerAsyncWriter : public AsyncWriterInterface { + public: + explicit ServerAsyncWriter(Call* call) : call_(call) {} + + virtual void Write(const W& msg, void* tag) { + // TODO + } + + private: + Call* call_; }; // Server-side interface for bi-directional streaming. template -class ServerAsyncReaderWriter : public WriterInterface, - public ReaderInterface { +class ServerAsyncReaderWriter : public AsyncWriterInterface, + public AsyncReaderInterface { public: - explicit ServerAsyncReaderWriter(StreamContextInterface* context) - : context_(context) { - GPR_ASSERT(context_); - context_->Start(true); - } + explicit ServerAsyncReaderWriter(Call* call) : call_(call) {} - virtual bool Read(R* msg) { return context_->Read(msg); } + virtual void Read(R* msg, void* tag) { + // TODO + } - virtual bool Write(const W& msg) { - return context_->Write(const_cast(&msg), false); + virtual void Write(const W& msg, void* tag) { + // TODO } private: - StreamContextInterface* const context_; // not owned + Call* call_; }; } // namespace grpc From b470169252c36a64749f6b7c60da36845c7fee1d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:12:00 -0800 Subject: [PATCH 020/232] Remove more unnecessary files --- Makefile | 3 - build.json | 2 - include/grpc++/server_context.h | 5 +- src/cpp/client/channel.cc | 1 - src/cpp/common/completion_queue.cc | 1 - src/cpp/server/server.cc | 18 ++-- src/cpp/server/server_rpc_handler.cc | 140 --------------------------- src/cpp/server/server_rpc_handler.h | 67 ------------- 8 files changed, 14 insertions(+), 223 deletions(-) delete mode 100644 src/cpp/server/server_rpc_handler.cc delete mode 100644 src/cpp/server/server_rpc_handler.h diff --git a/Makefile b/Makefile index 4918fbc19af..faa94d5a105 100644 --- a/Makefile +++ b/Makefile @@ -2622,7 +2622,6 @@ LIBGRPC++_SRC = \ src/cpp/server/server_builder.cc \ src/cpp/server/server_context_impl.cc \ src/cpp/server/server_credentials.cc \ - src/cpp/server/server_rpc_handler.cc \ src/cpp/server/thread_pool.cc \ src/cpp/util/status.cc \ src/cpp/util/time.cc \ @@ -2677,7 +2676,6 @@ src/cpp/server/server.cc: $(OPENSSL_DEP) src/cpp/server/server_builder.cc: $(OPENSSL_DEP) src/cpp/server/server_context_impl.cc: $(OPENSSL_DEP) src/cpp/server/server_credentials.cc: $(OPENSSL_DEP) -src/cpp/server/server_rpc_handler.cc: $(OPENSSL_DEP) src/cpp/server/thread_pool.cc: $(OPENSSL_DEP) src/cpp/util/status.cc: $(OPENSSL_DEP) src/cpp/util/time.cc: $(OPENSSL_DEP) @@ -2735,7 +2733,6 @@ objs/$(CONFIG)/src/cpp/server/server.o: objs/$(CONFIG)/src/cpp/server/server_builder.o: objs/$(CONFIG)/src/cpp/server/server_context_impl.o: objs/$(CONFIG)/src/cpp/server/server_credentials.o: -objs/$(CONFIG)/src/cpp/server/server_rpc_handler.o: objs/$(CONFIG)/src/cpp/server/thread_pool.o: objs/$(CONFIG)/src/cpp/util/status.o: objs/$(CONFIG)/src/cpp/util/time.o: diff --git a/build.json b/build.json index 3bedddfcd1f..bd4fcb9fd13 100644 --- a/build.json +++ b/build.json @@ -399,7 +399,6 @@ "headers": [ "src/cpp/client/channel.h", "src/cpp/proto/proto_utils.h", - "src/cpp/server/server_rpc_handler.h", "src/cpp/server/thread_pool.h", "src/cpp/util/time.h" ], @@ -418,7 +417,6 @@ "src/cpp/server/server_builder.cc", "src/cpp/server/server_context_impl.cc", "src/cpp/server/server_credentials.cc", - "src/cpp/server/server_rpc_handler.cc", "src/cpp/server/thread_pool.cc", "src/cpp/util/status.cc", "src/cpp/util/time.cc" diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 9fd3ab1689f..4af9fd6aaac 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -35,6 +35,9 @@ #define __GRPCPP_SERVER_CONTEXT_H_ #include +#include + +#include "config.h" namespace grpc { @@ -43,7 +46,7 @@ class ServerContext { public: virtual ~ServerContext() {} - virtual std::chrono::system_clock::time_point absolute_deadline() const = 0; + std::chrono::system_clock::time_point absolute_deadline(); private: std::vector > metadata_; diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index b5132129033..24bd7adaad4 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -42,7 +42,6 @@ #include #include "src/cpp/proto/proto_utils.h" -#include "src/cpp/stream/stream_context.h" #include #include #include diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 31c1fb92869..d7d616407e0 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -38,7 +38,6 @@ #include #include #include "src/cpp/util/time.h" -#include namespace grpc { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 1f48e83b880..5d44ab2ba42 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -37,10 +37,9 @@ #include #include #include -#include "src/cpp/server/server_rpc_handler.h" -#include #include #include +#include #include #include @@ -148,12 +147,12 @@ void Server::RunRpc() { void *tag = nullptr; GPR_ASSERT(started_); grpc_call *c_call = NULL; - grpc_call_details details; - grpc_call_details_init(&details); + grpc_call_details call_details; + grpc_call_details_init(&call_details); grpc_metadata_array initial_metadata; grpc_metadata_array_init(&initial_metadata); CompletionQueue cq; - grpc_call_error err = grpc_server_request_call(server_, &call, &details, &initial_metadata, cq.cq(), nullptr); + grpc_call_error err = grpc_server_request_call(server_, &c_call, &call_details, &initial_metadata, cq.cq(), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); bool ok = false; GPR_ASSERT(cq_.Next(&tag, &ok)); @@ -166,10 +165,13 @@ void Server::RunRpc() { if (iter != method_map_.end()) { method = iter->second; } - ServerRpcHandler rpc_handler(&call, context, method); - rpc_handler.StartRpc(); + // TODO(ctiller): allocate only if necessary + std::unique_ptr request(method->AllocateRequestProto()); + std::unique_ptr response(method->AllocateResponseProto()); + method->handler()->RunHandler(MethodHandler::HandlerParameter( + &call, &context, request.get(), response.get())); } - grpc_call_details_destroy(&details); + grpc_call_details_destroy(&call_details); grpc_metadata_array_destroy(&initial_metadata); { diff --git a/src/cpp/server/server_rpc_handler.cc b/src/cpp/server/server_rpc_handler.cc deleted file mode 100644 index bf02de8b805..00000000000 --- a/src/cpp/server/server_rpc_handler.cc +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Copyright 2014, 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 "src/cpp/server/server_rpc_handler.h" - -#include -#include "src/cpp/server/server_context_impl.h" -#include "src/cpp/stream/stream_context.h" -#include -#include - -namespace grpc { - -ServerRpcHandler::ServerRpcHandler(AsyncServerContext *async_server_context, - RpcServiceMethod *method) - : async_server_context_(async_server_context), method_(method) {} - -void ServerRpcHandler::StartRpc() { - if (method_ == nullptr) { - // Method not supported, finish the rpc with error. - // TODO(rocking): do we need to call read to consume the request? - FinishRpc(Status(StatusCode::UNIMPLEMENTED, "No such method.")); - return; - } - - ServerContextImpl user_context(async_server_context_->absolute_deadline()); - - if (method_->method_type() == RpcMethod::NORMAL_RPC) { - // Start the rpc on this dedicated completion queue. - async_server_context_->Accept(cq_.cq()); - - // Allocate request and response. - std::unique_ptr request( - method_->AllocateRequestProto()); - std::unique_ptr response( - method_->AllocateResponseProto()); - - // Read request - async_server_context_->StartRead(request.get()); - auto type = WaitForNextEvent(); - GPR_ASSERT(type == CompletionQueue::SERVER_READ_OK); - - // Run the application's rpc handler - MethodHandler *handler = method_->handler(); - Status status = handler->RunHandler(MethodHandler::HandlerParameter( - &user_context, request.get(), response.get())); - - if (status.IsOk()) { - // Send the response if we get an ok status. - async_server_context_->StartWrite(*response, GRPC_WRITE_BUFFER_HINT); - type = WaitForNextEvent(); - if (type != CompletionQueue::SERVER_WRITE_OK) { - status = Status(StatusCode::INTERNAL, "Error writing response."); - } - } - - FinishRpc(status); - } else { - // Allocate request and response. - // TODO(yangg) maybe not allocate both when not needed? - std::unique_ptr request( - method_->AllocateRequestProto()); - std::unique_ptr response( - method_->AllocateResponseProto()); - - StreamContext stream_context(*method_, async_server_context_->call(), - cq_.cq(), request.get(), response.get()); - - // Run the application's rpc handler - MethodHandler *handler = method_->handler(); - Status status = handler->RunHandler(MethodHandler::HandlerParameter( - &user_context, request.get(), response.get(), &stream_context)); - if (status.IsOk() && - method_->method_type() == RpcMethod::CLIENT_STREAMING) { - stream_context.Write(response.get(), false); - } - // TODO(yangg) Do we need to consider the status in stream_context? - FinishRpc(status); - } -} - -CompletionQueue::CompletionType ServerRpcHandler::WaitForNextEvent() { - void *tag = nullptr; - CompletionQueue::CompletionType type = cq_.Next(&tag); - if (type != CompletionQueue::QUEUE_CLOSED && - type != CompletionQueue::RPC_END) { - GPR_ASSERT(static_cast(tag) == - async_server_context_.get()); - } - return type; -} - -void ServerRpcHandler::FinishRpc(const Status &status) { - async_server_context_->StartWriteStatus(status); - CompletionQueue::CompletionType type; - - // HALFCLOSE_OK and RPC_END events come in either order. - type = WaitForNextEvent(); - GPR_ASSERT(type == CompletionQueue::HALFCLOSE_OK || - type == CompletionQueue::RPC_END); - type = WaitForNextEvent(); - GPR_ASSERT(type == CompletionQueue::HALFCLOSE_OK || - type == CompletionQueue::RPC_END); - - cq_.Shutdown(); - type = WaitForNextEvent(); - GPR_ASSERT(type == CompletionQueue::QUEUE_CLOSED); -} - -} // namespace grpc diff --git a/src/cpp/server/server_rpc_handler.h b/src/cpp/server/server_rpc_handler.h deleted file mode 100644 index 15efd1892dc..00000000000 --- a/src/cpp/server/server_rpc_handler.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_INTERNAL_SERVER_SERVER_RPC_HANDLER_H__ -#define __GRPCPP_INTERNAL_SERVER_SERVER_RPC_HANDLER_H__ - -#include - -#include -#include - -namespace grpc { - -class -class ServerContext; -class RpcServiceMethod; - -class ServerRpcHandler { - public: - ServerRpcHandler(Call *call, - ServerContext *server_context, - RpcServiceMethod *method); - - void StartRpc(); - - private: - void FinishRpc(const Status &status); - - Call *call_; - ServerContext* server_context_; - RpcServiceMethod *method_; - CompletionQueue cq_; -}; - -} // namespace grpc - -#endif // __GRPCPP_INTERNAL_SERVER_SERVER_RPC_HANDLER_H__ From 5319164875774098870896515d48ce6b41ec1332 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:15:23 -0800 Subject: [PATCH 021/232] Cleanup --- include/grpc++/stream.h | 7 +- .../end2end/sync_client_async_server_test.cc | 236 ------------------ 2 files changed, 3 insertions(+), 240 deletions(-) delete mode 100644 test/cpp/end2end/sync_client_async_server_test.cc diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 34604191e53..22dc44efe40 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -316,7 +316,7 @@ class AsyncReaderInterface { template class AsyncWriterInterface { public: - virtual ~Async WriterInterface() {} + virtual ~AsyncWriterInterface() {} virtual void Write(const W& msg, void* tag) = 0; }; @@ -354,7 +354,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, }; template -class ClientWriter final : public ClientAsyncStreamingInterface, +class ClientAsyncWriter final : public ClientAsyncStreamingInterface, public WriterInterface { public: // Blocking create a stream. @@ -411,7 +411,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&buf, tag); } - virtual bool WritesDone(void* tag) { + virtual void WritesDone(void* tag) { CallOpBuffer buf; buf.AddClientSendClose(); call_.PerformOps(&buf, tag); @@ -419,7 +419,6 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, virtual void Finish(Status* status, void* tag) override { CallOpBuffer buf; - Status status; buf.AddClientRecvStatus(status); call_.PerformOps(&buf, tag); } diff --git a/test/cpp/end2end/sync_client_async_server_test.cc b/test/cpp/end2end/sync_client_async_server_test.cc deleted file mode 100644 index 9955eb306f0..00000000000 --- a/test/cpp/end2end/sync_client_async_server_test.cc +++ /dev/null @@ -1,236 +0,0 @@ -/* - * - * Copyright 2014, 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 -#include "test/cpp/util/echo.pb.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "test/cpp/end2end/async_test_server.h" -#include "test/core/util/port.h" -#include - -using grpc::cpp::test::util::EchoRequest; -using grpc::cpp::test::util::EchoResponse; - -using std::chrono::duration_cast; -using std::chrono::microseconds; -using std::chrono::seconds; -using std::chrono::system_clock; - -using grpc::testing::AsyncTestServer; - -namespace grpc { -namespace { - -void ServerLoop(void* s) { - AsyncTestServer* server = static_cast(s); - server->MainLoop(); -} - -class End2endTest : public ::testing::Test { - protected: - void SetUp() override { - int port = grpc_pick_unused_port_or_die(); - // TODO(yangg) protobuf has a StringPrintf, maybe use that - std::ostringstream oss; - oss << "[::]:" << port; - // Setup server - server_.reset(new AsyncTestServer()); - server_->AddPort(oss.str()); - server_->Start(); - - RunServerThread(); - - // Setup client - oss.str(""); - oss << "127.0.0.1:" << port; - std::shared_ptr channel = - CreateChannel(oss.str(), ChannelArguments()); - stub_.set_channel(channel); - } - - void RunServerThread() { - gpr_thd_id id; - EXPECT_TRUE(gpr_thd_new(&id, ServerLoop, server_.get(), NULL)); - } - - void TearDown() override { server_->Shutdown(); } - - std::unique_ptr server_; - InternalStub stub_; -}; - -TEST_F(End2endTest, NoOpTest) { EXPECT_TRUE(stub_.channel() != nullptr); } - -TEST_F(End2endTest, SimpleRpc) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo"); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - Status s = - stub_.channel()->StartBlockingRpc(method, &context, request, &result); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(s.IsOk()); -} - -TEST_F(End2endTest, KSequentialSimpleRpcs) { - int k = 3; - for (int i = 0; i < k; i++) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo"); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - Status s = - stub_.channel()->StartBlockingRpc(method, &context, request, &result); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(s.IsOk()); - } -} - -TEST_F(End2endTest, OnePingpongBidiStream) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo", RpcMethod::RpcType::BIDI_STREAMING); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - StreamContextInterface* stream_interface = - stub_.channel()->CreateStream(method, &context, nullptr, nullptr); - std::unique_ptr> stream( - new ClientReaderWriter(stream_interface)); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->Read(&result)); - stream->WritesDone(); - EXPECT_FALSE(stream->Read(&result)); - Status s = stream->Wait(); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(s.IsOk()); -} - -TEST_F(End2endTest, TwoPingpongBidiStream) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo", RpcMethod::RpcType::BIDI_STREAMING); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - StreamContextInterface* stream_interface = - stub_.channel()->CreateStream(method, &context, nullptr, nullptr); - std::unique_ptr> stream( - new ClientReaderWriter(stream_interface)); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->Read(&result)); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(stream->Write(request)); - EXPECT_TRUE(stream->Read(&result)); - EXPECT_EQ(result.message(), request.message()); - stream->WritesDone(); - EXPECT_FALSE(stream->Read(&result)); - Status s = stream->Wait(); - EXPECT_TRUE(s.IsOk()); -} - -TEST_F(End2endTest, OnePingpongClientStream) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo", RpcMethod::RpcType::CLIENT_STREAMING); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - StreamContextInterface* stream_interface = - stub_.channel()->CreateStream(method, &context, nullptr, &result); - std::unique_ptr> stream( - new ClientWriter(stream_interface)); - EXPECT_TRUE(stream->Write(request)); - stream->WritesDone(); - Status s = stream->Wait(); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(s.IsOk()); -} - -TEST_F(End2endTest, OnePingpongServerStream) { - EchoRequest request; - request.set_message("hello"); - EchoResponse result; - ClientContext context; - RpcMethod method("/foo", RpcMethod::RpcType::SERVER_STREAMING); - std::chrono::system_clock::time_point deadline = - std::chrono::system_clock::now() + std::chrono::seconds(10); - context.set_absolute_deadline(deadline); - StreamContextInterface* stream_interface = - stub_.channel()->CreateStream(method, &context, &request, nullptr); - std::unique_ptr> stream( - new ClientReader(stream_interface)); - EXPECT_TRUE(stream->Read(&result)); - EXPECT_FALSE(stream->Read(nullptr)); - Status s = stream->Wait(); - EXPECT_EQ(result.message(), request.message()); - EXPECT_TRUE(s.IsOk()); -} - -} // namespace -} // namespace grpc - -int main(int argc, char** argv) { - grpc_init(); - ::testing::InitGoogleTest(&argc, argv); - int result = RUN_ALL_TESTS(); - grpc_shutdown(); - return result; -} From 65130596c1e6a2635b3eb26ae7c7399d0eda60e7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:15:53 -0800 Subject: [PATCH 022/232] Cleanup --- Makefile | 36 +----------------------------------- build.json | 16 ---------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/Makefile b/Makefile index faa94d5a105..02fd48728bf 100644 --- a/Makefile +++ b/Makefile @@ -391,7 +391,6 @@ qps_client: bins/$(CONFIG)/qps_client qps_server: bins/$(CONFIG)/qps_server ruby_plugin: bins/$(CONFIG)/ruby_plugin status_test: bins/$(CONFIG)/status_test -sync_client_async_server_test: bins/$(CONFIG)/sync_client_async_server_test thread_pool_test: bins/$(CONFIG)/thread_pool_test tips_client: bins/$(CONFIG)/tips_client tips_publisher_test: bins/$(CONFIG)/tips_publisher_test @@ -725,7 +724,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c bins/$(CONFIG)/alarm_heap_test bins/$(CONFIG)/alarm_list_test bins/$(CONFIG)/alarm_test bins/$(CONFIG)/alpn_test bins/$(CONFIG)/bin_encoder_test bins/$(CONFIG)/census_hash_table_test bins/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test bins/$(CONFIG)/census_statistics_multiple_writers_test bins/$(CONFIG)/census_statistics_performance_test bins/$(CONFIG)/census_statistics_quick_test bins/$(CONFIG)/census_statistics_small_log_test bins/$(CONFIG)/census_stub_test bins/$(CONFIG)/census_window_stats_test bins/$(CONFIG)/chttp2_status_conversion_test bins/$(CONFIG)/chttp2_stream_encoder_test bins/$(CONFIG)/chttp2_stream_map_test bins/$(CONFIG)/chttp2_transport_end2end_test bins/$(CONFIG)/dualstack_socket_test bins/$(CONFIG)/echo_client bins/$(CONFIG)/echo_server bins/$(CONFIG)/echo_test bins/$(CONFIG)/fd_posix_test bins/$(CONFIG)/fling_client bins/$(CONFIG)/fling_server bins/$(CONFIG)/fling_stream_test bins/$(CONFIG)/fling_test bins/$(CONFIG)/gpr_cancellable_test bins/$(CONFIG)/gpr_cmdline_test bins/$(CONFIG)/gpr_env_test bins/$(CONFIG)/gpr_file_test bins/$(CONFIG)/gpr_histogram_test bins/$(CONFIG)/gpr_host_port_test bins/$(CONFIG)/gpr_log_test bins/$(CONFIG)/gpr_slice_buffer_test bins/$(CONFIG)/gpr_slice_test bins/$(CONFIG)/gpr_string_test bins/$(CONFIG)/gpr_sync_test bins/$(CONFIG)/gpr_thd_test bins/$(CONFIG)/gpr_time_test bins/$(CONFIG)/gpr_useful_test bins/$(CONFIG)/grpc_base64_test bins/$(CONFIG)/grpc_byte_buffer_reader_test bins/$(CONFIG)/grpc_channel_stack_test bins/$(CONFIG)/grpc_completion_queue_test bins/$(CONFIG)/grpc_credentials_test bins/$(CONFIG)/grpc_json_token_test bins/$(CONFIG)/grpc_stream_op_test bins/$(CONFIG)/hpack_parser_test bins/$(CONFIG)/hpack_table_test bins/$(CONFIG)/httpcli_format_request_test bins/$(CONFIG)/httpcli_parser_test bins/$(CONFIG)/httpcli_test bins/$(CONFIG)/json_rewrite bins/$(CONFIG)/json_rewrite_test bins/$(CONFIG)/json_test bins/$(CONFIG)/lame_client_test bins/$(CONFIG)/message_compress_test bins/$(CONFIG)/metadata_buffer_test bins/$(CONFIG)/murmur_hash_test bins/$(CONFIG)/no_server_test bins/$(CONFIG)/poll_kick_posix_test bins/$(CONFIG)/resolve_address_test bins/$(CONFIG)/secure_endpoint_test bins/$(CONFIG)/sockaddr_utils_test bins/$(CONFIG)/tcp_client_posix_test bins/$(CONFIG)/tcp_posix_test bins/$(CONFIG)/tcp_server_posix_test bins/$(CONFIG)/time_averaged_stats_test bins/$(CONFIG)/time_test bins/$(CONFIG)/timeout_encoding_test bins/$(CONFIG)/transport_metadata_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test bins/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test bins/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_fake_security_census_simple_request_test bins/$(CONFIG)/chttp2_fake_security_disappearing_server_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_fake_security_invoke_large_request_test bins/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test bins/$(CONFIG)/chttp2_fake_security_no_op_test bins/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test bins/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test bins/$(CONFIG)/chttp2_fake_security_request_with_payload_test bins/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test bins/$(CONFIG)/chttp2_fake_security_simple_request_test bins/$(CONFIG)/chttp2_fake_security_thread_stress_test bins/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_fake_security_no_op_legacy_test bins/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test bins/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_fullstack_no_op_test bins/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_fullstack_simple_request_test bins/$(CONFIG)/chttp2_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test bins/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test bins/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_socket_pair_census_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_disappearing_server_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test bins/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test bins/$(CONFIG)/chttp2_socket_pair_no_op_test bins/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test bins/$(CONFIG)/chttp2_socket_pair_request_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test bins/$(CONFIG)/chttp2_socket_pair_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_thread_stress_test bins/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test bins/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test bins/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx bins/$(CONFIG)/channel_arguments_test bins/$(CONFIG)/credentials_test bins/$(CONFIG)/end2end_test bins/$(CONFIG)/interop_client bins/$(CONFIG)/interop_server bins/$(CONFIG)/qps_client bins/$(CONFIG)/qps_server bins/$(CONFIG)/status_test bins/$(CONFIG)/sync_client_async_server_test bins/$(CONFIG)/thread_pool_test bins/$(CONFIG)/tips_client bins/$(CONFIG)/tips_publisher_test bins/$(CONFIG)/tips_subscriber_test +buildtests_cxx: privatelibs_cxx bins/$(CONFIG)/channel_arguments_test bins/$(CONFIG)/credentials_test bins/$(CONFIG)/end2end_test bins/$(CONFIG)/interop_client bins/$(CONFIG)/interop_server bins/$(CONFIG)/qps_client bins/$(CONFIG)/qps_server bins/$(CONFIG)/status_test bins/$(CONFIG)/thread_pool_test bins/$(CONFIG)/tips_client bins/$(CONFIG)/tips_publisher_test bins/$(CONFIG)/tips_subscriber_test test: test_c test_cxx @@ -1439,8 +1438,6 @@ test_cxx: buildtests_cxx $(Q) ./bins/$(CONFIG)/qps_server || ( echo test qps_server failed ; exit 1 ) $(E) "[RUN] Testing status_test" $(Q) ./bins/$(CONFIG)/status_test || ( echo test status_test failed ; exit 1 ) - $(E) "[RUN] Testing sync_client_async_server_test" - $(Q) ./bins/$(CONFIG)/sync_client_async_server_test || ( echo test sync_client_async_server_test failed ; exit 1 ) $(E) "[RUN] Testing thread_pool_test" $(Q) ./bins/$(CONFIG)/thread_pool_test || ( echo test thread_pool_test failed ; exit 1 ) $(E) "[RUN] Testing tips_publisher_test" @@ -7074,37 +7071,6 @@ endif endif -SYNC_CLIENT_ASYNC_SERVER_TEST_SRC = \ - test/cpp/end2end/sync_client_async_server_test.cc \ - -SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(SYNC_CLIENT_ASYNC_SERVER_TEST_SRC)))) - -ifeq ($(NO_SECURE),true) - -# You can't build secure targets if you don't have OpenSSL with ALPN. - -bins/$(CONFIG)/sync_client_async_server_test: openssl_dep_error - -else - -bins/$(CONFIG)/sync_client_async_server_test: $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a - $(E) "[LD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/sync_client_async_server_test - -endif - -objs/$(CONFIG)/test/cpp/end2end/sync_client_async_server_test.o: libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a - -deps_sync_client_async_server_test: $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS:.o=.dep) - -ifneq ($(NO_SECURE),true) -ifneq ($(NO_DEPS),true) --include $(SYNC_CLIENT_ASYNC_SERVER_TEST_OBJS:.o=.dep) -endif -endif - - THREAD_POOL_TEST_SRC = \ test/cpp/server/thread_pool_test.cc \ diff --git a/build.json b/build.json index bd4fcb9fd13..f42c77c96c6 100644 --- a/build.json +++ b/build.json @@ -1671,22 +1671,6 @@ "gpr" ] }, - { - "name": "sync_client_async_server_test", - "build": "test", - "language": "c++", - "src": [ - "test/cpp/end2end/sync_client_async_server_test.cc" - ], - "deps": [ - "grpc++_test_util", - "grpc_test_util", - "grpc++", - "grpc", - "gpr_test_util", - "gpr" - ] - }, { "name": "thread_pool_test", "build": "test", From f8ac5d846c26b4b83828117ec20f13b61b998e32 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:24:20 -0800 Subject: [PATCH 023/232] Fixup callers with new api --- examples/tips/publisher_test.cc | 2 +- test/cpp/end2end/end2end_test.cc | 8 ++++---- test/cpp/interop/client.cc | 10 +++++----- test/cpp/interop/server.cc | 2 +- test/cpp/qps/server.cc | 2 +- tools/run_tests/tests.json | 4 ---- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/tips/publisher_test.cc b/examples/tips/publisher_test.cc index 34737ae6ed9..db3e3784da7 100644 --- a/examples/tips/publisher_test.cc +++ b/examples/tips/publisher_test.cc @@ -107,7 +107,7 @@ class PublisherTest : public ::testing::Test { server_address_ << "localhost:" << port; ServerBuilder builder; builder.AddPort(server_address_.str()); - builder.RegisterService(service_.service()); + builder.RegisterService(&service_); server_ = builder.BuildAndStart(); channel_ = CreateChannel(server_address_.str(), ChannelArguments()); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 4dea77ea811..94a04aed37d 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -147,8 +147,8 @@ class End2endTest : public ::testing::Test { // Setup server ServerBuilder builder; builder.AddPort(server_address_.str()); - builder.RegisterService(service_.service()); - builder.RegisterService(dup_pkg_service_.service()); + builder.RegisterService(&service_); + builder.RegisterService(&dup_pkg_service_); server_ = builder.BuildAndStart(); } @@ -290,7 +290,7 @@ TEST_F(End2endTest, RequestStreamOneRequest) { request.set_message("hello"); EXPECT_TRUE(stream->Write(request)); stream->WritesDone(); - Status s = stream->Wait(); + Status s = stream->Finish(); EXPECT_EQ(response.message(), request.message()); EXPECT_TRUE(s.IsOk()); @@ -308,7 +308,7 @@ TEST_F(End2endTest, RequestStreamTwoRequests) { EXPECT_TRUE(stream->Write(request)); EXPECT_TRUE(stream->Write(request)); stream->WritesDone(); - Status s = stream->Wait(); + Status s = stream->Finish(); EXPECT_EQ(response.message(), "hellohello"); EXPECT_TRUE(s.IsOk()); diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 0fa76f0e023..29bbe4d931d 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -248,7 +248,7 @@ void DoRequestStreaming() { aggregated_payload_size += request_stream_sizes[i]; } stream->WritesDone(); - grpc::Status s = stream->Wait(); + grpc::Status s = stream->Finish(); GPR_ASSERT(response.aggregated_payload_size() == aggregated_payload_size); GPR_ASSERT(s.IsOk()); @@ -278,7 +278,7 @@ void DoResponseStreaming() { ++i; } GPR_ASSERT(response_stream_sizes.size() == i); - grpc::Status s = stream->Wait(); + grpc::Status s = stream->Finish(); GPR_ASSERT(s.IsOk()); gpr_log(GPR_INFO, "Response streaming done."); @@ -311,7 +311,7 @@ void DoResponseStreamingWithSlowConsumer() { ++i; } GPR_ASSERT(kNumResponseMessages == i); - grpc::Status s = stream->Wait(); + grpc::Status s = stream->Finish(); GPR_ASSERT(s.IsOk()); gpr_log(GPR_INFO, "Response streaming done."); @@ -345,7 +345,7 @@ void DoHalfDuplex() { ++i; } GPR_ASSERT(response_stream_sizes.size() == i); - grpc::Status s = stream->Wait(); + grpc::Status s = stream->Finish(); GPR_ASSERT(s.IsOk()); gpr_log(GPR_INFO, "Half-duplex streaming rpc done."); } @@ -378,7 +378,7 @@ void DoPingPong() { stream->WritesDone(); GPR_ASSERT(!stream->Read(&response)); - grpc::Status s = stream->Wait(); + grpc::Status s = stream->Finish(); GPR_ASSERT(s.IsOk()); gpr_log(GPR_INFO, "Ping pong streaming done."); } diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 8a6be579294..a8399779b96 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -200,7 +200,7 @@ void RunServer() { ServerBuilder builder; builder.AddPort(server_address.str()); - builder.RegisterService(service.service()); + builder.RegisterService(&service); if (FLAGS_enable_ssl) { SslServerCredentialsOptions ssl_opts = { "", {{test_server1_key, test_server1_cert}}}; diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index c35d9ebdd87..4e1d2cab0e6 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -125,7 +125,7 @@ static void RunServer() { ServerBuilder builder; builder.AddPort(server_address); - builder.RegisterService(service.service()); + builder.RegisterService(&service); std::unique_ptr server(builder.BuildAndStart()); gpr_log(GPR_INFO, "Server listening on %s\n", server_address); diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 197dc3b2bac..2ab3f50bb28 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -281,10 +281,6 @@ "language": "c++", "name": "status_test" }, - { - "language": "c++", - "name": "sync_client_async_server_test" - }, { "language": "c++", "name": "thread_pool_test" From 4d0fb5f1c01a6ef51ddb83c1902622c7bf00321c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:27:22 -0800 Subject: [PATCH 024/232] Fixup callers with new api --- examples/tips/subscriber_test.cc | 2 +- test/cpp/end2end/end2end_test.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tips/subscriber_test.cc b/examples/tips/subscriber_test.cc index fda8909a025..736e6da319d 100644 --- a/examples/tips/subscriber_test.cc +++ b/examples/tips/subscriber_test.cc @@ -106,7 +106,7 @@ class SubscriberTest : public ::testing::Test { server_address_ << "localhost:" << port; ServerBuilder builder; builder.AddPort(server_address_.str()); - builder.RegisterService(service_.service()); + builder.RegisterService(&service_); server_ = builder.BuildAndStart(); channel_ = CreateChannel(server_address_.str(), ChannelArguments()); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 94a04aed37d..52deb0f32da 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -332,7 +332,7 @@ TEST_F(End2endTest, ResponseStream) { EXPECT_EQ(response.message(), request.message() + "2"); EXPECT_FALSE(stream->Read(&response)); - Status s = stream->Wait(); + Status s = stream->Finish(); EXPECT_TRUE(s.IsOk()); delete stream; @@ -366,7 +366,7 @@ TEST_F(End2endTest, BidiStream) { stream->WritesDone(); EXPECT_FALSE(stream->Read(&response)); - Status s = stream->Wait(); + Status s = stream->Finish(); EXPECT_TRUE(s.IsOk()); delete stream; @@ -422,7 +422,7 @@ TEST_F(End2endTest, BadCredentials) { ClientContext context2; ClientReaderWriter* stream = stub->BidiStream(&context2); - s = stream->Wait(); + s = stream->Finish(); EXPECT_FALSE(s.IsOk()); EXPECT_EQ(StatusCode::UNKNOWN, s.code()); EXPECT_EQ("Rpc sent on a lame channel.", s.details()); From 7630205bdfe2b7871e810f8ea7eab388d02240bf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 16:47:40 -0800 Subject: [PATCH 025/232] Add missing ifdef --- include/grpc/support/cpu.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index f8ec2c65220..9025f7c21f8 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -34,6 +34,10 @@ #ifndef __GRPC_INTERNAL_SUPPORT_CPU_H__ #define __GRPC_INTERNAL_SUPPORT_CPU_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* Interface providing CPU information for currently running system */ /* Return the number of CPU cores on the current system. Will return 0 if @@ -46,4 +50,8 @@ unsigned gpr_cpu_num_cores(void); [0, gpr_cpu_num_cores() - 1] */ unsigned gpr_cpu_current_cpu(void); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ From de917062ecacbeb547c8e2e4e3f4260d3e9a2f2e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 17:15:03 -0800 Subject: [PATCH 026/232] Refine completion queue --- include/grpc++/call.h | 9 +++- include/grpc++/channel_interface.h | 2 +- include/grpc++/completion_queue.h | 53 ++++++++++---------- include/grpc++/stream.h | 78 +++++++++++++++--------------- src/cpp/client/channel.cc | 4 +- src/cpp/client/channel.h | 2 +- src/cpp/common/call.cc | 4 +- src/cpp/common/completion_queue.cc | 31 +++++++----- 8 files changed, 97 insertions(+), 86 deletions(-) diff --git a/include/grpc++/call.h b/include/grpc++/call.h index 5aa96d33b96..94215bfa986 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -55,6 +55,8 @@ class ChannelInterface; class CallOpBuffer final : public CompletionQueueTag { public: + CallOpBuffer() : return_tag_(this) {} + void AddSendInitialMetadata(std::vector > *metadata); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); @@ -67,7 +69,10 @@ class CallOpBuffer final : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - FinalizeResultOutput FinalizeResult(bool status) override; + void FinalizeResult(void *tag, bool *status) override; + + private: + void *return_tag_; }; class CCallDeleter { @@ -80,7 +85,7 @@ class Call final { public: Call(grpc_call *call, ChannelInterface *channel, CompletionQueue *cq); - void PerformOps(CallOpBuffer *buffer, void *tag); + void PerformOps(CallOpBuffer *buffer); grpc_call *call() { return call_.get(); } CompletionQueue *cq() { return cq_; } diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 79466c9fda0..c128a08a9f9 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -58,7 +58,7 @@ class ChannelInterface { virtual Call CreateCall(const RpcMethod &method, ClientContext *context, CompletionQueue *cq) = 0; - virtual void PerformOpsOnCall(CallOpBuffer *ops, void *tag, Call *call) = 0; + virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; }; // Wrapper that begins an asynchronous unary call diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 8033fd12058..641d599c7ea 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -38,21 +38,27 @@ struct grpc_completion_queue; namespace grpc { +template +class ClientReader; +template +class ClientWriter; +template +class ClientReaderWriter; +template +class ServerReader; +template +class ServerWriter; +template +class ServerReaderWriter; + class CompletionQueue; class CompletionQueueTag { public: - enum FinalizeResultOutput { - SUCCEED, - FAIL, - SWALLOW, - }; - - virtual FinalizeResultOutput FinalizeResult(bool status) = 0; - - private: - friend class CompletionQueue; - void *user_tag_; + // Called prior to returning from Next(), return value + // is the status of the operation (return status is the default thing + // to do) + virtual void FinalizeResult(void *tag, bool *status) = 0; }; // grpc_completion_queue wrapper class @@ -66,22 +72,6 @@ class CompletionQueue { // for destruction. bool Next(void **tag, bool *ok); - bool Pluck(void *tag); - - // Prepare a tag for the C api - // Given a tag we'd like to receive from Next, what tag should we pass - // down to the C api? - // Usage example: - // grpc_call_start_batch(..., cq.PrepareTagForC(tag)); - // Allows attaching some work to be executed before the original tag - // is returned. - // MUST be used for all events that could be surfaced through this - // wrapping API - void *PrepareTagForC(CompletionQueueTag *cq_tag, void *user_tag) { - cq_tag->user_tag_ = user_tag; - return cq_tag; - } - // Shutdown has to be called, and the CompletionQueue can only be // destructed when false is returned from Next(). void Shutdown(); @@ -89,6 +79,15 @@ class CompletionQueue { grpc_completion_queue* cq() { return cq_; } private: + template friend class ::grpc::ClientReader; + template friend class ::grpc::ClientWriter; + template friend class ::grpc::ClientReaderWriter; + template friend class ::grpc::ServerReader; + template friend class ::grpc::ServerWriter; + template friend class ::grpc::ServerReaderWriter; + + bool Pluck(CompletionQueueTag *tag); + grpc_completion_queue* cq_; // owned }; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 22dc44efe40..ca32d60810d 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -123,23 +123,23 @@ class ClientReader final : public ClientStreamingInterface, CallOpBuffer buf; buf.AddSendMessage(request); buf.AddClientSendClose(); - call_.PerformOps(&buf, (void *)1); - cq_.Pluck((void *)1); + call_.PerformOps(&buf); + cq_.Pluck(&buf); } virtual bool Read(R *msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(&buf, (void *)2); - return cq_.Pluck((void *)2); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } virtual Status Finish() override { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(&status); - call_.PerformOps(&buf, (void *)3); - GPR_ASSERT(cq_.Pluck((void *)3)); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); return status; } @@ -162,15 +162,15 @@ class ClientWriter final : public ClientStreamingInterface, virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(&buf, (void *)2); - return cq_.Pluck((void *)2); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } virtual bool WritesDone() { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(&buf, (void *)3); - return cq_.Pluck((void *)3); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } // Read the final response and wait for the final status. @@ -179,8 +179,8 @@ class ClientWriter final : public ClientStreamingInterface, Status status; buf.AddRecvMessage(response_); buf.AddClientRecvStatus(&status); - call_.PerformOps(&buf, (void *)4); - GPR_ASSERT(cq_.Pluck((void *)4)); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); return status; } @@ -204,30 +204,30 @@ class ClientReaderWriter final : public ClientStreamingInterface, virtual bool Read(R *msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(&buf, (void *)2); - return cq_.Pluck((void *)2); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(&buf, (void *)3); - return cq_.Pluck((void *)3); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } virtual bool WritesDone() { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(&buf, (void *)4); - return cq_.Pluck((void *)4); + call_.PerformOps(&buf); + return cq_.Pluck(&buf); } virtual Status Finish() override { CallOpBuffer buf; Status status; buf.AddClientRecvStatus(&status); - call_.PerformOps(&buf, (void *)5); - GPR_ASSERT(cq_.Pluck((void *)5)); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); return status; } @@ -244,8 +244,8 @@ class ServerReader final : public ReaderInterface { virtual bool Read(R* msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_->PerformOps(&buf, (void *)2); - return call_->cq()->Pluck((void *)2); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); } private: @@ -260,8 +260,8 @@ class ServerWriter final : public WriterInterface { virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_->PerformOps(&buf, (void *)2); - return call_->cq()->Pluck((void *)2); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); } private: @@ -278,15 +278,15 @@ class ServerReaderWriter final : public WriterInterface, virtual bool Read(R* msg) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_->PerformOps(&buf, (void *)2); - return call_->cq()->Pluck((void *)2); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); } virtual bool Write(const W& msg) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_->PerformOps(&buf, (void *)3); - return call_->cq()->Pluck((void *)3); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); } private: @@ -333,19 +333,19 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, CallOpBuffer buf; buf.AddSendMessage(request); buf.AddClientSendClose(); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void Read(R *msg, void* tag) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void Finish(Status* status, void* tag) override { CallOpBuffer buf; buf.AddClientRecvStatus(status); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } private: @@ -367,20 +367,20 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, virtual void Write(const W& msg, void* tag) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void WritesDone(void* tag) { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void Finish(Status* status, void* tag) override { CallOpBuffer buf; buf.AddRecvMessage(response_); buf.AddClientRecvStatus(status); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } private: @@ -402,25 +402,25 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, virtual void Read(R *msg, void* tag) override { CallOpBuffer buf; buf.AddRecvMessage(msg); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void Write(const W& msg, void* tag) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void WritesDone(void* tag) { CallOpBuffer buf; buf.AddClientSendClose(); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } virtual void Finish(Status* status, void* tag) override { CallOpBuffer buf; buf.AddClientRecvStatus(status); - call_.PerformOps(&buf, tag); + call_.PerformOps(&buf); } private: @@ -437,7 +437,7 @@ class ServerAsyncResponseWriter final { virtual void Write(const W& msg, void* tag) override { CallOpBuffer buf; buf.AddSendMessage(msg); - call_->PerformOps(&buf, tag); + call_->PerformOps(&buf); } private: diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 24bd7adaad4..a1539e4711d 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -87,14 +87,14 @@ Call Channel::CreateCall(const RpcMethod &method, ClientContext *context, return Call(c_call, this, cq); } -void Channel::PerformOpsOnCall(CallOpBuffer *buf, void *tag, Call *call) { +void Channel::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { static const size_t MAX_OPS = 8; size_t nops = MAX_OPS; grpc_op ops[MAX_OPS]; buf->FillOps(ops, &nops); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call->call(), ops, nops, - call->cq()->PrepareTagForC(buf, tag))); + buf)); } } // namespace grpc diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 6cf222883c2..894f87698ce 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -59,7 +59,7 @@ class Channel final : public ChannelInterface { virtual Call CreateCall(const RpcMethod &method, ClientContext *context, CompletionQueue *cq) override; - virtual void PerformOpsOnCall(CallOpBuffer *ops, void *tag, + virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) override; private: diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 9f8d9364b18..d3a9de3620e 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -36,8 +36,8 @@ namespace grpc { -void Call::PerformOps(CallOpBuffer* buffer, void* tag) { - channel_->PerformOpsOnCall(buffer, tag, this); +void Call::PerformOps(CallOpBuffer* buffer) { + channel_->PerformOpsOnCall(buffer, this); } } // namespace grpc diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index d7d616407e0..cbeda81a0bc 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -56,19 +56,26 @@ class EventDeleter { bool CompletionQueue::Next(void **tag, bool *ok) { std::unique_ptr ev; - while (true) { - ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); - if (ev->type == GRPC_QUEUE_SHUTDOWN) { - return false; - } - auto cq_tag = static_cast(ev->tag); - switch (cq_tag->FinalizeResult(ev->data.op_complete == GRPC_OP_OK)) { - case CompletionQueueTag::SUCCEED: *ok = true; break; - case CompletionQueueTag::FAIL: *ok = false; break; - case CompletionQueueTag::SWALLOW: continue; - } - return true; + ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); + if (ev->type == GRPC_QUEUE_SHUTDOWN) { + return false; } + auto cq_tag = static_cast(ev->tag); + *ok = ev->data.op_complete == GRPC_OP_OK; + *tag = cq_tag; + cq_tag->FinalizeResult(tag, ok); + return true; +} + +bool CompletionQueue::Pluck(CompletionQueueTag *tag) { + std::unique_ptr ev; + + ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future)); + bool ok = ev->data.op_complete == GRPC_OP_OK; + void *ignored = tag; + tag->FinalizeResult(&ignored, &ok); + GPR_ASSERT(ignored == tag); + return ok; } } // namespace grpc From 80e00a8c63bd801b697fbe0cd1d8e00b14a81c76 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 20:54:25 -0800 Subject: [PATCH 027/232] Stub out unary call wrapper --- Makefile | 4 ++ build.json | 2 + include/grpc++/channel_interface.h | 13 ----- include/grpc++/completion_queue.h | 6 +++ include/grpc++/impl/client_unary_call.h | 67 +++++++++++++++++++++++++ src/compiler/cpp_generator.cc | 1 + src/cpp/client/client_unary_call.cc | 60 ++++++++++++++++++++++ 7 files changed, 140 insertions(+), 13 deletions(-) create mode 100644 include/grpc++/impl/client_unary_call.h create mode 100644 src/cpp/client/client_unary_call.cc diff --git a/Makefile b/Makefile index 02fd48728bf..3a61f79fb39 100644 --- a/Makefile +++ b/Makefile @@ -2608,6 +2608,7 @@ LIBGRPC++_SRC = \ src/cpp/client/channel.cc \ src/cpp/client/channel_arguments.cc \ src/cpp/client/client_context.cc \ + src/cpp/client/client_unary_call.cc \ src/cpp/client/create_channel.cc \ src/cpp/client/credentials.cc \ src/cpp/client/internal_stub.cc \ @@ -2631,6 +2632,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ @@ -2662,6 +2664,7 @@ ifneq ($(OPENSSL_DEP),) src/cpp/client/channel.cc: $(OPENSSL_DEP) src/cpp/client/channel_arguments.cc: $(OPENSSL_DEP) src/cpp/client/client_context.cc: $(OPENSSL_DEP) +src/cpp/client/client_unary_call.cc: $(OPENSSL_DEP) src/cpp/client/create_channel.cc: $(OPENSSL_DEP) src/cpp/client/credentials.cc: $(OPENSSL_DEP) src/cpp/client/internal_stub.cc: $(OPENSSL_DEP) @@ -2719,6 +2722,7 @@ endif objs/$(CONFIG)/src/cpp/client/channel.o: objs/$(CONFIG)/src/cpp/client/channel_arguments.o: objs/$(CONFIG)/src/cpp/client/client_context.o: +objs/$(CONFIG)/src/cpp/client/client_unary_call.o: objs/$(CONFIG)/src/cpp/client/create_channel.o: objs/$(CONFIG)/src/cpp/client/credentials.o: objs/$(CONFIG)/src/cpp/client/internal_stub.o: diff --git a/build.json b/build.json index f42c77c96c6..fdb32ebf717 100644 --- a/build.json +++ b/build.json @@ -385,6 +385,7 @@ "include/grpc++/config.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", + "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", @@ -406,6 +407,7 @@ "src/cpp/client/channel.cc", "src/cpp/client/channel_arguments.cc", "src/cpp/client/client_context.cc", + "src/cpp/client/client_unary_call.cc", "src/cpp/client/create_channel.cc", "src/cpp/client/credentials.cc", "src/cpp/client/internal_stub.cc", diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index c128a08a9f9..3631ea4d5d3 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -61,19 +61,6 @@ class ChannelInterface { virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; }; -// Wrapper that begins an asynchronous unary call -void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result, Status *status, - CompletionQueue *cq, void *tag); - -// Wrapper that performs a blocking unary call -Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); - } // namespace grpc #endif // __GRPCPP_CHANNEL_INTERFACE_H__ diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 641d599c7ea..c976bd5b454 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -34,6 +34,8 @@ #ifndef __GRPCPP_COMPLETION_QUEUE_H__ #define __GRPCPP_COMPLETION_QUEUE_H__ +#include + struct grpc_completion_queue; namespace grpc { @@ -85,6 +87,10 @@ class CompletionQueue { template friend class ::grpc::ServerReader; template friend class ::grpc::ServerWriter; template friend class ::grpc::ServerReaderWriter; + friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); bool Pluck(CompletionQueueTag *tag); diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h new file mode 100644 index 00000000000..091430b884d --- /dev/null +++ b/include/grpc++/impl/client_unary_call.h @@ -0,0 +1,67 @@ +/* +* +* Copyright 2014, 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. +* +*/ + +#ifndef __GRPCPP_CLIENT_UNARY_CALL_H__ +#define __GRPCPP_CLIENT_UNARY_CALL_H__ + +namespace google { +namespace protobuf { +class Message; +} // namespace protobuf +} // namespace google + +namespace grpc { + +class ChannelInterface; +class ClientContext; +class CompletionQueue; +class RpcMethod; +class Status; + +// Wrapper that begins an asynchronous unary call +void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result, Status *status, + CompletionQueue *cq, void *tag); + +// Wrapper that performs a blocking unary call +Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); + +} // namespace grpc + +#endif + diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 908b38f88e1..bced4df39b5 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -146,6 +146,7 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { std::string GetSourceIncludes() { return "#include \n" + "#include \n" "#include \n" "#include \n" "#include \n" diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc new file mode 100644 index 00000000000..e652750e22a --- /dev/null +++ b/src/cpp/client/client_unary_call.cc @@ -0,0 +1,60 @@ +/* + * + * Copyright 2014, 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 + +namespace grpc { + +// Wrapper that performs a blocking unary call +Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result) { + CompletionQueue cq; + Call call(channel->CreateCall(method, context, &cq)); + CallOpBuffer buf; + Status status; + buf.AddSendMessage(request); + buf.AddRecvMessage(result); + buf.AddClientSendClose(); + buf.AddClientRecvStatus(&status); + call.PerformOps(&buf); + cq.Pluck(&buf); + return status; +} + +} // namespace grpc From 549a74daa87c871b7bf47d11f6f0539f3235b631 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 22:13:44 -0800 Subject: [PATCH 028/232] Rephrase async streaming methods To ensure that the CallOpBuffers stay alive until completion. --- include/grpc++/call.h | 2 ++ include/grpc++/stream.h | 78 +++++++++++++++++++++++------------------ 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/include/grpc++/call.h b/include/grpc++/call.h index 94215bfa986..de789febe6e 100644 --- a/include/grpc++/call.h +++ b/include/grpc++/call.h @@ -57,6 +57,8 @@ class CallOpBuffer final : public CompletionQueueTag { public: CallOpBuffer() : return_tag_(this) {} + void Reset(void *next_return_tag); + void AddSendInitialMetadata(std::vector > *metadata); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index ca32d60810d..631183ea55c 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -330,27 +330,30 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, ClientContext *context, const google::protobuf::Message &request, void* tag) : call_(channel->CreateCall(method, context, &cq_)) { - CallOpBuffer buf; - buf.AddSendMessage(request); - buf.AddClientSendClose(); - call_.PerformOps(&buf); + init_buf_.Reset(tag); + init_buf_.AddSendMessage(request); + init_buf_.AddClientSendClose(); + call_.PerformOps(&init_buf_); } virtual void Read(R *msg, void* tag) override { - CallOpBuffer buf; - buf.AddRecvMessage(msg); - call_.PerformOps(&buf); + read_buf_.Reset(tag); + read_buf_.AddRecvMessage(msg); + call_.PerformOps(&read_buf_); } virtual void Finish(Status* status, void* tag) override { - CallOpBuffer buf; - buf.AddClientRecvStatus(status); - call_.PerformOps(&buf); + finish_buf_.Reset(tag); + finish_buf_.AddClientRecvStatus(status); + call_.PerformOps(&finish_buf_); } private: CompletionQueue cq_; Call call_; + CallOpBuffer init_buf_; + CallOpBuffer read_buf_; + CallOpBuffer finish_buf_; }; template @@ -365,28 +368,31 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, call_(channel->CreateCall(method, context, &cq_)) {} virtual void Write(const W& msg, void* tag) override { - CallOpBuffer buf; - buf.AddSendMessage(msg); - call_.PerformOps(&buf); + write_buf_.Reset(tag); + write_buf_.AddSendMessage(msg); + call_.PerformOps(&write_buf_); } - virtual void WritesDone(void* tag) { - CallOpBuffer buf; - buf.AddClientSendClose(); - call_.PerformOps(&buf); + virtual void WritesDone(void* tag) override { + writes_done_buf_.Reset(tag); + writes_done_buf_.AddClientSendClose(); + call_.PerformOps(&writes_done_buf_); } virtual void Finish(Status* status, void* tag) override { - CallOpBuffer buf; - buf.AddRecvMessage(response_); - buf.AddClientRecvStatus(status); - call_.PerformOps(&buf); + finish_buf_.Reset(tag); + finish_buf_.AddRecvMessage(response_); + finish_buf_.AddClientRecvStatus(status); + call_.PerformOps(&finish_buf_); } private: google::protobuf::Message *const response_; CompletionQueue cq_; Call call_; + CallOpBuffer write_buf_; + CallOpBuffer writes_done_buf_; + CallOpBuffer finish_buf_; }; // Client-side interface for bi-directional streaming. @@ -400,32 +406,36 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, : call_(channel->CreateCall(method, context, &cq_)) {} virtual void Read(R *msg, void* tag) override { - CallOpBuffer buf; - buf.AddRecvMessage(msg); - call_.PerformOps(&buf); + read_buf_.Reset(tag); + read_buf_.AddRecvMessage(msg); + call_.PerformOps(&read_buf_); } virtual void Write(const W& msg, void* tag) override { - CallOpBuffer buf; - buf.AddSendMessage(msg); - call_.PerformOps(&buf); + write_buf_.Reset(tag); + write_buf_.AddSendMessage(msg); + call_.PerformOps(&write_buf_); } - virtual void WritesDone(void* tag) { - CallOpBuffer buf; - buf.AddClientSendClose(); - call_.PerformOps(&buf); + virtual void WritesDone(void* tag) override { + writes_done_buf_.Reset(tag); + writes_done_buf_.AddClientSendClose(); + call_.PerformOps(&writes_done_buf_); } virtual void Finish(Status* status, void* tag) override { - CallOpBuffer buf; - buf.AddClientRecvStatus(status); - call_.PerformOps(&buf); + finish_buf_.Reset(tag); + finish_buf_.AddClientRecvStatus(status); + call_.PerformOps(&finish_buf_); } private: CompletionQueue cq_; Call call_; + CallOpBuffer read_buf_; + CallOpBuffer write_buf_; + CallOpBuffer writes_done_buf_; + CallOpBuffer finish_buf_; }; // TODO(yangg) Move out of stream.h From f9a06a78cb96f5475250926c1fa6ab6ed3217ac1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 22:14:52 -0800 Subject: [PATCH 029/232] Remove temp code --- include/grpc++/stream.h | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 631183ea55c..c30825a7a57 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -42,38 +42,6 @@ namespace grpc { -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE -// DELETE DELETE DELETE - class StreamContextInterface { - public: - template bool Write(T, bool); - template void Start(T); - template bool Read(T); - google::protobuf::Message *request(); - }; - // Common interface for all client side streaming. class ClientStreamingInterface { public: From 225f7be935731104495e2c825ffcbf005d520b2b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 9 Feb 2015 22:32:37 -0800 Subject: [PATCH 030/232] Fix up declarations --- src/compiler/cpp_generator.cc | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index bced4df39b5..d04c2efcc49 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -139,6 +139,12 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { temp.append( "template \n" "class ServerReaderWriter;\n"); + temp.append( + "template \n" + "class ClientAsyncReaderWriter;\n"); + temp.append( + "template \n" + "class ServerAsyncReaderWriter;\n"); } temp.append("} // namespace grpc\n"); return temp; @@ -193,7 +199,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientReaderWriter< $Request$, $Response$>* " "$Method$(::grpc::ClientContext* context);\n"); printer->Print(*vars, - "::grpc::ClientReaderWriter< $Request$, $Response$>* " + "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " "$Method$(::grpc::ClientContext* context, " "::grpc::CompletionQueue *cq, void *tag);\n"); } @@ -254,7 +260,6 @@ void PrintHeaderServerMethodAsync( "void $Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReader< $Request$>* reader, " - "$Response$* response, " "::grpc::CompletionQueue* cq, void *tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, @@ -267,7 +272,7 @@ void PrintHeaderServerMethodAsync( *vars, "void $Method$(" "::grpc::ServerContext* context, " - "::grpc::ServerReaderWriter< $Response$, $Request$>* stream, " + "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " "::grpc::CompletionQueue* cq, void *tag);\n"); } } @@ -457,6 +462,47 @@ void PrintSourceServerMethod(google::protobuf::io::Printer *printer, } } +void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, + const google::protobuf::MethodDescriptor *method, + std::map *vars) { + (*vars)["Method"] = method->name(); + (*vars)["Request"] = + grpc_cpp_generator::ClassName(method->input_type(), true); + (*vars)["Response"] = + grpc_cpp_generator::ClassName(method->output_type(), true); + if (NoStreaming(method)) { + printer->Print(*vars, + "void $Service$::AsyncService::$Method$(" + "::grpc::ServerContext* context, " + "$Request$* request, " + "::grpc::ServerAsyncResponseWriter< $Response$>* response, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print("}\n\n"); + } else if (ClientOnlyStreaming(method)) { + printer->Print(*vars, + "void $Service$::AsyncService::$Method$(" + "::grpc::ServerContext* context, " + "::grpc::ServerAsyncReader< $Request$>* reader, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print("}\n\n"); + } else if (ServerOnlyStreaming(method)) { + printer->Print(*vars, + "void $Service$::AsyncService::$Method$(" + "::grpc::ServerContext* context, " + "$Request$* request, " + "::grpc::ServerAsyncWriter< $Response$>* writer, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print("}\n\n"); + } else if (BidiStreaming(method)) { + printer->Print(*vars, + "void $Service$::AsyncService::$Method$(" + "::grpc::ServerContext* context, " + "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " + "::grpc::CompletionQueue* cq, void *tag) {\n"); + printer->Print("}\n\n"); + } +} + void PrintSourceService(google::protobuf::io::Printer *printer, const google::protobuf::ServiceDescriptor *service, std::map *vars) { @@ -479,6 +525,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, "}\n\n"); for (int i = 0; i < service->method_count(); ++i) { PrintSourceServerMethod(printer, service->method(i), vars); + PrintSourceServerAsyncMethod(printer, service->method(i), vars); } printer->Print(*vars, "::grpc::RpcService* $Service$::Service::service() {\n"); From 20f4af2e369f921e3709b6b443aa2fe92f39b9f3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 09:52:15 -0800 Subject: [PATCH 031/232] Move call.h -> impl/call.h --- Makefile | 1 + build.json | 1 + include/grpc++/{ => impl}/call.h | 0 include/grpc++/stream.h | 2 +- src/cpp/client/channel.cc | 2 +- src/cpp/client/client_unary_call.cc | 2 +- src/cpp/common/call.cc | 2 +- 7 files changed, 6 insertions(+), 4 deletions(-) rename include/grpc++/{ => impl}/call.h (100%) diff --git a/Makefile b/Makefile index 3a61f79fb39..f2884fd8e5e 100644 --- a/Makefile +++ b/Makefile @@ -2632,6 +2632,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/credentials.h \ + include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ include/grpc++/impl/internal_stub.h \ include/grpc++/impl/rpc_method.h \ diff --git a/build.json b/build.json index fdb32ebf717..602d7752a1c 100644 --- a/build.json +++ b/build.json @@ -385,6 +385,7 @@ "include/grpc++/config.h", "include/grpc++/create_channel.h", "include/grpc++/credentials.h", + "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/rpc_method.h", diff --git a/include/grpc++/call.h b/include/grpc++/impl/call.h similarity index 100% rename from include/grpc++/call.h rename to include/grpc++/impl/call.h diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index c30825a7a57..57ca86ad706 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -34,9 +34,9 @@ #ifndef __GRPCPP_STREAM_H__ #define __GRPCPP_STREAM_H__ -#include #include #include +#include #include #include diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index a1539e4711d..da94739ea0d 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -42,12 +42,12 @@ #include #include "src/cpp/proto/proto_utils.h" -#include #include #include #include #include #include +#include #include #include #include diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index e652750e22a..85985920685 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include #include #include diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index d3a9de3620e..0315ffb6bdd 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -31,7 +31,7 @@ * */ -#include +#include #include namespace grpc { From 24be0f79e2a1a0b8beeb6141aa5dc83804d36a0d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 14:04:22 -0800 Subject: [PATCH 032/232] Rewrite server request startup path Stub in registered methods, cleanup to the point I understand this code again. --- include/grpc/grpc.h | 48 +++-- src/core/surface/call.c | 4 + src/core/surface/call.h | 1 + src/core/surface/server.c | 398 +++++++++++++++++++++++++++++--------- 4 files changed, 349 insertions(+), 102 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 7b33a4d8619..4ccb5a4dd59 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -254,15 +254,18 @@ void grpc_call_details_init(grpc_call_details *details); void grpc_call_details_destroy(grpc_call_details *details); typedef enum { - /* Send initial metadata: one and only one instance MUST be sent for each call, + /* Send initial metadata: one and only one instance MUST be sent for each + call, unless the call was cancelled - in which case this can be skipped */ GRPC_OP_SEND_INITIAL_METADATA = 0, /* Send a message: 0 or more of these operations can occur for each call */ GRPC_OP_SEND_MESSAGE, - /* Send a close from the server: one and only one instance MUST be sent from the client, + /* Send a close from the server: one and only one instance MUST be sent from + the client, unless the call was cancelled - in which case this can be skipped */ GRPC_OP_SEND_CLOSE_FROM_CLIENT, - /* Send status from the server: one and only one instance MUST be sent from the server + /* Send status from the server: one and only one instance MUST be sent from + the server unless the call was cancelled - in which case this can be skipped */ GRPC_OP_SEND_STATUS_FROM_SERVER, /* Receive initial metadata: one and only one MUST be made on the client, must @@ -270,13 +273,16 @@ typedef enum { GRPC_OP_RECV_INITIAL_METADATA, /* Receive a message: 0 or more of these operations can occur for each call */ GRPC_OP_RECV_MESSAGE, - /* Receive status on the client: one and only one must be made on the client */ + /* Receive status on the client: one and only one must be made on the client + */ GRPC_OP_RECV_STATUS_ON_CLIENT, - /* Receive status on the server: one and only one must be made on the server */ + /* Receive status on the server: one and only one must be made on the server + */ GRPC_OP_RECV_CLOSE_ON_SERVER } grpc_op_type; -/* Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT which has +/* Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT + which has no arguments) */ typedef struct grpc_op { grpc_op_type op; @@ -300,29 +306,33 @@ typedef struct grpc_op { grpc_metadata_array *recv_initial_metadata; grpc_byte_buffer **recv_message; struct { - /* ownership of the array is with the caller, but ownership of the elements + /* ownership of the array is with the caller, but ownership of the + elements stays with the call object (ie key, value members are owned by the call object, trailing_metadata->array is owned by the caller). After the operation completes, call grpc_metadata_array_destroy on this value, or reuse it in a future op. */ grpc_metadata_array *trailing_metadata; grpc_status_code *status; - /* status_details is a buffer owned by the application before the op completes - and after the op has completed. During the operation status_details may be - reallocated to a size larger than *status_details_capacity, in which case + /* status_details is a buffer owned by the application before the op + completes + and after the op has completed. During the operation status_details may + be + reallocated to a size larger than *status_details_capacity, in which + case *status_details_capacity will be updated with the new array capacity. Pre-allocating space: size_t my_capacity = 8; char *my_details = gpr_malloc(my_capacity); x.status_details = &my_details; - x.status_details_capacity = &my_capacity; + x.status_details_capacity = &my_capacity; Not pre-allocating space: size_t my_capacity = 0; char *my_details = NULL; x.status_details = &my_details; - x.status_details_capacity = &my_capacity; + x.status_details_capacity = &my_capacity; After the call: gpr_free(my_details); */ @@ -330,7 +340,8 @@ typedef struct grpc_op { size_t *status_details_capacity; } recv_status_on_client; struct { - /* out argument, set to 1 if the call failed in any way (seen as a cancellation + /* out argument, set to 1 if the call failed in any way (seen as a + cancellation on the server), or 0 if the call succeeded */ int *cancelled; } recv_close_on_server; @@ -392,7 +403,7 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel, gpr_timespec deadline); /* Start a batch of operations defined in the array ops; when complete, post a - completion of type 'tag' to the completion queue bound to the call. + completion of type 'tag' to the completion queue bound to the call. The order of ops specified in the batch has no significance. Only one operation of each type can be active at once in any given batch. */ @@ -544,6 +555,15 @@ grpc_call_error grpc_server_request_call( grpc_metadata_array *request_metadata, grpc_completion_queue *completion_queue, void *tag_new); +void *grpc_server_register_method(grpc_server *server, const char *method, + const char *host); + +grpc_call_error grpc_server_request_registered_call( + grpc_server *server, void *registered_method, grpc_call **call, + gpr_timespec *deadline, grpc_metadata_array *request_metadata, + grpc_byte_buffer **optional_payload, + grpc_completion_queue *completion_queue, void *tag_new); + /* Create a server */ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); diff --git a/src/core/surface/call.c b/src/core/surface/call.c index ee8e8588c70..cc7094a0ce2 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -258,6 +258,10 @@ void grpc_call_set_completion_queue(grpc_call *call, call->cq = cq; } +grpc_completion_queue *grpc_call_get_completion_queue(grpc_call *call) { + return call->cq; +} + void grpc_call_internal_ref(grpc_call *c) { gpr_ref(&c->internal_refcount); } static void destroy_call(void *call, int ignored_success) { diff --git a/src/core/surface/call.h b/src/core/surface/call.h index 05014c631c7..55e434433d3 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -89,6 +89,7 @@ grpc_call *grpc_call_create(grpc_channel *channel, grpc_completion_queue *cq, const void *server_transport_data); void grpc_call_set_completion_queue(grpc_call *call, grpc_completion_queue *cq); +grpc_completion_queue *grpc_call_get_completion_queue(grpc_call *call); void grpc_call_internal_ref(grpc_call *call); void grpc_call_internal_unref(grpc_call *call, int allow_immediate_deletion); diff --git a/src/core/surface/server.c b/src/core/surface/server.c index ee0f96a5803..0415949dacd 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -60,6 +60,55 @@ typedef struct listener { typedef struct call_data call_data; typedef struct channel_data channel_data; +typedef struct registered_method registered_method; + +typedef struct { + call_data *next; + call_data *prev; +} call_link; + +typedef enum { LEGACY_CALL, BATCH_CALL, REGISTERED_CALL } requested_call_type; + +typedef struct { + requested_call_type type; + void *tag; + union { + struct { + grpc_completion_queue *cq; + grpc_call **call; + grpc_call_details *details; + grpc_metadata_array *initial_metadata; + } batch; + struct { + grpc_completion_queue *cq; + grpc_call **call; + registered_method *registered_method; + gpr_timespec *deadline; + grpc_metadata_array *initial_metadata; + grpc_byte_buffer **optional_payload; + } registered; + } data; +} requested_call; + +typedef struct { + requested_call *calls; + size_t count; + size_t capacity; +} requested_call_array; + +struct registered_method { + char *method; + char *host; + call_link pending; + requested_call_array requested; + registered_method *next; +}; + +typedef struct channel_registered_method { + registered_method *server_registered_method; + grpc_mdstr *method; + grpc_mdstr *host; +} channel_registered_method; struct channel_data { grpc_server *server; @@ -71,20 +120,6 @@ struct channel_data { channel_data *prev; }; -typedef void (*new_call_cb)(grpc_server *server, grpc_completion_queue *cq, - grpc_call **call, grpc_call_details *details, - grpc_metadata_array *initial_metadata, - call_data *calld, void *user_data); - -typedef struct { - void *user_data; - grpc_completion_queue *cq; - grpc_call **call; - grpc_call_details *details; - grpc_metadata_array *initial_metadata; - new_call_cb cb; -} requested_call; - struct grpc_server { size_t channel_filter_count; const grpc_channel_filter **channel_filters; @@ -93,9 +128,8 @@ struct grpc_server { gpr_mu mu; - requested_call *requested_calls; - size_t requested_call_count; - size_t requested_call_capacity; + registered_method *registered_methods; + requested_call_array requested_calls; gpr_uint8 shutdown; gpr_uint8 have_shutdown_tag; @@ -108,11 +142,6 @@ struct grpc_server { gpr_refcount internal_refcount; }; -typedef struct { - call_data *next; - call_data *prev; -} call_link; - typedef enum { /* waiting for metadata */ NOT_STARTED, @@ -125,7 +154,7 @@ typedef enum { } call_state; typedef struct legacy_data { - grpc_metadata_array *initial_metadata; + grpc_metadata_array initial_metadata; } legacy_data; struct call_data { @@ -137,7 +166,6 @@ struct call_data { grpc_mdstr *host; legacy_data *legacy; - grpc_call_details *details; gpr_uint8 included[CALL_LIST_COUNT]; call_link links[CALL_LIST_COUNT]; @@ -148,6 +176,10 @@ struct call_data { static void do_nothing(void *unused, grpc_op_error ignored) {} +static void begin_call(grpc_server *server, call_data *calld, + requested_call *rc); +static void fail_call(grpc_server *server, requested_call *rc); + static int call_list_join(grpc_server *server, call_data *call, call_list list) { if (call->included[list]) return 0; @@ -196,6 +228,22 @@ static int call_list_remove(grpc_server *server, call_data *call, return 1; } +static void requested_call_array_destroy(requested_call_array *array) { + gpr_free(array->calls); +} + +static requested_call *requested_call_array_add(requested_call_array *array) { + requested_call *rc; + if (array->count == array->capacity) { + array->capacity = GPR_MAX(array->capacity + 8, array->capacity * 2); + array->calls = + gpr_realloc(array->calls, sizeof(requested_call) * array->capacity); + } + rc = &array->calls[array->count++]; + memset(rc, 0, sizeof(*rc)); + return rc; +} + static void server_ref(grpc_server *server) { gpr_ref(&server->internal_refcount); } @@ -205,7 +253,7 @@ static void server_unref(grpc_server *server) { grpc_channel_args_destroy(server->channel_args); gpr_mu_destroy(&server->mu); gpr_free(server->channel_filters); - gpr_free(server->requested_calls); + requested_call_array_destroy(&server->requested_calls); gpr_free(server); } } @@ -223,7 +271,6 @@ static void orphan_channel(channel_data *chand) { static void finish_destroy_channel(void *cd, int success) { channel_data *chand = cd; grpc_server *server = chand->server; - /*gpr_log(GPR_INFO, "destroy channel %p", chand->channel);*/ grpc_channel_destroy(chand->channel); server_unref(server); } @@ -242,12 +289,12 @@ static void start_new_rpc(grpc_call_element *elem) { grpc_server *server = chand->server; gpr_mu_lock(&server->mu); - if (server->requested_call_count > 0) { - requested_call rc = server->requested_calls[--server->requested_call_count]; + if (server->requested_calls.count > 0) { + requested_call rc = + server->requested_calls.calls[--server->requested_calls.count]; calld->state = ACTIVATED; gpr_mu_unlock(&server->mu); - rc.cb(server, rc.cq, rc.call, rc.details, rc.initial_metadata, calld, - rc.user_data); + begin_call(server, calld, &rc); } else { calld->state = PENDING; call_list_join(server, calld, PENDING_START); @@ -427,8 +474,7 @@ static void destroy_call_elem(grpc_call_element *elem) { } if (calld->legacy) { - gpr_free(calld->legacy->initial_metadata->metadata); - gpr_free(calld->legacy->initial_metadata); + gpr_free(calld->legacy->initial_metadata.metadata); gpr_free(calld->legacy); } @@ -464,9 +510,8 @@ static void destroy_channel_elem(grpc_channel_element *elem) { } static const grpc_channel_filter server_surface_filter = { - call_op, channel_op, sizeof(call_data), - init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "server", + call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, "server", }; grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, @@ -509,6 +554,36 @@ grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, return server; } +static int streq(const char *a, const char *b) { + if (a == NULL && b == NULL) return 1; + if (a == NULL) return 0; + if (b == NULL) return 0; + return 0 == strcmp(a, b); +} + +void *grpc_server_register_method(grpc_server *server, const char *method, + const char *host) { + registered_method *m; + if (!method) { + gpr_log(GPR_ERROR, "%s method string cannot be NULL", __FUNCTION__); + return NULL; + } + for (m = server->registered_methods; m; m = m->next) { + if (streq(m->method, method) && streq(m->host, host)) { + gpr_log(GPR_ERROR, "duplicate registration for %s@%s", method, + host ? host : "*"); + return NULL; + } + } + m = gpr_malloc(sizeof(registered_method)); + memset(m, 0, sizeof(*m)); + m->method = gpr_strdup(method); + m->host = gpr_strdup(host); + m->next = server->registered_methods; + server->registered_methods = m; + return m; +} + void grpc_server_start(grpc_server *server) { listener *l; @@ -561,8 +636,7 @@ grpc_transport_setup_result grpc_server_setup_transport( void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, void *shutdown_tag) { listener *l; - requested_call *requested_calls; - size_t requested_call_count; + requested_call_array requested_calls; channel_data **channels; channel_data *c; size_t nchannels; @@ -592,9 +666,7 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, } requested_calls = server->requested_calls; - requested_call_count = server->requested_call_count; - server->requested_calls = NULL; - server->requested_call_count = 0; + memset(&server->requested_calls, 0, sizeof(server->requested_calls)); server->shutdown = 1; server->have_shutdown_tag = have_shutdown_tag; @@ -623,13 +695,10 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, gpr_free(channels); /* terminate all the requested calls */ - for (i = 0; i < requested_call_count; i++) { - requested_calls[i].cb(server, requested_calls[i].cq, - requested_calls[i].call, requested_calls[i].details, - requested_calls[i].initial_metadata, NULL, - requested_calls[i].user_data); + for (i = 0; i < requested_calls.count; i++) { + fail_call(server, &requested_calls.calls[i]); } - gpr_free(requested_calls); + gpr_free(requested_calls.calls); /* Shutdown listeners */ for (l = server->listeners; l; l = l->next) { @@ -675,17 +744,12 @@ void grpc_server_add_listener(grpc_server *server, void *arg, } static grpc_call_error queue_call_request(grpc_server *server, - grpc_completion_queue *cq, - grpc_call **call, - grpc_call_details *details, - grpc_metadata_array *initial_metadata, - new_call_cb cb, void *user_data) { + requested_call *rc) { call_data *calld; - requested_call *rc; gpr_mu_lock(&server->mu); if (server->shutdown) { gpr_mu_unlock(&server->mu); - cb(server, cq, call, details, initial_metadata, NULL, user_data); + fail_call(server, rc); return GRPC_CALL_OK; } calld = call_list_remove_head(server, PENDING_START); @@ -693,29 +757,60 @@ static grpc_call_error queue_call_request(grpc_server *server, GPR_ASSERT(calld->state == PENDING); calld->state = ACTIVATED; gpr_mu_unlock(&server->mu); - cb(server, cq, call, details, initial_metadata, calld, user_data); + begin_call(server, calld, rc); return GRPC_CALL_OK; } else { - if (server->requested_call_count == server->requested_call_capacity) { - server->requested_call_capacity = - GPR_MAX(server->requested_call_capacity + 8, - server->requested_call_capacity * 2); - server->requested_calls = - gpr_realloc(server->requested_calls, - sizeof(requested_call) * server->requested_call_capacity); - } - rc = &server->requested_calls[server->requested_call_count++]; - rc->cb = cb; - rc->cq = cq; - rc->call = call; - rc->details = details; - rc->user_data = user_data; - rc->initial_metadata = initial_metadata; + *requested_call_array_add(&server->requested_calls) = *rc; gpr_mu_unlock(&server->mu); return GRPC_CALL_OK; } } +grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, + grpc_call_details *details, + grpc_metadata_array *initial_metadata, + grpc_completion_queue *cq, void *tag) { + requested_call rc; + grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + rc.type = BATCH_CALL; + rc.tag = tag; + rc.data.batch.cq = cq; + rc.data.batch.call = call; + rc.data.batch.details = details; + rc.data.batch.initial_metadata = initial_metadata; + return queue_call_request(server, &rc); +} + +grpc_call_error grpc_server_request_registered_call( + grpc_server *server, void *registered_method, grpc_call **call, + gpr_timespec *deadline, grpc_metadata_array *initial_metadata, + grpc_byte_buffer **optional_payload, grpc_completion_queue *cq, void *tag) { + requested_call rc; + grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + rc.type = REGISTERED_CALL; + rc.tag = tag; + rc.data.registered.cq = cq; + rc.data.registered.call = call; + rc.data.registered.registered_method = registered_method; + rc.data.registered.deadline = deadline; + rc.data.registered.initial_metadata = initial_metadata; + rc.data.registered.optional_payload = optional_payload; + return queue_call_request(server, &rc); +} + +grpc_call_error grpc_server_request_call_old(grpc_server *server, + void *tag_new) { + requested_call rc; + grpc_cq_begin_op(server->cq, NULL, GRPC_SERVER_RPC_NEW); + rc.type = LEGACY_CALL; + rc.tag = tag_new; + return queue_call_request(server, &rc); +} + +static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag); +static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, + void *tag); + static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) { gpr_slice slice = value->slice; size_t len = GPR_SLICE_LENGTH(slice); @@ -727,6 +822,108 @@ static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) { memcpy(*dest, grpc_mdstr_as_c_string(value), len + 1); } +static void begin_call(grpc_server *server, call_data *calld, + requested_call *rc) { + grpc_ioreq_completion_func publish; + grpc_ioreq req[2]; + grpc_ioreq *r = req; + + /* called once initial metadata has been read by the call, but BEFORE + the ioreq to fetch it out of the call has been executed. + This means metadata related fields can be relied on in calld, but to + fill in the metadata array passed by the client, we need to perform + an ioreq op, that should complete immediately. */ + + switch (rc->type) { + case LEGACY_CALL: + calld->legacy = gpr_malloc(sizeof(legacy_data)); + memset(calld->legacy, 0, sizeof(legacy_data)); + r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; + r->data.recv_metadata = &calld->legacy->initial_metadata; + r++; + publish = publish_legacy; + break; + case BATCH_CALL: + cpstr(&rc->data.batch.details->host, + &rc->data.batch.details->host_capacity, calld->host); + cpstr(&rc->data.batch.details->method, + &rc->data.batch.details->method_capacity, calld->path); + grpc_call_set_completion_queue(calld->call, rc->data.batch.cq); + *rc->data.batch.call = calld->call; + r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; + r->data.recv_metadata = rc->data.batch.initial_metadata; + r++; + publish = publish_registered_or_batch; + break; + case REGISTERED_CALL: + *rc->data.registered.deadline = calld->deadline; + grpc_call_set_completion_queue(calld->call, rc->data.registered.cq); + *rc->data.registered.call = calld->call; + r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; + r->data.recv_metadata = rc->data.registered.initial_metadata; + r++; + if (rc->data.registered.optional_payload) { + r->op = GRPC_IOREQ_RECV_MESSAGE; + r->data.recv_message = rc->data.registered.optional_payload; + r++; + } + publish = publish_registered_or_batch; + break; + } + + grpc_call_internal_ref(calld->call); + grpc_call_start_ioreq_and_call_back(calld->call, req, r - req, publish, + rc->tag); +} + +static void fail_call(grpc_server *server, requested_call *rc) { + switch (rc->type) { + case LEGACY_CALL: + grpc_cq_end_new_rpc(server->cq, rc->tag, NULL, do_nothing, NULL, NULL, + NULL, gpr_inf_past, 0, NULL); + break; + case BATCH_CALL: + *rc->data.batch.call = NULL; + rc->data.batch.initial_metadata->count = 0; + grpc_cq_end_op_complete(rc->data.batch.cq, rc->tag, NULL, do_nothing, + NULL, GRPC_OP_ERROR); + break; + case REGISTERED_CALL: + *rc->data.registered.call = NULL; + rc->data.registered.initial_metadata->count = 0; + grpc_cq_end_op_complete(rc->data.registered.cq, rc->tag, NULL, do_nothing, + NULL, GRPC_OP_ERROR); + break; + } +} + +static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag) { + grpc_call_element *elem = + grpc_call_stack_element(grpc_call_get_call_stack(call), 0); + call_data *calld = elem->call_data; + channel_data *chand = elem->channel_data; + grpc_server *server = chand->server; + + if (status == GRPC_OP_OK) { + grpc_cq_end_new_rpc(server->cq, tag, call, do_nothing, NULL, + grpc_mdstr_as_c_string(calld->path), + grpc_mdstr_as_c_string(calld->host), calld->deadline, + calld->legacy->initial_metadata.count, + calld->legacy->initial_metadata.metadata); + } else { + gpr_log(GPR_ERROR, "should never reach here"); + abort(); + } +} + +static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, + void *tag) { + grpc_cq_end_op_complete(grpc_call_get_completion_queue(call), tag, call, + do_nothing, NULL, status); +} + +#if 0 + static void publish_request(grpc_call *call, grpc_op_error status, void *tag) { grpc_call_element *elem = grpc_call_stack_element(grpc_call_get_call_stack(call), 0); @@ -748,9 +945,14 @@ static void publish_request(grpc_call *call, grpc_op_error status, void *tag) { static void begin_request(grpc_server *server, grpc_completion_queue *cq, grpc_call **call, grpc_call_details *details, + registered_method *registered_method, gpr_timespec *deadline, grpc_metadata_array *initial_metadata, + grpc_byte_buffer **optional_payload, call_data *calld, void *tag) { grpc_ioreq req; + GPR_ASSERT(registered_method == NULL); + GPR_ASSERT(deadline == NULL); + GPR_ASSERT(optional_payload == NULL); if (!calld) { *call = NULL; initial_metadata->count = 0; @@ -767,13 +969,39 @@ static void begin_request(grpc_server *server, grpc_completion_queue *cq, tag); } -grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, - grpc_call_details *details, - grpc_metadata_array *initial_metadata, - grpc_completion_queue *cq, void *tag) { - grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); - return queue_call_request(server, cq, call, details, initial_metadata, - begin_request, tag); +static void begin_registered_request(grpc_server *server, grpc_completion_queue *cq, + grpc_call **call, grpc_call_details *details, + registered_method *registered_method, gpr_timespec *deadline, + grpc_metadata_array *initial_metadata, + grpc_byte_buffer **optional_payload, + call_data *calld, void *tag) { + grpc_ioreq req[2]; + grpc_ioreq *r; + GPR_ASSERT(registered_method != NULL); + GPR_ASSERT(deadline != NULL); + GPR_ASSERT(optional_payload != NULL); + if (!calld) { + *call = NULL; + initial_metadata->count = 0; + grpc_cq_end_op_complete(cq, tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); + return; + } + calld->details = NULL; + calld->registered_method = registered_method; + grpc_call_set_completion_queue(calld->call, cq); + *call = calld->call; + r = req; + r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; + r->data.recv_metadata = initial_metadata; + r++; + if (optional_payload != NULL) { + r->op = GRPC_IOREQ_RECV_MESSAGE; + r->data.recv_message = optional_payload; + r++; + } + grpc_call_internal_ref(calld->call); + grpc_call_start_ioreq_and_call_back(calld->call, req, r - rq, publish_request, + tag); } static void publish_legacy_request(grpc_call *call, grpc_op_error status, @@ -796,9 +1024,11 @@ static void publish_legacy_request(grpc_call *call, grpc_op_error status, } static void begin_legacy_request(grpc_server *server, grpc_completion_queue *cq, - grpc_call **call, grpc_call_details *details, - grpc_metadata_array *initial_metadata, - call_data *calld, void *tag) { + grpc_call **call, grpc_call_details *details, + registered_method *registered_method, gpr_timespec *deadline, + grpc_metadata_array *initial_metadata, + grpc_byte_buffer **optional_payload, + call_data *calld, void *tag) { grpc_ioreq req; GPR_ASSERT(call == NULL); GPR_ASSERT(details == NULL); @@ -818,15 +1048,7 @@ static void begin_legacy_request(grpc_server *server, grpc_completion_queue *cq, publish_legacy_request, tag); } -grpc_call_error grpc_server_request_call_old(grpc_server *server, - void *tag_new) { - grpc_metadata_array *client_metadata = - gpr_malloc(sizeof(grpc_metadata_array)); - memset(client_metadata, 0, sizeof(*client_metadata)); - grpc_cq_begin_op(server->cq, NULL, GRPC_SERVER_RPC_NEW); - return queue_call_request(server, server->cq, NULL, NULL, client_metadata, - begin_legacy_request, tag_new); -} +#endif const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { return server->channel_args; From 85326964b017f1c9a211ec407e2b8002a7314705 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 14:05:03 -0800 Subject: [PATCH 033/232] Remove dead code --- src/core/surface/server.c | 128 -------------------------------------- 1 file changed, 128 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 0415949dacd..972ac28cd26 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -922,134 +922,6 @@ static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, do_nothing, NULL, status); } -#if 0 - -static void publish_request(grpc_call *call, grpc_op_error status, void *tag) { - grpc_call_element *elem = - grpc_call_stack_element(grpc_call_get_call_stack(call), 0); - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; - grpc_server *server = chand->server; - - if (status == GRPC_OP_OK) { - cpstr(&calld->details->host, &calld->details->host_capacity, calld->host); - cpstr(&calld->details->method, &calld->details->method_capacity, - calld->path); - calld->details->deadline = calld->deadline; - grpc_cq_end_op_complete(server->cq, tag, call, do_nothing, NULL, - GRPC_OP_OK); - } else { - abort(); - } -} - -static void begin_request(grpc_server *server, grpc_completion_queue *cq, - grpc_call **call, grpc_call_details *details, - registered_method *registered_method, gpr_timespec *deadline, - grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, - call_data *calld, void *tag) { - grpc_ioreq req; - GPR_ASSERT(registered_method == NULL); - GPR_ASSERT(deadline == NULL); - GPR_ASSERT(optional_payload == NULL); - if (!calld) { - *call = NULL; - initial_metadata->count = 0; - grpc_cq_end_op_complete(cq, tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); - return; - } - calld->details = details; - grpc_call_set_completion_queue(calld->call, cq); - *call = calld->call; - req.op = GRPC_IOREQ_RECV_INITIAL_METADATA; - req.data.recv_metadata = initial_metadata; - grpc_call_internal_ref(calld->call); - grpc_call_start_ioreq_and_call_back(calld->call, &req, 1, publish_request, - tag); -} - -static void begin_registered_request(grpc_server *server, grpc_completion_queue *cq, - grpc_call **call, grpc_call_details *details, - registered_method *registered_method, gpr_timespec *deadline, - grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, - call_data *calld, void *tag) { - grpc_ioreq req[2]; - grpc_ioreq *r; - GPR_ASSERT(registered_method != NULL); - GPR_ASSERT(deadline != NULL); - GPR_ASSERT(optional_payload != NULL); - if (!calld) { - *call = NULL; - initial_metadata->count = 0; - grpc_cq_end_op_complete(cq, tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); - return; - } - calld->details = NULL; - calld->registered_method = registered_method; - grpc_call_set_completion_queue(calld->call, cq); - *call = calld->call; - r = req; - r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; - r->data.recv_metadata = initial_metadata; - r++; - if (optional_payload != NULL) { - r->op = GRPC_IOREQ_RECV_MESSAGE; - r->data.recv_message = optional_payload; - r++; - } - grpc_call_internal_ref(calld->call); - grpc_call_start_ioreq_and_call_back(calld->call, req, r - rq, publish_request, - tag); -} - -static void publish_legacy_request(grpc_call *call, grpc_op_error status, - void *tag) { - grpc_call_element *elem = - grpc_call_stack_element(grpc_call_get_call_stack(call), 0); - call_data *calld = elem->call_data; - channel_data *chand = elem->channel_data; - grpc_server *server = chand->server; - - if (status == GRPC_OP_OK) { - grpc_cq_end_new_rpc(server->cq, tag, call, do_nothing, NULL, - grpc_mdstr_as_c_string(calld->path), - grpc_mdstr_as_c_string(calld->host), calld->deadline, - calld->legacy->initial_metadata->count, - calld->legacy->initial_metadata->metadata); - } else { - abort(); - } -} - -static void begin_legacy_request(grpc_server *server, grpc_completion_queue *cq, - grpc_call **call, grpc_call_details *details, - registered_method *registered_method, gpr_timespec *deadline, - grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, - call_data *calld, void *tag) { - grpc_ioreq req; - GPR_ASSERT(call == NULL); - GPR_ASSERT(details == NULL); - if (!calld) { - gpr_free(initial_metadata); - grpc_cq_end_new_rpc(cq, tag, NULL, do_nothing, NULL, NULL, NULL, - gpr_inf_past, 0, NULL); - return; - } - req.op = GRPC_IOREQ_RECV_INITIAL_METADATA; - req.data.recv_metadata = initial_metadata; - calld->legacy = gpr_malloc(sizeof(legacy_data)); - memset(calld->legacy, 0, sizeof(legacy_data)); - calld->legacy->initial_metadata = initial_metadata; - grpc_call_internal_ref(calld->call); - grpc_call_start_ioreq_and_call_back(calld->call, &req, 1, - publish_legacy_request, tag); -} - -#endif - const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { return server->channel_args; } From 7eb7d75c512020cc9ca43c12414281a2b7b45e78 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 10 Feb 2015 14:23:15 -0800 Subject: [PATCH 034/232] call implementation before the meeting --- include/grpc++/impl/call.h | 13 ++++++++--- src/cpp/common/call.cc | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index de789febe6e..91f3f584439 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -38,7 +38,7 @@ #include #include -#include +#include namespace google { namespace protobuf { @@ -59,7 +59,9 @@ class CallOpBuffer final : public CompletionQueueTag { void Reset(void *next_return_tag); - void AddSendInitialMetadata(std::vector > *metadata); + // Does not take ownership. + void AddSendInitialMetadata( + std::multimap *metadata); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); @@ -74,7 +76,12 @@ class CallOpBuffer final : public CompletionQueueTag { void FinalizeResult(void *tag, bool *status) override; private: - void *return_tag_; + void *return_tag_ = nullptr; + std::multimap* metadata_ = nullptr; + const google::protobuf::Message* send_message_ = nullptr; + google::protobuf::Message* recv_message_ = nullptr; + bool client_send_close_ = false; + Status* status_ = nullptr; }; class CCallDeleter { diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 0315ffb6bdd..37e374bad31 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -36,6 +36,52 @@ namespace grpc { +void CallOpBuffer::Reset(void* next_return_tag) { + return_tag_ = next_return_tag; + metadata_ = nullptr; + send_message_ = nullptr; + recv_message_ = nullptr; + client_send_close_ = false; + status_ = false; +} + +void CallOpBuffer::AddSendInitialMetadata( + std::multimap* metadata) { + metadata_ = metadata; +} + +void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { + send_message_ = &message; +} + +void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) { + recv_message_ = message; +} + +void CallOpBuffer::AddClientSendClose() { + client_sent_close_ = true; +} + +void CallOpBuffer::AddClientRecvStatus(Status *status) { + status_ = status; +} + +void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { + + +} + +void CallOpBuffer::FinalizeResult(void *tag, bool *status) { + +} + +void CCallDeleter::operator()(grpc_call* c) { + grpc_call_destroy(c); +} + +Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq) + : channel_(channel), cq_(cq), call_(call) {} + void Call::PerformOps(CallOpBuffer* buffer) { channel_->PerformOpsOnCall(buffer, this); } From 04cc8be23362025625c787ecce69514087e2fc2b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 16:11:22 -0800 Subject: [PATCH 035/232] First draft registered methods --- src/core/surface/server.c | 152 ++++++++++++++++++++++++++++---------- 1 file changed, 115 insertions(+), 37 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 972ac28cd26..81eaf4fc940 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -99,7 +99,7 @@ typedef struct { struct registered_method { char *method; char *host; - call_link pending; + call_data *pending; requested_call_array requested; registered_method *next; }; @@ -118,6 +118,9 @@ struct channel_data { /* linked list of all channels on a server */ channel_data *next; channel_data *prev; + channel_registered_method *registered_methods; + gpr_uint32 registered_method_slots; + gpr_uint32 registered_method_max_probes; }; struct grpc_server { @@ -167,7 +170,7 @@ struct call_data { legacy_data *legacy; - gpr_uint8 included[CALL_LIST_COUNT]; + call_data **root[CALL_LIST_COUNT]; call_link links[CALL_LIST_COUNT]; }; @@ -180,30 +183,30 @@ static void begin_call(grpc_server *server, call_data *calld, requested_call *rc); static void fail_call(grpc_server *server, requested_call *rc); -static int call_list_join(grpc_server *server, call_data *call, +static int call_list_join(call_data **root, call_data *call, call_list list) { - if (call->included[list]) return 0; - call->included[list] = 1; - if (!server->lists[list]) { - server->lists[list] = call; + GPR_ASSERT(!call->root[list]); + call->root[list] = root; + if (!*root) { + *root = call; call->links[list].next = call->links[list].prev = call; } else { - call->links[list].next = server->lists[list]; - call->links[list].prev = server->lists[list]->links[list].prev; + call->links[list].next = *root; + call->links[list].prev = (*root)->links[list].prev; call->links[list].next->links[list].prev = call->links[list].prev->links[list].next = call; } return 1; } -static call_data *call_list_remove_head(grpc_server *server, call_list list) { - call_data *out = server->lists[list]; +static call_data *call_list_remove_head(call_data **root, call_list list) { + call_data *out = *root; if (out) { - out->included[list] = 0; + out->root[list] = NULL; if (out->links[list].next == out) { - server->lists[list] = NULL; + *root = NULL; } else { - server->lists[list] = out->links[list].next; + *root = out->links[list].next; out->links[list].next->links[list].prev = out->links[list].prev; out->links[list].prev->links[list].next = out->links[list].next; } @@ -211,18 +214,18 @@ static call_data *call_list_remove_head(grpc_server *server, call_list list) { return out; } -static int call_list_remove(grpc_server *server, call_data *call, - call_list list) { - if (!call->included[list]) return 0; - call->included[list] = 0; - if (server->lists[list] == call) { - server->lists[list] = call->links[list].next; - if (server->lists[list] == call) { - server->lists[list] = NULL; +static int call_list_remove(call_data *call, call_list list) { + call_data **root = call->root[list]; + if (root == NULL) return 0; + call->root[list] = NULL; + if (*root == call) { + *root = call->links[list].next; + if (*root == call) { + *root = NULL; return 1; } } - GPR_ASSERT(server->lists[list] != call); + GPR_ASSERT(*root != call); call->links[list].next->links[list].prev = call->links[list].prev; call->links[list].prev->links[list].next = call->links[list].next; return 1; @@ -283,23 +286,53 @@ static void destroy_channel(channel_data *chand) { grpc_iomgr_add_callback(finish_destroy_channel, chand); } +static void finish_start_new_rpc_and_unlock(grpc_server *server, grpc_call_element *elem, call_data **pending_root, requested_call_array *array) { + requested_call rc; + call_data *calld = elem->call_data; + if (array->count == 0) { + calld->state = PENDING; + call_list_join(pending_root, calld, PENDING_START); + gpr_mu_unlock(&server->mu); + } else { + rc = server->requested_calls.calls[--server->requested_calls.count]; + calld->state = ACTIVATED; + gpr_mu_unlock(&server->mu); + begin_call(server, calld, &rc); + } +} + static void start_new_rpc(grpc_call_element *elem) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; grpc_server *server = chand->server; + gpr_uint32 i; + gpr_uint32 hash; + channel_registered_method *rm; gpr_mu_lock(&server->mu); - if (server->requested_calls.count > 0) { - requested_call rc = - server->requested_calls.calls[--server->requested_calls.count]; - calld->state = ACTIVATED; - gpr_mu_unlock(&server->mu); - begin_call(server, calld, &rc); - } else { - calld->state = PENDING; - call_list_join(server, calld, PENDING_START); - gpr_mu_unlock(&server->mu); + if (chand->registered_methods && calld->path && calld->host) { + /* check for an exact match with host */ + hash = GRPC_MDSTR_KV_HASH(calld->host->hash, calld->path->hash); + for (i = 0; i < chand->registered_method_max_probes; i++) { + rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; + if (!rm) break; + if (rm->host != calld->host) continue; + if (rm->method != calld->path) continue; + finish_start_new_rpc_and_unlock(server, elem, &rm->server_registered_method->pending, &rm->server_registered_method->requested); + return; + } + /* check for a wildcard method definition (no host set) */ + hash = GRPC_MDSTR_KV_HASH(0, calld->path->hash); + for (i = 0; i < chand->registered_method_max_probes; i++) { + rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; + if (!rm) break; + if (rm->host != NULL) continue; + if (rm->method != calld->path) continue; + finish_start_new_rpc_and_unlock(server, elem, &rm->server_registered_method->pending, &rm->server_registered_method->requested); + return; + } } + finish_start_new_rpc_and_unlock(server, elem, &server->lists[PENDING_START], &server->requested_calls); } static void kill_zombie(void *elem, int success) { @@ -314,7 +347,7 @@ static void stream_closed(grpc_call_element *elem) { case ACTIVATED: break; case PENDING: - call_list_remove(chand->server, calld, PENDING_START); + call_list_remove(calld, PENDING_START); /* fallthrough intended */ case NOT_STARTED: calld->state = ZOMBIED; @@ -445,7 +478,7 @@ static void init_call_elem(grpc_call_element *elem, calld->call = grpc_call_from_top_element(elem); gpr_mu_lock(&chand->server->mu); - call_list_join(chand->server, calld, ALL_CALLS); + call_list_join(&chand->server->lists[ALL_CALLS], calld, ALL_CALLS); gpr_mu_unlock(&chand->server->mu); server_ref(chand->server); @@ -458,7 +491,7 @@ static void destroy_call_elem(grpc_call_element *elem) { gpr_mu_lock(&chand->server->mu); for (i = 0; i < CALL_LIST_COUNT; i++) { - call_list_remove(chand->server, elem->call_data, i); + call_list_remove(elem->call_data, i); } if (chand->server->shutdown && chand->server->have_shutdown_tag && chand->server->lists[ALL_CALLS] == NULL) { @@ -493,6 +526,7 @@ static void init_channel_elem(grpc_channel_element *elem, chand->path_key = grpc_mdstr_from_string(metadata_context, ":path"); chand->authority_key = grpc_mdstr_from_string(metadata_context, ":authority"); chand->next = chand->prev = chand; + chand->registered_methods = NULL; } static void destroy_channel_elem(grpc_channel_element *elem) { @@ -600,8 +634,18 @@ grpc_transport_setup_result grpc_server_setup_transport( grpc_channel_filter const **filters = gpr_malloc(sizeof(grpc_channel_filter *) * num_filters); size_t i; + size_t num_registered_methods; + size_t alloc; + registered_method *rm; + channel_registered_method *crm; grpc_channel *channel; channel_data *chand; + grpc_mdstr *host; + grpc_mdstr *method; + gpr_uint32 hash; + gpr_uint32 slots; + gpr_uint32 probes; + gpr_uint32 max_probes = 0; for (i = 0; i < s->channel_filter_count; i++) { filters[i] = s->channel_filters[i]; @@ -621,6 +665,32 @@ grpc_transport_setup_result grpc_server_setup_transport( server_ref(s); chand->channel = channel; + num_registered_methods = 0; + for (rm = s->registered_methods; rm; rm = rm->next) { + num_registered_methods++; + } + /* build a lookup table phrased in terms of mdstr's in this channels context + to quickly find registered methods */ + if (num_registered_methods > 0) { + slots = 2 * num_registered_methods; + alloc = sizeof(channel_registered_method) * slots; + chand->registered_methods = gpr_malloc(alloc); + memset(chand->registered_methods, 0, alloc); + for (rm = s->registered_methods; rm; rm = rm->next) { + host = rm->host ? grpc_mdstr_from_string(mdctx, rm->host) : NULL; + method = grpc_mdstr_from_string(mdctx, rm->host); + hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); + for (probes = 0; chand->registered_methods[(hash + probes) % slots].server_registered_method != NULL; probes++); + if (probes > max_probes) max_probes = probes; + crm = &chand->registered_methods[(hash + probes) % slots]; + crm->server_registered_method = rm; + crm->host = host; + crm->method = method; + } + chand->registered_method_slots = slots; + chand->registered_method_max_probes = max_probes; + } + gpr_mu_lock(&s->mu); chand->next = &s->root_channel_data; chand->prev = chand->next->prev; @@ -752,7 +822,15 @@ static grpc_call_error queue_call_request(grpc_server *server, fail_call(server, rc); return GRPC_CALL_OK; } - calld = call_list_remove_head(server, PENDING_START); + switch (rc->type) { + case LEGACY_CALL: + case BATCH_CALL: + calld = call_list_remove_head(&server->lists[PENDING_START], PENDING_START); + break; + case REGISTERED_CALL: + calld = call_list_remove_head(&rc->data.registered.registered_method->pending, PENDING_START); + break; + } if (calld) { GPR_ASSERT(calld->state == PENDING); calld->state = ACTIVATED; From 70a761b3f03916cc93e63c6706571ea0d5c89318 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 16:28:30 -0800 Subject: [PATCH 036/232] Make sure new rpcs always come in on server cq --- src/core/surface/server.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 972ac28cd26..8455ccf5c98 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -771,7 +771,7 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_metadata_array *initial_metadata, grpc_completion_queue *cq, void *tag) { requested_call rc; - grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); rc.type = BATCH_CALL; rc.tag = tag; rc.data.batch.cq = cq; @@ -786,7 +786,7 @@ grpc_call_error grpc_server_request_registered_call( gpr_timespec *deadline, grpc_metadata_array *initial_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq, void *tag) { requested_call rc; - grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); rc.type = REGISTERED_CALL; rc.tag = tag; rc.data.registered.cq = cq; @@ -918,8 +918,11 @@ static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag) { static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag) { - grpc_cq_end_op_complete(grpc_call_get_completion_queue(call), tag, call, - do_nothing, NULL, status); + grpc_call_element *elem = + grpc_call_stack_element(grpc_call_get_call_stack(call), 0); + channel_data *chand = elem->channel_data; + grpc_server *server = chand->server; + grpc_cq_end_op_complete(server->cq, tag, call, do_nothing, NULL, status); } const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { From 8e8fd89fafbab00bcb91c032692978320b8b1e6b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 17:02:08 -0800 Subject: [PATCH 037/232] Allow two completion queues on request call One for the new rpc notification, the other is bound to the new call. This will make async c++ soooo much easier. --- include/grpc/grpc | 1 + include/grpc/grpc.h | 7 +++- src/core/surface/server.c | 39 ++++++++++++------- test/core/end2end/tests/cancel_after_accept.c | 3 +- ...esponse_with_binary_metadata_and_payload.c | 3 +- ...quest_response_with_metadata_and_payload.c | 3 +- .../tests/request_response_with_payload.c | 3 +- ...ponse_with_trailing_metadata_and_payload.c | 3 +- .../tests/request_with_large_metadata.c | 3 +- .../core/end2end/tests/request_with_payload.c | 3 +- .../end2end/tests/simple_delayed_request.c | 3 +- test/core/end2end/tests/simple_request.c | 3 +- 12 files changed, 50 insertions(+), 24 deletions(-) create mode 120000 include/grpc/grpc diff --git a/include/grpc/grpc b/include/grpc/grpc new file mode 120000 index 00000000000..fc80ad1c867 --- /dev/null +++ b/include/grpc/grpc @@ -0,0 +1 @@ +/home/craig/grpc-ct/include/grpc \ No newline at end of file diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 4ccb5a4dd59..7733f8bb2ae 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -553,7 +553,9 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, grpc_call_error grpc_server_request_call( grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, - grpc_completion_queue *completion_queue, void *tag_new); + grpc_completion_queue *cq_when_rpc_available, + grpc_completion_queue *cq_bound_to_call, + void *tag_new); void *grpc_server_register_method(grpc_server *server, const char *method, const char *host); @@ -562,7 +564,8 @@ grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, - grpc_completion_queue *completion_queue, void *tag_new); + grpc_completion_queue *cq_when_rpc_available, + grpc_completion_queue *cq_bound_to_call, void *tag_new); /* Create a server */ grpc_server *grpc_server_create(grpc_completion_queue *cq, diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 81eaf4fc940..b28a52bcbdd 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -74,13 +74,15 @@ typedef struct { void *tag; union { struct { - grpc_completion_queue *cq; + grpc_completion_queue *cq_new; + grpc_completion_queue *cq_bind; grpc_call **call; grpc_call_details *details; grpc_metadata_array *initial_metadata; } batch; struct { - grpc_completion_queue *cq; + grpc_completion_queue *cq_new; + grpc_completion_queue *cq_bind; grpc_call **call; registered_method *registered_method; gpr_timespec *deadline; @@ -172,6 +174,8 @@ struct call_data { call_data **root[CALL_LIST_COUNT]; call_link links[CALL_LIST_COUNT]; + + grpc_completion_queue *cq_new; }; #define SERVER_FROM_CALL_ELEM(elem) \ @@ -847,12 +851,14 @@ static grpc_call_error queue_call_request(grpc_server *server, grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *initial_metadata, - grpc_completion_queue *cq, void *tag) { + grpc_completion_queue *cq_new, + grpc_completion_queue *cq_bind, void *tag) { requested_call rc; - grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(cq_new, NULL, GRPC_OP_COMPLETE); rc.type = BATCH_CALL; rc.tag = tag; - rc.data.batch.cq = cq; + rc.data.batch.cq_new = cq_new; + rc.data.batch.cq_bind = cq_bind; rc.data.batch.call = call; rc.data.batch.details = details; rc.data.batch.initial_metadata = initial_metadata; @@ -862,12 +868,14 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, grpc_completion_queue *cq, void *tag) { + grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_new, grpc_completion_queue *cq_bind, + void *tag) { requested_call rc; - grpc_cq_begin_op(cq, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(cq_new, NULL, GRPC_OP_COMPLETE); rc.type = REGISTERED_CALL; rc.tag = tag; - rc.data.registered.cq = cq; + rc.data.registered.cq_new = cq_new; + rc.data.registered.cq_bind = cq_bind; rc.data.registered.call = call; rc.data.registered.registered_method = registered_method; rc.data.registered.deadline = deadline; @@ -926,16 +934,17 @@ static void begin_call(grpc_server *server, call_data *calld, &rc->data.batch.details->host_capacity, calld->host); cpstr(&rc->data.batch.details->method, &rc->data.batch.details->method_capacity, calld->path); - grpc_call_set_completion_queue(calld->call, rc->data.batch.cq); + grpc_call_set_completion_queue(calld->call, rc->data.batch.cq_bind); *rc->data.batch.call = calld->call; r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; r->data.recv_metadata = rc->data.batch.initial_metadata; r++; + calld->cq_new = rc->data.batch.cq_new; publish = publish_registered_or_batch; break; case REGISTERED_CALL: *rc->data.registered.deadline = calld->deadline; - grpc_call_set_completion_queue(calld->call, rc->data.registered.cq); + grpc_call_set_completion_queue(calld->call, rc->data.registered.cq_bind); *rc->data.registered.call = calld->call; r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; r->data.recv_metadata = rc->data.registered.initial_metadata; @@ -945,6 +954,7 @@ static void begin_call(grpc_server *server, call_data *calld, r->data.recv_message = rc->data.registered.optional_payload; r++; } + calld->cq_new = rc->data.registered.cq_new; publish = publish_registered_or_batch; break; } @@ -963,13 +973,13 @@ static void fail_call(grpc_server *server, requested_call *rc) { case BATCH_CALL: *rc->data.batch.call = NULL; rc->data.batch.initial_metadata->count = 0; - grpc_cq_end_op_complete(rc->data.batch.cq, rc->tag, NULL, do_nothing, + grpc_cq_end_op_complete(rc->data.batch.cq_new, rc->tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); break; case REGISTERED_CALL: *rc->data.registered.call = NULL; rc->data.registered.initial_metadata->count = 0; - grpc_cq_end_op_complete(rc->data.registered.cq, rc->tag, NULL, do_nothing, + grpc_cq_end_op_complete(rc->data.registered.cq_new, rc->tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); break; } @@ -996,7 +1006,10 @@ static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag) { static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag) { - grpc_cq_end_op_complete(grpc_call_get_completion_queue(call), tag, call, + grpc_call_element *elem = + grpc_call_stack_element(grpc_call_get_call_stack(call), 0); + call_data *calld = elem->call_data; + grpc_cq_end_op_complete(calld->cq_new, tag, call, do_nothing, NULL, status); } diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index eb26ff14f00..ab7c683e452 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -166,7 +166,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(2))); + f.server_cq, f.server_cq, + tag(2))); cq_expect_completion(v_server, tag(2), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index fa5df5f5260..cb477144d3f 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -175,7 +175,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index ad01fe70813..0d4822ec91b 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -168,7 +168,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index 6b60c4da651..fe3f05fa954 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -162,7 +162,8 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 5878058c982..86ee405964b 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -169,7 +169,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 7e7bec0160c..8e5b1014f54 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -166,7 +166,8 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 2c23f37e0c3..67b15770142 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -157,7 +157,8 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 99d1a263864..5c9109f9629 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -144,7 +144,8 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s, &call_details, &request_metadata_recv, - f->server_cq, tag(101))); + f->server_cq, f->server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 0f046ae2d23..280bf98c167 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -150,7 +150,8 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); From 36d18a089e66aff8fc542ec2d98623b56a2e78f1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 17:05:56 -0800 Subject: [PATCH 038/232] Fix compile --- src/cpp/server/server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 5d44ab2ba42..44c5276b54a 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -152,7 +152,7 @@ void Server::RunRpc() { grpc_metadata_array initial_metadata; grpc_metadata_array_init(&initial_metadata); CompletionQueue cq; - grpc_call_error err = grpc_server_request_call(server_, &c_call, &call_details, &initial_metadata, cq.cq(), nullptr); + grpc_call_error err = grpc_server_request_call(server_, &c_call, &call_details, &initial_metadata, cq.cq(), cq.cq(), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); bool ok = false; GPR_ASSERT(cq_.Next(&tag, &ok)); From cbd04850884ed6978fa6ae19ec8d04c3773d8ac4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 10 Feb 2015 17:39:54 -0800 Subject: [PATCH 039/232] Simplify server ready for async path --- include/grpc++/server.h | 29 ++++++++++++++++---- src/cpp/server/server.cc | 58 ++++++++++++++-------------------------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 670ffa78154..eefd4457f95 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -35,7 +35,7 @@ #define __GRPCPP_SERVER_H__ #include -#include +#include #include #include @@ -69,6 +69,25 @@ class Server { private: friend class ServerBuilder; + class MethodRequestData { + public: + MethodRequestData(RpcServiceMethod* method, void* tag) : method_(method), tag_(tag) {} + static MethodRequestData *Wait(CompletionQueue *cq); + + void Request(CompletionQueue* cq); + + class CallData { + public: + explicit CallData(MethodRequestData *mrd); + + void Run(); + }; + + private: + RpcServiceMethod *const method_; + void *const tag_; + }; + // ServerBuilder use only Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, ServerCredentials* creds); Server(); @@ -85,7 +104,8 @@ class Server { void ScheduleCallback(); // Completion queue. - CompletionQueue cq_; + std::unique_ptr cq_sync_; + std::unique_ptr cq_async_; // Sever status std::mutex mu_; @@ -95,12 +115,11 @@ class Server { int num_running_cb_; std::condition_variable callback_cv_; + std::list methods_; + // Pointer to the c grpc server. grpc_server* server_; - // A map for all method information. - std::map method_map_; - ThreadPoolInterface* thread_pool_; // Whether the thread pool is created and owned by the server. bool thread_pool_owned_; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 44c5276b54a..f5bbfdc6f73 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -54,9 +54,9 @@ Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, ServerC secure_(creds != nullptr) { if (creds) { server_ = - grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); + grpc_secure_server_create(creds->GetRawCreds(), nullptr, nullptr); } else { - server_ = grpc_server_create(cq_.cq(), nullptr); + server_ = grpc_server_create(nullptr, nullptr); } } @@ -80,13 +80,17 @@ Server::~Server() { } bool Server::RegisterService(RpcService *service) { + if (!cq_sync_) { + cq_sync_.reset(new CompletionQueue); + } for (int i = 0; i < service->GetMethodCount(); ++i) { RpcServiceMethod *method = service->GetMethod(i); - if (method_map_.find(method->name()) != method_map_.end()) { + void *tag = grpc_server_register_method(server_, method->name(), nullptr); + if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); return false; } - method_map_.insert(std::make_pair(method->name(), method)); + methods_.emplace_back(method, tag); } return true; } @@ -106,7 +110,11 @@ bool Server::Start() { grpc_server_start(server_); // Start processing rpcs. - if (thread_pool_) { + if (cq_sync_) { + for (auto& m : methods_) { + m.Request(cq_sync_.get()); + } + ScheduleCallback(); } @@ -126,12 +134,6 @@ void Server::Shutdown() { } } } - - // Shutdown the completion queue. - cq_.Shutdown(); - void *tag = nullptr; - bool ok = false; - GPR_ASSERT(false == cq_.Next(&tag, &ok)); } void Server::ScheduleCallback() { @@ -144,35 +146,15 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. - void *tag = nullptr; - GPR_ASSERT(started_); - grpc_call *c_call = NULL; - grpc_call_details call_details; - grpc_call_details_init(&call_details); - grpc_metadata_array initial_metadata; - grpc_metadata_array_init(&initial_metadata); - CompletionQueue cq; - grpc_call_error err = grpc_server_request_call(server_, &c_call, &call_details, &initial_metadata, cq.cq(), cq.cq(), nullptr); - GPR_ASSERT(err == GRPC_CALL_OK); - bool ok = false; - GPR_ASSERT(cq_.Next(&tag, &ok)); - if (ok) { - ServerContext context; - Call call(c_call, nullptr, &cq); + auto* mrd = MethodRequestData::Wait(cq_sync_.get()); + if (mrd) { + MethodRequestData::CallData cd(mrd); + + mrd->Request(cq_sync_.get()); ScheduleCallback(); - RpcServiceMethod *method = nullptr; - auto iter = method_map_.find(call_details.method); - if (iter != method_map_.end()) { - method = iter->second; - } - // TODO(ctiller): allocate only if necessary - std::unique_ptr request(method->AllocateRequestProto()); - std::unique_ptr response(method->AllocateResponseProto()); - method->handler()->RunHandler(MethodHandler::HandlerParameter( - &call, &context, request.get(), response.get())); + + cd.Run(); } - grpc_call_details_destroy(&call_details); - grpc_metadata_array_destroy(&initial_metadata); { std::unique_lock lock(mu_); From d5a04bdc6e5ea6bc81ff15409381323c196b0e0f Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 00:04:32 -0800 Subject: [PATCH 040/232] Implement FillOps --- include/grpc++/impl/call.h | 14 +++++- src/cpp/common/call.cc | 95 +++++++++++++++++++++++++++++++++++--- 2 files changed, 100 insertions(+), 9 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 91f3f584439..edc6555b0c4 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -34,6 +34,7 @@ #ifndef __GRPCPP_CALL_H__ #define __GRPCPP_CALL_H__ +#include #include #include @@ -72,16 +73,25 @@ class CallOpBuffer final : public CompletionQueueTag { // Convert to an array of grpc_op elements void FillOps(grpc_op *ops, size_t *nops); + // Release send buffers. + void ReleaseSendBuffer(); + // Called by completion queue just prior to returning from Next() or Pluck() void FinalizeResult(void *tag, bool *status) override; private: void *return_tag_ = nullptr; - std::multimap* metadata_ = nullptr; + size_t initial_metadata_count_ = 0; + grpc_metadata* initial_metadata_ = nullptr; const google::protobuf::Message* send_message_ = nullptr; + grpc_byte_buffer* write_buffer_ = nullptr; google::protobuf::Message* recv_message_ = nullptr; + grpc_byte_buffer* recv_message_buf_ = nullptr; bool client_send_close_ = false; - Status* status_ = nullptr; + Status* recv_status_ = nullptr; + grpc_status_code status_code_ = GRPC_STATUS_OK; + char* status_details_ = nullptr; + size_t status_details_capacity_ = 0; }; class CCallDeleter { diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 37e374bad31..1aa79d46150 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -31,23 +31,64 @@ * */ +#include #include #include +#include "src/cpp/proto/proto_utils.h" + namespace grpc { void CallOpBuffer::Reset(void* next_return_tag) { return_tag_ = next_return_tag; - metadata_ = nullptr; + initial_metadata_count_ = 0; + if (initial_metadata_) { + gpr_free(initial_metadata_); + } send_message_ = nullptr; + if (write_buffer_) { + grpc_byte_buffer_destroy(write_buffer_); + write_buffer_ = nullptr; + } recv_message_ = nullptr; + if (recv_message_buf_) { + grpc_byte_buffer_destroy(recv_message_buf_); + recv_message_buf_ = nullptr; + } client_send_close_ = false; - status_ = false; + recv_status_ = nullptr; + status_code_ = GRPC_STATUS_OK; + if (status_details_) { + gpr_free(status_details_); + status_details_ = nullptr; + } + status_details_capacity_ = 0; +} + +namespace { +// TODO(yangg) if the map is changed before we send, the pointers will be a +// mess. Make sure it does not happen. +grpc_metadata* FillMetadata( + 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; } +} // namespace void CallOpBuffer::AddSendInitialMetadata( - std::multimap* metadata) { - metadata_ = metadata; + std::multimap* metadata) { + initial_metadata_count_ = metadata->size(); + initial_metadata_ = FillMetadata(metadata); } void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { @@ -59,16 +100,55 @@ void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) { } void CallOpBuffer::AddClientSendClose() { - client_sent_close_ = true; + client_send_close_ = true; } void CallOpBuffer::AddClientRecvStatus(Status *status) { - status_ = status; + recv_status_ = status; } -void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { +void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { + *nops = 0; + if (initial_metadata_count_) { + ops[*nops].op = GRPC_OP_SEND_INITIAL_METADATA; + ops[*nops].data.send_initial_metadata.count = initial_metadata_count_; + ops[*nops].data.send_initial_metadata.metadata = initial_metadata_; + (*nops)++; + } + if (send_message_) { + bool success = SerializeProto(*send_message_, &write_buffer_); + if (!success) { + // TODO handle parse failure + } + ops[*nops].op = GRPC_OP_SEND_MESSAGE; + ops[*nops].data.send_message = write_buffer_; + (*nops)++; + } + if (recv_message_) { + ops[*nops].op = GRPC_OP_RECV_MESSAGE; + ops[*nops].data.recv_message = &recv_message_buf_; + (*nops)++; + } + if (client_send_close_) { + ops[*nops].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + (*nops)++; + } + if (recv_status_) { + ops[*nops].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + // ops[*nops].data.recv_status_on_client.trailing_metadata = + ops[*nops].data.recv_status_on_client.status = &status_code_; + ops[*nops].data.recv_status_on_client.status_details = &status_details_; + ops[*nops].data.recv_status_on_client.status_details_capacity = &status_details_capacity_; + (*nops)++; + } +} +void CallOpBuffer::ReleaseSendBuffer() { + if (write_buffer_) { + grpc_byte_buffer_destroy(write_buffer_); + write_buffer_ = nullptr; + } } void CallOpBuffer::FinalizeResult(void *tag, bool *status) { @@ -84,6 +164,7 @@ Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq) void Call::PerformOps(CallOpBuffer* buffer) { channel_->PerformOpsOnCall(buffer, this); + buffer->ReleaseSendBuffer(); } } // namespace grpc From 6d6b90376b0e47e120936832c18f577906cf9868 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 10:19:20 -0800 Subject: [PATCH 041/232] Release write buffer in FinalizeResult --- include/grpc++/impl/call.h | 3 --- src/cpp/common/call.cc | 7 ++----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index edc6555b0c4..139604a531b 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -73,9 +73,6 @@ class CallOpBuffer final : public CompletionQueueTag { // Convert to an array of grpc_op elements void FillOps(grpc_op *ops, size_t *nops); - // Release send buffers. - void ReleaseSendBuffer(); - // Called by completion queue just prior to returning from Next() or Pluck() void FinalizeResult(void *tag, bool *status) override; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 1aa79d46150..2ff6007f71d 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -144,17 +144,14 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } } -void CallOpBuffer::ReleaseSendBuffer() { +void CallOpBuffer::FinalizeResult(void *tag, bool *status) { + // Release send buffers if (write_buffer_) { grpc_byte_buffer_destroy(write_buffer_); write_buffer_ = nullptr; } } -void CallOpBuffer::FinalizeResult(void *tag, bool *status) { - -} - void CCallDeleter::operator()(grpc_call* c) { grpc_call_destroy(c); } From 3f631bdec4ab203c7c09f40c314732b14a480492 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 10:29:36 -0800 Subject: [PATCH 042/232] Remove stale call site. --- src/cpp/common/call.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 2ff6007f71d..8dfe583653d 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -161,7 +161,5 @@ Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq) void Call::PerformOps(CallOpBuffer* buffer) { channel_->PerformOpsOnCall(buffer, this); - buffer->ReleaseSendBuffer(); -} } // namespace grpc From a52ea7bd1cdcbd007fadc0650fe5d49ae9bf7d46 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 10:31:29 -0800 Subject: [PATCH 043/232] typo fix --- src/cpp/common/call.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 8dfe583653d..5a6656900ed 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -161,5 +161,6 @@ Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq) void Call::PerformOps(CallOpBuffer* buffer) { channel_->PerformOpsOnCall(buffer, this); +} } // namespace grpc From c4165776366a7bccd2a8571356e409a721093a97 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 10:51:04 -0800 Subject: [PATCH 044/232] Server progress --- Makefile | 6 +- build.json | 10 +- include/grpc++/completion_queue.h | 3 + include/grpc++/impl/call.h | 1 + include/grpc++/server.h | 19 +-- include/grpc++/server_context.h | 4 + src/cpp/server/server.cc | 125 ++++++++++++++++-- ...rver_context_impl.cc => server_context.cc} | 2 +- src/cpp/server/server_context_impl.h | 61 --------- 9 files changed, 133 insertions(+), 98 deletions(-) rename src/cpp/server/{server_context_impl.cc => server_context.cc} (97%) delete mode 100644 src/cpp/server/server_context_impl.h diff --git a/Makefile b/Makefile index 622181b15b6..ea0ce66fbe3 100644 --- a/Makefile +++ b/Makefile @@ -2645,7 +2645,7 @@ LIBGRPC++_SRC = \ src/cpp/proto/proto_utils.cc \ src/cpp/server/server.cc \ src/cpp/server/server_builder.cc \ - src/cpp/server/server_context_impl.cc \ + src/cpp/server/server_context.cc \ src/cpp/server/server_credentials.cc \ src/cpp/server/thread_pool.cc \ src/cpp/util/status.cc \ @@ -2702,7 +2702,7 @@ src/cpp/common/rpc_method.cc: $(OPENSSL_DEP) src/cpp/proto/proto_utils.cc: $(OPENSSL_DEP) src/cpp/server/server.cc: $(OPENSSL_DEP) src/cpp/server/server_builder.cc: $(OPENSSL_DEP) -src/cpp/server/server_context_impl.cc: $(OPENSSL_DEP) +src/cpp/server/server_context.cc: $(OPENSSL_DEP) src/cpp/server/server_credentials.cc: $(OPENSSL_DEP) src/cpp/server/thread_pool.cc: $(OPENSSL_DEP) src/cpp/util/status.cc: $(OPENSSL_DEP) @@ -2760,7 +2760,7 @@ objs/$(CONFIG)/src/cpp/common/rpc_method.o: objs/$(CONFIG)/src/cpp/proto/proto_utils.o: objs/$(CONFIG)/src/cpp/server/server.o: objs/$(CONFIG)/src/cpp/server/server_builder.o: -objs/$(CONFIG)/src/cpp/server/server_context_impl.o: +objs/$(CONFIG)/src/cpp/server/server_context.o: objs/$(CONFIG)/src/cpp/server/server_credentials.o: objs/$(CONFIG)/src/cpp/server/thread_pool.o: objs/$(CONFIG)/src/cpp/util/status.o: diff --git a/build.json b/build.json index e6993acd6e8..77a737031ad 100644 --- a/build.json +++ b/build.json @@ -428,7 +428,7 @@ "src/cpp/proto/proto_utils.cc", "src/cpp/server/server.cc", "src/cpp/server/server_builder.cc", - "src/cpp/server/server_context_impl.cc", + "src/cpp/server/server_context.cc", "src/cpp/server/server_credentials.cc", "src/cpp/server/thread_pool.cc", "src/cpp/util/status.cc", @@ -1621,7 +1621,6 @@ { "name": "qps_client", "build": "test", - "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1634,12 +1633,12 @@ "grpc", "gpr_test_util", "gpr" - ] + ], + "run": false }, { "name": "qps_server", "build": "test", - "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1652,7 +1651,8 @@ "grpc", "gpr_test_util", "gpr" - ] + ], + "run": false }, { "name": "ruby_plugin", diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index c976bd5b454..7f0677b4e5f 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -54,6 +54,7 @@ template class ServerReaderWriter; class CompletionQueue; +class Server; class CompletionQueueTag { public: @@ -67,6 +68,7 @@ class CompletionQueueTag { class CompletionQueue { public: CompletionQueue(); + explicit CompletionQueue(grpc_completion_queue *take); ~CompletionQueue(); // Blocking read from queue. @@ -87,6 +89,7 @@ class CompletionQueue { template friend class ::grpc::ServerReader; template friend class ::grpc::ServerWriter; template friend class ::grpc::ServerReaderWriter; + friend class ::grpc::Server; friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request, diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index edc6555b0c4..11e193eec16 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -67,6 +67,7 @@ class CallOpBuffer final : public CompletionQueueTag { void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(Status *status); + void AddServerSendStatus(std::multimap *metadata, const Status& status); // INTERNAL API: diff --git a/include/grpc++/server.h b/include/grpc++/server.h index eefd4457f95..b02c4130d9c 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -69,24 +69,7 @@ class Server { private: friend class ServerBuilder; - class MethodRequestData { - public: - MethodRequestData(RpcServiceMethod* method, void* tag) : method_(method), tag_(tag) {} - static MethodRequestData *Wait(CompletionQueue *cq); - - void Request(CompletionQueue* cq); - - class CallData { - public: - explicit CallData(MethodRequestData *mrd); - - void Run(); - }; - - private: - RpcServiceMethod *const method_; - void *const tag_; - }; + class MethodRequestData; // ServerBuilder use only Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, ServerCredentials* creds); diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 4af9fd6aaac..a58e63aff24 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -39,11 +39,15 @@ #include "config.h" +struct grpc_metadata; +struct gpr_timespec; + namespace grpc { // Interface of server side rpc context. class ServerContext { public: + ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); virtual ~ServerContext() {} std::chrono::system_clock::time_point absolute_deadline(); diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index f5bbfdc6f73..02fb383394a 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -43,9 +43,12 @@ #include #include +#include "src/cpp/proto/proto_utils.h" + namespace grpc { -Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, ServerCredentials *creds) +Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, + ServerCredentials *creds) : started_(false), shutdown_(false), num_running_cb_(0), @@ -53,8 +56,7 @@ Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, ServerC thread_pool_owned_(thread_pool_owned), secure_(creds != nullptr) { if (creds) { - server_ = - grpc_secure_server_create(creds->GetRawCreds(), nullptr, nullptr); + server_ = grpc_secure_server_create(creds->GetRawCreds(), nullptr, nullptr); } else { server_ = grpc_server_create(nullptr, nullptr); } @@ -87,7 +89,8 @@ bool Server::RegisterService(RpcService *service) { RpcServiceMethod *method = service->GetMethod(i); void *tag = grpc_server_register_method(server_, method->name(), nullptr); if (!tag) { - gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); + gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", + method->name()); return false; } methods_.emplace_back(method, tag); @@ -104,6 +107,105 @@ int Server::AddPort(const grpc::string &addr) { } } +class Server::MethodRequestData final : public CompletionQueueTag { + public: + MethodRequestData(RpcServiceMethod *method, void *tag) + : method_(method), + tag_(tag), + has_request_payload_(method->method_type() == RpcMethod::NORMAL_RPC || + method->method_type() == + RpcMethod::SERVER_STREAMING), + has_response_payload_(method->method_type() == RpcMethod::NORMAL_RPC || + method->method_type() == + RpcMethod::CLIENT_STREAMING) { + grpc_metadata_array_init(&request_metadata_); + } + + static MethodRequestData *Wait(CompletionQueue *cq, bool *ok) { + void *tag; + if (!cq->Next(&tag, ok)) { + return nullptr; + } + auto *mrd = static_cast(tag); + GPR_ASSERT(mrd->in_flight_); + return mrd; + } + + void Request(grpc_server *server, CompletionQueue *cq) { + GPR_ASSERT(!in_flight_); + in_flight_ = true; + cq_ = grpc_completion_queue_create(); + GPR_ASSERT(GRPC_CALL_OK == + grpc_server_request_registered_call( + server, tag_, &call_, &deadline_, &request_metadata_, + has_request_payload_ ? &request_payload_ : nullptr, cq->cq(), + cq_, this)); + } + + void FinalizeResult(void *tag, bool *status) override {} + + class CallData { + public: + explicit CallData(MethodRequestData *mrd) + : cq_(mrd->cq_), + call_(mrd->call_, nullptr, &cq_), + ctx_(mrd->deadline_, mrd->request_metadata_.metadata, + mrd->request_metadata_.count), + has_request_payload_(mrd->has_request_payload_), + has_response_payload_(mrd->has_response_payload_), + request_payload_(mrd->request_payload_), + method_(mrd->method_) { + GPR_ASSERT(mrd->in_flight_); + mrd->in_flight_ = false; + mrd->request_metadata_.count = 0; + } + + void Run() { + std::unique_ptr req; + std::unique_ptr res; + if (has_request_payload_) { + req.reset(method_->AllocateRequestProto()); + if (!DeserializeProto(request_payload_, req.get())) { + abort(); // for now + } + } + if (has_response_payload_) { + req.reset(method_->AllocateResponseProto()); + } + auto status = method_->handler()->RunHandler( + MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); + CallOpBuffer buf; + buf.AddServerSendStatus(nullptr, status); + if (has_response_payload_) { + buf.AddSendMessage(*res); + } + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + } + + private: + CompletionQueue cq_; + Call call_; + ServerContext ctx_; + const bool has_request_payload_; + const bool has_response_payload_; + grpc_byte_buffer *request_payload_; + RpcServiceMethod *const method_; + }; + + private: + RpcServiceMethod *const method_; + void *const tag_; + bool in_flight_ = false; + const bool has_request_payload_; + const bool has_response_payload_; + grpc_call *call_; + gpr_timespec deadline_; + grpc_metadata_array request_metadata_; + grpc_byte_buffer *request_payload_; + grpc_completion_queue *cq_; +}; + bool Server::Start() { GPR_ASSERT(!started_); started_ = true; @@ -111,8 +213,8 @@ bool Server::Start() { // Start processing rpcs. if (cq_sync_) { - for (auto& m : methods_) { - m.Request(cq_sync_.get()); + for (auto &m : methods_) { + m.Request(server_, cq_sync_.get()); } ScheduleCallback(); @@ -146,14 +248,17 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. - auto* mrd = MethodRequestData::Wait(cq_sync_.get()); + bool ok; + auto *mrd = MethodRequestData::Wait(cq_sync_.get(), &ok); if (mrd) { MethodRequestData::CallData cd(mrd); - mrd->Request(cq_sync_.get()); - ScheduleCallback(); + if (ok) { + mrd->Request(server_, cq_sync_.get()); + ScheduleCallback(); - cd.Run(); + cd.Run(); + } } { diff --git a/src/cpp/server/server_context_impl.cc b/src/cpp/server/server_context.cc similarity index 97% rename from src/cpp/server/server_context_impl.cc rename to src/cpp/server/server_context.cc index 467cc80e055..0edadd87090 100644 --- a/src/cpp/server/server_context_impl.cc +++ b/src/cpp/server/server_context.cc @@ -31,6 +31,6 @@ * */ -#include "src/cpp/server/server_context_impl.h" +#include namespace grpc {} // namespace grpc diff --git a/src/cpp/server/server_context_impl.h b/src/cpp/server/server_context_impl.h deleted file mode 100644 index c6016b76357..00000000000 --- a/src/cpp/server/server_context_impl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2014, 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. - * - */ - -#ifndef __GRPCPP_INTERNAL_SERVER_SERVER_CONTEXT_IMPL_H_ -#define __GRPCPP_INTERNAL_SERVER_SERVER_CONTEXT_IMPL_H_ - -#include - -#include - -#include - -namespace grpc { - -class ServerContextImpl : public ServerContext { - public: - explicit ServerContextImpl(std::chrono::system_clock::time_point deadline) - : absolute_deadline_(deadline) {} - ~ServerContextImpl() {} - - std::chrono::system_clock::time_point absolute_deadline() const { - return absolute_deadline_; - } - - private: - std::chrono::system_clock::time_point absolute_deadline_; -}; - -} // namespace grpc - -#endif // __GRPCPP_INTERNAL_SERVER_SERVER_CONTEXT_IMPL_H_ From 04c8ff0245e9cd0372fdcc5e1d48388316c60185 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 11:01:07 -0800 Subject: [PATCH 045/232] Fix FinalizeResult signature --- include/grpc++/completion_queue.h | 2 +- include/grpc++/impl/call.h | 2 +- src/cpp/common/call.cc | 2 +- src/cpp/server/server.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 7f0677b4e5f..3e68cf37760 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -61,7 +61,7 @@ class CompletionQueueTag { // Called prior to returning from Next(), return value // is the status of the operation (return status is the default thing // to do) - virtual void FinalizeResult(void *tag, bool *status) = 0; + virtual void FinalizeResult(void **tag, bool *status) = 0; }; // grpc_completion_queue wrapper class diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index d5a865df05a..e8492e0e954 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -75,7 +75,7 @@ class CallOpBuffer final : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - void FinalizeResult(void *tag, bool *status) override; + void FinalizeResult(void **tag, bool *status) override; private: void *return_tag_ = nullptr; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 5a6656900ed..2b47eb74c3a 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -144,7 +144,7 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } } -void CallOpBuffer::FinalizeResult(void *tag, bool *status) { +void CallOpBuffer::FinalizeResult(void **tag, bool *status) { // Release send buffers if (write_buffer_) { grpc_byte_buffer_destroy(write_buffer_); diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 02fb383394a..6d014a55f36 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -142,7 +142,7 @@ class Server::MethodRequestData final : public CompletionQueueTag { cq_, this)); } - void FinalizeResult(void *tag, bool *status) override {} + void FinalizeResult(void **tag, bool *status) override {} class CallData { public: From eb8e7cd922a1c45fe581040a9138afa1f99f1404 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 11:43:40 -0800 Subject: [PATCH 046/232] Implement FinalizeResult --- include/grpc++/impl/call.h | 7 ++++-- src/core/surface/server.c | 7 ++++-- src/cpp/common/call.cc | 47 +++++++++++++++++++++++++++++--------- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index d5a865df05a..141b16ab5bf 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -75,14 +75,14 @@ class CallOpBuffer final : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - void FinalizeResult(void *tag, bool *status) override; + void FinalizeResult(void **tag, bool *status) override; private: void *return_tag_ = nullptr; size_t initial_metadata_count_ = 0; grpc_metadata* initial_metadata_ = nullptr; const google::protobuf::Message* send_message_ = nullptr; - grpc_byte_buffer* write_buffer_ = nullptr; + grpc_byte_buffer* send_message_buf_ = nullptr; google::protobuf::Message* recv_message_ = nullptr; grpc_byte_buffer* recv_message_buf_ = nullptr; bool client_send_close_ = false; @@ -90,6 +90,9 @@ class CallOpBuffer final : public CompletionQueueTag { grpc_status_code status_code_ = GRPC_STATUS_OK; char* status_details_ = nullptr; size_t status_details_capacity_ = 0; + Status* send_status_ = nullptr; + size_t trailing_metadata_count_ = 0; + grpc_metadata* trailing_metadata_ = nullptr; }; class CCallDeleter { diff --git a/src/core/surface/server.c b/src/core/surface/server.c index b28a52bcbdd..93994e6bdda 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -819,7 +819,7 @@ void grpc_server_add_listener(grpc_server *server, void *arg, static grpc_call_error queue_call_request(grpc_server *server, requested_call *rc) { - call_data *calld; + call_data *calld = NULL; gpr_mu_lock(&server->mu); if (server->shutdown) { gpr_mu_unlock(&server->mu); @@ -896,6 +896,9 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag); static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag); +static void publish_was_not_set(grpc_call *call, grpc_op_error status, void *tag) { + abort(); +} static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) { gpr_slice slice = value->slice; @@ -910,7 +913,7 @@ static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) { static void begin_call(grpc_server *server, call_data *calld, requested_call *rc) { - grpc_ioreq_completion_func publish; + grpc_ioreq_completion_func publish = publish_was_not_set; grpc_ioreq req[2]; grpc_ioreq *r = req; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 5a6656900ed..59630a82dac 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -46,9 +46,9 @@ void CallOpBuffer::Reset(void* next_return_tag) { gpr_free(initial_metadata_); } send_message_ = nullptr; - if (write_buffer_) { - grpc_byte_buffer_destroy(write_buffer_); - write_buffer_ = nullptr; + if (send_message_buf_) { + grpc_byte_buffer_destroy(send_message_buf_); + send_message_buf_ = nullptr; } recv_message_ = nullptr; if (recv_message_buf_) { @@ -107,6 +107,10 @@ void CallOpBuffer::AddClientRecvStatus(Status *status) { recv_status_ = status; } +void CallOpBuffer::AddServerSendStatus(std::multimap* metadata, + const Status& status) { + +} void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { *nops = 0; @@ -117,12 +121,12 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { (*nops)++; } if (send_message_) { - bool success = SerializeProto(*send_message_, &write_buffer_); + bool success = SerializeProto(*send_message_, &send_message_buf_); if (!success) { // TODO handle parse failure } ops[*nops].op = GRPC_OP_SEND_MESSAGE; - ops[*nops].data.send_message = write_buffer_; + ops[*nops].data.send_message = send_message_buf_; (*nops)++; } if (recv_message_) { @@ -136,7 +140,7 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } if (recv_status_) { ops[*nops].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - // ops[*nops].data.recv_status_on_client.trailing_metadata = + // TODO ops[*nops].data.recv_status_on_client.trailing_metadata = ops[*nops].data.recv_status_on_client.status = &status_code_; ops[*nops].data.recv_status_on_client.status_details = &status_details_; ops[*nops].data.recv_status_on_client.status_details_capacity = &status_details_capacity_; @@ -144,11 +148,32 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } } -void CallOpBuffer::FinalizeResult(void *tag, bool *status) { - // Release send buffers - if (write_buffer_) { - grpc_byte_buffer_destroy(write_buffer_); - write_buffer_ = nullptr; +void CallOpBuffer::FinalizeResult(void **tag, bool *status) { + // Release send buffers. + if (send_message_buf_) { + grpc_byte_buffer_destroy(send_message_buf_); + send_message_buf_ = nullptr; + } + if (initial_metadata_) { + gpr_free(initial_metadata_); + initial_metadata_ = nullptr; + } + // Set user-facing tag. + *tag = return_tag_; + // Parse received message if any. + if (recv_message_ && recv_message_buf_) { + *status = DeserializeProto(recv_message_buf_, recv_message_); + grpc_byte_buffer_destroy(recv_message_buf_); + recv_message_buf_ = nullptr; + } + // Parse received status. + if (recv_status_) { + if (status_details_) { + *recv_status_ = Status(static_cast(status_code_), + grpc::string(status_details_, status_details_capacity_)); + } else { + *recv_status_ = Status(static_cast(status_code_)); + } } } From 854a30c73a2ae7123e62291ec91666c29aa1c50d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 11:44:10 -0800 Subject: [PATCH 047/232] More implementation --- include/grpc++/server_context.h | 13 +++++++++---- src/cpp/common/completion_queue.cc | 2 ++ src/cpp/server/server_context.cc | 14 +++++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a58e63aff24..790dd7116b4 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -35,7 +35,7 @@ #define __GRPCPP_SERVER_CONTEXT_H_ #include -#include +#include #include "config.h" @@ -44,16 +44,21 @@ struct gpr_timespec; namespace grpc { +class Server; + // Interface of server side rpc context. class ServerContext { public: - ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); virtual ~ServerContext() {} - std::chrono::system_clock::time_point absolute_deadline(); + std::chrono::system_clock::time_point absolute_deadline() { return deadline_; } private: - std::vector > metadata_; + friend class ::grpc::Server; + ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); + + const std::chrono::system_clock::time_point deadline_; + std::multimap metadata_; }; } // namespace grpc diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index cbeda81a0bc..f69ddc3b7e0 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -43,6 +43,8 @@ namespace grpc { CompletionQueue::CompletionQueue() { cq_ = grpc_completion_queue_create(); } +CompletionQueue::CompletionQueue(grpc_completion_queue *take) : cq_(take) {} + CompletionQueue::~CompletionQueue() { grpc_completion_queue_destroy(cq_); } void CompletionQueue::Shutdown() { grpc_completion_queue_shutdown(cq_); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 0edadd87090..7e0bc4de36a 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -32,5 +32,17 @@ */ #include +#include +#include "src/cpp/util/time.h" -namespace grpc {} // namespace grpc +namespace grpc { + +ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count) + : deadline_(Timespec2Timepoint(deadline)) { + for (size_t i = 0; i < metadata_count; i++) { + metadata_.insert(std::make_pair(grpc::string(metadata[i].key), + grpc::string(metadata[i].value, metadata[i].value + metadata[i].value_length))); + } +} + +} // namespace grpc From a7c49ab077afc602873ee72ae431211a53e1c88d Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 11:49:33 -0800 Subject: [PATCH 048/232] minor improvement --- src/cpp/common/call.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 59630a82dac..b2cd55fe245 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -168,12 +168,10 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { } // Parse received status. if (recv_status_) { - if (status_details_) { - *recv_status_ = Status(static_cast(status_code_), - grpc::string(status_details_, status_details_capacity_)); - } else { - *recv_status_ = Status(static_cast(status_code_)); - } + *recv_status_ = Status( + static_cast(status_code_), + status_details_ ? grpc::string(status_details_, status_details_capacity_) + : grpc::string()); } } From 3b29b566a260c66173f235425a84c316d49bb2cc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 12:58:46 -0800 Subject: [PATCH 049/232] Just use one completion queue per server for delivering completions This simplifies (drastically) the polling story, although will slightly complicate mixing sync & async servers - but we're not there yet. --- include/grpc++/server.h | 3 +- include/grpc/grpc.h | 2 -- src/core/surface/server.c | 71 +++++++++++++++++++++------------------ src/cpp/server/server.cc | 19 +++++------ 4 files changed, 48 insertions(+), 47 deletions(-) diff --git a/include/grpc++/server.h b/include/grpc++/server.h index b02c4130d9c..daa3f0a6617 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -87,8 +87,7 @@ class Server { void ScheduleCallback(); // Completion queue. - std::unique_ptr cq_sync_; - std::unique_ptr cq_async_; + CompletionQueue cq_; // Sever status std::mutex mu_; diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 7733f8bb2ae..561bc9a5a95 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -553,7 +553,6 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, grpc_call_error grpc_server_request_call( grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, - grpc_completion_queue *cq_when_rpc_available, grpc_completion_queue *cq_bound_to_call, void *tag_new); @@ -564,7 +563,6 @@ grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, - grpc_completion_queue *cq_when_rpc_available, grpc_completion_queue *cq_bound_to_call, void *tag_new); /* Create a server */ diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 93994e6bdda..c5f49a091ec 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -74,14 +74,12 @@ typedef struct { void *tag; union { struct { - grpc_completion_queue *cq_new; grpc_completion_queue *cq_bind; grpc_call **call; grpc_call_details *details; grpc_metadata_array *initial_metadata; } batch; struct { - grpc_completion_queue *cq_new; grpc_completion_queue *cq_bind; grpc_call **call; registered_method *registered_method; @@ -174,8 +172,6 @@ struct call_data { call_data **root[CALL_LIST_COUNT]; call_link links[CALL_LIST_COUNT]; - - grpc_completion_queue *cq_new; }; #define SERVER_FROM_CALL_ELEM(elem) \ @@ -187,8 +183,7 @@ static void begin_call(grpc_server *server, call_data *calld, requested_call *rc); static void fail_call(grpc_server *server, requested_call *rc); -static int call_list_join(call_data **root, call_data *call, - call_list list) { +static int call_list_join(call_data **root, call_data *call, call_list list) { GPR_ASSERT(!call->root[list]); call->root[list] = root; if (!*root) { @@ -290,7 +285,10 @@ static void destroy_channel(channel_data *chand) { grpc_iomgr_add_callback(finish_destroy_channel, chand); } -static void finish_start_new_rpc_and_unlock(grpc_server *server, grpc_call_element *elem, call_data **pending_root, requested_call_array *array) { +static void finish_start_new_rpc_and_unlock(grpc_server *server, + grpc_call_element *elem, + call_data **pending_root, + requested_call_array *array) { requested_call rc; call_data *calld = elem->call_data; if (array->count == 0) { @@ -318,25 +316,32 @@ static void start_new_rpc(grpc_call_element *elem) { /* check for an exact match with host */ hash = GRPC_MDSTR_KV_HASH(calld->host->hash, calld->path->hash); for (i = 0; i < chand->registered_method_max_probes; i++) { - rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; + rm = &chand->registered_methods[(hash + i) % + chand->registered_method_slots]; if (!rm) break; if (rm->host != calld->host) continue; if (rm->method != calld->path) continue; - finish_start_new_rpc_and_unlock(server, elem, &rm->server_registered_method->pending, &rm->server_registered_method->requested); + finish_start_new_rpc_and_unlock(server, elem, + &rm->server_registered_method->pending, + &rm->server_registered_method->requested); return; } /* check for a wildcard method definition (no host set) */ hash = GRPC_MDSTR_KV_HASH(0, calld->path->hash); for (i = 0; i < chand->registered_method_max_probes; i++) { - rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; + rm = &chand->registered_methods[(hash + i) % + chand->registered_method_slots]; if (!rm) break; if (rm->host != NULL) continue; if (rm->method != calld->path) continue; - finish_start_new_rpc_and_unlock(server, elem, &rm->server_registered_method->pending, &rm->server_registered_method->requested); + finish_start_new_rpc_and_unlock(server, elem, + &rm->server_registered_method->pending, + &rm->server_registered_method->requested); return; } } - finish_start_new_rpc_and_unlock(server, elem, &server->lists[PENDING_START], &server->requested_calls); + finish_start_new_rpc_and_unlock(server, elem, &server->lists[PENDING_START], + &server->requested_calls); } static void kill_zombie(void *elem, int success) { @@ -684,7 +689,10 @@ grpc_transport_setup_result grpc_server_setup_transport( host = rm->host ? grpc_mdstr_from_string(mdctx, rm->host) : NULL; method = grpc_mdstr_from_string(mdctx, rm->host); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); - for (probes = 0; chand->registered_methods[(hash + probes) % slots].server_registered_method != NULL; probes++); + for (probes = 0; chand->registered_methods[(hash + probes) % slots] + .server_registered_method != NULL; + probes++) + ; if (probes > max_probes) max_probes = probes; crm = &chand->registered_methods[(hash + probes) % slots]; crm->server_registered_method = rm; @@ -829,10 +837,12 @@ static grpc_call_error queue_call_request(grpc_server *server, switch (rc->type) { case LEGACY_CALL: case BATCH_CALL: - calld = call_list_remove_head(&server->lists[PENDING_START], PENDING_START); + calld = + call_list_remove_head(&server->lists[PENDING_START], PENDING_START); break; case REGISTERED_CALL: - calld = call_list_remove_head(&rc->data.registered.registered_method->pending, PENDING_START); + calld = call_list_remove_head( + &rc->data.registered.registered_method->pending, PENDING_START); break; } if (calld) { @@ -851,13 +861,12 @@ static grpc_call_error queue_call_request(grpc_server *server, grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *initial_metadata, - grpc_completion_queue *cq_new, - grpc_completion_queue *cq_bind, void *tag) { + grpc_completion_queue *cq_bind, + void *tag) { requested_call rc; - grpc_cq_begin_op(cq_new, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); rc.type = BATCH_CALL; rc.tag = tag; - rc.data.batch.cq_new = cq_new; rc.data.batch.cq_bind = cq_bind; rc.data.batch.call = call; rc.data.batch.details = details; @@ -868,13 +877,12 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_new, grpc_completion_queue *cq_bind, + grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bind, void *tag) { requested_call rc; - grpc_cq_begin_op(cq_new, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); rc.type = REGISTERED_CALL; rc.tag = tag; - rc.data.registered.cq_new = cq_new; rc.data.registered.cq_bind = cq_bind; rc.data.registered.call = call; rc.data.registered.registered_method = registered_method; @@ -896,7 +904,8 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag); static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag); -static void publish_was_not_set(grpc_call *call, grpc_op_error status, void *tag) { +static void publish_was_not_set(grpc_call *call, grpc_op_error status, + void *tag) { abort(); } @@ -942,7 +951,6 @@ static void begin_call(grpc_server *server, call_data *calld, r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; r->data.recv_metadata = rc->data.batch.initial_metadata; r++; - calld->cq_new = rc->data.batch.cq_new; publish = publish_registered_or_batch; break; case REGISTERED_CALL: @@ -957,7 +965,6 @@ static void begin_call(grpc_server *server, call_data *calld, r->data.recv_message = rc->data.registered.optional_payload; r++; } - calld->cq_new = rc->data.registered.cq_new; publish = publish_registered_or_batch; break; } @@ -976,14 +983,14 @@ static void fail_call(grpc_server *server, requested_call *rc) { case BATCH_CALL: *rc->data.batch.call = NULL; rc->data.batch.initial_metadata->count = 0; - grpc_cq_end_op_complete(rc->data.batch.cq_new, rc->tag, NULL, do_nothing, - NULL, GRPC_OP_ERROR); + grpc_cq_end_op_complete(server->cq, rc->tag, NULL, do_nothing, NULL, + GRPC_OP_ERROR); break; case REGISTERED_CALL: *rc->data.registered.call = NULL; rc->data.registered.initial_metadata->count = 0; - grpc_cq_end_op_complete(rc->data.registered.cq_new, rc->tag, NULL, do_nothing, - NULL, GRPC_OP_ERROR); + grpc_cq_end_op_complete(server->cq, rc->tag, NULL, do_nothing, NULL, + GRPC_OP_ERROR); break; } } @@ -1011,9 +1018,9 @@ static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag) { grpc_call_element *elem = grpc_call_stack_element(grpc_call_get_call_stack(call), 0); - call_data *calld = elem->call_data; - grpc_cq_end_op_complete(calld->cq_new, tag, call, - do_nothing, NULL, status); + channel_data *chand = elem->channel_data; + grpc_server *server = chand->server; + grpc_cq_end_op_complete(server->cq, tag, call, do_nothing, NULL, status); } const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 6d014a55f36..5f59a382c56 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -56,9 +56,9 @@ Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, thread_pool_owned_(thread_pool_owned), secure_(creds != nullptr) { if (creds) { - server_ = grpc_secure_server_create(creds->GetRawCreds(), nullptr, nullptr); + server_ = grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); } else { - server_ = grpc_server_create(nullptr, nullptr); + server_ = grpc_server_create(cq_.cq(), nullptr); } } @@ -82,9 +82,6 @@ Server::~Server() { } bool Server::RegisterService(RpcService *service) { - if (!cq_sync_) { - cq_sync_.reset(new CompletionQueue); - } for (int i = 0; i < service->GetMethodCount(); ++i) { RpcServiceMethod *method = service->GetMethod(i); void *tag = grpc_server_register_method(server_, method->name(), nullptr); @@ -131,14 +128,14 @@ class Server::MethodRequestData final : public CompletionQueueTag { return mrd; } - void Request(grpc_server *server, CompletionQueue *cq) { + void Request(grpc_server *server) { GPR_ASSERT(!in_flight_); in_flight_ = true; cq_ = grpc_completion_queue_create(); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_registered_call( server, tag_, &call_, &deadline_, &request_metadata_, - has_request_payload_ ? &request_payload_ : nullptr, cq->cq(), + has_request_payload_ ? &request_payload_ : nullptr, cq_, this)); } @@ -212,9 +209,9 @@ bool Server::Start() { grpc_server_start(server_); // Start processing rpcs. - if (cq_sync_) { + if (!methods_.empty()) { for (auto &m : methods_) { - m.Request(server_, cq_sync_.get()); + m.Request(server_); } ScheduleCallback(); @@ -249,12 +246,12 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; - auto *mrd = MethodRequestData::Wait(cq_sync_.get(), &ok); + auto *mrd = MethodRequestData::Wait(&cq_, &ok); if (mrd) { MethodRequestData::CallData cd(mrd); if (ok) { - mrd->Request(server_, cq_sync_.get()); + mrd->Request(server_); ScheduleCallback(); cd.Run(); From a5c0e7bc46721e73ab562d90ca37736ea69b8e90 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 13:14:49 -0800 Subject: [PATCH 050/232] Initial metadata fix --- include/grpc++/client_context.h | 7 +++++-- include/grpc++/impl/call.h | 23 +++++++++++++---------- src/cpp/client/client_context.cc | 2 +- src/cpp/client/client_unary_call.cc | 1 + src/cpp/common/call.cc | 19 ++++++++++++------- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 0cf6bdc647e..a6e8ccc67c4 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -35,8 +35,8 @@ #define __GRPCPP_CLIENT_CONTEXT_H__ #include +#include #include -#include #include #include @@ -49,6 +49,8 @@ struct grpc_completion_queue; namespace grpc { +class CallOpBuffer; + class ClientContext { public: ClientContext(); @@ -67,6 +69,7 @@ class ClientContext { ClientContext(const ClientContext &); ClientContext &operator=(const ClientContext &); + friend class CallOpBuffer; friend class Channel; friend class StreamContext; @@ -84,7 +87,7 @@ class ClientContext { grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; - std::vector > metadata_; + std::multimap metadata_; }; } // namespace grpc diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 141b16ab5bf..d0cb9024ba6 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -63,11 +63,13 @@ class CallOpBuffer final : public CompletionQueueTag { // Does not take ownership. void AddSendInitialMetadata( std::multimap *metadata); + void AddSendInitialMetadata(ClientContext *ctx); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(Status *status); - void AddServerSendStatus(std::multimap *metadata, const Status& status); + void AddServerSendStatus(std::multimap *metadata, + const Status &status); // INTERNAL API: @@ -79,20 +81,21 @@ class CallOpBuffer final : public CompletionQueueTag { private: void *return_tag_ = nullptr; + bool send_initial_metadata_ = false; size_t initial_metadata_count_ = 0; - grpc_metadata* initial_metadata_ = nullptr; - const google::protobuf::Message* send_message_ = nullptr; - grpc_byte_buffer* send_message_buf_ = nullptr; - google::protobuf::Message* recv_message_ = nullptr; - grpc_byte_buffer* recv_message_buf_ = nullptr; + grpc_metadata *initial_metadata_ = nullptr; + const google::protobuf::Message *send_message_ = nullptr; + grpc_byte_buffer *send_message_buf_ = nullptr; + google::protobuf::Message *recv_message_ = nullptr; + grpc_byte_buffer *recv_message_buf_ = nullptr; bool client_send_close_ = false; - Status* recv_status_ = nullptr; + Status *recv_status_ = nullptr; grpc_status_code status_code_ = GRPC_STATUS_OK; - char* status_details_ = nullptr; + char *status_details_ = nullptr; size_t status_details_capacity_ = 0; - Status* send_status_ = nullptr; + Status *send_status_ = nullptr; size_t trailing_metadata_count_ = 0; - grpc_metadata* trailing_metadata_ = nullptr; + grpc_metadata *trailing_metadata_ = nullptr; }; class CCallDeleter { diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 7bda2d07c31..5c2772f5dfb 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -72,7 +72,7 @@ system_clock::time_point ClientContext::absolute_deadline() { void ClientContext::AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value) { - return; + metadata_.insert(std::make_pair(meta_key, meta_value)); } void ClientContext::StartCancel() {} diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 85985920685..73be3cff8c1 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -48,6 +48,7 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, Call call(channel->CreateCall(method, context, &cq)); CallOpBuffer buf; Status status; + buf.AddSendInitialMetadata(context); buf.AddSendMessage(request); buf.AddRecvMessage(result); buf.AddClientSendClose(); diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index b2cd55fe245..f97240d067c 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -31,9 +31,10 @@ * */ -#include -#include -#include +#include +#include +#include +#include #include "src/cpp/proto/proto_utils.h" @@ -41,10 +42,9 @@ namespace grpc { void CallOpBuffer::Reset(void* next_return_tag) { return_tag_ = next_return_tag; + send_initial_metadata_ = false; initial_metadata_count_ = 0; - if (initial_metadata_) { - gpr_free(initial_metadata_); - } + gpr_free(initial_metadata_); send_message_ = nullptr; if (send_message_buf_) { grpc_byte_buffer_destroy(send_message_buf_); @@ -87,10 +87,15 @@ grpc_metadata* FillMetadata( void CallOpBuffer::AddSendInitialMetadata( std::multimap* metadata) { + send_initial_metadata_ = true; initial_metadata_count_ = metadata->size(); initial_metadata_ = FillMetadata(metadata); } +void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { + AddSendInitialMetadata(&ctx->metadata_); +} + void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { send_message_ = &message; } @@ -114,7 +119,7 @@ void CallOpBuffer::AddServerSendStatus(std::multimap void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { *nops = 0; - if (initial_metadata_count_) { + if (send_initial_metadata_) { ops[*nops].op = GRPC_OP_SEND_INITIAL_METADATA; ops[*nops].data.send_initial_metadata.count = initial_metadata_count_; ops[*nops].data.send_initial_metadata.metadata = initial_metadata_; From e76c96658b971c03b91d967138b61d0db333422c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 13:18:31 -0800 Subject: [PATCH 051/232] Fix typo causing crash --- src/core/surface/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index c5f49a091ec..3f1c2add55e 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -687,7 +687,7 @@ grpc_transport_setup_result grpc_server_setup_transport( memset(chand->registered_methods, 0, alloc); for (rm = s->registered_methods; rm; rm = rm->next) { host = rm->host ? grpc_mdstr_from_string(mdctx, rm->host) : NULL; - method = grpc_mdstr_from_string(mdctx, rm->host); + method = grpc_mdstr_from_string(mdctx, rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] .server_registered_method != NULL; From 7c2f3f7af1ebf6ca88780271e0d6f0f8147c3a33 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 13:21:54 -0800 Subject: [PATCH 052/232] Fix typo causing crash --- src/cpp/server/server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 5f59a382c56..049c3e36b26 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -167,7 +167,7 @@ class Server::MethodRequestData final : public CompletionQueueTag { } } if (has_response_payload_) { - req.reset(method_->AllocateResponseProto()); + res.reset(method_->AllocateResponseProto()); } auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); From bb5227fc39fb44ae27d33d934470acd81f2ae57f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 13:34:48 -0800 Subject: [PATCH 053/232] Allow server to hook calls also, fix crash --- include/grpc++/channel_interface.h | 4 ++-- include/grpc++/impl/call.h | 13 ++++++++++--- include/grpc++/server.h | 8 ++++++-- src/cpp/common/call.cc | 6 +++--- src/cpp/server/server.cc | 16 +++++++++++++--- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 3631ea4d5d3..b0366faabb9 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -35,6 +35,7 @@ #define __GRPCPP_CHANNEL_INTERFACE_H__ #include +#include namespace google { namespace protobuf { @@ -52,13 +53,12 @@ class CompletionQueue; class RpcMethod; class CallInterface; -class ChannelInterface { +class ChannelInterface : public CallHook { public: virtual ~ChannelInterface() {} virtual Call CreateCall(const RpcMethod &method, ClientContext *context, CompletionQueue *cq) = 0; - virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; }; } // namespace grpc diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index d0cb9024ba6..bc1a3d847d2 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -52,7 +52,7 @@ struct grpc_op; namespace grpc { -class ChannelInterface; +class Call; class CallOpBuffer final : public CompletionQueueTag { public: @@ -103,10 +103,17 @@ class CCallDeleter { void operator()(grpc_call *c); }; +// Channel and Server implement this to allow them to hook performing ops +class CallHook { + public: + virtual ~CallHook() {} + virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) = 0; +}; + // Straightforward wrapping of the C call object class Call final { public: - Call(grpc_call *call, ChannelInterface *channel, CompletionQueue *cq); + Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq); void PerformOps(CallOpBuffer *buffer); @@ -114,7 +121,7 @@ class Call final { CompletionQueue *cq() { return cq_; } private: - ChannelInterface *channel_; + CallHook *call_hook_; CompletionQueue *cq_; std::unique_ptr call_; }; diff --git a/include/grpc++/server.h b/include/grpc++/server.h index daa3f0a6617..98f3f171975 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -41,6 +41,7 @@ #include #include +#include #include struct grpc_server; @@ -59,7 +60,7 @@ class ServerCredentials; class ThreadPoolInterface; // Currently it only supports handling rpcs in a single thread. -class Server { +class Server final : private CallHook { public: ~Server(); @@ -72,7 +73,8 @@ class Server { class MethodRequestData; // ServerBuilder use only - Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, ServerCredentials* creds); + Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, + ServerCredentials* creds); Server(); // Register a service. This call does not take ownership of the service. // The service must exist for the lifetime of the Server instance. @@ -86,6 +88,8 @@ class Server { void RunRpc(); void ScheduleCallback(); + void PerformOpsOnCall(CallOpBuffer* ops, Call* call) override; + // Completion queue. CompletionQueue cq_; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index f97240d067c..4d465e0a6f4 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -184,11 +184,11 @@ void CCallDeleter::operator()(grpc_call* c) { grpc_call_destroy(c); } -Call::Call(grpc_call* call, ChannelInterface* channel, CompletionQueue* cq) - : channel_(channel), cq_(cq), call_(call) {} +Call::Call(grpc_call* call, CallHook *call_hook, CompletionQueue* cq) + : call_hook_(call_hook), cq_(cq), call_(call) {} void Call::PerformOps(CallOpBuffer* buffer) { - channel_->PerformOpsOnCall(buffer, this); + call_hook_->PerformOpsOnCall(buffer, this); } } // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 049c3e36b26..8974850b8ce 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -143,9 +143,9 @@ class Server::MethodRequestData final : public CompletionQueueTag { class CallData { public: - explicit CallData(MethodRequestData *mrd) + explicit CallData(Server *server, MethodRequestData *mrd) : cq_(mrd->cq_), - call_(mrd->call_, nullptr, &cq_), + call_(mrd->call_, server, &cq_), ctx_(mrd->deadline_, mrd->request_metadata_.metadata, mrd->request_metadata_.count), has_request_payload_(mrd->has_request_payload_), @@ -235,6 +235,16 @@ void Server::Shutdown() { } } +void Server::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { + static const size_t MAX_OPS = 8; + size_t nops = MAX_OPS; + grpc_op ops[MAX_OPS]; + buf->FillOps(ops, &nops); + GPR_ASSERT(GRPC_CALL_OK == + grpc_call_start_batch(call->call(), ops, nops, + buf)); +} + void Server::ScheduleCallback() { { std::unique_lock lock(mu_); @@ -248,7 +258,7 @@ void Server::RunRpc() { bool ok; auto *mrd = MethodRequestData::Wait(&cq_, &ok); if (mrd) { - MethodRequestData::CallData cd(mrd); + MethodRequestData::CallData cd(this, mrd); if (ok) { mrd->Request(server_); From f1258c4951f9880e6943558c310da9c5629ea6de Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 13:44:11 -0800 Subject: [PATCH 054/232] save before the change --- include/grpc++/impl/call.h | 19 +++++++- src/cpp/common/call.cc | 89 ++++++++++++++++++++++++++++++++------ 2 files changed, 92 insertions(+), 16 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 141b16ab5bf..40939e458fa 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -63,11 +63,15 @@ class CallOpBuffer final : public CompletionQueueTag { // Does not take ownership. void AddSendInitialMetadata( std::multimap *metadata); + void AddRecvInitialMetadata( + std::multimap *metadata); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); - void AddClientRecvStatus(Status *status); - void AddServerSendStatus(std::multimap *metadata, const Status& status); + void AddClientRecvStatus(std::multimap *metadata, + Status *status); + void AddServerSendStatus(std::multimap *metadata, + const Status& status); // INTERNAL API: @@ -79,17 +83,28 @@ class CallOpBuffer final : public CompletionQueueTag { private: void *return_tag_ = nullptr; + // Send initial metadata size_t initial_metadata_count_ = 0; grpc_metadata* initial_metadata_ = nullptr; + // Recv initial metadta + std::multimap* recv_initial_metadata_ = nullptr; + grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr}; + // Send message const google::protobuf::Message* send_message_ = nullptr; grpc_byte_buffer* send_message_buf_ = nullptr; + // Recv message google::protobuf::Message* recv_message_ = nullptr; grpc_byte_buffer* recv_message_buf_ = nullptr; + // Client send close bool client_send_close_ = false; + // Client recv status + std::multimap* recv_trailing_metadata_ = nullptr; Status* recv_status_ = nullptr; + grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr}; grpc_status_code status_code_ = GRPC_STATUS_OK; char* status_details_ = nullptr; size_t status_details_capacity_ = 0; + // Server send status Status* send_status_ = nullptr; size_t trailing_metadata_count_ = 0; grpc_metadata* trailing_metadata_ = nullptr; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index b2cd55fe245..22fad2f4398 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -41,34 +41,47 @@ namespace grpc { void CallOpBuffer::Reset(void* next_return_tag) { return_tag_ = next_return_tag; + initial_metadata_count_ = 0; - if (initial_metadata_) { - gpr_free(initial_metadata_); - } + gpr_free(initial_metadata_); + + recv_initial_metadata_ = nullptr; + gpr_free(recv_initial_metadata_arr_.metadata); + recv_initial_metadata_arr_ = {0, 0, nullptr}; + send_message_ = nullptr; if (send_message_buf_) { grpc_byte_buffer_destroy(send_message_buf_); send_message_buf_ = nullptr; } + recv_message_ = nullptr; if (recv_message_buf_) { grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } + client_send_close_ = false; + + recv_trailing_metadata_ = nullptr; recv_status_ = nullptr; + gpr_free(recv_trailing_metadata_arr_.metadata); + recv_trailing_metadata_arr_ = {0, 0, nullptr}; + status_code_ = GRPC_STATUS_OK; - if (status_details_) { - gpr_free(status_details_); - status_details_ = nullptr; - } + gpr_free(status_details_); + status_details_ = nullptr; status_details_capacity_ = 0; + + send_status_ = nullptr; + trailing_metadata_count_ = 0; + trailing_metadata_ = nullptr; } namespace { // TODO(yangg) if the map is changed before we send, the pointers will be a // mess. Make sure it does not happen. -grpc_metadata* FillMetadata( +grpc_metadata* FillMetadataArray( std::multimap* metadata) { if (metadata->empty()) { return nullptr; } grpc_metadata* metadata_array = (grpc_metadata*)gpr_malloc( @@ -83,6 +96,17 @@ grpc_metadata* FillMetadata( } 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, {arr->metadata[i].value, arr->metadata[i].value_length})); + } + grpc_metadata_array_destroy(arr); + grpc_metadata_array_init(&recv_trailing_metadata_arr_); +} } // namespace void CallOpBuffer::AddSendInitialMetadata( @@ -91,6 +115,11 @@ void CallOpBuffer::AddSendInitialMetadata( initial_metadata_ = FillMetadata(metadata); } +void CallOpBuffer::AddRecvInitialMetadata( + std::multimap* metadata) { + recv_initial_metadata_ = metadata; +} + void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { send_message_ = &message; } @@ -103,13 +132,17 @@ void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } -void CallOpBuffer::AddClientRecvStatus(Status *status) { +void CallOpBuffer::AddClientRecvStatus( + std::multimap* metadata, Status *status) { + recv_trailing_metadata_ = metadata; recv_status_ = status; } -void CallOpBuffer::AddServerSendStatus(std::multimap* metadata, - const Status& status) { - +void CallOpBuffer::AddServerSendStatus( + std::multimap* metadata, const Status& status) { + trailing_metadata_count_ = metadata->size(); + trailing_metadata_ = FillMetadata(metadata); + send_status_ = &status; } void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { @@ -120,6 +153,11 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { ops[*nops].data.send_initial_metadata.metadata = initial_metadata_; (*nops)++; } + if (recv_initial_metadata_) { + ops[*nops].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[*nops].data.recv_initial_metadata = &recv_initial_metadata_arr_; + (*nops)++; + } if (send_message_) { bool success = SerializeProto(*send_message_, &send_message_buf_); if (!success) { @@ -140,10 +178,24 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } if (recv_status_) { ops[*nops].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - // TODO ops[*nops].data.recv_status_on_client.trailing_metadata = + ops[*nops].data.recv_status_on_client.trailing_metadata = + &recv_trailing_metadata_arr_; ops[*nops].data.recv_status_on_client.status = &status_code_; ops[*nops].data.recv_status_on_client.status_details = &status_details_; - ops[*nops].data.recv_status_on_client.status_details_capacity = &status_details_capacity_; + ops[*nops].data.recv_status_on_client.status_details_capacity = + &status_details_capacity_; + (*nops)++; + } + if (send_status_) { + ops[*nops].op = GRPC_OP_SEND_STATUS_FROM_SERVER; + ops[*nops].data.send_status_from_server.trailing_metadata_count = + trailing_metadata_count_; + ops[*nops].data.send_status_from_server.trailing_metadata = + trailing_metadata_; + ops[*nops].data.send_status_from_server.status = + static_cast(send_status_->code()); + ops[*nops].data.send_status_from_server.status_details = + send_status_->details().c_str(); (*nops)++; } } @@ -158,8 +210,16 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { gpr_free(initial_metadata_); initial_metadata_ = nullptr; } + if (trailing_metadata_count_) { + gpr_free(trailing_metadata_); + trailing_metadata_ = nullptr; + } // Set user-facing tag. *tag = return_tag_; + // Process received initial metadata + if (recv_initial_metadata_) { + FillMetadataMap(&recv_initial_metadata_, recv_initial_metadata_); + } // Parse received message if any. if (recv_message_ && recv_message_buf_) { *status = DeserializeProto(recv_message_buf_, recv_message_); @@ -168,6 +228,7 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { } // Parse received status. if (recv_status_) { + FillMetadataMap(&recv_trailing_metadata_arr_, recv_trailing_metadata_); *recv_status_ = Status( static_cast(status_code_), status_details_ ? grpc::string(status_details_, status_details_capacity_) From 23822932262c5a3eb9404be59d5512fe4c88f18d Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 13:59:25 -0800 Subject: [PATCH 055/232] Make it compile --- include/grpc++/impl/call.h | 3 ++- include/grpc++/stream.h | 12 ++++++------ src/cpp/client/client_unary_call.cc | 2 +- src/cpp/common/call.cc | 9 +++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 8fed305ac64..5922e2581a9 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -85,6 +85,7 @@ class CallOpBuffer final : public CompletionQueueTag { private: void *return_tag_ = nullptr; // Send initial metadata + bool send_initial_metadata_ = false; size_t initial_metadata_count_ = 0; grpc_metadata* initial_metadata_ = nullptr; // Recv initial metadta @@ -106,7 +107,7 @@ class CallOpBuffer final : public CompletionQueueTag { char *status_details_ = nullptr; size_t status_details_capacity_ = 0; // Server send status - Status* send_status_ = nullptr; + const Status* send_status_ = nullptr; size_t trailing_metadata_count_ = 0; grpc_metadata *trailing_metadata_ = nullptr; }; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 57ca86ad706..85a7261fb92 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -105,7 +105,7 @@ class ClientReader final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(&status); + buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; @@ -146,7 +146,7 @@ class ClientWriter final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddRecvMessage(response_); - buf.AddClientRecvStatus(&status); + buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; @@ -193,7 +193,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(&status); + buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; @@ -312,7 +312,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, virtual void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); - finish_buf_.AddClientRecvStatus(status); + finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata call_.PerformOps(&finish_buf_); } @@ -350,7 +350,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, virtual void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); finish_buf_.AddRecvMessage(response_); - finish_buf_.AddClientRecvStatus(status); + finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata call_.PerformOps(&finish_buf_); } @@ -393,7 +393,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, virtual void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); - finish_buf_.AddClientRecvStatus(status); + finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata call_.PerformOps(&finish_buf_); } diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 73be3cff8c1..68253986124 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -52,7 +52,7 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf.AddSendMessage(request); buf.AddRecvMessage(result); buf.AddClientSendClose(); - buf.AddClientRecvStatus(&status); + buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call.PerformOps(&buf); cq.Pluck(&buf); return status; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 607958df89f..765baa06cae 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -43,6 +43,7 @@ namespace grpc { void CallOpBuffer::Reset(void* next_return_tag) { return_tag_ = next_return_tag; + send_initial_metadata_ = false; initial_metadata_count_ = 0; gpr_free(initial_metadata_); @@ -106,7 +107,7 @@ void FillMetadataMap(grpc_metadata_array* arr, arr->metadata[i].key, {arr->metadata[i].value, arr->metadata[i].value_length})); } grpc_metadata_array_destroy(arr); - grpc_metadata_array_init(&recv_trailing_metadata_arr_); + grpc_metadata_array_init(arr); } } // namespace @@ -114,7 +115,7 @@ void CallOpBuffer::AddSendInitialMetadata( std::multimap* metadata) { send_initial_metadata_ = true; initial_metadata_count_ = metadata->size(); - initial_metadata_ = FillMetadata(metadata); + initial_metadata_ = FillMetadataArray(metadata); } void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { @@ -142,7 +143,7 @@ void CallOpBuffer::AddClientRecvStatus( void CallOpBuffer::AddServerSendStatus( std::multimap* metadata, const Status& status) { trailing_metadata_count_ = metadata->size(); - trailing_metadata_ = FillMetadata(metadata); + trailing_metadata_ = FillMetadataArray(metadata); send_status_ = &status; } @@ -219,7 +220,7 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { *tag = return_tag_; // Process received initial metadata if (recv_initial_metadata_) { - FillMetadataMap(&recv_initial_metadata_, recv_initial_metadata_); + FillMetadataMap(&recv_initial_metadata_arr_, recv_initial_metadata_); } // Parse received message if any. if (recv_message_ && recv_message_buf_) { From 7596e7d12c6e86bd250f65708aedc982b7e6524e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 14:13:52 -0800 Subject: [PATCH 056/232] Tweak metadata sending --- src/cpp/common/call.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 765baa06cae..61488553374 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -142,8 +142,12 @@ void CallOpBuffer::AddClientRecvStatus( void CallOpBuffer::AddServerSendStatus( std::multimap* metadata, const Status& status) { - trailing_metadata_count_ = metadata->size(); - trailing_metadata_ = FillMetadataArray(metadata); + if (metadata != NULL) { + trailing_metadata_count_ = metadata->size(); + trailing_metadata_ = FillMetadataArray(metadata); + } else { + trailing_metadata_count_ = 0; + } send_status_ = &status; } @@ -163,6 +167,7 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { if (send_message_) { bool success = SerializeProto(*send_message_, &send_message_buf_); if (!success) { + abort(); // TODO handle parse failure } ops[*nops].op = GRPC_OP_SEND_MESSAGE; From 7418d01de4b10b5870b8b78a4ce5198beae49445 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 15:25:03 -0800 Subject: [PATCH 057/232] Make end2end_test use fewer threads Helps finding interesting threads in gdb much easier --- test/cpp/end2end/end2end_test.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 52deb0f32da..2aaecb4e119 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -38,6 +38,7 @@ #include "test/cpp/util/echo_duplicate.pb.h" #include "test/cpp/util/echo.pb.h" #include "src/cpp/util/time.h" +#include "src/cpp/server/thread_pool.h" #include #include #include @@ -76,6 +77,7 @@ void MaybeEchoDeadline(ServerContext* context, const EchoRequest* request, response->mutable_param()->set_request_deadline(deadline.tv_sec); } } + } // namespace class TestServiceImpl : public ::grpc::cpp::test::util::TestService::Service { @@ -141,6 +143,8 @@ class TestServiceImplDupPkg class End2endTest : public ::testing::Test { protected: + End2endTest() : thread_pool_(2) {} + void SetUp() override { int port = grpc_pick_unused_port_or_die(); server_address_ << "localhost:" << port; @@ -149,6 +153,7 @@ class End2endTest : public ::testing::Test { builder.AddPort(server_address_.str()); builder.RegisterService(&service_); builder.RegisterService(&dup_pkg_service_); + builder.SetThreadPool(&thread_pool_); server_ = builder.BuildAndStart(); } @@ -165,6 +170,7 @@ class End2endTest : public ::testing::Test { std::ostringstream server_address_; TestServiceImpl service_; TestServiceImplDupPkg dup_pkg_service_; + ThreadPool thread_pool_; }; static void SendRpc(grpc::cpp::test::util::TestService::Stub* stub, From 9dcb0f8e1d58d3f6f4d14b47bddb53ba8cf83a42 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 15:36:31 -0800 Subject: [PATCH 058/232] Send initial metadata --- include/grpc++/server_context.h | 8 +++++++- src/cpp/server/server.cc | 5 ++++- src/cpp/server/server_context.cc | 11 +++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 790dd7116b4..6fa01f5f196 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -53,12 +53,18 @@ class ServerContext { std::chrono::system_clock::time_point absolute_deadline() { return deadline_; } + void AddInitialMetadata(const grpc::string& key, const grpc::string& value); + void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + private: friend class ::grpc::Server; ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); const std::chrono::system_clock::time_point deadline_; - std::multimap metadata_; + bool sent_initial_metadata_ = false; + std::multimap client_metadata_; + std::multimap initial_metadata_; + std::multimap trailing_metadata_; }; } // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 8974850b8ce..43927393675 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -172,10 +172,13 @@ class Server::MethodRequestData final : public CompletionQueueTag { auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; - buf.AddServerSendStatus(nullptr, status); + if (!ctx_.sent_initial_metadata_) { + buf.AddSendInitialMetadata(&ctx_.initial_metadata_); + } if (has_response_payload_) { buf.AddSendMessage(*res); } + buf.AddServerSendStatus(&ctx_.trailing_metadata_, status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 7e0bc4de36a..2bf4104d766 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -37,11 +37,14 @@ namespace grpc { -ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count) - : deadline_(Timespec2Timepoint(deadline)) { +ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, + size_t metadata_count) + : deadline_(Timespec2Timepoint(deadline)) { for (size_t i = 0; i < metadata_count; i++) { - metadata_.insert(std::make_pair(grpc::string(metadata[i].key), - grpc::string(metadata[i].value, metadata[i].value + metadata[i].value_length))); + client_metadata_.insert(std::make_pair( + grpc::string(metadata[i].key), + grpc::string(metadata[i].value, + metadata[i].value + metadata[i].value_length))); } } From dcf9c0e588fce023b0644010c837681b4f303c20 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 16:12:41 -0800 Subject: [PATCH 059/232] Fix race --- src/core/transport/chttp2_transport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index ea579cf4a52..7d78bfa0cc1 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -478,9 +478,6 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, ref_transport(t); gpr_mu_unlock(&t->mu); - ref_transport(t); - recv_data(t, slices, nslices, GRPC_ENDPOINT_CB_OK); - sr = setup(arg, &t->base, t->metadata_context); lock(t); @@ -488,6 +485,10 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, t->cb_user_data = sr.user_data; t->calling_back = 0; unlock(t); + + ref_transport(t); + recv_data(t, slices, nslices, GRPC_ENDPOINT_CB_OK); + unref_transport(t); } From 0ef1a928186f9b5afba1b1677bc492130142720e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 16:23:01 -0800 Subject: [PATCH 060/232] Fix hash table --- src/core/surface/server.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 3f1c2add55e..3f76138d1ce 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -296,7 +296,7 @@ static void finish_start_new_rpc_and_unlock(grpc_server *server, call_list_join(pending_root, calld, PENDING_START); gpr_mu_unlock(&server->mu); } else { - rc = server->requested_calls.calls[--server->requested_calls.count]; + rc = array->calls[--array->count]; calld->state = ACTIVATED; gpr_mu_unlock(&server->mu); begin_call(server, calld, &rc); @@ -328,7 +328,7 @@ static void start_new_rpc(grpc_call_element *elem) { } /* check for a wildcard method definition (no host set) */ hash = GRPC_MDSTR_KV_HASH(0, calld->path->hash); - for (i = 0; i < chand->registered_method_max_probes; i++) { + for (i = 0; i <= chand->registered_method_max_probes; i++) { rm = &chand->registered_methods[(hash + i) % chand->registered_method_slots]; if (!rm) break; @@ -828,6 +828,7 @@ void grpc_server_add_listener(grpc_server *server, void *arg, static grpc_call_error queue_call_request(grpc_server *server, requested_call *rc) { call_data *calld = NULL; + requested_call_array *requested_calls = NULL; gpr_mu_lock(&server->mu); if (server->shutdown) { gpr_mu_unlock(&server->mu); @@ -839,10 +840,12 @@ static grpc_call_error queue_call_request(grpc_server *server, case BATCH_CALL: calld = call_list_remove_head(&server->lists[PENDING_START], PENDING_START); + requested_calls = &server->requested_calls; break; case REGISTERED_CALL: calld = call_list_remove_head( &rc->data.registered.registered_method->pending, PENDING_START); + requested_calls = &rc->data.registered.registered_method->requested; break; } if (calld) { @@ -852,7 +855,7 @@ static grpc_call_error queue_call_request(grpc_server *server, begin_call(server, calld, rc); return GRPC_CALL_OK; } else { - *requested_call_array_add(&server->requested_calls) = *rc; + *requested_call_array_add(requested_calls) = *rc; gpr_mu_unlock(&server->mu); return GRPC_CALL_OK; } From 968ca530b2eaa20715793861453f96dcfd075c53 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 16:23:47 -0800 Subject: [PATCH 061/232] Add trailing metadata to client context and use it. --- include/grpc++/client_context.h | 17 +++++++++++++++-- include/grpc++/stream.h | 16 ++++++++++------ src/cpp/client/client_context.cc | 2 +- src/cpp/common/call.cc | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index a6e8ccc67c4..91293d11231 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -50,6 +50,12 @@ struct grpc_completion_queue; namespace grpc { class CallOpBuffer; +template class ClientReader; +template class ClientWriter; +template class ClientReaderWriter; +template class ServerReader; +template class ServerWriter; +template class ServerReaderWriter; class ClientContext { public: @@ -71,7 +77,12 @@ class ClientContext { friend class CallOpBuffer; friend class Channel; - friend class StreamContext; + template friend class ::grpc::ClientReader; + template friend class ::grpc::ClientWriter; + template friend class ::grpc::ClientReaderWriter; + template friend class ::grpc::ServerReader; + template friend class ::grpc::ServerWriter; + template friend class ::grpc::ServerReaderWriter; grpc_call *call() { return call_; } void set_call(grpc_call *call) { @@ -87,7 +98,9 @@ class ClientContext { grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; - std::multimap metadata_; + std::multimap send_initial_metadata_; + std::multimap recv_initial_metadata_; + std::multimap trailing_metadata_; }; } // namespace grpc diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 85a7261fb92..2791468490d 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -35,6 +35,7 @@ #define __GRPCPP_STREAM_H__ #include +#include #include #include #include @@ -87,7 +88,7 @@ class ClientReader final : public ClientStreamingInterface, ClientReader(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request) - : call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendMessage(request); buf.AddClientSendClose(); @@ -105,13 +106,14 @@ class ClientReader final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(nullptr, &status); // TODO metadata + buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; } private: + ClientContext* context_; CompletionQueue cq_; Call call_; }; @@ -124,7 +126,7 @@ class ClientWriter final : public ClientStreamingInterface, ClientWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, google::protobuf::Message *response) - : response_(response), + : context_(context), response_(response), call_(channel->CreateCall(method, context, &cq_)) {} virtual bool Write(const W& msg) override { @@ -146,13 +148,14 @@ class ClientWriter final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddRecvMessage(response_); - buf.AddClientRecvStatus(nullptr, &status); // TODO metadata + buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; } private: + ClientContext* context_; google::protobuf::Message *const response_; CompletionQueue cq_; Call call_; @@ -167,7 +170,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, // Blocking create a stream. ClientReaderWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context) - : call_(channel->CreateCall(method, context, &cq_)) {} + : context_(context), call_(channel->CreateCall(method, context, &cq_)) {} virtual bool Read(R *msg) override { CallOpBuffer buf; @@ -193,13 +196,14 @@ class ClientReaderWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(nullptr, &status); // TODO metadata + buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; } private: + ClientContext* context_; CompletionQueue cq_; Call call_; }; diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 5c2772f5dfb..afacc81c168 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -72,7 +72,7 @@ system_clock::time_point ClientContext::absolute_deadline() { void ClientContext::AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value) { - metadata_.insert(std::make_pair(meta_key, meta_value)); + send_initial_metadata_.insert(std::make_pair(meta_key, meta_value)); } void ClientContext::StartCancel() {} diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 61488553374..a954525b7d8 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -119,7 +119,7 @@ void CallOpBuffer::AddSendInitialMetadata( } void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { - AddSendInitialMetadata(&ctx->metadata_); + AddSendInitialMetadata(&ctx->send_initial_metadata_); } void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { From 47a573602a27e718a7f13d5a9cceed7519e42234 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 16:31:45 -0800 Subject: [PATCH 062/232] Fix ownership --- include/grpc++/impl/call.h | 10 +++------- src/cpp/common/call.cc | 4 ---- src/cpp/server/server.cc | 4 ++++ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 5922e2581a9..9ac92a00dd9 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -112,11 +112,6 @@ class CallOpBuffer final : public CompletionQueueTag { grpc_metadata *trailing_metadata_ = nullptr; }; -class CCallDeleter { - public: - void operator()(grpc_call *c); -}; - // Channel and Server implement this to allow them to hook performing ops class CallHook { public: @@ -127,17 +122,18 @@ class CallHook { // Straightforward wrapping of the C call object class Call final { public: + /* call is owned by the caller */ Call(grpc_call *call, CallHook *call_hook_, CompletionQueue *cq); void PerformOps(CallOpBuffer *buffer); - grpc_call *call() { return call_.get(); } + grpc_call *call() { return call_; } CompletionQueue *cq() { return cq_; } private: CallHook *call_hook_; CompletionQueue *cq_; - std::unique_ptr call_; + grpc_call* call_; }; } // namespace grpc diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 61488553374..84791aa0a46 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -243,10 +243,6 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { } } -void CCallDeleter::operator()(grpc_call* c) { - grpc_call_destroy(c); -} - Call::Call(grpc_call* call, CallHook *call_hook, CompletionQueue* cq) : call_hook_(call_hook), cq_(cq), call_(call) {} diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 43927393675..2ee85815486 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -157,6 +157,10 @@ class Server::MethodRequestData final : public CompletionQueueTag { mrd->request_metadata_.count = 0; } + ~CallData() { + grpc_call_destroy(call_.call()); + } + void Run() { std::unique_ptr req; std::unique_ptr res; From bd217574fb7ec65f899103eb4e1f8719b83fa43a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 18:10:56 -0800 Subject: [PATCH 063/232] Fix server shutdown issues First end2end test passes --- src/core/surface/server.c | 13 ++++++++++++- src/cpp/server/server.cc | 9 +++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 3f76138d1ce..80b248ee84e 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -715,7 +715,7 @@ grpc_transport_setup_result grpc_server_setup_transport( grpc_channel_get_channel_stack(channel), transport); } -void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, +static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, void *shutdown_tag) { listener *l; requested_call_array requested_calls; @@ -725,6 +725,7 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, size_t i; grpc_channel_op op; grpc_channel_element *elem; + registered_method *rm; /* lock, and gather up some stuff to do */ gpr_mu_lock(&server->mu); @@ -747,8 +748,18 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, i++; } + /* collect all unregistered then registered calls */ requested_calls = server->requested_calls; memset(&server->requested_calls, 0, sizeof(server->requested_calls)); + for (rm = server->registered_methods; rm; rm = rm->next) { + if (requested_calls.count + rm->requested.count > requested_calls.capacity) { + requested_calls.capacity = GPR_MAX(requested_calls.count + rm->requested.count, 2 * requested_calls.capacity); + requested_calls.calls = gpr_realloc(requested_calls.calls, sizeof(*requested_calls.calls) * requested_calls.capacity); + } + memcpy(requested_calls.calls + requested_calls.count, rm->requested.calls, sizeof(*requested_calls.calls) * rm->requested.count); + requested_calls.count += rm->requested.count; + memset(&rm->requested, 0, sizeof(rm->requested)); + } server->shutdown = 1; server->have_shutdown_tag = have_shutdown_tag; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 2ee85815486..1c95ab21bd6 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -158,7 +158,7 @@ class Server::MethodRequestData final : public CompletionQueueTag { } ~CallData() { - grpc_call_destroy(call_.call()); + if (call_.call()) grpc_call_destroy(call_.call()); } void Run() { @@ -233,6 +233,7 @@ void Server::Shutdown() { if (started_ && !shutdown_) { shutdown_ = true; grpc_server_shutdown(server_); + cq_.Shutdown(); // Wait for running callbacks to finish. while (num_running_cb_ != 0) { @@ -264,12 +265,12 @@ void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; auto *mrd = MethodRequestData::Wait(&cq_, &ok); + gpr_log(GPR_DEBUG, "Wait: %p %d", mrd, ok); if (mrd) { - MethodRequestData::CallData cd(this, mrd); - + ScheduleCallback(); if (ok) { + MethodRequestData::CallData cd(this, mrd); mrd->Request(server_); - ScheduleCallback(); cd.Run(); } From ea9fb4a6f3a0eb3c545ac2e329bb44add75c9947 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 18:21:20 -0800 Subject: [PATCH 064/232] Update vsprojects --- vsprojects/vs2013/gpr_shared.vcxproj | 2 ++ vsprojects/vs2013/gpr_shared.vcxproj.filters | 3 +++ vsprojects/vs2013/grpc_shared.vcxproj | 2 ++ vsprojects/vs2013/grpc_shared.vcxproj.filters | 3 +++ 4 files changed, 10 insertions(+) diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index 0b3d4eab7c6..b9131e381c1 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -120,6 +120,8 @@ + + diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters index 20e4e07c49d..1e908a5ba51 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -16,6 +16,9 @@ src\core\support + + src\core\support + src\core\support diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index b1890cf6e73..71b4a0cbabe 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -277,6 +277,8 @@ + + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index fed8fb10bfb..75ecc7a822d 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -130,6 +130,9 @@ src\core\iomgr + + src\core\iomgr + src\core\iomgr From 4dd70173bdf0754a039ddf634080e2fbf29d86e7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 18:25:07 -0800 Subject: [PATCH 065/232] This string is null terminated --- src/cpp/common/call.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index ffbc599d573..6b1d99f739a 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -238,7 +238,7 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { FillMetadataMap(&recv_trailing_metadata_arr_, recv_trailing_metadata_); *recv_status_ = Status( static_cast(status_code_), - status_details_ ? grpc::string(status_details_, status_details_capacity_) + status_details_ ? grpc::string(status_details_) : grpc::string()); } } From 504bd331aba5817c2753c4f447f40cc83fa4d907 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 20:34:33 -0800 Subject: [PATCH 066/232] Make sure we get a close before stopping the server --- include/grpc++/impl/call.h | 3 +++ src/cpp/client/client_unary_call.cc | 3 ++- src/cpp/common/call.cc | 14 ++++++++++++++ src/cpp/server/server.cc | 6 ++++-- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 9ac92a00dd9..f4b07625bee 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -73,6 +73,7 @@ class CallOpBuffer final : public CompletionQueueTag { Status *status); void AddServerSendStatus(std::multimap *metadata, const Status& status); + void AddServerRecvClose(bool* cancelled); // INTERNAL API: @@ -110,6 +111,8 @@ class CallOpBuffer final : public CompletionQueueTag { const Status* send_status_ = nullptr; size_t trailing_metadata_count_ = 0; grpc_metadata *trailing_metadata_ = nullptr; + int cancelled_buf_; + bool *recv_closed_ = nullptr; }; // Channel and Server implement this to allow them to hook performing ops diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 68253986124..30bf2d0fc21 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -36,6 +36,7 @@ #include #include #include +#include namespace grpc { @@ -54,7 +55,7 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf.AddClientSendClose(); buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call.PerformOps(&buf); - cq.Pluck(&buf); + GPR_ASSERT(cq.Pluck(&buf)); return status; } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 6b1d99f739a..d90ef0311e4 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -78,6 +78,8 @@ void CallOpBuffer::Reset(void* next_return_tag) { send_status_ = nullptr; trailing_metadata_count_ = 0; trailing_metadata_ = nullptr; + + recv_closed_ = nullptr; } namespace { @@ -134,6 +136,10 @@ void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } +void CallOpBuffer::AddServerRecvClose(bool* cancelled) { + recv_closed_ = cancelled; +} + void CallOpBuffer::AddClientRecvStatus( std::multimap* metadata, Status *status) { recv_trailing_metadata_ = metadata; @@ -205,6 +211,11 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { send_status_->details().c_str(); (*nops)++; } + if (recv_closed_) { + ops[*nops].op = GRPC_OP_RECV_CLOSE_ON_SERVER; + ops[*nops].data.recv_close_on_server.cancelled = &cancelled_buf_; + (*nops)++; + } } void CallOpBuffer::FinalizeResult(void **tag, bool *status) { @@ -241,6 +252,9 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { status_details_ ? grpc::string(status_details_) : grpc::string()); } + if (recv_closed_) { + *recv_closed_ = cancelled_buf_ != 0; + } } Call::Call(grpc_call* call, CallHook *call_hook, CompletionQueue* cq) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 1c95ab21bd6..be3d2256302 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -119,7 +119,8 @@ class Server::MethodRequestData final : public CompletionQueueTag { } static MethodRequestData *Wait(CompletionQueue *cq, bool *ok) { - void *tag; + void *tag = nullptr; + *ok = false; if (!cq->Next(&tag, ok)) { return nullptr; } @@ -183,6 +184,8 @@ class Server::MethodRequestData final : public CompletionQueueTag { buf.AddSendMessage(*res); } buf.AddServerSendStatus(&ctx_.trailing_metadata_, status); + bool cancelled; + buf.AddServerRecvClose(&cancelled); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); } @@ -265,7 +268,6 @@ void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; auto *mrd = MethodRequestData::Wait(&cq_, &ok); - gpr_log(GPR_DEBUG, "Wait: %p %d", mrd, ok); if (mrd) { ScheduleCallback(); if (ok) { From 0156752a66e5e8f00e7e49fd1aae35a6b8157cca Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 21:08:49 -0800 Subject: [PATCH 067/232] Some streaming progress --- include/grpc++/client_context.h | 12 +++--- include/grpc++/impl/call.h | 3 +- include/grpc++/impl/rpc_service_method.h | 6 +-- include/grpc++/server_context.h | 17 ++++++++ include/grpc++/stream.h | 54 +++++++++++++++--------- src/core/transport/chttp2_transport.c | 4 ++ src/cpp/client/client_unary_call.cc | 5 ++- src/cpp/common/call.cc | 17 +++++--- src/cpp/server/server.cc | 4 +- src/cpp/server/server_context.cc | 8 ++++ 10 files changed, 91 insertions(+), 39 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 91293d11231..0a81f6a3666 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -53,9 +53,9 @@ class CallOpBuffer; template class ClientReader; template class ClientWriter; template class ClientReaderWriter; -template class ServerReader; -template class ServerWriter; -template class ServerReaderWriter; +template class ClientAsyncReader; +template class ClientAsyncWriter; +template class ClientAsyncReaderWriter; class ClientContext { public: @@ -80,9 +80,9 @@ class ClientContext { template friend class ::grpc::ClientReader; template friend class ::grpc::ClientWriter; template friend class ::grpc::ClientReaderWriter; - template friend class ::grpc::ServerReader; - template friend class ::grpc::ServerWriter; - template friend class ::grpc::ServerReaderWriter; + template friend class ::grpc::ClientAsyncReader; + template friend class ::grpc::ClientAsyncWriter; + template friend class ::grpc::ClientAsyncReaderWriter; grpc_call *call() { return call_; } void set_call(grpc_call *call) { diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index f4b07625bee..a1ef9268f0c 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -67,7 +67,7 @@ class CallOpBuffer final : public CompletionQueueTag { void AddRecvInitialMetadata( std::multimap *metadata); void AddSendMessage(const google::protobuf::Message &message); - void AddRecvMessage(google::protobuf::Message *message); + void AddRecvMessage(google::protobuf::Message *message, bool* got_message); void AddClientSendClose(); void AddClientRecvStatus(std::multimap *metadata, Status *status); @@ -97,6 +97,7 @@ class CallOpBuffer final : public CompletionQueueTag { grpc_byte_buffer* send_message_buf_ = nullptr; // Recv message google::protobuf::Message* recv_message_ = nullptr; + bool* got_message_ = nullptr; grpc_byte_buffer* recv_message_buf_ = nullptr; // Client send close bool client_send_close_ = false; diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 0fb4f79b595..c201676065e 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -107,7 +107,7 @@ class ClientStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerReader reader(param.call); + ServerReader reader(param.call, param.server_context); return func_(service_, param.server_context, &reader, dynamic_cast(param.response)); } @@ -129,7 +129,7 @@ class ServerStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerWriter writer(param.call); + ServerWriter writer(param.call, param.server_context); return func_(service_, param.server_context, dynamic_cast(param.request), &writer); } @@ -152,7 +152,7 @@ class BidiStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerReaderWriter stream(param.call); + ServerReaderWriter stream(param.call, param.server_context); return func_(service_, param.server_context, &stream); } diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 6fa01f5f196..a30f6cb51d0 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -44,6 +44,14 @@ struct gpr_timespec; namespace grpc { +template class ServerAsyncReader; +template class ServerAsyncWriter; +template class ServerAsyncReaderWriter; +template class ServerReader; +template class ServerWriter; +template class ServerReaderWriter; + +class CallOpBuffer; class Server; // Interface of server side rpc context. @@ -58,8 +66,17 @@ class ServerContext { private: friend class ::grpc::Server; + template friend class ::grpc::ServerAsyncReader; + template friend class ::grpc::ServerAsyncWriter; + template friend class ::grpc::ServerAsyncReaderWriter; + template friend class ::grpc::ServerReader; + template friend class ::grpc::ServerWriter; + template friend class ::grpc::ServerReaderWriter; + ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); + void SendInitialMetadataIfNeeded(CallOpBuffer *buf); + const std::chrono::system_clock::time_point deadline_; bool sent_initial_metadata_ = false; std::multimap client_metadata_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 2791468490d..4a804c7c902 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -98,9 +99,10 @@ class ClientReader final : public ClientStreamingInterface, virtual bool Read(R *msg) override { CallOpBuffer buf; - buf.AddRecvMessage(msg); + bool got_message; + buf.AddRecvMessage(msg, &got_message); call_.PerformOps(&buf); - return cq_.Pluck(&buf); + return cq_.Pluck(&buf) && got_message; } virtual Status Finish() override { @@ -127,7 +129,12 @@ class ClientWriter final : public ClientStreamingInterface, ClientContext *context, google::protobuf::Message *response) : context_(context), response_(response), - call_(channel->CreateCall(method, context, &cq_)) {} + call_(channel->CreateCall(method, context, &cq_)) { + CallOpBuffer buf; + buf.AddSendInitialMetadata(&context->send_initial_metadata_); + call_.PerformOps(&buf); + cq_.Pluck(&buf); + } virtual bool Write(const W& msg) override { CallOpBuffer buf; @@ -147,10 +154,11 @@ class ClientWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddRecvMessage(response_); + bool got_message; + buf.AddRecvMessage(response_, &got_message); buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); - GPR_ASSERT(cq_.Pluck(&buf)); + GPR_ASSERT(cq_.Pluck(&buf) && got_message); return status; } @@ -174,9 +182,10 @@ class ClientReaderWriter final : public ClientStreamingInterface, virtual bool Read(R *msg) override { CallOpBuffer buf; - buf.AddRecvMessage(msg); + bool got_message; + buf.AddRecvMessage(msg, &got_message); call_.PerformOps(&buf); - return cq_.Pluck(&buf); + return cq_.Pluck(&buf) && got_message; } virtual bool Write(const W& msg) override { @@ -211,33 +220,37 @@ class ClientReaderWriter final : public ClientStreamingInterface, template class ServerReader final : public ReaderInterface { public: - explicit ServerReader(Call* call) : call_(call) {} + explicit ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} virtual bool Read(R* msg) override { CallOpBuffer buf; - buf.AddRecvMessage(msg); + bool got_message; + buf.AddRecvMessage(msg, &got_message); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf); + return call_->cq()->Pluck(&buf) && got_message; } private: - Call* call_; + Call* const call_; + ServerContext* const ctx_; }; template class ServerWriter final : public WriterInterface { public: - explicit ServerWriter(Call* call) : call_(call) {} + explicit ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} virtual bool Write(const W& msg) override { CallOpBuffer buf; + ctx_->SendInitialMetadataIfNeeded(&buf); buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); } private: - Call* call_; + Call* const call_; + ServerContext* const ctx_; }; // Server-side interface for bi-directional streaming. @@ -245,25 +258,27 @@ template class ServerReaderWriter final : public WriterInterface, public ReaderInterface { public: - explicit ServerReaderWriter(Call* call) : call_(call) {} + explicit ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} virtual bool Read(R* msg) override { CallOpBuffer buf; - buf.AddRecvMessage(msg); + bool got_message; + buf.AddRecvMessage(msg, &got_message); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf); + return call_->cq()->Pluck(&buf) && got_message; } virtual bool Write(const W& msg) override { CallOpBuffer buf; + ctx_->SendInitialMetadataIfNeeded(&buf); buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); } private: - CompletionQueue* cq_; - Call* call_; + Call* const call_; + ServerContext* const ctx_; }; // Async interfaces @@ -353,13 +368,14 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, virtual void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); - finish_buf_.AddRecvMessage(response_); + finish_buf_.AddRecvMessage(response_, &got_message_); finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata call_.PerformOps(&finish_buf_); } private: google::protobuf::Message *const response_; + bool got_message_; CompletionQueue cq_; Call call_; CallOpBuffer write_buf_; diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 7d78bfa0cc1..65d11f16c75 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1015,6 +1015,8 @@ static void cancel_stream_inner(transport *t, stream *s, gpr_uint32 id, int had_outgoing; char buffer[GPR_LTOA_MIN_BUFSIZE]; + gpr_log(GPR_DEBUG, "cancel %d", id); + if (s) { /* clear out any unreported input & output: nobody cares anymore */ had_outgoing = s->outgoing_sopb.nops != 0; @@ -1185,6 +1187,8 @@ static void on_header(void *tp, grpc_mdelem *md) { transport *t = tp; stream *s = t->incoming_stream; + gpr_log(GPR_DEBUG, "on_header: %d %s %s", s->id, grpc_mdstr_as_c_string(md->key), grpc_mdstr_as_c_string(md->value)); + GPR_ASSERT(s); stream_list_join(t, s, PENDING_CALLBACKS); if (md->key == t->str_grpc_timeout) { diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 30bf2d0fc21..bc0e83733a2 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -51,11 +51,12 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, Status status; buf.AddSendInitialMetadata(context); buf.AddSendMessage(request); - buf.AddRecvMessage(result); + bool got_message; + buf.AddRecvMessage(result, &got_message); buf.AddClientSendClose(); buf.AddClientRecvStatus(nullptr, &status); // TODO metadata call.PerformOps(&buf); - GPR_ASSERT(cq.Pluck(&buf)); + GPR_ASSERT(cq.Pluck(&buf) && (got_message || !status.IsOk())); return status; } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index d90ef0311e4..a20d4a0d9a6 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -58,6 +58,7 @@ void CallOpBuffer::Reset(void* next_return_tag) { } recv_message_ = nullptr; + got_message_ = nullptr; if (recv_message_buf_) { grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; @@ -128,8 +129,9 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { send_message_ = &message; } -void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) { +void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message, bool* got_message) { recv_message_ = message; + got_message_ = got_message; } void CallOpBuffer::AddClientSendClose() { @@ -239,10 +241,15 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { FillMetadataMap(&recv_initial_metadata_arr_, recv_initial_metadata_); } // Parse received message if any. - if (recv_message_ && recv_message_buf_) { - *status = DeserializeProto(recv_message_buf_, recv_message_); - grpc_byte_buffer_destroy(recv_message_buf_); - recv_message_buf_ = nullptr; + if (recv_message_) { + if (recv_message_buf_) { + *got_message_ = true; + *status = DeserializeProto(recv_message_buf_, recv_message_); + grpc_byte_buffer_destroy(recv_message_buf_); + recv_message_buf_ = nullptr; + } else { + *got_message_ = false; + } } // Parse received status. if (recv_status_) { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index be3d2256302..17b0543bcd3 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -177,9 +177,7 @@ class Server::MethodRequestData final : public CompletionQueueTag { auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; - if (!ctx_.sent_initial_metadata_) { - buf.AddSendInitialMetadata(&ctx_.initial_metadata_); - } + ctx_.SendInitialMetadataIfNeeded(&buf); if (has_response_payload_) { buf.AddSendMessage(*res); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 2bf4104d766..06eeb392975 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -32,6 +32,7 @@ */ #include +#include #include #include "src/cpp/util/time.h" @@ -48,4 +49,11 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, } } +void ServerContext::SendInitialMetadataIfNeeded(CallOpBuffer* buf) { + if (!sent_initial_metadata_) { + buf->AddSendInitialMetadata(&initial_metadata_); + sent_initial_metadata_ = true; + } +} + } // namespace grpc From 0d6b9b35ee8db0249d0c541a087a1ecdc0ab1f8d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 21:09:17 -0800 Subject: [PATCH 068/232] Remove debug --- src/core/transport/chttp2_transport.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 65d11f16c75..37cdb9d2e5d 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1187,8 +1187,6 @@ static void on_header(void *tp, grpc_mdelem *md) { transport *t = tp; stream *s = t->incoming_stream; - gpr_log(GPR_DEBUG, "on_header: %d %s %s", s->id, grpc_mdstr_as_c_string(md->key), grpc_mdstr_as_c_string(md->value)); - GPR_ASSERT(s); stream_list_join(t, s, PENDING_CALLBACKS); if (md->key == t->str_grpc_timeout) { From a847a8f8bc3f2fdc542d11671a4d34997f2b0538 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 21:20:25 -0800 Subject: [PATCH 069/232] Finish streaming, lame client --- include/grpc++/stream.h | 8 +++++++- src/core/surface/lame_client.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 4a804c7c902..a59ccd8c051 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -91,6 +91,7 @@ class ClientReader final : public ClientStreamingInterface, const google::protobuf::Message &request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; + buf.AddSendInitialMetadata(&context->send_initial_metadata_); buf.AddSendMessage(request); buf.AddClientSendClose(); call_.PerformOps(&buf); @@ -178,7 +179,12 @@ class ClientReaderWriter final : public ClientStreamingInterface, // Blocking create a stream. ClientReaderWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) {} + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + CallOpBuffer buf; + buf.AddSendInitialMetadata(&context->send_initial_metadata_); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + } virtual bool Read(R *msg) override { CallOpBuffer buf; diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index 411dbabfd32..a8fdeed87f9 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -47,6 +47,7 @@ typedef struct { } call_data; typedef struct { + grpc_mdelem *status; grpc_mdelem *message; } channel_data; @@ -57,6 +58,7 @@ static void call_op(grpc_call_element *elem, grpc_call_element *from_elem, switch (op->type) { case GRPC_SEND_START: + grpc_call_recv_metadata(elem, grpc_mdelem_ref(channeld->status)); grpc_call_recv_metadata(elem, grpc_mdelem_ref(channeld->message)); grpc_call_stream_closed(elem); break; @@ -93,18 +95,22 @@ static void init_channel_elem(grpc_channel_element *elem, const grpc_channel_args *args, grpc_mdctx *mdctx, int is_first, int is_last) { channel_data *channeld = elem->channel_data; + char status[12]; GPR_ASSERT(is_first); GPR_ASSERT(is_last); channeld->message = grpc_mdelem_from_strings(mdctx, "grpc-message", "Rpc sent on a lame channel."); + gpr_ltoa(GRPC_STATUS_UNKNOWN, status); + channeld->status = grpc_mdelem_from_strings(mdctx, "grpc-status", status); } static void destroy_channel_elem(grpc_channel_element *elem) { channel_data *channeld = elem->channel_data; grpc_mdelem_unref(channeld->message); + grpc_mdelem_unref(channeld->status); } static const grpc_channel_filter lame_filter = { From 24c06eada35ae75558858c62aa46291095acd8c6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 21:26:45 -0800 Subject: [PATCH 070/232] Run build cleaner --- Makefile | 10 +++++----- build.json | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 24a1141178e..21bb9683001 100644 --- a/Makefile +++ b/Makefile @@ -1890,8 +1890,8 @@ LIBGRPC_SRC = \ src/core/iomgr/iomgr_posix.c \ src/core/iomgr/iomgr_windows.c \ src/core/iomgr/pollset_kick.c \ - src/core/iomgr/pollset_multipoller_with_poll_posix.c \ src/core/iomgr/pollset_multipoller_with_epoll.c \ + src/core/iomgr/pollset_multipoller_with_poll_posix.c \ src/core/iomgr/pollset_posix.c \ src/core/iomgr/pollset_windows.c \ src/core/iomgr/resolve_address.c \ @@ -2026,8 +2026,8 @@ src/core/iomgr/iomgr.c: $(OPENSSL_DEP) src/core/iomgr/iomgr_posix.c: $(OPENSSL_DEP) src/core/iomgr/iomgr_windows.c: $(OPENSSL_DEP) src/core/iomgr/pollset_kick.c: $(OPENSSL_DEP) -src/core/iomgr/pollset_multipoller_with_poll_posix.c: $(OPENSSL_DEP) src/core/iomgr/pollset_multipoller_with_epoll.c: $(OPENSSL_DEP) +src/core/iomgr/pollset_multipoller_with_poll_posix.c: $(OPENSSL_DEP) src/core/iomgr/pollset_posix.c: $(OPENSSL_DEP) src/core/iomgr/pollset_windows.c: $(OPENSSL_DEP) src/core/iomgr/resolve_address.c: $(OPENSSL_DEP) @@ -2184,8 +2184,8 @@ objs/$(CONFIG)/src/core/iomgr/iomgr.o: objs/$(CONFIG)/src/core/iomgr/iomgr_posix.o: objs/$(CONFIG)/src/core/iomgr/iomgr_windows.o: objs/$(CONFIG)/src/core/iomgr/pollset_kick.o: -objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_epoll.o: +objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_windows.o: objs/$(CONFIG)/src/core/iomgr/resolve_address.o: @@ -2426,8 +2426,8 @@ LIBGRPC_UNSECURE_SRC = \ src/core/iomgr/iomgr_posix.c \ src/core/iomgr/iomgr_windows.c \ src/core/iomgr/pollset_kick.c \ - src/core/iomgr/pollset_multipoller_with_poll_posix.c \ src/core/iomgr/pollset_multipoller_with_epoll.c \ + src/core/iomgr/pollset_multipoller_with_poll_posix.c \ src/core/iomgr/pollset_posix.c \ src/core/iomgr/pollset_windows.c \ src/core/iomgr/resolve_address.c \ @@ -2567,8 +2567,8 @@ objs/$(CONFIG)/src/core/iomgr/iomgr.o: objs/$(CONFIG)/src/core/iomgr/iomgr_posix.o: objs/$(CONFIG)/src/core/iomgr/iomgr_windows.o: objs/$(CONFIG)/src/core/iomgr/pollset_kick.o: -objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_epoll.o: +objs/$(CONFIG)/src/core/iomgr/pollset_multipoller_with_poll_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_posix.o: objs/$(CONFIG)/src/core/iomgr/pollset_windows.o: objs/$(CONFIG)/src/core/iomgr/resolve_address.o: diff --git a/build.json b/build.json index 4895c793bd0..0b46bc2109b 100644 --- a/build.json +++ b/build.json @@ -138,8 +138,8 @@ "src/core/iomgr/iomgr_posix.c", "src/core/iomgr/iomgr_windows.c", "src/core/iomgr/pollset_kick.c", - "src/core/iomgr/pollset_multipoller_with_poll_posix.c", "src/core/iomgr/pollset_multipoller_with_epoll.c", + "src/core/iomgr/pollset_multipoller_with_poll_posix.c", "src/core/iomgr/pollset_posix.c", "src/core/iomgr/pollset_windows.c", "src/core/iomgr/resolve_address.c", @@ -1624,6 +1624,7 @@ { "name": "qps_client", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1636,12 +1637,12 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "qps_server", "build": "test", + "run": false, "language": "c++", "src": [ "test/cpp/qps/qpstest.proto", @@ -1654,8 +1655,7 @@ "grpc", "gpr_test_util", "gpr" - ], - "run": false + ] }, { "name": "ruby_plugin", From 1fe817fffd12bfc91f61941eb4a42ec9de92b43c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 21:26:54 -0800 Subject: [PATCH 071/232] Run build cleaner --- vsprojects/vs2013/grpc.vcxproj | 4 ++-- vsprojects/vs2013/grpc.vcxproj.filters | 4 ++-- vsprojects/vs2013/grpc_shared.vcxproj | 4 ++-- vsprojects/vs2013/grpc_shared.vcxproj.filters | 4 ++-- vsprojects/vs2013/grpc_unsecure.vcxproj | 4 ++-- vsprojects/vs2013/grpc_unsecure.vcxproj.filters | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index fc740fec925..dab819c51ba 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -271,10 +271,10 @@ - - + + diff --git a/vsprojects/vs2013/grpc.vcxproj.filters b/vsprojects/vs2013/grpc.vcxproj.filters index 75ecc7a822d..8c174d9159a 100644 --- a/vsprojects/vs2013/grpc.vcxproj.filters +++ b/vsprojects/vs2013/grpc.vcxproj.filters @@ -127,10 +127,10 @@ src\core\iomgr - + src\core\iomgr - + src\core\iomgr diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index 71b4a0cbabe..7ef520b7b60 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -275,10 +275,10 @@ - - + + diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index 75ecc7a822d..8c174d9159a 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -127,10 +127,10 @@ src\core\iomgr - + src\core\iomgr - + src\core\iomgr diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj b/vsprojects/vs2013/grpc_unsecure.vcxproj index c5130eee5e7..8b3b853cce7 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj @@ -233,10 +233,10 @@ - - + + diff --git a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters index 50f319066f1..6fac8464227 100644 --- a/vsprojects/vs2013/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vs2013/grpc_unsecure.vcxproj.filters @@ -88,10 +88,10 @@ src\core\iomgr - + src\core\iomgr - + src\core\iomgr From 94f87588fadea5e5ee429ab0b0bff9143d366dba Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 23:00:59 -0800 Subject: [PATCH 072/232] Fix up C tests --- test/core/end2end/tests/cancel_after_accept.c | 2 +- .../tests/request_response_with_binary_metadata_and_payload.c | 2 +- .../end2end/tests/request_response_with_metadata_and_payload.c | 2 +- test/core/end2end/tests/request_response_with_payload.c | 2 +- .../tests/request_response_with_trailing_metadata_and_payload.c | 2 +- test/core/end2end/tests/request_with_large_metadata.c | 2 +- test/core/end2end/tests/request_with_payload.c | 2 +- test/core/end2end/tests/simple_delayed_request.c | 2 +- test/core/end2end/tests/simple_request.c | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 6527fef846f..17f37d6719f 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -166,7 +166,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(2))); cq_expect_completion(v_server, tag(2), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index 695ddbca7d6..a71e3a77368 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -175,7 +175,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index d8624a30037..f7394a25b03 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -168,7 +168,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index 6a6c792b265..be4beb537a6 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -162,7 +162,7 @@ static void request_response_with_payload(grpc_end2end_test_fixture f) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 76e298d8027..637a9ffe1cf 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -169,7 +169,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 693f81ef96d..fff83dcbf0b 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -166,7 +166,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 3924991a787..2b520046bb5 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -157,7 +157,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 851d0cb8655..ac248f9be0e 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -144,7 +144,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f->server, &s, &call_details, &request_metadata_recv, - f->server_cq, f->server_cq, + f->server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 9b6230db15d..ab034795868 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -150,7 +150,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); From fada7d43b1ee8d128e4ee5267ab859e84ce56752 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 11 Feb 2015 23:03:55 -0800 Subject: [PATCH 073/232] Add some documentation --- include/grpc/grpc.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 561bc9a5a95..f6c7da4654a 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -550,15 +550,24 @@ void grpc_call_destroy(grpc_call *call); grpc_call_error grpc_server_request_call_old(grpc_server *server, void *tag_new); +/* Request notification of a new call */ grpc_call_error grpc_server_request_call( grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, void *tag_new); +/* Registers a method in the server. + Methods to this (host, method) pair will not be reported by + grpc_server_request_call, but instead be reported by + grpc_server_request_registered_call when passed the appropriate + registered_method (as returned by this function). + Must be called before grpc_server_start. + Returns NULL on failure. */ void *grpc_server_register_method(grpc_server *server, const char *method, const char *host); +/* Request notification of a new pre-registered call */ grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, From fd7199f64ec05c46f6aebd8644bbcb78f2889898 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 23:14:49 -0800 Subject: [PATCH 074/232] Add client side WaitForInitialMetadata for streaming. --- include/grpc++/impl/call.h | 9 +++++++++ include/grpc++/stream.h | 29 +++++++++++++++++++++++++++++ src/cpp/common/call.cc | 6 ++++++ 3 files changed, 44 insertions(+) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index a1ef9268f0c..5fafd0e8904 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -134,7 +134,16 @@ class Call final { grpc_call *call() { return call_; } CompletionQueue *cq() { return cq_; } + // TODO(yangg) change it to a general state query function. + bool initial_metadata_received() { + return initial_metadata_received_; + } + void set_initial_metadata_received() { + initial_metadata_received_ = true; + } + private: + bool initial_metadata_received_ = false; CallHook *call_hook_; CompletionQueue *cq_; grpc_call* call_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index a59ccd8c051..6da1be4e9fe 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -98,7 +98,22 @@ class ClientReader final : public ClientStreamingInterface, cq_.Pluck(&buf); } + // Blocking wait for initial metadata from server. The received metadata + // can only be accessed after this call returns. Calling this method is + // optional as it will be called internally before the first Read. + void WaitForInitialMetadata() { + if (!call_.initial_metadata_received()) { + CallOpBuffer buf; + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + call_.set_initial_metadata_received(); + } + } + + virtual bool Read(R *msg) override { + WaitForInitialMetadata(); CallOpBuffer buf; bool got_message; buf.AddRecvMessage(msg, &got_message); @@ -186,7 +201,21 @@ class ClientReaderWriter final : public ClientStreamingInterface, GPR_ASSERT(cq_.Pluck(&buf)); } + // Blocking wait for initial metadata from server. The received metadata + // can only be accessed after this call returns. Calling this method is + // optional as it will be called internally before the first Read. + void WaitForInitialMetadata() { + if (!call_.initial_metadata_received()) { + CallOpBuffer buf; + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + call_.set_initial_metadata_received(); + } + } + virtual bool Read(R *msg) override { + WaitForInitialMetadata(); CallOpBuffer buf; bool got_message; buf.AddRecvMessage(msg, &got_message); diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index a20d4a0d9a6..aae69084eb4 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -121,6 +121,12 @@ void CallOpBuffer::AddSendInitialMetadata( initial_metadata_ = FillMetadataArray(metadata); } +void CallOpBuffer::AddRecvInitialMetadata( + std::multimap* metadata) { + recv_initial_metadata_ = metadata; +} + + void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { AddSendInitialMetadata(&ctx->send_initial_metadata_); } From b492f06c9dc45c62f1cb46b9320a25f0f4be4300 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 23:43:20 -0800 Subject: [PATCH 075/232] Add SendInitialMetadata() to server streaming interfaces --- include/grpc++/stream.h | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6da1be4e9fe..be518c61ed6 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -111,7 +111,6 @@ class ClientReader final : public ClientStreamingInterface, } } - virtual bool Read(R *msg) override { WaitForInitialMetadata(); CallOpBuffer buf; @@ -255,7 +254,14 @@ class ClientReaderWriter final : public ClientStreamingInterface, template class ServerReader final : public ReaderInterface { public: - explicit ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + CallOpBuffer buf; + ctx_->SendInitialMetadataIfNeeded(&buf); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); + } virtual bool Read(R* msg) override { CallOpBuffer buf; @@ -273,7 +279,14 @@ class ServerReader final : public ReaderInterface { template class ServerWriter final : public WriterInterface { public: - explicit ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + CallOpBuffer buf; + ctx_->SendInitialMetadataIfNeeded(&buf); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); + } virtual bool Write(const W& msg) override { CallOpBuffer buf; @@ -293,7 +306,14 @@ template class ServerReaderWriter final : public WriterInterface, public ReaderInterface { public: - explicit ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} + + void SendInitialMetadata() { + CallOpBuffer buf; + ctx_->SendInitialMetadataIfNeeded(&buf); + call_->PerformOps(&buf); + return call_->cq()->Pluck(&buf); + } virtual bool Read(R* msg) override { CallOpBuffer buf; From 3ccdbe9bcc66f5769348ca5279f9bf5b7e700613 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 11 Feb 2015 23:56:30 -0800 Subject: [PATCH 076/232] Make SendInitialMetadata work. --- include/grpc++/server_context.h | 2 -- include/grpc++/stream.h | 37 ++++++++++++++++++++------------ src/cpp/server/server.cc | 1 - src/cpp/server/server_context.cc | 7 ------ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a30f6cb51d0..6cc3716291c 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -75,8 +75,6 @@ class ServerContext { ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); - void SendInitialMetadataIfNeeded(CallOpBuffer *buf); - const std::chrono::system_clock::time_point deadline_; bool sent_initial_metadata_ = false; std::multimap client_metadata_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index be518c61ed6..6265310c5a8 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -257,10 +257,13 @@ class ServerReader final : public ReaderInterface { ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - CallOpBuffer buf; - ctx_->SendInitialMetadataIfNeeded(&buf); - call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf); + if (!ctx_->sent_initial_metadata_) { + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); + } } virtual bool Read(R* msg) override { @@ -282,15 +285,18 @@ class ServerWriter final : public WriterInterface { ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - CallOpBuffer buf; - ctx_->SendInitialMetadataIfNeeded(&buf); - call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf); + if (!ctx_->sent_initial_metadata_) { + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); + } } virtual bool Write(const W& msg) override { + SendInitialMetadata(); CallOpBuffer buf; - ctx_->SendInitialMetadataIfNeeded(&buf); buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); @@ -309,10 +315,13 @@ class ServerReaderWriter final : public WriterInterface, ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - CallOpBuffer buf; - ctx_->SendInitialMetadataIfNeeded(&buf); - call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf); + if (!ctx_->sent_initial_metadata_) { + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); + } } virtual bool Read(R* msg) override { @@ -324,8 +333,8 @@ class ServerReaderWriter final : public WriterInterface, } virtual bool Write(const W& msg) override { + SendInitialMetadata(); CallOpBuffer buf; - ctx_->SendInitialMetadataIfNeeded(&buf); buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 17b0543bcd3..630b16ba0b2 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -177,7 +177,6 @@ class Server::MethodRequestData final : public CompletionQueueTag { auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; - ctx_.SendInitialMetadataIfNeeded(&buf); if (has_response_payload_) { buf.AddSendMessage(*res); } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 06eeb392975..1823dfc81b0 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -49,11 +49,4 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, } } -void ServerContext::SendInitialMetadataIfNeeded(CallOpBuffer* buf) { - if (!sent_initial_metadata_) { - buf->AddSendInitialMetadata(&initial_metadata_); - sent_initial_metadata_ = true; - } -} - } // namespace grpc From ca3cb3e19a618157ea70a5054be5b11e5dc1203c Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 00:05:11 -0800 Subject: [PATCH 077/232] Prefix Request to async server method names --- src/compiler/cpp_generator.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index d04c2efcc49..e29cfadcefb 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -251,26 +251,26 @@ void PrintHeaderServerMethodAsync( grpc_cpp_generator::ClassName(method->output_type(), true); if (NoStreaming(method)) { printer->Print(*vars, - "void $Method$(" + "void Request$Method$(" "::grpc::ServerContext* context, $Request$* request, " "::grpc::ServerAsyncResponseWriter< $Response$>* response, " "::grpc::CompletionQueue* cq, void *tag);\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, - "void $Method$(" + "void Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReader< $Request$>* reader, " "::grpc::CompletionQueue* cq, void *tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, - "void $Method$(" + "void Request$Method$(" "::grpc::ServerContext* context, $Request$* request, " "::grpc::ServerAsyncWriter< $Response$>* writer, " "::grpc::CompletionQueue* cq, void *tag);\n"); } else if (BidiStreaming(method)) { printer->Print( *vars, - "void $Method$(" + "void Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " "::grpc::CompletionQueue* cq, void *tag);\n"); @@ -472,7 +472,7 @@ void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, grpc_cpp_generator::ClassName(method->output_type(), true); if (NoStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::$Method$(" + "void $Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "$Request$* request, " "::grpc::ServerAsyncResponseWriter< $Response$>* response, " @@ -480,14 +480,14 @@ void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, printer->Print("}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::$Method$(" + "void $Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReader< $Request$>* reader, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print("}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::$Method$(" + "void $Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "$Request$* request, " "::grpc::ServerAsyncWriter< $Response$>* writer, " @@ -495,7 +495,7 @@ void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, printer->Print("}\n\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, - "void $Service$::AsyncService::$Method$(" + "void $Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " "::grpc::CompletionQueue* cq, void *tag) {\n"); From 20bc56d8908358b1e4f8e8d853a3d3c53f8cb4fe Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 09:02:56 -0800 Subject: [PATCH 078/232] Multi-completion-queue-server Allow binding a different completion queue to each registered method. This will allow multiplexing for the C++ server between sync & async methods more easily. --- include/grpc/grpc.h | 3 +- src/core/iomgr/tcp_server.h | 5 +- src/core/iomgr/tcp_server_posix.c | 11 ++-- src/core/security/server_secure_chttp2.c | 5 +- src/core/surface/server.c | 79 +++++++++++++++++------- src/core/surface/server.h | 2 +- src/core/surface/server_chttp2.c | 4 +- src/cpp/server/server.cc | 2 +- test/core/iomgr/tcp_server_posix_test.c | 6 +- 9 files changed, 77 insertions(+), 40 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index f6c7da4654a..bd766b55b3e 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -565,7 +565,8 @@ grpc_call_error grpc_server_request_call( Must be called before grpc_server_start. Returns NULL on failure. */ void *grpc_server_register_method(grpc_server *server, const char *method, - const char *host); + const char *host, + grpc_completion_queue *new_call_cq); /* Request notification of a new pre-registered call */ grpc_call_error grpc_server_request_registered_call( diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 2558a1eb9f9..11f9b05663d 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -46,8 +46,9 @@ typedef void (*grpc_tcp_server_cb)(void *arg, grpc_endpoint *ep); grpc_tcp_server *grpc_tcp_server_create(void); /* Start listening to bound ports */ -void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset *pollset, - grpc_tcp_server_cb cb, void *cb_arg); +void grpc_tcp_server_start(grpc_tcp_server *server, grpc_pollset **pollsets, + size_t pollset_count, grpc_tcp_server_cb cb, + void *cb_arg); /* Add a port to the server, returning port number on success, or negative on failure. diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 091f0aab1a6..e362dd1e6ce 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -353,9 +353,10 @@ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index) { return (index < s->nports) ? s->ports[index].fd : -1; } -void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset *pollset, - grpc_tcp_server_cb cb, void *cb_arg) { - size_t i; +void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollsets, + size_t pollset_count, grpc_tcp_server_cb cb, + void *cb_arg) { + size_t i, j; GPR_ASSERT(cb); gpr_mu_lock(&s->mu); GPR_ASSERT(!s->cb); @@ -363,8 +364,8 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset *pollset, s->cb = cb; s->cb_arg = cb_arg; for (i = 0; i < s->nports; i++) { - if (pollset) { - grpc_pollset_add_fd(pollset, s->ports[i].emfd); + for (j = 0; j < pollset_count; j++) { + grpc_pollset_add_fd(pollsets[j], s->ports[i].emfd); } grpc_fd_notify_on_read(s->ports[i].emfd, on_read, &s->ports[i]); s->active_ports++; diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index 480c8827943..19056ba23e8 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -76,9 +76,10 @@ static void on_accept(void *server, grpc_endpoint *tcp) { /* Note: the following code is the same with server_chttp2.c */ /* Server callback: start listening on our ports */ -static void start(grpc_server *server, void *tcpp, grpc_pollset *pollset) { +static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets, + size_t pollset_count) { grpc_tcp_server *tcp = tcpp; - grpc_tcp_server_start(tcp, pollset, on_accept, server); + grpc_tcp_server_start(tcp, pollsets, pollset_count, on_accept, server); } /* Server callback: destroy the tcp listener (so we don't generate further diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 80b248ee84e..22588194ea3 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -53,7 +53,7 @@ typedef enum { PENDING_START, ALL_CALLS, CALL_LIST_COUNT } call_list; typedef struct listener { void *arg; - void (*start)(grpc_server *server, void *arg, grpc_pollset *pollset); + void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets, size_t pollset_count); void (*destroy)(grpc_server *server, void *arg); struct listener *next; } listener; @@ -101,6 +101,7 @@ struct registered_method { char *host; call_data *pending; requested_call_array requested; + grpc_completion_queue *cq; registered_method *next; }; @@ -127,7 +128,11 @@ struct grpc_server { size_t channel_filter_count; const grpc_channel_filter **channel_filters; grpc_channel_args *channel_args; - grpc_completion_queue *cq; + grpc_completion_queue *unregistered_cq; + + grpc_completion_queue **cqs; + grpc_pollset **pollsets; + size_t cq_count; gpr_mu mu; @@ -169,6 +174,7 @@ struct call_data { grpc_mdstr *host; legacy_data *legacy; + grpc_completion_queue *cq_new; call_data **root[CALL_LIST_COUNT]; call_link links[CALL_LIST_COUNT]; @@ -496,7 +502,7 @@ static void init_call_elem(grpc_call_element *elem, static void destroy_call_elem(grpc_call_element *elem) { channel_data *chand = elem->channel_data; call_data *calld = elem->call_data; - int i; + size_t i; gpr_mu_lock(&chand->server->mu); for (i = 0; i < CALL_LIST_COUNT; i++) { @@ -504,7 +510,9 @@ static void destroy_call_elem(grpc_call_element *elem) { } if (chand->server->shutdown && chand->server->have_shutdown_tag && chand->server->lists[ALL_CALLS] == NULL) { - grpc_cq_end_server_shutdown(chand->server->cq, chand->server->shutdown_tag); + for (i = 0; i < chand->server->cq_count; i++) { + grpc_cq_end_server_shutdown(chand->server->cqs[i], chand->server->shutdown_tag); + } } gpr_mu_unlock(&chand->server->mu); @@ -557,6 +565,16 @@ static const grpc_channel_filter server_surface_filter = { sizeof(channel_data), init_channel_elem, destroy_channel_elem, "server", }; +static void addcq(grpc_server *server, grpc_completion_queue *cq) { + size_t i, n; + for (i = 0; i < server->cq_count; i++) { + if (server->cqs[i] == cq) return; + } + n = server->cq_count++; + server->cqs = gpr_realloc(server->cqs, server->cq_count * sizeof(grpc_completion_queue*)); + server->cqs[n] = cq; +} + grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, grpc_channel_filter **filters, size_t filter_count, @@ -566,10 +584,11 @@ grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, grpc_server *server = gpr_malloc(sizeof(grpc_server)); memset(server, 0, sizeof(grpc_server)); + if (cq) addcq(server, cq); gpr_mu_init(&server->mu); - server->cq = cq; + server->unregistered_cq = cq; /* decremented by grpc_server_destroy */ gpr_ref_init(&server->internal_refcount, 1); server->root_channel_data.next = server->root_channel_data.prev = @@ -605,7 +624,7 @@ static int streq(const char *a, const char *b) { } void *grpc_server_register_method(grpc_server *server, const char *method, - const char *host) { + const char *host, grpc_completion_queue *cq_new_rpc) { registered_method *m; if (!method) { gpr_log(GPR_ERROR, "%s method string cannot be NULL", __FUNCTION__); @@ -618,20 +637,28 @@ void *grpc_server_register_method(grpc_server *server, const char *method, return NULL; } } + addcq(server, cq_new_rpc); m = gpr_malloc(sizeof(registered_method)); memset(m, 0, sizeof(*m)); m->method = gpr_strdup(method); m->host = gpr_strdup(host); m->next = server->registered_methods; + m->cq = cq_new_rpc; server->registered_methods = m; return m; } void grpc_server_start(grpc_server *server) { listener *l; + size_t i; + + server->pollsets = gpr_malloc(sizeof(grpc_pollset*) * server->cq_count); + for (i = 0; i < server->cq_count; i++) { + server->pollsets[i] = grpc_cq_pollset(server->cqs[i]); + } for (l = server->listeners; l; l = l->next) { - l->start(server, l->arg, grpc_cq_pollset(server->cq)); + l->start(server, l->arg, server->pollsets, server->cq_count); } } @@ -664,7 +691,9 @@ grpc_transport_setup_result grpc_server_setup_transport( } filters[i] = &grpc_connected_channel_filter; - grpc_transport_add_to_pollset(transport, grpc_cq_pollset(s->cq)); + for (i = 0; i < s->cq_count; i++) { + grpc_transport_add_to_pollset(transport, grpc_cq_pollset(s->cqs[i])); + } channel = grpc_channel_create_from_filters(filters, num_filters, s->channel_args, mdctx, 0); @@ -765,9 +794,11 @@ static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, server->have_shutdown_tag = have_shutdown_tag; server->shutdown_tag = shutdown_tag; if (have_shutdown_tag) { - grpc_cq_begin_op(server->cq, NULL, GRPC_SERVER_SHUTDOWN); - if (server->lists[ALL_CALLS] == NULL) { - grpc_cq_end_server_shutdown(server->cq, shutdown_tag); + for (i = 0; i < server->cq_count; i++) { + grpc_cq_begin_op(server->cqs[i], NULL, GRPC_SERVER_SHUTDOWN); + if (server->lists[ALL_CALLS] == NULL) { + grpc_cq_end_server_shutdown(server->cqs[i], shutdown_tag); + } } } gpr_mu_unlock(&server->mu); @@ -826,7 +857,7 @@ void grpc_server_destroy(grpc_server *server) { void grpc_server_add_listener(grpc_server *server, void *arg, void (*start)(grpc_server *server, void *arg, - grpc_pollset *pollset), + grpc_pollset **pollsets, size_t pollset_count), void (*destroy)(grpc_server *server, void *arg)) { listener *l = gpr_malloc(sizeof(listener)); l->arg = arg; @@ -878,7 +909,7 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_completion_queue *cq_bind, void *tag) { requested_call rc; - grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); + grpc_cq_begin_op(server->unregistered_cq, NULL, GRPC_OP_COMPLETE); rc.type = BATCH_CALL; rc.tag = tag; rc.data.batch.cq_bind = cq_bind; @@ -889,12 +920,13 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, } grpc_call_error grpc_server_request_registered_call( - grpc_server *server, void *registered_method, grpc_call **call, + grpc_server *server, void *rm, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *initial_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bind, void *tag) { requested_call rc; - grpc_cq_begin_op(server->cq, NULL, GRPC_OP_COMPLETE); + registered_method *registered_method = rm; + grpc_cq_begin_op(registered_method->cq, NULL, GRPC_OP_COMPLETE); rc.type = REGISTERED_CALL; rc.tag = tag; rc.data.registered.cq_bind = cq_bind; @@ -909,7 +941,7 @@ grpc_call_error grpc_server_request_registered_call( grpc_call_error grpc_server_request_call_old(grpc_server *server, void *tag_new) { requested_call rc; - grpc_cq_begin_op(server->cq, NULL, GRPC_SERVER_RPC_NEW); + grpc_cq_begin_op(server->unregistered_cq, NULL, GRPC_SERVER_RPC_NEW); rc.type = LEGACY_CALL; rc.tag = tag_new; return queue_call_request(server, &rc); @@ -965,6 +997,7 @@ static void begin_call(grpc_server *server, call_data *calld, r->op = GRPC_IOREQ_RECV_INITIAL_METADATA; r->data.recv_metadata = rc->data.batch.initial_metadata; r++; + calld->cq_new = server->unregistered_cq; publish = publish_registered_or_batch; break; case REGISTERED_CALL: @@ -979,6 +1012,7 @@ static void begin_call(grpc_server *server, call_data *calld, r->data.recv_message = rc->data.registered.optional_payload; r++; } + calld->cq_new = rc->data.registered.registered_method->cq; publish = publish_registered_or_batch; break; } @@ -991,19 +1025,19 @@ static void begin_call(grpc_server *server, call_data *calld, static void fail_call(grpc_server *server, requested_call *rc) { switch (rc->type) { case LEGACY_CALL: - grpc_cq_end_new_rpc(server->cq, rc->tag, NULL, do_nothing, NULL, NULL, + grpc_cq_end_new_rpc(server->unregistered_cq, rc->tag, NULL, do_nothing, NULL, NULL, NULL, gpr_inf_past, 0, NULL); break; case BATCH_CALL: *rc->data.batch.call = NULL; rc->data.batch.initial_metadata->count = 0; - grpc_cq_end_op_complete(server->cq, rc->tag, NULL, do_nothing, NULL, + grpc_cq_end_op_complete(server->unregistered_cq, rc->tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); break; case REGISTERED_CALL: *rc->data.registered.call = NULL; rc->data.registered.initial_metadata->count = 0; - grpc_cq_end_op_complete(server->cq, rc->tag, NULL, do_nothing, NULL, + grpc_cq_end_op_complete(rc->data.registered.registered_method->cq, rc->tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); break; } @@ -1017,7 +1051,7 @@ static void publish_legacy(grpc_call *call, grpc_op_error status, void *tag) { grpc_server *server = chand->server; if (status == GRPC_OP_OK) { - grpc_cq_end_new_rpc(server->cq, tag, call, do_nothing, NULL, + grpc_cq_end_new_rpc(server->unregistered_cq, tag, call, do_nothing, NULL, grpc_mdstr_as_c_string(calld->path), grpc_mdstr_as_c_string(calld->host), calld->deadline, calld->legacy->initial_metadata.count, @@ -1032,9 +1066,8 @@ static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, void *tag) { grpc_call_element *elem = grpc_call_stack_element(grpc_call_get_call_stack(call), 0); - channel_data *chand = elem->channel_data; - grpc_server *server = chand->server; - grpc_cq_end_op_complete(server->cq, tag, call, do_nothing, NULL, status); + call_data *calld = elem->call_data; + grpc_cq_end_op_complete(calld->cq_new, tag, call, do_nothing, NULL, status); } const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { diff --git a/src/core/surface/server.h b/src/core/surface/server.h index 50574d66a40..c8861f420d8 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -48,7 +48,7 @@ grpc_server *grpc_server_create_from_filters(grpc_completion_queue *cq, and when it shuts down, it will call destroy */ void grpc_server_add_listener(grpc_server *server, void *listener, void (*start)(grpc_server *server, void *arg, - grpc_pollset *pollset), + grpc_pollset **pollsets, size_t npollsets), void (*destroy)(grpc_server *server, void *arg)); /* Setup a transport - creates a channel stack, binds the transport to the diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index 5ba7d47efd9..3b6abb7d032 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -59,9 +59,9 @@ static void new_transport(void *server, grpc_endpoint *tcp) { } /* Server callback: start listening on our ports */ -static void start(grpc_server *server, void *tcpp, grpc_pollset *pollset) { +static void start(grpc_server *server, void *tcpp, grpc_pollset **pollsets, size_t pollset_count) { grpc_tcp_server *tcp = tcpp; - grpc_tcp_server_start(tcp, pollset, new_transport, server); + grpc_tcp_server_start(tcp, pollsets, pollset_count, new_transport, server); } /* Server callback: destroy the tcp listener (so we don't generate further diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 17b0543bcd3..938a549d4fa 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -84,7 +84,7 @@ Server::~Server() { bool Server::RegisterService(RpcService *service) { for (int i = 0; i < service->GetMethodCount(); ++i) { RpcServiceMethod *method = service->GetMethod(i); - void *tag = grpc_server_register_method(server_, method->name(), nullptr); + void *tag = grpc_server_register_method(server_, method->name(), nullptr, cq_.cq()); if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index e906f302cf6..ae6994ef071 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -66,7 +66,7 @@ static void test_no_op(void) { static void test_no_op_with_start(void) { grpc_tcp_server *s = grpc_tcp_server_create(); LOG_TEST(); - grpc_tcp_server_start(s, NULL, on_connect, NULL); + grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); grpc_tcp_server_destroy(s); } @@ -93,7 +93,7 @@ static void test_no_op_with_port_and_start(void) { GPR_ASSERT( grpc_tcp_server_add_port(s, (struct sockaddr *)&addr, sizeof(addr))); - grpc_tcp_server_start(s, NULL, on_connect, NULL); + grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); grpc_tcp_server_destroy(s); } @@ -120,7 +120,7 @@ static void test_connect(int n) { GPR_ASSERT(getsockname(svrfd, (struct sockaddr *)&addr, &addr_len) == 0); GPR_ASSERT(addr_len <= sizeof(addr)); - grpc_tcp_server_start(s, NULL, on_connect, NULL); + grpc_tcp_server_start(s, NULL, 0, on_connect, NULL); for (i = 0; i < n; i++) { deadline = gpr_time_add(gpr_now(), gpr_time_from_micros(10000000)); From ea222b2001bddc573f9151847cdd339ff517e54c Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 09:38:51 -0800 Subject: [PATCH 079/232] resolve comments, the context_ member needs protection for thread safety --- include/grpc++/client_context.h | 1 + include/grpc++/impl/call.h | 9 --- include/grpc++/stream.h | 100 ++++++++++++++++++-------------- 3 files changed, 58 insertions(+), 52 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 0a81f6a3666..f74de8fad4f 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -95,6 +95,7 @@ class ClientContext { gpr_timespec RawDeadline() { return absolute_deadline_; } + bool initial_metadata_received_ = false; grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 5fafd0e8904..a1ef9268f0c 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -134,16 +134,7 @@ class Call final { grpc_call *call() { return call_; } CompletionQueue *cq() { return cq_; } - // TODO(yangg) change it to a general state query function. - bool initial_metadata_received() { - return initial_metadata_received_; - } - void set_initial_metadata_received() { - initial_metadata_received_ = true; - } - private: - bool initial_metadata_received_ = false; CallHook *call_hook_; CompletionQueue *cq_; grpc_call* call_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6265310c5a8..74e7539aa47 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -99,21 +99,25 @@ class ClientReader final : public ClientStreamingInterface, } // Blocking wait for initial metadata from server. The received metadata - // can only be accessed after this call returns. Calling this method is - // optional as it will be called internally before the first Read. + // can only be accessed after this call returns. Should only be called before + // the first read. Calling this method is optional, and if it is not called + // the metadata will be available in ClientContext after the first read. void WaitForInitialMetadata() { - if (!call_.initial_metadata_received()) { - CallOpBuffer buf; - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - call_.PerformOps(&buf); - GPR_ASSERT(cq_.Pluck(&buf)); - call_.set_initial_metadata_received(); - } + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpBuffer buf; + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + context_->initial_metadata_received_ = true; } virtual bool Read(R *msg) override { - WaitForInitialMetadata(); CallOpBuffer buf; + if (!context_->initial_metadata_received_) { + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } bool got_message; buf.AddRecvMessage(msg, &got_message); call_.PerformOps(&buf); @@ -201,21 +205,25 @@ class ClientReaderWriter final : public ClientStreamingInterface, } // Blocking wait for initial metadata from server. The received metadata - // can only be accessed after this call returns. Calling this method is - // optional as it will be called internally before the first Read. + // can only be accessed after this call returns. Should only be called before + // the first read. Calling this method is optional, and if it is not called + // the metadata will be available in ClientContext after the first read. void WaitForInitialMetadata() { - if (!call_.initial_metadata_received()) { - CallOpBuffer buf; - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - call_.PerformOps(&buf); - GPR_ASSERT(cq_.Pluck(&buf)); - call_.set_initial_metadata_received(); - } + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpBuffer buf; + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + GPR_ASSERT(cq_.Pluck(&buf)); + context_->initial_metadata_received_ = true; } virtual bool Read(R *msg) override { - WaitForInitialMetadata(); CallOpBuffer buf; + if (!context_->initial_metadata_received_) { + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } bool got_message; buf.AddRecvMessage(msg, &got_message); call_.PerformOps(&buf); @@ -257,13 +265,13 @@ class ServerReader final : public ReaderInterface { ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - if (!ctx_->sent_initial_metadata_) { - CallOpBuffer buf; - buf.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&buf); - call_->cq()->Pluck(&buf); - } + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); } virtual bool Read(R* msg) override { @@ -285,18 +293,21 @@ class ServerWriter final : public WriterInterface { ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - if (!ctx_->sent_initial_metadata_) { - CallOpBuffer buf; - buf.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&buf); - call_->cq()->Pluck(&buf); - } + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); } virtual bool Write(const W& msg) override { - SendInitialMetadata(); CallOpBuffer buf; + if (!ctx_->sent_initial_metadata_) { + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); @@ -315,13 +326,13 @@ class ServerReaderWriter final : public WriterInterface, ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} void SendInitialMetadata() { - if (!ctx_->sent_initial_metadata_) { - CallOpBuffer buf; - buf.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&buf); - call_->cq()->Pluck(&buf); - } + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + CallOpBuffer buf; + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&buf); + call_->cq()->Pluck(&buf); } virtual bool Read(R* msg) override { @@ -333,8 +344,11 @@ class ServerReaderWriter final : public WriterInterface, } virtual bool Write(const W& msg) override { - SendInitialMetadata(); CallOpBuffer buf; + if (!ctx_->sent_initial_metadata_) { + buf.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } buf.AddSendMessage(msg); call_->PerformOps(&buf); return call_->cq()->Pluck(&buf); From bc8e3db73eecec79e5592c1e1723f6b69095e84a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 09:56:02 -0800 Subject: [PATCH 080/232] Re-add mysteriously disappearing lines --- src/cpp/server/server.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index ea5d3651546..90a2863b0ce 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -177,6 +177,9 @@ class Server::MethodRequestData final : public CompletionQueueTag { auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; + if (!ctx_.sent_initial_metadata_) { + buf.AddSendInitialMetadata(&ctx_.initial_metadata_); + } if (has_response_payload_) { buf.AddSendMessage(*res); } From 424bc92e377ad0f2aed23bb4bcde6bb06aa49774 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 10:24:39 -0800 Subject: [PATCH 081/232] implement ClientAsyncX api --- include/grpc++/stream.h | 105 ++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 20 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 74e7539aa47..52a764bfc4e 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -365,6 +365,8 @@ class ClientAsyncStreamingInterface { public: virtual ~ClientAsyncStreamingInterface() {} + virtual void ReadInitialMetadata(void* tag) = 0; + virtual void Finish(Status* status, void* tag) = 0; }; @@ -390,30 +392,50 @@ template class ClientAsyncReader final : public ClientAsyncStreamingInterface, public AsyncReaderInterface { public: - // Blocking create a stream and write the first request out. + // Create a stream and write the first request out. ClientAsyncReader(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request, void* tag) - : call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { init_buf_.Reset(tag); + init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); init_buf_.AddSendMessage(request); init_buf_.AddClientSendClose(); call_.PerformOps(&init_buf_); } - virtual void Read(R *msg, void* tag) override { + void ReadInitialMetadata(void* tag) override { + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpBuffer buf; + buf.Reset(tag); + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + context_->initial_metadata_received_ = true; + } + + void Read(R *msg, void* tag) override { read_buf_.Reset(tag); + if (!context_->initial_metadata_received_) { + read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } - virtual void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); - finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata + if (!context_->initial_metadata_received_) { + finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } + finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } private: + ClientContext* context_ = nullptr; CompletionQueue cq_; Call call_; CallOpBuffer init_buf_; @@ -425,37 +447,56 @@ template class ClientAsyncWriter final : public ClientAsyncStreamingInterface, public WriterInterface { public: - // Blocking create a stream. ClientAsyncWriter(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, - google::protobuf::Message *response) - : response_(response), - call_(channel->CreateCall(method, context, &cq_)) {} + google::protobuf::Message *response, void* tag) + : context_(context), response_(response), + call_(channel->CreateCall(method, context, &cq_)) { + init_buf_.Reset(tag); + init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); + call_.PerformOps(&init_buf_); + } - virtual void Write(const W& msg, void* tag) override { + void ReadInitialMetadata(void* tag) override { + GPR_ASSERT(!context_->initial_metadata_received_); + + CallOpBuffer buf; + buf.Reset(tag); + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + context_->initial_metadata_received_ = true; + } + + void Write(const W& msg, void* tag) override { write_buf_.Reset(tag); write_buf_.AddSendMessage(msg); call_.PerformOps(&write_buf_); } - virtual void WritesDone(void* tag) override { + void WritesDone(void* tag) override { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); } - virtual void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); + if (!context_->initial_metadata_received_) { + finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } finish_buf_.AddRecvMessage(response_, &got_message_); - finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata + finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } private: + ClientContext* context_ = nullptr; google::protobuf::Message *const response_; bool got_message_; CompletionQueue cq_; Call call_; + CallOpBuffer init_buf_; CallOpBuffer write_buf_; CallOpBuffer writes_done_buf_; CallOpBuffer finish_buf_; @@ -468,36 +509,60 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, public AsyncReaderInterface { public: ClientAsyncReaderWriter(ChannelInterface *channel, - const RpcMethod &method, ClientContext *context) - : call_(channel->CreateCall(method, context, &cq_)) {} + const RpcMethod &method, ClientContext *context, void* tag) + : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + init_buf_.Reset(tag); + init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); + call_.PerformOps(&init_buf_); + } + + void ReadInitialMetadata(void* tag) override { + GPR_ASSERT(!context_->initial_metadata_received_); - virtual void Read(R *msg, void* tag) override { + CallOpBuffer buf; + buf.Reset(tag); + buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&buf); + context_->initial_metadata_received_ = true; + } + + void Read(R *msg, void* tag) override { read_buf_.Reset(tag); + if (!context_->initial_metadata_received_) { + read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } - virtual void Write(const W& msg, void* tag) override { + void Write(const W& msg, void* tag) override { write_buf_.Reset(tag); write_buf_.AddSendMessage(msg); call_.PerformOps(&write_buf_); } - virtual void WritesDone(void* tag) override { + void WritesDone(void* tag) override { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); } - virtual void Finish(Status* status, void* tag) override { + void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); - finish_buf_.AddClientRecvStatus(nullptr, status); // TODO metadata + if (!context_->initial_metadata_received_) { + finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + context_->initial_metadata_received_ = true; + } + finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } private: + ClientContext* context_ = nullptr; CompletionQueue cq_; Call call_; + CallOpBuffer init_buf_; CallOpBuffer read_buf_; CallOpBuffer write_buf_; CallOpBuffer writes_done_buf_; From 8c8d0aa1d881fbcf393a73f99b86ed29a866f8ff Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 11:38:36 -0800 Subject: [PATCH 082/232] Async API progress --- include/grpc++/impl/service_type.h | 18 +++++-- include/grpc++/server.h | 3 +- include/grpc++/server_builder.h | 7 ++- src/compiler/cpp_generator.cc | 67 +++++++++++++++++--------- src/cpp/server/server.cc | 75 +++++++++++++++++++----------- src/cpp/server/server_builder.cc | 22 +++++---- 6 files changed, 129 insertions(+), 63 deletions(-) diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 0684f322d8d..30654553ade 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -37,19 +37,29 @@ namespace grpc { class RpcService; +class Server; class SynchronousService { public: virtual ~SynchronousService() {} - virtual RpcService *service() = 0; + virtual RpcService* service() = 0; }; class AsynchronousService { public: - virtual ~AsynchronousService() {} - virtual RpcService *service() = 0; + AsynchronousService(CompletionQueue* cq, const char** method_names, size_t method_count) : cq_(cq), method_names_(method_names), method_count_(method_count) {} + + CompletionQueue* completion_queue() const { return cq_; } + + private: + friend class Server; + CompletionQueue* const cq_; + Server* server_ = nullptr; + const char**const method_names_; + size_t method_count_; + std::vector request_args_; }; } // namespace grpc -#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 98f3f171975..77aac75076e 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -53,7 +53,7 @@ class Message; } // namespace google namespace grpc { -class AsyncServerContext; +class AsynchronousService; class RpcService; class RpcServiceMethod; class ServerCredentials; @@ -79,6 +79,7 @@ class Server final : private CallHook { // Register a service. This call does not take ownership of the service. // The service must exist for the lifetime of the Server instance. bool RegisterService(RpcService* service); + bool RegisterAsyncService(AsynchronousService* service); // Add a listening port. Can be called multiple times. int AddPort(const grpc::string& addr); // Start the server. diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 8b4c81bc873..a550a53afb5 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -42,6 +42,7 @@ namespace grpc { class AsynchronousService; +class CompletionQueue; class RpcService; class Server; class ServerCredentials; @@ -57,7 +58,11 @@ class ServerBuilder { // BuildAndStart(). void RegisterService(SynchronousService* service); - void RegisterAsyncService(AsynchronousService *service); + // Register an asynchronous service. New calls will be delevered to cq. + // This call does not take ownership of the service or completion queue. + // The service and completion queuemust exist for the lifetime of the Server + // instance returned by BuildAndStart(). + void RegisterAsyncService(AsynchronousService* service); // Add a listening port. Can be called multiple times. void AddPort(const grpc::string& addr); diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index e29cfadcefb..4a31ff949e8 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -41,10 +41,18 @@ #include #include #include +#include namespace grpc_cpp_generator { namespace { +template +std::string as_string(T x) { + std::ostringstream out; + out << x; + return out.str(); +} + bool NoStreaming(const google::protobuf::MethodDescriptor *method) { return !method->client_streaming() && !method->server_streaming(); } @@ -113,6 +121,7 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { "#include \n" "\n" "namespace grpc {\n" + "class CompletionQueue;\n" "class ChannelInterface;\n" "class RpcService;\n" "class ServerContext;\n"; @@ -325,16 +334,13 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, "class AsyncService final : public ::grpc::AsynchronousService {\n" " public:\n"); printer->Indent(); - printer->Print("AsyncService() : service_(nullptr) {}\n"); + (*vars)["MethodCount"] = as_string(service->method_count()); + printer->Print("explicit AsyncService(::grpc::CompletionQueue* cq);\n"); printer->Print("~AsyncService();\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderServerMethodAsync(printer, service->method(i), vars); } - printer->Print("::grpc::RpcService* service() override;\n"); printer->Outdent(); - printer->Print( - " private:\n" - " ::grpc::RpcService* service_;\n"); printer->Print("};\n"); printer->Outdent(); @@ -369,7 +375,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "const $Request$& request, $Response$* response) {\n"); printer->Print(*vars, "return ::grpc::BlockingUnaryCall(channel()," - "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\"), " + "::grpc::RpcMethod($Service$_method_names[$Idx$]), " "context, request, response);\n" "}\n\n"); } else if (ClientOnlyStreaming(method)) { @@ -380,7 +386,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, " return new ::grpc::ClientWriter< $Request$>(" "channel()," - "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " "context, response);\n" "}\n\n"); @@ -392,7 +398,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, " return new ::grpc::ClientReader< $Response$>(" "channel()," - "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " "context, *request);\n" "}\n\n"); @@ -405,7 +411,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, *vars, " return new ::grpc::ClientReaderWriter< $Request$, $Response$>(" "channel()," - "::grpc::RpcMethod(\"/$Package$$Service$/$Method$\", " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " "context);\n" "}\n\n"); @@ -462,9 +468,10 @@ void PrintSourceServerMethod(google::protobuf::io::Printer *printer, } } -void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, - const google::protobuf::MethodDescriptor *method, - std::map *vars) { +void PrintSourceServerAsyncMethod( + google::protobuf::io::Printer *printer, + const google::protobuf::MethodDescriptor *method, + std::map *vars) { (*vars)["Method"] = method->name(); (*vars)["Request"] = grpc_cpp_generator::ClassName(method->input_type(), true); @@ -494,11 +501,12 @@ void PrintSourceServerAsyncMethod(google::protobuf::io::Printer *printer, "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print("}\n\n"); } else if (BidiStreaming(method)) { - printer->Print(*vars, - "void $Service$::AsyncService::Request$Method$(" - "::grpc::ServerContext* context, " - "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " - "::grpc::CompletionQueue* cq, void *tag) {\n"); + printer->Print( + *vars, + "void $Service$::AsyncService::Request$Method$(" + "::grpc::ServerContext* context, " + "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " + "::grpc::CompletionQueue* cq, void *tag) {\n"); printer->Print("}\n\n"); } } @@ -507,6 +515,14 @@ void PrintSourceService(google::protobuf::io::Printer *printer, const google::protobuf::ServiceDescriptor *service, std::map *vars) { (*vars)["Service"] = service->name(); + + printer->Print(*vars, "static const char* $Service$_method_names[] = {\n"); + for (int i = 0; i < service->method_count(); ++i) { + (*vars)["Method"] = service->method(i)->name(); + printer->Print(*vars, " \"/$Package$$Service$/$Method$\",\n"); + } + printer->Print(*vars, "};\n\n"); + printer->Print( *vars, "$Service$::Stub* $Service$::NewStub(" @@ -516,9 +532,17 @@ void PrintSourceService(google::protobuf::io::Printer *printer, " return stub;\n" "};\n\n"); for (int i = 0; i < service->method_count(); ++i) { + (*vars)["Idx"] = as_string(i); PrintSourceClientMethod(printer, service->method(i), vars); } + (*vars)["MethodCount"] = as_string(service->method_count()); + printer->Print( + *vars, + "$Service$::AsyncService::AsyncService(::grpc::CompletionQueue* cq) : " + "::grpc::AsynchronousService(cq, $Service$_method_names, $MethodCount$) " + "{}\n\n"); + printer->Print(*vars, "$Service$::Service::~Service() {\n" " delete service_;\n" @@ -537,6 +561,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, printer->Print("service_ = new ::grpc::RpcService();\n"); for (int i = 0; i < service->method_count(); ++i) { const google::protobuf::MethodDescriptor *method = service->method(i); + (*vars)["Idx"] = as_string(i); (*vars)["Method"] = method->name(); (*vars)["Request"] = grpc_cpp_generator::ClassName(method->input_type(), true); @@ -546,7 +571,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " \"/$Package$$Service$/$Method$\",\n" + " $Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::NORMAL_RPC,\n" " new ::grpc::RpcMethodHandler< $Service$::Service, $Request$, " "$Response$>(\n" @@ -558,7 +583,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " \"/$Package$$Service$/$Method$\",\n" + " $Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::CLIENT_STREAMING,\n" " new ::grpc::ClientStreamingHandler< " "$Service$::Service, $Request$, $Response$>(\n" @@ -571,7 +596,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " \"/$Package$$Service$/$Method$\",\n" + " $Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::SERVER_STREAMING,\n" " new ::grpc::ServerStreamingHandler< " "$Service$::Service, $Request$, $Response$>(\n" @@ -584,7 +609,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, printer->Print( *vars, "service_->AddMethod(new ::grpc::RpcServiceMethod(\n" - " \"/$Package$$Service$/$Method$\",\n" + " $Service$_method_names[$Idx$],\n" " ::grpc::RpcMethod::BIDI_STREAMING,\n" " new ::grpc::BidiStreamingHandler< " "$Service$::Service, $Request$, $Response$>(\n" diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 90a2863b0ce..20dd135a86f 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -47,8 +48,8 @@ namespace grpc { -Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, - ServerCredentials *creds) +Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, + ServerCredentials* creds) : started_(false), shutdown_(false), num_running_cb_(0), @@ -56,7 +57,8 @@ Server::Server(ThreadPoolInterface *thread_pool, bool thread_pool_owned, thread_pool_owned_(thread_pool_owned), secure_(creds != nullptr) { if (creds) { - server_ = grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); + server_ = + grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); } else { server_ = grpc_server_create(cq_.cq(), nullptr); } @@ -81,10 +83,11 @@ Server::~Server() { } } -bool Server::RegisterService(RpcService *service) { +bool Server::RegisterService(RpcService* service) { for (int i = 0; i < service->GetMethodCount(); ++i) { - RpcServiceMethod *method = service->GetMethod(i); - void *tag = grpc_server_register_method(server_, method->name(), nullptr, cq_.cq()); + RpcServiceMethod* method = service->GetMethod(i); + void* tag = + grpc_server_register_method(server_, method->name(), nullptr, cq_.cq()); if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); @@ -95,7 +98,24 @@ bool Server::RegisterService(RpcService *service) { return true; } -int Server::AddPort(const grpc::string &addr) { +bool Server::RegisterAsyncService(AsynchronousService* service) { + GPR_ASSERT(service->server_ == nullptr && "Can only register an asynchronous service against one server."); + service->server_ = this; + service->request_args_.reserve(service->method_count_); + for (size_t i = 0; i < service->method_count_; ++i) { + void* tag = grpc_server_register_method(server_, service->method_names_[i], nullptr, + service->completion_queue()->cq()); + if (!tag) { + gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", + service->method_names_[i]); + return false; + } + service->request_args_.push_back(tag); + } + return true; +} + +int Server::AddPort(const grpc::string& addr) { GPR_ASSERT(!started_); if (secure_) { return grpc_server_add_secure_http2_port(server_, addr.c_str()); @@ -106,7 +126,7 @@ int Server::AddPort(const grpc::string &addr) { class Server::MethodRequestData final : public CompletionQueueTag { public: - MethodRequestData(RpcServiceMethod *method, void *tag) + MethodRequestData(RpcServiceMethod* method, void* tag) : method_(method), tag_(tag), has_request_payload_(method->method_type() == RpcMethod::NORMAL_RPC || @@ -118,33 +138,33 @@ class Server::MethodRequestData final : public CompletionQueueTag { grpc_metadata_array_init(&request_metadata_); } - static MethodRequestData *Wait(CompletionQueue *cq, bool *ok) { - void *tag = nullptr; + static MethodRequestData* Wait(CompletionQueue* cq, bool* ok) { + void* tag = nullptr; *ok = false; if (!cq->Next(&tag, ok)) { return nullptr; } - auto *mrd = static_cast(tag); + auto* mrd = static_cast(tag); GPR_ASSERT(mrd->in_flight_); return mrd; } - void Request(grpc_server *server) { + void Request(grpc_server* server) { GPR_ASSERT(!in_flight_); in_flight_ = true; cq_ = grpc_completion_queue_create(); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_registered_call( server, tag_, &call_, &deadline_, &request_metadata_, - has_request_payload_ ? &request_payload_ : nullptr, - cq_, this)); + has_request_payload_ ? &request_payload_ : nullptr, cq_, + this)); } - void FinalizeResult(void **tag, bool *status) override {} + void FinalizeResult(void** tag, bool* status) override {} class CallData { public: - explicit CallData(Server *server, MethodRequestData *mrd) + explicit CallData(Server* server, MethodRequestData* mrd) : cq_(mrd->cq_), call_(mrd->call_, server, &cq_), ctx_(mrd->deadline_, mrd->request_metadata_.metadata, @@ -196,21 +216,21 @@ class Server::MethodRequestData final : public CompletionQueueTag { ServerContext ctx_; const bool has_request_payload_; const bool has_response_payload_; - grpc_byte_buffer *request_payload_; - RpcServiceMethod *const method_; + grpc_byte_buffer* request_payload_; + RpcServiceMethod* const method_; }; private: - RpcServiceMethod *const method_; - void *const tag_; + RpcServiceMethod* const method_; + void* const tag_; bool in_flight_ = false; const bool has_request_payload_; const bool has_response_payload_; - grpc_call *call_; + grpc_call* call_; gpr_timespec deadline_; grpc_metadata_array request_metadata_; - grpc_byte_buffer *request_payload_; - grpc_completion_queue *cq_; + grpc_byte_buffer* request_payload_; + grpc_completion_queue* cq_; }; bool Server::Start() { @@ -220,7 +240,7 @@ bool Server::Start() { // Start processing rpcs. if (!methods_.empty()) { - for (auto &m : methods_) { + for (auto& m : methods_) { m.Request(server_); } @@ -246,14 +266,13 @@ void Server::Shutdown() { } } -void Server::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { +void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) { static const size_t MAX_OPS = 8; size_t nops = MAX_OPS; grpc_op ops[MAX_OPS]; buf->FillOps(ops, &nops); GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call->call(), ops, nops, - buf)); + grpc_call_start_batch(call->call(), ops, nops, buf)); } void Server::ScheduleCallback() { @@ -267,7 +286,7 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; - auto *mrd = MethodRequestData::Wait(&cq_, &ok); + auto* mrd = MethodRequestData::Wait(&cq_, &ok); if (mrd) { ScheduleCallback(); if (ok) { diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index d6bcb9313aa..dd23e929b15 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -43,25 +43,25 @@ namespace grpc { ServerBuilder::ServerBuilder() {} -void ServerBuilder::RegisterService(SynchronousService *service) { +void ServerBuilder::RegisterService(SynchronousService* service) { services_.push_back(service->service()); } -void ServerBuilder::RegisterAsyncService(AsynchronousService *service) { +void ServerBuilder::RegisterAsyncService(AsynchronousService* service) { async_services_.push_back(service); } -void ServerBuilder::AddPort(const grpc::string &addr) { +void ServerBuilder::AddPort(const grpc::string& addr) { ports_.push_back(addr); } void ServerBuilder::SetCredentials( - const std::shared_ptr &creds) { + const std::shared_ptr& creds) { GPR_ASSERT(!creds_); creds_ = creds; } -void ServerBuilder::SetThreadPool(ThreadPoolInterface *thread_pool) { +void ServerBuilder::SetThreadPool(ThreadPoolInterface* thread_pool) { thread_pool_ = thread_pool; } @@ -77,13 +77,19 @@ std::unique_ptr ServerBuilder::BuildAndStart() { thread_pool_ = new ThreadPool(cores); thread_pool_owned = true; } - std::unique_ptr server(new Server(thread_pool_, thread_pool_owned, creds_.get())); - for (auto *service : services_) { + std::unique_ptr server( + new Server(thread_pool_, thread_pool_owned, creds_.get())); + for (auto* service : services_) { if (!server->RegisterService(service)) { return nullptr; } } - for (auto &port : ports_) { + for (auto* service : async_services_) { + if (!server->RegisterAsyncService(service)) { + return nullptr; + } + } + for (auto& port : ports_) { if (!server->AddPort(port)) { return nullptr; } From a38feb9be756ef2fe06dc192b1d74bd015a384ee Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 12:05:20 -0800 Subject: [PATCH 083/232] Implement async streaming APIs --- include/grpc++/server_context.h | 2 +- include/grpc++/stream.h | 139 ++++++++++++++++++++++++++++---- 2 files changed, 125 insertions(+), 16 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 6cc3716291c..e976e118147 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -72,7 +72,7 @@ class ServerContext { template friend class ::grpc::ServerReader; template friend class ::grpc::ServerWriter; template friend class ::grpc::ServerReaderWriter; - + ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); const std::chrono::system_clock::time_point deadline_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 52a764bfc4e..6dc05bc9a6b 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -370,6 +370,15 @@ class ClientAsyncStreamingInterface { virtual void Finish(Status* status, void* tag) = 0; }; +class ServerAsyncStreamingInterface { + public: + virtual ~ServerAsyncStreamingInterface() {} + + virtual void SendInitialMetadata(void* tag) = 0; + + virtual void Finish(const Status& status, void* tag) = 0; +}; + // An interface that yields a sequence of R messages. template class AsyncReaderInterface { @@ -577,6 +586,7 @@ class ServerAsyncResponseWriter final { virtual void Write(const W& msg, void* tag) override { CallOpBuffer buf; + buf.Reset(tag); buf.AddSendMessage(msg); call_->PerformOps(&buf); } @@ -586,48 +596,147 @@ class ServerAsyncResponseWriter final { }; template -class ServerAsyncReader : public AsyncReaderInterface { +class ServerAsyncReader : public ServerAsyncStreamingInterface, + public AsyncReaderInterface { public: - explicit ServerAsyncReader(Call* call) : call_(call) {} + ServerAsyncReader(Call* call, ServerContext* ctx) + : call_(call), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) override { + GPR_ASSERT(!ctx_->sent_initial_metadata_); - virtual void Read(R* msg, void* tag) { - // TODO + meta_buf_.Reset(tag); + meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&meta_buf_); + } + + void Read(R* msg, void* tag) override { + read_buf_.Reset(tag); + read_buf_.AddRecvMessage(msg); + call_->PerformOps(&read_buf_); + } + + void Finish(const Status& status, void* tag) override { + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_->PerformOps(&finish_buf_); } + private: Call* call_; + ServerContext* ctx_; + CallOpBuffer meta_buf_; + CallOpBuffer read_buf_; + CallOpBuffer finish_buf_; }; template -class ServerAsyncWriter : public AsyncWriterInterface { +class ServerAsyncWriter : public ServerAsyncStreamingInterface, + public AsyncWriterInterface { public: - explicit ServerAsyncWriter(Call* call) : call_(call) {} + ServerAsyncWriter(Call* call, ServerContext* ctx) + : call_(call), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) override { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_buf_.Reset(tag); + meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&meta_buf_); + } + + void Write(const W& msg, void* tag) override { + write_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + write_buf_.AddSendMessage(msg); + call_->PerformOps(&write_buf_); + } - virtual void Write(const W& msg, void* tag) { - // TODO + void Finish(const Status& status, void* tag) override { + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_->PerformOps(&finish_buf_); } private: Call* call_; + ServerContext* ctx_; + CallOpBuffer meta_buf_; + CallOpBuffer write_buf_; + CallOpBuffer finish_buf_; }; // Server-side interface for bi-directional streaming. template -class ServerAsyncReaderWriter : public AsyncWriterInterface, - public AsyncReaderInterface { +class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, + public AsyncWriterInterface, + public AsyncReaderInterface { public: - explicit ServerAsyncReaderWriter(Call* call) : call_(call) {} + ServerAsyncReaderWriter(Call* call, ServerContext* ctx) + : call_(call), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) override { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_buf_.Reset(tag); + meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&meta_buf_); + } + + virtual void Read(R* msg, void* tag) override { + read_buf_.Reset(tag); + read_buf_.AddRecvMessage(msg); + call_->PerformOps(&read_buf_); + } - virtual void Read(R* msg, void* tag) { - // TODO + virtual void Write(const W& msg, void* tag) override { + write_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + write_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + write_buf_.AddSendMessage(msg); + call_->PerformOps(&write_buf_); } - virtual void Write(const W& msg, void* tag) { - // TODO + void Finish(const Status& status, void* tag) override { + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_->PerformOps(&finish_buf_); } private: Call* call_; + ServerContext* ctx_; + CallOpBuffer meta_buf_; + CallOpBuffer read_buf_; + CallOpBuffer write_buf_; + CallOpBuffer finish_buf_; }; } // namespace grpc From 106906924fd77fdb6b24f16fc54156a5aa5e78b7 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 13:27:14 -0800 Subject: [PATCH 084/232] implement ServerAsyncResponseWriter for unary call --- include/grpc++/stream.h | 47 +++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6dc05bc9a6b..53c070ab2bb 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -582,17 +582,52 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, template class ServerAsyncResponseWriter final { public: - explicit ServerAsyncResponseWriter(Call* call) : call_(call) {} + ServerAsyncResponseWriter(Call* call, ServerContext* ctx) + : call_(call), ctx_(ctx) {} - virtual void Write(const W& msg, void* tag) override { - CallOpBuffer buf; - buf.Reset(tag); - buf.AddSendMessage(msg); - call_->PerformOps(&buf); + void SendInitialMetadata(void* tag) { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_buf_.Reset(tag); + meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_->PerformOps(&meta_buf_); + } + + void Finish(const W& msg, const Status& status, void* tag) { + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // The response is dropped if the status is not OK. + if (status.IsOk()) { + finish_buf_.AddSendMessage(msg); + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_->PerformOps(&finish_buf_); + } + + void FinishWithError(const Status& status, void* tag) { + GPR_ASSERT(!status.IsOk()); + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_->PerformOps(&finish_buf_); } private: Call* call_; + ServerCotnext* ctx_; + CallOpBuffer meta_buf_; + CallOpBuffer finish_buf_; }; template From 0b18a8bd4c2c7b1f246c1d738667640829af14c7 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 13:37:33 -0800 Subject: [PATCH 085/232] typo fix --- include/grpc++/stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 53c070ab2bb..4c54737a559 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -625,7 +625,7 @@ class ServerAsyncResponseWriter final { private: Call* call_; - ServerCotnext* ctx_; + ServerContext* ctx_; CallOpBuffer meta_buf_; CallOpBuffer finish_buf_; }; From e0b73fdabea84b14e0d948ac623bb0c829d75e7f Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 14:05:47 -0800 Subject: [PATCH 086/232] Async client calls should return async interfaces --- src/compiler/cpp_generator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 4a31ff949e8..6ef2128afd2 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -190,7 +190,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientWriter< $Request$>* $Method$(" "::grpc::ClientContext* context, $Response$* response);\n"); printer->Print(*vars, - "::grpc::ClientWriter< $Request$>* $Method$(" + "::grpc::ClientAsyncWriter< $Request$>* $Method$(" "::grpc::ClientContext* context, $Response$* response, " "::grpc::Status *status, " "::grpc::CompletionQueue *cq, void *tag);\n"); @@ -200,7 +200,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientReader< $Response$>* $Method$(" "::grpc::ClientContext* context, const $Request$* request);\n"); printer->Print(*vars, - "::grpc::ClientReader< $Response$>* $Method$(" + "::grpc::ClientAsyncReader< $Response$>* $Method$(" "::grpc::ClientContext* context, const $Request$* request, " "::grpc::CompletionQueue *cq, void *tag);\n"); } else if (BidiStreaming(method)) { From 1c9a2a91ca3b917de982eb6aac6adc421b595f3e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 14:10:25 -0800 Subject: [PATCH 087/232] Async API progress --- include/grpc++/impl/service_type.h | 66 ++++++++++++++++++++++++++-- include/grpc++/server.h | 15 +++++-- include/grpc++/stream.h | 14 ++---- src/compiler/cpp_generator.cc | 15 ++++++- src/cpp/server/server.cc | 69 ++++++++++++++++++++++-------- 5 files changed, 143 insertions(+), 36 deletions(-) diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 30654553ade..19432522dfd 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -34,10 +34,18 @@ #ifndef __GRPCPP_IMPL_SERVICE_TYPE_H__ #define __GRPCPP_IMPL_SERVICE_TYPE_H__ +namespace google { +namespace protobuf { +class Message; +} // namespace protobuf +} // namespace google + namespace grpc { class RpcService; class Server; +class ServerContext; +class Status; class SynchronousService { public: @@ -45,19 +53,69 @@ class SynchronousService { virtual RpcService* service() = 0; }; +class ServerAsyncStreamingInterface { + public: + virtual ~ServerAsyncStreamingInterface() {} + + virtual void SendInitialMetadata(void* tag) = 0; + virtual void Finish(const Status& status, void* tag) = 0; +}; + class AsynchronousService { public: - AsynchronousService(CompletionQueue* cq, const char** method_names, size_t method_count) : cq_(cq), method_names_(method_names), method_count_(method_count) {} + // this is Server, but in disguise to avoid a link dependency + class DispatchImpl { + public: + virtual void RequestAsyncCall(void* registered_method, + ServerContext* context, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) = 0; + }; + + AsynchronousService(CompletionQueue* cq, const char** method_names, + size_t method_count) + : cq_(cq), method_names_(method_names), method_count_(method_count) {} + + ~AsynchronousService(); CompletionQueue* completion_queue() const { return cq_; } + protected: + void RequestAsyncUnary(int index, ServerContext* context, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) { + dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, + stream, cq, tag); + } + void RequestClientStreaming(int index, ServerContext* context, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) { + dispatch_impl_->RequestAsyncCall(request_args_[index], context, nullptr, + stream, cq, tag); + } + void RequestServerStreaming(int index, ServerContext* context, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) { + dispatch_impl_->RequestAsyncCall(request_args_[index], context, request, + stream, cq, tag); + } + void RequestBidiStreaming(int index, ServerContext* context, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) { + dispatch_impl_->RequestAsyncCall(request_args_[index], context, nullptr, + stream, cq, tag); + } + private: friend class Server; CompletionQueue* const cq_; - Server* server_ = nullptr; - const char**const method_names_; + DispatchImpl* dispatch_impl_ = nullptr; + const char** const method_names_; size_t method_count_; - std::vector request_args_; + void** request_args_ = nullptr; }; } // namespace grpc diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 77aac75076e..8050ef8c9d6 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -42,6 +42,7 @@ #include #include #include +#include #include struct grpc_server; @@ -60,7 +61,8 @@ class ServerCredentials; class ThreadPoolInterface; // Currently it only supports handling rpcs in a single thread. -class Server final : private CallHook { +class Server final : private CallHook, + private AsynchronousService::DispatchImpl { public: ~Server(); @@ -70,7 +72,8 @@ class Server final : private CallHook { private: friend class ServerBuilder; - class MethodRequestData; + class SyncRequest; + class AsyncRequest; // ServerBuilder use only Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, @@ -91,6 +94,12 @@ class Server final : private CallHook { void PerformOpsOnCall(CallOpBuffer* ops, Call* call) override; + // DispatchImpl + void RequestAsyncCall(void* registered_method, ServerContext* context, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag); + // Completion queue. CompletionQueue cq_; @@ -102,7 +111,7 @@ class Server final : private CallHook { int num_running_cb_; std::condition_variable callback_cv_; - std::list methods_; + std::list sync_methods_; // Pointer to the c grpc server. grpc_server* server_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6dc05bc9a6b..c013afb1413 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -370,15 +371,6 @@ class ClientAsyncStreamingInterface { virtual void Finish(Status* status, void* tag) = 0; }; -class ServerAsyncStreamingInterface { - public: - virtual ~ServerAsyncStreamingInterface() {} - - virtual void SendInitialMetadata(void* tag) = 0; - - virtual void Finish(const Status& status, void* tag) = 0; -}; - // An interface that yields a sequence of R messages. template class AsyncReaderInterface { @@ -580,11 +572,11 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, // TODO(yangg) Move out of stream.h template -class ServerAsyncResponseWriter final { +class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { public: explicit ServerAsyncResponseWriter(Call* call) : call_(call) {} - virtual void Write(const W& msg, void* tag) override { + virtual void Write(const W& msg, void* tag) { CallOpBuffer buf; buf.Reset(tag); buf.AddSendMessage(msg); diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 4a31ff949e8..d1a7bd2b88c 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -374,7 +374,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::ClientContext* context, " "const $Request$& request, $Response$* response) {\n"); printer->Print(*vars, - "return ::grpc::BlockingUnaryCall(channel()," + " return ::grpc::BlockingUnaryCall(channel()," "::grpc::RpcMethod($Service$_method_names[$Idx$]), " "context, request, response);\n" "}\n\n"); @@ -484,6 +484,9 @@ void PrintSourceServerAsyncMethod( "$Request$* request, " "::grpc::ServerAsyncResponseWriter< $Response$>* response, " "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print( + *vars, + " AsynchronousService::RequestAsyncUnary($Idx$, context, request, response, cq, tag);\n"); printer->Print("}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, @@ -491,6 +494,9 @@ void PrintSourceServerAsyncMethod( "::grpc::ServerContext* context, " "::grpc::ServerAsyncReader< $Request$>* reader, " "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print( + *vars, + " AsynchronousService::RequestClientStreaming($Idx$, context, reader, cq, tag);\n"); printer->Print("}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, @@ -499,6 +505,9 @@ void PrintSourceServerAsyncMethod( "$Request$* request, " "::grpc::ServerAsyncWriter< $Response$>* writer, " "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print( + *vars, + " AsynchronousService::RequestServerStreaming($Idx$, context, request, writer, cq, tag);\n"); printer->Print("}\n\n"); } else if (BidiStreaming(method)) { printer->Print( @@ -507,6 +516,9 @@ void PrintSourceServerAsyncMethod( "::grpc::ServerContext* context, " "::grpc::ServerAsyncReaderWriter< $Response$, $Request$>* stream, " "::grpc::CompletionQueue* cq, void *tag) {\n"); + printer->Print( + *vars, + " AsynchronousService::RequestBidiStreaming($Idx$, context, stream, cq, tag);\n"); printer->Print("}\n\n"); } } @@ -548,6 +560,7 @@ void PrintSourceService(google::protobuf::io::Printer *printer, " delete service_;\n" "}\n\n"); for (int i = 0; i < service->method_count(); ++i) { + (*vars)["Idx"] = as_string(i); PrintSourceServerMethod(printer, service->method(i), vars); PrintSourceServerAsyncMethod(printer, service->method(i), vars); } diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 20dd135a86f..b4620868b8a 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -93,24 +93,26 @@ bool Server::RegisterService(RpcService* service) { method->name()); return false; } - methods_.emplace_back(method, tag); + sync_methods_.emplace_back(method, tag); } return true; } bool Server::RegisterAsyncService(AsynchronousService* service) { - GPR_ASSERT(service->server_ == nullptr && "Can only register an asynchronous service against one server."); - service->server_ = this; - service->request_args_.reserve(service->method_count_); + GPR_ASSERT(service->dispatch_impl_ == nullptr && + "Can only register an asynchronous service against one server."); + service->dispatch_impl_ = this; + service->request_args_ = new void* [service->method_count_]; for (size_t i = 0; i < service->method_count_; ++i) { - void* tag = grpc_server_register_method(server_, service->method_names_[i], nullptr, - service->completion_queue()->cq()); + void* tag = + grpc_server_register_method(server_, service->method_names_[i], nullptr, + service->completion_queue()->cq()); if (!tag) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", service->method_names_[i]); return false; } - service->request_args_.push_back(tag); + service->request_args_[i] = tag; } return true; } @@ -124,9 +126,9 @@ int Server::AddPort(const grpc::string& addr) { } } -class Server::MethodRequestData final : public CompletionQueueTag { +class Server::SyncRequest final : public CompletionQueueTag { public: - MethodRequestData(RpcServiceMethod* method, void* tag) + SyncRequest(RpcServiceMethod* method, void* tag) : method_(method), tag_(tag), has_request_payload_(method->method_type() == RpcMethod::NORMAL_RPC || @@ -138,13 +140,13 @@ class Server::MethodRequestData final : public CompletionQueueTag { grpc_metadata_array_init(&request_metadata_); } - static MethodRequestData* Wait(CompletionQueue* cq, bool* ok) { + static SyncRequest* Wait(CompletionQueue* cq, bool* ok) { void* tag = nullptr; *ok = false; if (!cq->Next(&tag, ok)) { return nullptr; } - auto* mrd = static_cast(tag); + auto* mrd = static_cast(tag); GPR_ASSERT(mrd->in_flight_); return mrd; } @@ -162,9 +164,9 @@ class Server::MethodRequestData final : public CompletionQueueTag { void FinalizeResult(void** tag, bool* status) override {} - class CallData { + class CallData final { public: - explicit CallData(Server* server, MethodRequestData* mrd) + explicit CallData(Server* server, SyncRequest* mrd) : cq_(mrd->cq_), call_(mrd->call_, server, &cq_), ctx_(mrd->deadline_, mrd->request_metadata_.metadata, @@ -239,8 +241,8 @@ bool Server::Start() { grpc_server_start(server_); // Start processing rpcs. - if (!methods_.empty()) { - for (auto& m : methods_) { + if (!sync_methods_.empty()) { + for (auto& m : sync_methods_) { m.Request(server_); } @@ -275,6 +277,39 @@ void Server::PerformOpsOnCall(CallOpBuffer* buf, Call* call) { grpc_call_start_batch(call->call(), ops, nops, buf)); } +class Server::AsyncRequest final : public CompletionQueueTag { + public: + AsyncRequest(Server* server, void* registered_method, ServerContext* ctx, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, CompletionQueue* cq, + void* tag) + : tag_(tag), request_(request), stream_(stream), ctx_(ctx) { + memset(&array_, 0, sizeof(array_)); + grpc_server_request_registered_call( + server->server_, registered_method, &call_, &deadline_, &array_, + request ? &payload_ : nullptr, cq->cq(), this); + } + + void FinalizeResult(void** tag, bool* status) override {} + + private: + void* const tag_; + ::google::protobuf::Message* const request_; + ServerAsyncStreamingInterface* const stream_; + ServerContext* const ctx_; + grpc_call* call_ = nullptr; + gpr_timespec deadline_; + grpc_metadata_array array_; + grpc_byte_buffer* payload_ = nullptr; +}; + +void Server::RequestAsyncCall(void* registered_method, ServerContext* context, + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag) { + new AsyncRequest(this, registered_method, context, request, stream, cq, tag); +} + void Server::ScheduleCallback() { { std::unique_lock lock(mu_); @@ -286,11 +321,11 @@ void Server::ScheduleCallback() { void Server::RunRpc() { // Wait for one more incoming rpc. bool ok; - auto* mrd = MethodRequestData::Wait(&cq_, &ok); + auto* mrd = SyncRequest::Wait(&cq_, &ok); if (mrd) { ScheduleCallback(); if (ok) { - MethodRequestData::CallData cd(this, mrd); + SyncRequest::CallData cd(this, mrd); mrd->Request(server_); cd.Run(); From 5705fe3fca7c9ed042b78dee3c2b89364fe183f8 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 14:30:34 -0800 Subject: [PATCH 088/232] Add a cq argument in ClientAsync ctor and give it to the Call --- include/grpc++/stream.h | 42 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 2f37cc4075e..4bc540cb577 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -394,10 +394,10 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, public AsyncReaderInterface { public: // Create a stream and write the first request out. - ClientAsyncReader(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, + ClientAsyncReader(ChannelInterface *channel, CompletionQueue* cq, + const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request, void* tag) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); init_buf_.AddSendMessage(request); @@ -408,10 +408,9 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, void ReadInitialMetadata(void* tag) override { GPR_ASSERT(!context_->initial_metadata_received_); - CallOpBuffer buf; - buf.Reset(tag); - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - call_.PerformOps(&buf); + meta_buf_.Reset(tag); + meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&meta_buf_); context_->initial_metadata_received_ = true; } @@ -437,9 +436,9 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, private: ClientContext* context_ = nullptr; - CompletionQueue cq_; Call call_; CallOpBuffer init_buf_; + CallOpBuffer meta_buf_; CallOpBuffer read_buf_; CallOpBuffer finish_buf_; }; @@ -448,11 +447,11 @@ template class ClientAsyncWriter final : public ClientAsyncStreamingInterface, public WriterInterface { public: - ClientAsyncWriter(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - google::protobuf::Message *response, void* tag) + ClientAsyncWriter(ChannelInterface *channel, CompletionQueue* cq, + const RpcMethod &method, ClientContext *context, + google::protobuf::Message *response, void* tag) : context_(context), response_(response), - call_(channel->CreateCall(method, context, &cq_)) { + call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); call_.PerformOps(&init_buf_); @@ -461,10 +460,9 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, void ReadInitialMetadata(void* tag) override { GPR_ASSERT(!context_->initial_metadata_received_); - CallOpBuffer buf; - buf.Reset(tag); - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - call_.PerformOps(&buf); + meta_buf_.Reset(tag); + meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&meta_buf_); context_->initial_metadata_received_ = true; } @@ -495,9 +493,9 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, ClientContext* context_ = nullptr; google::protobuf::Message *const response_; bool got_message_; - CompletionQueue cq_; Call call_; CallOpBuffer init_buf_; + CallOpBuffer meta_buf_; CallOpBuffer write_buf_; CallOpBuffer writes_done_buf_; CallOpBuffer finish_buf_; @@ -509,7 +507,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, public AsyncWriterInterface, public AsyncReaderInterface { public: - ClientAsyncReaderWriter(ChannelInterface *channel, + ClientAsyncReaderWriter(ChannelInterface *channel, CompletionQueue* cq, const RpcMethod &method, ClientContext *context, void* tag) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { init_buf_.Reset(tag); @@ -520,10 +518,9 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, void ReadInitialMetadata(void* tag) override { GPR_ASSERT(!context_->initial_metadata_received_); - CallOpBuffer buf; - buf.Reset(tag); - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - call_.PerformOps(&buf); + meta_buf_.Reset(tag); + meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + call_.PerformOps(&meta_buf_); context_->initial_metadata_received_ = true; } @@ -564,6 +561,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, CompletionQueue cq_; Call call_; CallOpBuffer init_buf_; + CallOpBuffer meta_buf_; CallOpBuffer read_buf_; CallOpBuffer write_buf_; CallOpBuffer writes_done_buf_; From 3d6ceb646178ce7a5b0de38c38ba75da448fae39 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 14:33:54 -0800 Subject: [PATCH 089/232] Async server dispatch --- include/grpc++/impl/service_type.h | 5 +++ include/grpc++/server_context.h | 54 ++++++++++++++++++++---------- src/cpp/server/server.cc | 47 ++++++++++++++++++++++---- src/cpp/server/server_context.cc | 6 ++++ 4 files changed, 88 insertions(+), 24 deletions(-) diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 19432522dfd..cac2be30aba 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -42,6 +42,7 @@ class Message; namespace grpc { +class Call; class RpcService; class Server; class ServerContext; @@ -59,6 +60,10 @@ class ServerAsyncStreamingInterface { virtual void SendInitialMetadata(void* tag) = 0; virtual void Finish(const Status& status, void* tag) = 0; + + private: + friend class Server; + virtual void BindCall(Call* call) = 0; }; class AsynchronousService { diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index e976e118147..fcca85594a1 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -39,43 +39,61 @@ #include "config.h" -struct grpc_metadata; struct gpr_timespec; +struct grpc_metadata; +struct grpc_call; namespace grpc { -template class ServerAsyncReader; -template class ServerAsyncWriter; -template class ServerAsyncReaderWriter; -template class ServerReader; -template class ServerWriter; -template class ServerReaderWriter; +template +class ServerAsyncReader; +template +class ServerAsyncWriter; +template +class ServerAsyncReaderWriter; +template +class ServerReader; +template +class ServerWriter; +template +class ServerReaderWriter; class CallOpBuffer; class Server; // Interface of server side rpc context. -class ServerContext { +class ServerContext final { public: - virtual ~ServerContext() {} + ServerContext(); // for async calls + ~ServerContext(); - std::chrono::system_clock::time_point absolute_deadline() { return deadline_; } + std::chrono::system_clock::time_point absolute_deadline() { + return deadline_; + } void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); private: friend class ::grpc::Server; - template friend class ::grpc::ServerAsyncReader; - template friend class ::grpc::ServerAsyncWriter; - template friend class ::grpc::ServerAsyncReaderWriter; - template friend class ::grpc::ServerReader; - template friend class ::grpc::ServerWriter; - template friend class ::grpc::ServerReaderWriter; + template + friend class ::grpc::ServerAsyncReader; + template + friend class ::grpc::ServerAsyncWriter; + template + friend class ::grpc::ServerAsyncReaderWriter; + template + friend class ::grpc::ServerReader; + template + friend class ::grpc::ServerWriter; + template + friend class ::grpc::ServerReaderWriter; - ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count); + ServerContext(gpr_timespec deadline, grpc_metadata* metadata, + size_t metadata_count); - const std::chrono::system_clock::time_point deadline_; + std::chrono::system_clock::time_point deadline_; + grpc_call* call_ = nullptr; bool sent_initial_metadata_ = false; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index b4620868b8a..7d198347999 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -45,6 +45,7 @@ #include #include "src/cpp/proto/proto_utils.h" +#include "src/cpp/util/time.h" namespace grpc { @@ -175,15 +176,12 @@ class Server::SyncRequest final : public CompletionQueueTag { has_response_payload_(mrd->has_response_payload_), request_payload_(mrd->request_payload_), method_(mrd->method_) { + ctx_.call_ = mrd->call_; GPR_ASSERT(mrd->in_flight_); mrd->in_flight_ = false; mrd->request_metadata_.count = 0; } - ~CallData() { - if (call_.call()) grpc_call_destroy(call_.call()); - } - void Run() { std::unique_ptr req; std::unique_ptr res; @@ -283,20 +281,57 @@ class Server::AsyncRequest final : public CompletionQueueTag { ::google::protobuf::Message* request, ServerAsyncStreamingInterface* stream, CompletionQueue* cq, void* tag) - : tag_(tag), request_(request), stream_(stream), ctx_(ctx) { + : tag_(tag), + request_(request), + stream_(stream), + cq_(cq), + ctx_(ctx), + server_(server) { memset(&array_, 0, sizeof(array_)); grpc_server_request_registered_call( server->server_, registered_method, &call_, &deadline_, &array_, request ? &payload_ : nullptr, cq->cq(), this); } - void FinalizeResult(void** tag, bool* status) override {} + ~AsyncRequest() { + if (payload_) { + grpc_byte_buffer_destroy(payload_); + } + grpc_metadata_array_destroy(&array_); + } + + void FinalizeResult(void** tag, bool* status) override { + *tag = tag_; + if (*status && request_) { + if (payload_) { + *status = DeserializeProto(payload_, request_); + } else { + *status = false; + } + } + if (*status) { + ctx_->deadline_ = Timespec2Timepoint(deadline_); + for (size_t i = 0; i < array_.count; i++) { + ctx_->client_metadata_.insert(std::make_pair( + grpc::string(array_.metadata[i].key), + grpc::string( + array_.metadata[i].value, + array_.metadata[i].value + array_.metadata[i].value_length))); + } + } + ctx_->call_ = call_; + Call call(call_, server_, cq_); + stream_->BindCall(&call); + delete this; + } private: void* const tag_; ::google::protobuf::Message* const request_; ServerAsyncStreamingInterface* const stream_; + CompletionQueue* const cq_; ServerContext* const ctx_; + Server* const server_; grpc_call* call_ = nullptr; gpr_timespec deadline_; grpc_metadata_array array_; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 1823dfc81b0..9e02ac5a3c5 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -49,4 +49,10 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, } } +ServerContext::~ServerContext() { + if (call_) { + grpc_call_destroy(call_); + } +} + } // namespace grpc From d4ebeeb7fbd61031c9b3db013e07195f31013e89 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 14:57:17 -0800 Subject: [PATCH 090/232] Async server streaming --- include/grpc++/stream.h | 58 +++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 2f37cc4075e..23387e78ab3 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -574,8 +574,8 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, template class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { public: - ServerAsyncResponseWriter(Call* call, ServerContext* ctx) - : call_(call), ctx_(ctx) {} + explicit ServerAsyncResponseWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} void SendInitialMetadata(void* tag) { GPR_ASSERT(!ctx_->sent_initial_metadata_); @@ -583,7 +583,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { meta_buf_.Reset(tag); meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&meta_buf_); + call_.PerformOps(&meta_buf_); } void Finish(const W& msg, const Status& status, void* tag) { @@ -599,7 +599,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_->PerformOps(&finish_buf_); + call_.PerformOps(&finish_buf_); } void FinishWithError(const Status& status, void* tag) { @@ -612,11 +612,13 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_->PerformOps(&finish_buf_); + call_.PerformOps(&finish_buf_); } private: - Call* call_; + void BindCall(Call *call) override { call_ = *call; } + + Call call_; ServerContext* ctx_; CallOpBuffer meta_buf_; CallOpBuffer finish_buf_; @@ -626,8 +628,8 @@ template class ServerAsyncReader : public ServerAsyncStreamingInterface, public AsyncReaderInterface { public: - ServerAsyncReader(Call* call, ServerContext* ctx) - : call_(call), ctx_(ctx) {} + explicit ServerAsyncReader(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} void SendInitialMetadata(void* tag) override { GPR_ASSERT(!ctx_->sent_initial_metadata_); @@ -635,13 +637,13 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, meta_buf_.Reset(tag); meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&meta_buf_); + call_.PerformOps(&meta_buf_); } void Read(R* msg, void* tag) override { read_buf_.Reset(tag); read_buf_.AddRecvMessage(msg); - call_->PerformOps(&read_buf_); + call_.PerformOps(&read_buf_); } void Finish(const Status& status, void* tag) override { @@ -653,12 +655,14 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_->PerformOps(&finish_buf_); + call_.PerformOps(&finish_buf_); } private: - Call* call_; + void BindCall(Call *call) override { call_ = *call; } + + Call call_; ServerContext* ctx_; CallOpBuffer meta_buf_; CallOpBuffer read_buf_; @@ -669,8 +673,8 @@ template class ServerAsyncWriter : public ServerAsyncStreamingInterface, public AsyncWriterInterface { public: - ServerAsyncWriter(Call* call, ServerContext* ctx) - : call_(call), ctx_(ctx) {} + explicit ServerAsyncWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} void SendInitialMetadata(void* tag) override { GPR_ASSERT(!ctx_->sent_initial_metadata_); @@ -678,7 +682,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, meta_buf_.Reset(tag); meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&meta_buf_); + call_.PerformOps(&meta_buf_); } void Write(const W& msg, void* tag) override { @@ -688,7 +692,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } write_buf_.AddSendMessage(msg); - call_->PerformOps(&write_buf_); + call_.PerformOps(&write_buf_); } void Finish(const Status& status, void* tag) override { @@ -700,11 +704,13 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_->PerformOps(&finish_buf_); + call_.PerformOps(&finish_buf_); } private: - Call* call_; + void BindCall(Call *call) override { call_ = *call; } + + Call call_; ServerContext* ctx_; CallOpBuffer meta_buf_; CallOpBuffer write_buf_; @@ -717,8 +723,8 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, public AsyncWriterInterface, public AsyncReaderInterface { public: - ServerAsyncReaderWriter(Call* call, ServerContext* ctx) - : call_(call), ctx_(ctx) {} + explicit ServerAsyncReaderWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} void SendInitialMetadata(void* tag) override { GPR_ASSERT(!ctx_->sent_initial_metadata_); @@ -726,13 +732,13 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, meta_buf_.Reset(tag); meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; - call_->PerformOps(&meta_buf_); + call_.PerformOps(&meta_buf_); } virtual void Read(R* msg, void* tag) override { read_buf_.Reset(tag); read_buf_.AddRecvMessage(msg); - call_->PerformOps(&read_buf_); + call_.PerformOps(&read_buf_); } virtual void Write(const W& msg, void* tag) override { @@ -742,7 +748,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, ctx_->sent_initial_metadata_ = true; } write_buf_.AddSendMessage(msg); - call_->PerformOps(&write_buf_); + call_.PerformOps(&write_buf_); } void Finish(const Status& status, void* tag) override { @@ -754,11 +760,13 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_->PerformOps(&finish_buf_); + call_.PerformOps(&finish_buf_); } private: - Call* call_; + void BindCall(Call *call) override { call_ = *call; } + + Call call_; ServerContext* ctx_; CallOpBuffer meta_buf_; CallOpBuffer read_buf_; From 6859ad901614b6333f0a611ec3492eec0ed4983b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 14:59:12 -0800 Subject: [PATCH 091/232] Update projects --- vsprojects/vs2013/grpc_shared.vcxproj | 2 -- vsprojects/vs2013/grpc_shared.vcxproj.filters | 3 --- 2 files changed, 5 deletions(-) diff --git a/vsprojects/vs2013/grpc_shared.vcxproj b/vsprojects/vs2013/grpc_shared.vcxproj index 82adcdb5e2d..7ef520b7b60 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj +++ b/vsprojects/vs2013/grpc_shared.vcxproj @@ -279,8 +279,6 @@ - - diff --git a/vsprojects/vs2013/grpc_shared.vcxproj.filters b/vsprojects/vs2013/grpc_shared.vcxproj.filters index 8acd1e88b28..8c174d9159a 100644 --- a/vsprojects/vs2013/grpc_shared.vcxproj.filters +++ b/vsprojects/vs2013/grpc_shared.vcxproj.filters @@ -133,9 +133,6 @@ src\core\iomgr - - src\core\iomgr - src\core\iomgr From 068c85b21cb0ae9d08ca2a513904670ccd59269b Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 15:21:24 -0800 Subject: [PATCH 092/232] make codegen generate async client calls --- include/grpc++/stream.h | 18 +++++---- src/compiler/cpp_generator.cc | 58 ++++++++++++++++++++++++++--- src/cpp/client/client_unary_call.cc | 7 ++++ 3 files changed, 69 insertions(+), 14 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 4bc540cb577..1821d666356 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -420,7 +420,8 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg); + bool ignore; + read_buf_.AddRecvMessage(msg, &ignore); call_.PerformOps(&read_buf_); } @@ -445,7 +446,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, template class ClientAsyncWriter final : public ClientAsyncStreamingInterface, - public WriterInterface { + public AsyncWriterInterface { public: ClientAsyncWriter(ChannelInterface *channel, CompletionQueue* cq, const RpcMethod &method, ClientContext *context, @@ -472,7 +473,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void WritesDone(void* tag) override { + void WritesDone(void* tag) { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); @@ -484,7 +485,8 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - finish_buf_.AddRecvMessage(response_, &got_message_); + bool ignore; + finish_buf_.AddRecvMessage(response_, &ignore); finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -509,7 +511,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, public: ClientAsyncReaderWriter(ChannelInterface *channel, CompletionQueue* cq, const RpcMethod &method, ClientContext *context, void* tag) - : context_(context), call_(channel->CreateCall(method, context, &cq_)) { + : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); call_.PerformOps(&init_buf_); @@ -530,7 +532,8 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg); + bool ignore; + read_buf_.AddRecvMessage(msg, &ignore); call_.PerformOps(&read_buf_); } @@ -540,7 +543,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void WritesDone(void* tag) override { + void WritesDone(void* tag) { writes_done_buf_.Reset(tag); writes_done_buf_.AddClientSendClose(); call_.PerformOps(&writes_done_buf_); @@ -558,7 +561,6 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, private: ClientContext* context_ = nullptr; - CompletionQueue cq_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index aa9be6db87d..1ab4c29451c 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -183,8 +183,8 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "void $Method$(::grpc::ClientContext* context, " "const $Request$& request, $Response$* response, " - "::grpc::Status *status, " - "::grpc::CompletionQueue *cq, void *tag);\n"); + "::grpc::Status* status, " + "::grpc::CompletionQueue* cq, void* tag);\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, "::grpc::ClientWriter< $Request$>* $Method$(" @@ -192,8 +192,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientAsyncWriter< $Request$>* $Method$(" "::grpc::ClientContext* context, $Response$* response, " - "::grpc::Status *status, " - "::grpc::CompletionQueue *cq, void *tag);\n"); + "::grpc::CompletionQueue* cq, void* tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, @@ -202,7 +201,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientAsyncReader< $Response$>* $Method$(" "::grpc::ClientContext* context, const $Request$* request, " - "::grpc::CompletionQueue *cq, void *tag);\n"); + "::grpc::CompletionQueue* cq, void* tag);\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, "::grpc::ClientReaderWriter< $Request$, $Response$>* " @@ -210,7 +209,7 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print(*vars, "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " "$Method$(::grpc::ClientContext* context, " - "::grpc::CompletionQueue *cq, void *tag);\n"); + "::grpc::CompletionQueue* cq, void* tag);\n"); } } @@ -378,6 +377,16 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::RpcMethod($Service$_method_names[$Idx$]), " "context, request, response);\n" "}\n\n"); + printer->Print(*vars, + "void $Service$::Stub::$Method$(" + "::grpc::ClientContext* context, " + "const $Request$& request, $Response$* response, ::grpc::Status* status, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print(*vars, + " ::grpc::AsyncUnaryCall(channel()," + "::grpc::RpcMethod($Service$_method_names[$Idx$]), " + "context, request, response, status, cq, tag);\n" + "}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print( *vars, @@ -390,6 +399,18 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " "context, response);\n" "}\n\n"); + printer->Print( + *vars, + "::grpc::ClientAsyncWriter< $Request$>* $Service$::Stub::$Method$(" + "::grpc::ClientContext* context, $Response$* response, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print(*vars, + " return new ::grpc::ClientAsyncWriter< $Request$>(" + "channel(), cq, " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod::RpcType::CLIENT_STREAMING), " + "context, response, tag);\n" + "}\n\n"); } else if (ServerOnlyStreaming(method)) { printer->Print( *vars, @@ -402,6 +423,18 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " "context, *request);\n" "}\n\n"); + printer->Print( + *vars, + "::grpc::ClientAsyncReader< $Response$>* $Service$::Stub::$Method$(" + "::grpc::ClientContext* context, const $Request$* request, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print(*vars, + " return new ::grpc::ClientAsyncReader< $Response$>(" + "channel(), cq, " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " + "context, *request, tag);\n" + "}\n\n"); } else if (BidiStreaming(method)) { printer->Print( *vars, @@ -415,6 +448,19 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " "context);\n" "}\n\n"); + printer->Print( + *vars, + "::grpc::ClientAsyncReaderWriter< $Request$, $Response$>* " + "$Service$::Stub::$Method$(::grpc::ClientContext* context, " + "::grpc::CompletionQueue* cq, void* tag) {\n"); + printer->Print( + *vars, + " return new ::grpc::ClientAsyncReaderWriter< $Request$, $Response$>(" + "channel(), cq, " + "::grpc::RpcMethod($Service$_method_names[$Idx$], " + "::grpc::RpcMethod::RpcType::BIDI_STREAMING), " + "context, tag);\n" + "}\n\n"); } } diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index bc0e83733a2..1221630a35c 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -60,4 +60,11 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, return status; } +void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result, Status *status, + CompletionQueue *cq, void *tag) { + +} } // namespace grpc From ec3257c120c5c199101ef99cff25cddccabe005e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 15:59:43 -0800 Subject: [PATCH 093/232] Fix end2end leaks --- include/grpc++/impl/call.h | 1 + src/core/surface/server.c | 77 +++++++++++++++++++++++--------- src/cpp/common/call.cc | 21 ++++++--- src/cpp/server/server.cc | 12 ++++- test/cpp/end2end/end2end_test.cc | 1 + 5 files changed, 82 insertions(+), 30 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index a1ef9268f0c..853f19e9b31 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -57,6 +57,7 @@ class Call; class CallOpBuffer final : public CompletionQueueTag { public: CallOpBuffer() : return_tag_(this) {} + ~CallOpBuffer(); void Reset(void *next_return_tag); diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 22588194ea3..169fb1a7813 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -53,7 +53,8 @@ typedef enum { PENDING_START, ALL_CALLS, CALL_LIST_COUNT } call_list; typedef struct listener { void *arg; - void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets, size_t pollset_count); + void (*start)(grpc_server *server, void *arg, grpc_pollset **pollsets, + size_t pollset_count); void (*destroy)(grpc_server *server, void *arg); struct listener *next; } listener; @@ -129,7 +130,7 @@ struct grpc_server { const grpc_channel_filter **channel_filters; grpc_channel_args *channel_args; grpc_completion_queue *unregistered_cq; - + grpc_completion_queue **cqs; grpc_pollset **pollsets; size_t cq_count; @@ -257,11 +258,21 @@ static void server_ref(grpc_server *server) { } static void server_unref(grpc_server *server) { + registered_method *rm; if (gpr_unref(&server->internal_refcount)) { grpc_channel_args_destroy(server->channel_args); gpr_mu_destroy(&server->mu); gpr_free(server->channel_filters); requested_call_array_destroy(&server->requested_calls); + while ((rm = server->registered_methods) != NULL) { + server->registered_methods = rm->next; + gpr_free(rm->method); + gpr_free(rm->host); + requested_call_array_destroy(&rm->requested); + gpr_free(rm); + } + gpr_free(server->cqs); + gpr_free(server->pollsets); gpr_free(server); } } @@ -511,7 +522,8 @@ static void destroy_call_elem(grpc_call_element *elem) { if (chand->server->shutdown && chand->server->have_shutdown_tag && chand->server->lists[ALL_CALLS] == NULL) { for (i = 0; i < chand->server->cq_count; i++) { - grpc_cq_end_server_shutdown(chand->server->cqs[i], chand->server->shutdown_tag); + grpc_cq_end_server_shutdown(chand->server->cqs[i], + chand->server->shutdown_tag); } } gpr_mu_unlock(&chand->server->mu); @@ -547,7 +559,19 @@ static void init_channel_elem(grpc_channel_element *elem, } static void destroy_channel_elem(grpc_channel_element *elem) { + size_t i; channel_data *chand = elem->channel_data; + if (chand->registered_methods) { + for (i = 0; i < chand->registered_method_slots; i++) { + if (chand->registered_methods[i].method) { + grpc_mdstr_unref(chand->registered_methods[i].method); + } + if (chand->registered_methods[i].host) { + grpc_mdstr_unref(chand->registered_methods[i].host); + } + } + gpr_free(chand->registered_methods); + } if (chand->server) { gpr_mu_lock(&chand->server->mu); chand->next->prev = chand->prev; @@ -571,7 +595,8 @@ static void addcq(grpc_server *server, grpc_completion_queue *cq) { if (server->cqs[i] == cq) return; } n = server->cq_count++; - server->cqs = gpr_realloc(server->cqs, server->cq_count * sizeof(grpc_completion_queue*)); + server->cqs = gpr_realloc(server->cqs, + server->cq_count * sizeof(grpc_completion_queue *)); server->cqs[n] = cq; } @@ -624,7 +649,8 @@ static int streq(const char *a, const char *b) { } void *grpc_server_register_method(grpc_server *server, const char *method, - const char *host, grpc_completion_queue *cq_new_rpc) { + const char *host, + grpc_completion_queue *cq_new_rpc) { registered_method *m; if (!method) { gpr_log(GPR_ERROR, "%s method string cannot be NULL", __FUNCTION__); @@ -652,7 +678,7 @@ void grpc_server_start(grpc_server *server) { listener *l; size_t i; - server->pollsets = gpr_malloc(sizeof(grpc_pollset*) * server->cq_count); + server->pollsets = gpr_malloc(sizeof(grpc_pollset *) * server->cq_count); for (i = 0; i < server->cq_count; i++) { server->pollsets[i] = grpc_cq_pollset(server->cqs[i]); } @@ -745,7 +771,7 @@ grpc_transport_setup_result grpc_server_setup_transport( } static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, - void *shutdown_tag) { + void *shutdown_tag) { listener *l; requested_call_array requested_calls; channel_data **channels; @@ -781,12 +807,19 @@ static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, requested_calls = server->requested_calls; memset(&server->requested_calls, 0, sizeof(server->requested_calls)); for (rm = server->registered_methods; rm; rm = rm->next) { - if (requested_calls.count + rm->requested.count > requested_calls.capacity) { - requested_calls.capacity = GPR_MAX(requested_calls.count + rm->requested.count, 2 * requested_calls.capacity); - requested_calls.calls = gpr_realloc(requested_calls.calls, sizeof(*requested_calls.calls) * requested_calls.capacity); + if (requested_calls.count + rm->requested.count > + requested_calls.capacity) { + requested_calls.capacity = + GPR_MAX(requested_calls.count + rm->requested.count, + 2 * requested_calls.capacity); + requested_calls.calls = + gpr_realloc(requested_calls.calls, sizeof(*requested_calls.calls) * + requested_calls.capacity); } - memcpy(requested_calls.calls + requested_calls.count, rm->requested.calls, sizeof(*requested_calls.calls) * rm->requested.count); + memcpy(requested_calls.calls + requested_calls.count, rm->requested.calls, + sizeof(*requested_calls.calls) * rm->requested.count); requested_calls.count += rm->requested.count; + gpr_free(rm->requested.calls); memset(&rm->requested, 0, sizeof(rm->requested)); } @@ -857,7 +890,8 @@ void grpc_server_destroy(grpc_server *server) { void grpc_server_add_listener(grpc_server *server, void *arg, void (*start)(grpc_server *server, void *arg, - grpc_pollset **pollsets, size_t pollset_count), + grpc_pollset **pollsets, + size_t pollset_count), void (*destroy)(grpc_server *server, void *arg)) { listener *l = gpr_malloc(sizeof(listener)); l->arg = arg; @@ -920,10 +954,9 @@ grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, } grpc_call_error grpc_server_request_registered_call( - grpc_server *server, void *rm, grpc_call **call, - gpr_timespec *deadline, grpc_metadata_array *initial_metadata, - grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bind, - void *tag) { + grpc_server *server, void *rm, grpc_call **call, gpr_timespec *deadline, + grpc_metadata_array *initial_metadata, grpc_byte_buffer **optional_payload, + grpc_completion_queue *cq_bind, void *tag) { requested_call rc; registered_method *registered_method = rm; grpc_cq_begin_op(registered_method->cq, NULL, GRPC_OP_COMPLETE); @@ -1025,20 +1058,20 @@ static void begin_call(grpc_server *server, call_data *calld, static void fail_call(grpc_server *server, requested_call *rc) { switch (rc->type) { case LEGACY_CALL: - grpc_cq_end_new_rpc(server->unregistered_cq, rc->tag, NULL, do_nothing, NULL, NULL, - NULL, gpr_inf_past, 0, NULL); + grpc_cq_end_new_rpc(server->unregistered_cq, rc->tag, NULL, do_nothing, + NULL, NULL, NULL, gpr_inf_past, 0, NULL); break; case BATCH_CALL: *rc->data.batch.call = NULL; rc->data.batch.initial_metadata->count = 0; - grpc_cq_end_op_complete(server->unregistered_cq, rc->tag, NULL, do_nothing, NULL, - GRPC_OP_ERROR); + grpc_cq_end_op_complete(server->unregistered_cq, rc->tag, NULL, + do_nothing, NULL, GRPC_OP_ERROR); break; case REGISTERED_CALL: *rc->data.registered.call = NULL; rc->data.registered.initial_metadata->count = 0; - grpc_cq_end_op_complete(rc->data.registered.registered_method->cq, rc->tag, NULL, do_nothing, NULL, - GRPC_OP_ERROR); + grpc_cq_end_op_complete(rc->data.registered.registered_method->cq, + rc->tag, NULL, do_nothing, NULL, GRPC_OP_ERROR); break; } } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index aae69084eb4..d706ec45e51 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -48,8 +48,7 @@ void CallOpBuffer::Reset(void* next_return_tag) { gpr_free(initial_metadata_); recv_initial_metadata_ = nullptr; - gpr_free(recv_initial_metadata_arr_.metadata); - recv_initial_metadata_arr_ = {0, 0, nullptr}; + recv_initial_metadata_arr_.count = 0; send_message_ = nullptr; if (send_message_buf_) { @@ -68,13 +67,9 @@ void CallOpBuffer::Reset(void* next_return_tag) { recv_trailing_metadata_ = nullptr; recv_status_ = nullptr; - gpr_free(recv_trailing_metadata_arr_.metadata); - recv_trailing_metadata_arr_ = {0, 0, nullptr}; + recv_trailing_metadata_arr_.count = 0; status_code_ = GRPC_STATUS_OK; - gpr_free(status_details_); - status_details_ = nullptr; - status_details_capacity_ = 0; send_status_ = nullptr; trailing_metadata_count_ = 0; @@ -83,6 +78,18 @@ void CallOpBuffer::Reset(void* next_return_tag) { recv_closed_ = nullptr; } +CallOpBuffer::~CallOpBuffer() { + gpr_free(status_details_); + gpr_free(recv_initial_metadata_arr_.metadata); + gpr_free(recv_trailing_metadata_arr_.metadata); + if (recv_message_buf_) { + grpc_byte_buffer_destroy(recv_message_buf_); + } + if (send_message_buf_) { + grpc_byte_buffer_destroy(send_message_buf_); + } +} + namespace { // TODO(yangg) if the map is changed before we send, the pointers will be a // mess. Make sure it does not happen. diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 7d198347999..294eeae5850 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -163,7 +163,11 @@ class Server::SyncRequest final : public CompletionQueueTag { this)); } - void FinalizeResult(void** tag, bool* status) override {} + void FinalizeResult(void** tag, bool* status) override { + if (!*status) { + grpc_completion_queue_destroy(cq_); + } + } class CallData final { public: @@ -182,6 +186,12 @@ class Server::SyncRequest final : public CompletionQueueTag { mrd->request_metadata_.count = 0; } + ~CallData() { + if (has_request_payload_ && request_payload_) { + grpc_byte_buffer_destroy(request_payload_); + } + } + void Run() { std::unique_ptr req; std::unique_ptr res; diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 2aaecb4e119..4fda5808bdb 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -445,5 +445,6 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); grpc_shutdown(); + google::protobuf::ShutdownProtobufLibrary(); return result; } From cbcc977857bb81e624b5cbca3c05eb68d9797826 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 16:09:08 -0800 Subject: [PATCH 094/232] fix sync unary call with metadata pieces --- include/grpc++/client_context.h | 23 +++++++++++++++++++++++ src/cpp/client/client_unary_call.cc | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index f74de8fad4f..5ff60a5399b 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -47,9 +47,18 @@ using std::chrono::system_clock; struct grpc_call; struct grpc_completion_queue; +namespace google { +namespace protobuf { +class Message; +} // namespace protobuf +} // namespace google + namespace grpc { class CallOpBuffer; +class ChannelInterface; +class RpcMethod; +class Status; template class ClientReader; template class ClientWriter; template class ClientReaderWriter; @@ -65,6 +74,16 @@ class ClientContext { void AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value); + std::multimap GetServerInitialMetadata() { + GPR_ASSERT(initial_metadata_received_); + return recv_initial_metadata_; + } + + std::multimap GetServerTrailingMetadata() { + // TODO(yangg) check finished + return trailing_metadata_; + } + void set_absolute_deadline(const system_clock::time_point &deadline); system_clock::time_point absolute_deadline(); @@ -83,6 +102,10 @@ class ClientContext { template friend class ::grpc::ClientAsyncReader; template friend class ::grpc::ClientAsyncWriter; template friend class ::grpc::ClientAsyncReaderWriter; + friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); grpc_call *call() { return call_; } void set_call(grpc_call *call) { diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 1221630a35c..99030a2d476 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -51,10 +52,11 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, Status status; buf.AddSendInitialMetadata(context); buf.AddSendMessage(request); + buf.AddRecvInitialMetadata(&context->recv_initial_metadata_); bool got_message; buf.AddRecvMessage(result, &got_message); buf.AddClientSendClose(); - buf.AddClientRecvStatus(nullptr, &status); // TODO metadata + buf.AddClientRecvStatus(&context->trailing_metadata_, &status); call.PerformOps(&buf); GPR_ASSERT(cq.Pluck(&buf) && (got_message || !status.IsOk())); return status; From 31150f01db50241ee29cce5966a7dcfcf981ec0b Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 16:44:00 -0800 Subject: [PATCH 095/232] implement async unary call --- include/grpc++/client_context.h | 6 ++++++ include/grpc++/completion_queue.h | 1 + include/grpc++/impl/call.h | 2 +- src/cpp/client/client_unary_call.cc | 20 +++++++++++++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 5ff60a5399b..ab5965f55a9 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -57,6 +57,7 @@ namespace grpc { class CallOpBuffer; class ChannelInterface; +class CompletionQueue; class RpcMethod; class Status; template class ClientReader; @@ -106,6 +107,11 @@ class ClientContext { ClientContext *context, const google::protobuf::Message &request, google::protobuf::Message *result); + friend void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result, Status *status, + CompletionQueue *cq, void *tag); grpc_call *call() { return call_; } void set_call(grpc_call *call) { diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 3e68cf37760..80874cd1e69 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -58,6 +58,7 @@ class Server; class CompletionQueueTag { public: + virtual ~CompletionQueueTag() {} // Called prior to returning from Next(), return value // is the status of the operation (return status is the default thing // to do) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 853f19e9b31..7aa22ee7c25 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -54,7 +54,7 @@ namespace grpc { class Call; -class CallOpBuffer final : public CompletionQueueTag { +class CallOpBuffer : public CompletionQueueTag { public: CallOpBuffer() : return_tag_(this) {} ~CallOpBuffer(); diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 99030a2d476..69f0b77d7b8 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -62,11 +62,29 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, return status; } +class ClientAsyncRequest final : public CallOpBuffer { + public: + void FinalizeResult(void** tag, bool* status) override { + CallOpBuffer::FinalizeResult(tag, status); + delete this; + } +}; + void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request, google::protobuf::Message *result, Status *status, CompletionQueue *cq, void *tag) { - + ClientAsyncRequest* buf = new ClientAsyncRequest; + buf->Reset(tag); + Call call(channel->CreateCall(method, context, cq)); + buf->AddSendInitialMetadata(context); + buf->AddSendMessage(request); + buf->AddRecvInitialMetadata(&context->recv_initial_metadata_); + buf->AddRecvMessage(result, nullptr); + buf->AddClientSendClose(); + buf->AddClientRecvStatus(&context->trailing_metadata_, status); + call.PerformOps(buf); } + } // namespace grpc From c645306b64c96d51c4d9104711e8eae9020e7354 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 17:32:57 -0800 Subject: [PATCH 096/232] Fixes --- include/grpc++/impl/service_type.h | 4 ++-- include/grpc++/server_context.h | 4 ++++ src/cpp/server/server_context.cc | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index cac2be30aba..fde5962107a 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -82,7 +82,7 @@ class AsynchronousService { size_t method_count) : cq_(cq), method_names_(method_names), method_count_(method_count) {} - ~AsynchronousService(); + ~AsynchronousService() { delete[] request_args_; } CompletionQueue* completion_queue() const { return cq_; } @@ -125,4 +125,4 @@ class AsynchronousService { } // namespace grpc -#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index fcca85594a1..64091a4505d 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -49,6 +49,8 @@ template class ServerAsyncReader; template class ServerAsyncWriter; +template +class ServerAsyncResponseWriter; template class ServerAsyncReaderWriter; template @@ -80,6 +82,8 @@ class ServerContext final { friend class ::grpc::ServerAsyncReader; template friend class ::grpc::ServerAsyncWriter; + template + friend class ::grpc::ServerAsyncResponseWriter; template friend class ::grpc::ServerAsyncReaderWriter; template diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 9e02ac5a3c5..21a61af3a04 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -38,6 +38,8 @@ namespace grpc { +ServerContext::ServerContext() {} + ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, size_t metadata_count) : deadline_(Timespec2Timepoint(deadline)) { From 0220cf14b02e9d3aa43c9cece4f52a8ca3f49d55 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 17:39:26 -0800 Subject: [PATCH 097/232] Add end2end async unary single threaded test (compiles) --- Makefile | 36 +++++- build.json | 16 +++ include/grpc++/impl/service_type.h | 1 - include/grpc++/stream.h | 6 +- src/compiler/cpp_generator.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 156 +++++++++++++++++++++++++ tools/run_tests/tests.json | 4 + 7 files changed, 215 insertions(+), 6 deletions(-) create mode 100644 test/cpp/end2end/async_end2end_test.cc diff --git a/Makefile b/Makefile index 5342145842e..7753a174f86 100644 --- a/Makefile +++ b/Makefile @@ -443,6 +443,7 @@ time_averaged_stats_test: bins/$(CONFIG)/time_averaged_stats_test time_test: bins/$(CONFIG)/time_test timeout_encoding_test: bins/$(CONFIG)/timeout_encoding_test transport_metadata_test: bins/$(CONFIG)/transport_metadata_test +async_end2end_test: bins/$(CONFIG)/async_end2end_test channel_arguments_test: bins/$(CONFIG)/channel_arguments_test cpp_plugin: bins/$(CONFIG)/cpp_plugin credentials_test: bins/$(CONFIG)/credentials_test @@ -810,7 +811,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c bins/$(CONFIG)/alarm_heap_test bins/$(CONFIG)/alarm_list_test bins/$(CONFIG)/alarm_test bins/$(CONFIG)/alpn_test bins/$(CONFIG)/bin_encoder_test bins/$(CONFIG)/census_hash_table_test bins/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test bins/$(CONFIG)/census_statistics_multiple_writers_test bins/$(CONFIG)/census_statistics_performance_test bins/$(CONFIG)/census_statistics_quick_test bins/$(CONFIG)/census_statistics_small_log_test bins/$(CONFIG)/census_stub_test bins/$(CONFIG)/census_window_stats_test bins/$(CONFIG)/chttp2_status_conversion_test bins/$(CONFIG)/chttp2_stream_encoder_test bins/$(CONFIG)/chttp2_stream_map_test bins/$(CONFIG)/chttp2_transport_end2end_test bins/$(CONFIG)/dualstack_socket_test bins/$(CONFIG)/echo_client bins/$(CONFIG)/echo_server bins/$(CONFIG)/echo_test bins/$(CONFIG)/fd_posix_test bins/$(CONFIG)/fling_client bins/$(CONFIG)/fling_server bins/$(CONFIG)/fling_stream_test bins/$(CONFIG)/fling_test bins/$(CONFIG)/gpr_cancellable_test bins/$(CONFIG)/gpr_cmdline_test bins/$(CONFIG)/gpr_env_test bins/$(CONFIG)/gpr_file_test bins/$(CONFIG)/gpr_histogram_test bins/$(CONFIG)/gpr_host_port_test bins/$(CONFIG)/gpr_log_test bins/$(CONFIG)/gpr_slice_buffer_test bins/$(CONFIG)/gpr_slice_test bins/$(CONFIG)/gpr_string_test bins/$(CONFIG)/gpr_sync_test bins/$(CONFIG)/gpr_thd_test bins/$(CONFIG)/gpr_time_test bins/$(CONFIG)/gpr_useful_test bins/$(CONFIG)/grpc_base64_test bins/$(CONFIG)/grpc_byte_buffer_reader_test bins/$(CONFIG)/grpc_channel_stack_test bins/$(CONFIG)/grpc_completion_queue_test bins/$(CONFIG)/grpc_credentials_test bins/$(CONFIG)/grpc_json_token_test bins/$(CONFIG)/grpc_stream_op_test bins/$(CONFIG)/hpack_parser_test bins/$(CONFIG)/hpack_table_test bins/$(CONFIG)/httpcli_format_request_test bins/$(CONFIG)/httpcli_parser_test bins/$(CONFIG)/httpcli_test bins/$(CONFIG)/json_rewrite bins/$(CONFIG)/json_rewrite_test bins/$(CONFIG)/json_test bins/$(CONFIG)/lame_client_test bins/$(CONFIG)/message_compress_test bins/$(CONFIG)/metadata_buffer_test bins/$(CONFIG)/murmur_hash_test bins/$(CONFIG)/no_server_test bins/$(CONFIG)/poll_kick_posix_test bins/$(CONFIG)/resolve_address_test bins/$(CONFIG)/secure_endpoint_test bins/$(CONFIG)/sockaddr_utils_test bins/$(CONFIG)/tcp_client_posix_test bins/$(CONFIG)/tcp_posix_test bins/$(CONFIG)/tcp_server_posix_test bins/$(CONFIG)/time_averaged_stats_test bins/$(CONFIG)/time_test bins/$(CONFIG)/timeout_encoding_test bins/$(CONFIG)/transport_metadata_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test bins/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test bins/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_fake_security_census_simple_request_test bins/$(CONFIG)/chttp2_fake_security_disappearing_server_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_fake_security_empty_batch_test bins/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_fake_security_invoke_large_request_test bins/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test bins/$(CONFIG)/chttp2_fake_security_no_op_test bins/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test bins/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test bins/$(CONFIG)/chttp2_fake_security_request_with_payload_test bins/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test bins/$(CONFIG)/chttp2_fake_security_simple_request_test bins/$(CONFIG)/chttp2_fake_security_thread_stress_test bins/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_fake_security_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_fake_security_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_fake_security_no_op_legacy_test bins/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_fake_security_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_fake_security_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_simple_request_legacy_test bins/$(CONFIG)/chttp2_fake_security_thread_stress_legacy_test bins/$(CONFIG)/chttp2_fake_security_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_fullstack_empty_batch_test bins/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_fullstack_no_op_test bins/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_fullstack_simple_request_test bins/$(CONFIG)/chttp2_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_thread_stress_legacy_test bins/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test bins/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test bins/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_socket_pair_census_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_disappearing_server_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_socket_pair_empty_batch_test bins/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test bins/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test bins/$(CONFIG)/chttp2_socket_pair_no_op_test bins/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test bins/$(CONFIG)/chttp2_socket_pair_request_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test bins/$(CONFIG)/chttp2_socket_pair_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_thread_stress_test bins/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_socket_pair_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_socket_pair_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_socket_pair_no_op_legacy_test bins/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_socket_pair_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_thread_stress_legacy_test bins/$(CONFIG)/chttp2_socket_pair_writes_done_hangs_with_pending_read_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_thread_stress_legacy_test bins/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_writes_done_hangs_with_pending_read_legacy_test -buildtests_cxx: privatelibs_cxx bins/$(CONFIG)/channel_arguments_test bins/$(CONFIG)/credentials_test bins/$(CONFIG)/end2end_test bins/$(CONFIG)/interop_client bins/$(CONFIG)/interop_server bins/$(CONFIG)/qps_client bins/$(CONFIG)/qps_server bins/$(CONFIG)/status_test bins/$(CONFIG)/thread_pool_test bins/$(CONFIG)/tips_client bins/$(CONFIG)/tips_publisher_test bins/$(CONFIG)/tips_subscriber_test +buildtests_cxx: privatelibs_cxx bins/$(CONFIG)/async_end2end_test bins/$(CONFIG)/channel_arguments_test bins/$(CONFIG)/credentials_test bins/$(CONFIG)/end2end_test bins/$(CONFIG)/interop_client bins/$(CONFIG)/interop_server bins/$(CONFIG)/qps_client bins/$(CONFIG)/qps_server bins/$(CONFIG)/status_test bins/$(CONFIG)/thread_pool_test bins/$(CONFIG)/tips_client bins/$(CONFIG)/tips_publisher_test bins/$(CONFIG)/tips_subscriber_test test: test_c test_cxx @@ -1524,6 +1525,8 @@ test_c: buildtests_c test_cxx: buildtests_cxx + $(E) "[RUN] Testing async_end2end_test" + $(Q) ./bins/$(CONFIG)/async_end2end_test || ( echo test async_end2end_test failed ; exit 1 ) $(E) "[RUN] Testing channel_arguments_test" $(Q) ./bins/$(CONFIG)/channel_arguments_test || ( echo test channel_arguments_test failed ; exit 1 ) $(E) "[RUN] Testing credentials_test" @@ -6995,6 +6998,37 @@ endif endif +ASYNC_END2END_TEST_SRC = \ + test/cpp/end2end/async_end2end_test.cc \ + +ASYNC_END2END_TEST_OBJS = $(addprefix objs/$(CONFIG)/, $(addsuffix .o, $(basename $(ASYNC_END2END_TEST_SRC)))) + +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +bins/$(CONFIG)/async_end2end_test: openssl_dep_error + +else + +bins/$(CONFIG)/async_end2end_test: $(ASYNC_END2END_TEST_OBJS) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) $(ASYNC_END2END_TEST_OBJS) $(GTEST_LIB) libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o bins/$(CONFIG)/async_end2end_test + +endif + +objs/$(CONFIG)/test/cpp/end2end/async_end2end_test.o: libs/$(CONFIG)/libgrpc++_test_util.a libs/$(CONFIG)/libgrpc_test_util.a libs/$(CONFIG)/libgrpc++.a libs/$(CONFIG)/libgrpc.a libs/$(CONFIG)/libgpr_test_util.a libs/$(CONFIG)/libgpr.a + +deps_async_end2end_test: $(ASYNC_END2END_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(ASYNC_END2END_TEST_OBJS:.o=.dep) +endif +endif + + CHANNEL_ARGUMENTS_TEST_SRC = \ test/cpp/client/channel_arguments_test.cc \ diff --git a/build.json b/build.json index 0b46bc2109b..53e132a9759 100644 --- a/build.json +++ b/build.json @@ -1524,6 +1524,22 @@ "gpr" ] }, + { + "name": "async_end2end_test", + "build": "test", + "language": "c++", + "src": [ + "test/cpp/end2end/async_end2end_test.cc" + ], + "deps": [ + "grpc++_test_util", + "grpc_test_util", + "grpc++", + "grpc", + "gpr_test_util", + "gpr" + ] + }, { "name": "channel_arguments_test", "build": "test", diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index fde5962107a..221664befe2 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -59,7 +59,6 @@ class ServerAsyncStreamingInterface { virtual ~ServerAsyncStreamingInterface() {} virtual void SendInitialMetadata(void* tag) = 0; - virtual void Finish(const Status& status, void* tag) = 0; private: friend class Server; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index fd33deea4dc..359a272e7b7 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -646,7 +646,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, call_.PerformOps(&read_buf_); } - void Finish(const Status& status, void* tag) override { + void Finish(const Status& status, void* tag) { finish_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -695,7 +695,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void Finish(const Status& status, void* tag) override { + void Finish(const Status& status, void* tag) { finish_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); @@ -751,7 +751,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, call_.PerformOps(&write_buf_); } - void Finish(const Status& status, void* tag) override { + void Finish(const Status& status, void* tag) { finish_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 1ab4c29451c..a34aa4e568e 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -335,7 +335,7 @@ void PrintHeaderService(google::protobuf::io::Printer *printer, printer->Indent(); (*vars)["MethodCount"] = as_string(service->method_count()); printer->Print("explicit AsyncService(::grpc::CompletionQueue* cq);\n"); - printer->Print("~AsyncService();\n"); + printer->Print("~AsyncService() {};\n"); for (int i = 0; i < service->method_count(); ++i) { PrintHeaderServerMethodAsync(printer, service->method(i), vars); } diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc new file mode 100644 index 00000000000..52fb80e8db3 --- /dev/null +++ b/test/cpp/end2end/async_end2end_test.cc @@ -0,0 +1,156 @@ +/* + * + * Copyright 2014, 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 "test/core/util/test_config.h" +#include "test/cpp/util/echo_duplicate.pb.h" +#include "test/cpp/util/echo.pb.h" +#include "src/cpp/util/time.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "test/core/util/port.h" +#include + +#include +#include +#include + +using grpc::cpp::test::util::EchoRequest; +using grpc::cpp::test::util::EchoResponse; +using std::chrono::system_clock; + +namespace grpc { +namespace testing { + +namespace { + +class End2endTest : public ::testing::Test { + protected: + End2endTest() : service_(&cq_) {} + + void SetUp() override { + int port = grpc_pick_unused_port_or_die(); + server_address_ << "localhost:" << port; + // Setup server + ServerBuilder builder; + builder.AddPort(server_address_.str()); + builder.RegisterAsyncService(&service_); + server_ = builder.BuildAndStart(); + } + + void TearDown() override { server_->Shutdown(); } + + void ResetStub() { + std::shared_ptr channel = + CreateChannel(server_address_.str(), ChannelArguments()); + stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel)); + } + + CompletionQueue cq_; + std::unique_ptr stub_; + std::unique_ptr server_; + grpc::cpp::test::util::TestService::AsyncService service_; + std::ostringstream server_address_; +}; + +void* tag(int i) { + return (void*)(gpr_intptr)i; +} + +TEST_F(End2endTest, SimpleRpc) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + stub_->Echo(&cli_ctx, send_request, &recv_response, &recv_status, &cq_, tag(1)); + + service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, &cq_, tag(2)); + + void *got_tag; + bool ok; + EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(ok); + EXPECT_EQ(got_tag, tag(2)); + EXPECT_EQ(recv_request.message(), "Hello"); + + send_response.set_message(recv_request.message()); + response_writer.Finish(send_response, Status::OK, tag(3)); + + EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(ok); + if (got_tag == tag(3)) { + EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(ok); + EXPECT_EQ(got_tag, tag(1)); + } else { + EXPECT_EQ(got_tag, tag(1)); + EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(ok); + EXPECT_EQ(got_tag, tag(3)); + } + + EXPECT_EQ(recv_response.message(), "Hello"); + EXPECT_TRUE(recv_status.IsOk()); +} + +} // namespace +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_test_init(argc, argv); + grpc_init(); + ::testing::InitGoogleTest(&argc, argv); + int result = RUN_ALL_TESTS(); + grpc_shutdown(); + google::protobuf::ShutdownProtobufLibrary(); + return result; +} diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 7d02dca2d10..b69faad26ca 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -265,6 +265,10 @@ "language": "c", "name": "transport_metadata_test" }, + { + "language": "c++", + "name": "async_end2end_test" + }, { "language": "c++", "name": "channel_arguments_test" From cbc427a9557460375ad686081c775339fcfa2a38 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 22:18:56 -0800 Subject: [PATCH 098/232] allow null got_message --- src/cpp/common/call.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index d706ec45e51..3f9b4852b95 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -256,12 +256,16 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { // Parse received message if any. if (recv_message_) { if (recv_message_buf_) { - *got_message_ = true; + if (got_message_) { + *got_message_ = true; + } *status = DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } else { - *got_message_ = false; + if (got_message_) { + *got_message_ = false; + } } } // Parse received status. From db73e90e3bd956c4be471789d8e23f5eb2a4601e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 22:21:54 -0800 Subject: [PATCH 099/232] Fix nullptr crash --- src/cpp/client/client_unary_call.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 69f0b77d7b8..b6bd81d93fc 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -64,8 +64,10 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, class ClientAsyncRequest final : public CallOpBuffer { public: + bool got_message = false; void FinalizeResult(void** tag, bool* status) override { CallOpBuffer::FinalizeResult(tag, status); + *status &= got_message; delete this; } }; @@ -81,7 +83,7 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf->AddSendInitialMetadata(context); buf->AddSendMessage(request); buf->AddRecvInitialMetadata(&context->recv_initial_metadata_); - buf->AddRecvMessage(result, nullptr); + buf->AddRecvMessage(result, &buf->got_message); buf->AddClientSendClose(); buf->AddClientRecvStatus(&context->trailing_metadata_, status); call.PerformOps(buf); From c17e861aa06cfe2a75159192cdb90b425801aa5f Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 22:22:23 -0800 Subject: [PATCH 100/232] more nullptr for got_message --- include/grpc++/stream.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 359a272e7b7..6f2441ff926 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -420,8 +420,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool ignore; - read_buf_.AddRecvMessage(msg, &ignore); + read_buf_.AddRecvMessage(msg, nullptr); call_.PerformOps(&read_buf_); } @@ -485,8 +484,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool ignore; - finish_buf_.AddRecvMessage(response_, &ignore); + finish_buf_.AddRecvMessage(response_, nullptr); finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -494,7 +492,6 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, private: ClientContext* context_ = nullptr; google::protobuf::Message *const response_; - bool got_message_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -532,8 +529,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool ignore; - read_buf_.AddRecvMessage(msg, &ignore); + read_buf_.AddRecvMessage(msg, nullptr); call_.PerformOps(&read_buf_); } From 5d6bd443818f157995207c3049820dead5fdcde0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 12 Feb 2015 22:50:38 -0800 Subject: [PATCH 101/232] Fix tsan reported race --- src/core/surface/server.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 169fb1a7813..4ae6f5d9559 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -708,6 +708,7 @@ grpc_transport_setup_result grpc_server_setup_transport( gpr_uint32 slots; gpr_uint32 probes; gpr_uint32 max_probes = 0; + grpc_transport_setup_result result; for (i = 0; i < s->channel_filter_count; i++) { filters[i] = s->channel_filters[i]; @@ -758,6 +759,9 @@ grpc_transport_setup_result grpc_server_setup_transport( chand->registered_method_max_probes = max_probes; } + result = grpc_connected_channel_bind_transport( + grpc_channel_get_channel_stack(channel), transport); + gpr_mu_lock(&s->mu); chand->next = &s->root_channel_data; chand->prev = chand->next->prev; @@ -766,8 +770,7 @@ grpc_transport_setup_result grpc_server_setup_transport( gpr_free(filters); - return grpc_connected_channel_bind_transport( - grpc_channel_get_channel_stack(channel), transport); + return result; } static void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, From 0c7aafaa0caf7b9fb3dfabb35f4270033b4ad164 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 22:51:38 -0800 Subject: [PATCH 102/232] change AddRecvMessage signature --- include/grpc++/impl/call.h | 4 ++-- include/grpc++/stream.h | 31 ++++++++++++----------------- src/cpp/client/client_unary_call.cc | 7 +++---- src/cpp/common/call.cc | 15 ++++++-------- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 7aa22ee7c25..af1c710098f 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -68,7 +68,7 @@ class CallOpBuffer : public CompletionQueueTag { void AddRecvInitialMetadata( std::multimap *metadata); void AddSendMessage(const google::protobuf::Message &message); - void AddRecvMessage(google::protobuf::Message *message, bool* got_message); + void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); void AddClientRecvStatus(std::multimap *metadata, Status *status); @@ -84,6 +84,7 @@ class CallOpBuffer : public CompletionQueueTag { // Called by completion queue just prior to returning from Next() or Pluck() void FinalizeResult(void **tag, bool *status) override; + bool got_message = false; private: void *return_tag_ = nullptr; // Send initial metadata @@ -98,7 +99,6 @@ class CallOpBuffer : public CompletionQueueTag { grpc_byte_buffer* send_message_buf_ = nullptr; // Recv message google::protobuf::Message* recv_message_ = nullptr; - bool* got_message_ = nullptr; grpc_byte_buffer* recv_message_buf_ = nullptr; // Client send close bool client_send_close_ = false; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6f2441ff926..ecc28f62160 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -119,10 +119,9 @@ class ClientReader final : public ClientStreamingInterface, buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_.PerformOps(&buf); - return cq_.Pluck(&buf) && got_message; + return cq_.Pluck(&buf) && buf.got_message; } virtual Status Finish() override { @@ -174,11 +173,10 @@ class ClientWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - bool got_message; - buf.AddRecvMessage(response_, &got_message); + buf.AddRecvMessage(response_); buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); call_.PerformOps(&buf); - GPR_ASSERT(cq_.Pluck(&buf) && got_message); + GPR_ASSERT(cq_.Pluck(&buf) && buf.got_message); return status; } @@ -225,10 +223,9 @@ class ClientReaderWriter final : public ClientStreamingInterface, buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_.PerformOps(&buf); - return cq_.Pluck(&buf) && got_message; + return cq_.Pluck(&buf) && buf.got_message; } virtual bool Write(const W& msg) override { @@ -277,10 +274,9 @@ class ServerReader final : public ReaderInterface { virtual bool Read(R* msg) override { CallOpBuffer buf; - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf) && got_message; + return call_->cq()->Pluck(&buf) && buf.got_message; } private: @@ -338,10 +334,9 @@ class ServerReaderWriter final : public WriterInterface, virtual bool Read(R* msg) override { CallOpBuffer buf; - bool got_message; - buf.AddRecvMessage(msg, &got_message); + buf.AddRecvMessage(msg); call_->PerformOps(&buf); - return call_->cq()->Pluck(&buf) && got_message; + return call_->cq()->Pluck(&buf) && buf.got_message; } virtual bool Write(const W& msg) override { @@ -420,7 +415,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg, nullptr); + read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } @@ -484,7 +479,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - finish_buf_.AddRecvMessage(response_, nullptr); + finish_buf_.AddRecvMessage(response_); finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -529,7 +524,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); context_->initial_metadata_received_ = true; } - read_buf_.AddRecvMessage(msg, nullptr); + read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); } diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 69f0b77d7b8..d68d7a9242f 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -53,12 +53,11 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf.AddSendInitialMetadata(context); buf.AddSendMessage(request); buf.AddRecvInitialMetadata(&context->recv_initial_metadata_); - bool got_message; - buf.AddRecvMessage(result, &got_message); + buf.AddRecvMessage(result); buf.AddClientSendClose(); buf.AddClientRecvStatus(&context->trailing_metadata_, &status); call.PerformOps(&buf); - GPR_ASSERT(cq.Pluck(&buf) && (got_message || !status.IsOk())); + GPR_ASSERT(cq.Pluck(&buf) && (buf.got_message || !status.IsOk())); return status; } @@ -81,7 +80,7 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf->AddSendInitialMetadata(context); buf->AddSendMessage(request); buf->AddRecvInitialMetadata(&context->recv_initial_metadata_); - buf->AddRecvMessage(result, nullptr); + buf->AddRecvMessage(result); buf->AddClientSendClose(); buf->AddClientRecvStatus(&context->trailing_metadata_, status); call.PerformOps(buf); diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 3f9b4852b95..fe8859de944 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -57,7 +57,7 @@ void CallOpBuffer::Reset(void* next_return_tag) { } recv_message_ = nullptr; - got_message_ = nullptr; + got_message = false; if (recv_message_buf_) { grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; @@ -142,9 +142,8 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { send_message_ = &message; } -void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message, bool* got_message) { +void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) { recv_message_ = message; - got_message_ = got_message; } void CallOpBuffer::AddClientSendClose() { @@ -256,16 +255,14 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { // Parse received message if any. if (recv_message_) { if (recv_message_buf_) { - if (got_message_) { - *got_message_ = true; - } + got_message = true; *status = DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } else { - if (got_message_) { - *got_message_ = false; - } + // Read failed + got_message = false; + *status = false; } } // Parse received status. From bb84a30f07518dca4ebd772415e43e0346e552db Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 12 Feb 2015 23:30:12 -0800 Subject: [PATCH 103/232] let the client/server use their own cq and pretty the test --- test/cpp/end2end/async_end2end_test.cc | 38 ++++++++++++-------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 52fb80e8db3..25f8111ca80 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -66,7 +66,7 @@ namespace { class End2endTest : public ::testing::Test { protected: - End2endTest() : service_(&cq_) {} + End2endTest() : service_(&srv_cq_) {} void SetUp() override { int port = grpc_pick_unused_port_or_die(); @@ -86,7 +86,8 @@ class End2endTest : public ::testing::Test { stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel)); } - CompletionQueue cq_; + CompletionQueue cli_cq_; + CompletionQueue srv_cq_; std::unique_ptr stub_; std::unique_ptr server_; grpc::cpp::test::util::TestService::AsyncService service_; @@ -99,7 +100,7 @@ void* tag(int i) { TEST_F(End2endTest, SimpleRpc) { ResetStub(); - + EchoRequest send_request; EchoRequest recv_request; EchoResponse send_response; @@ -110,34 +111,31 @@ TEST_F(End2endTest, SimpleRpc) { grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); send_request.set_message("Hello"); - stub_->Echo(&cli_ctx, send_request, &recv_response, &recv_status, &cq_, tag(1)); + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); - service_.RequestEcho(&srv_ctx, &recv_request, &response_writer, &cq_, tag(2)); + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); void *got_tag; bool ok; - EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(srv_cq_.Next(&got_tag, &ok)); EXPECT_TRUE(ok); - EXPECT_EQ(got_tag, tag(2)); - EXPECT_EQ(recv_request.message(), "Hello"); + EXPECT_EQ(tag(2), got_tag); + EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - EXPECT_TRUE(cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(srv_cq_.Next(&got_tag, &ok)); EXPECT_TRUE(ok); - if (got_tag == tag(3)) { - EXPECT_TRUE(cq_.Next(&got_tag, &ok)); - EXPECT_TRUE(ok); - EXPECT_EQ(got_tag, tag(1)); - } else { - EXPECT_EQ(got_tag, tag(1)); - EXPECT_TRUE(cq_.Next(&got_tag, &ok)); - EXPECT_TRUE(ok); - EXPECT_EQ(got_tag, tag(3)); - } + EXPECT_EQ(tag(3), got_tag); + + EXPECT_TRUE(cli_cq_.Next(&got_tag, &ok)); + EXPECT_TRUE(ok); + EXPECT_EQ(tag(1), got_tag); - EXPECT_EQ(recv_response.message(), "Hello"); + EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); } From c05b6cb89d09a326a3a63e83e8399cc38e93a007 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Feb 2015 00:34:10 -0800 Subject: [PATCH 104/232] add a bidi test and simplify the test a bit, test passes --- test/cpp/end2end/async_end2end_test.cc | 94 ++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 15 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 25f8111ca80..62c7e40ed2a 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -64,6 +64,18 @@ namespace testing { namespace { +void* tag(int i) { + return (void*)(gpr_intptr)i; +} + +void verify_ok(CompletionQueue* cq, int i, bool expect_ok) { + bool ok; + void* got_tag; + EXPECT_TRUE(cq->Next(&got_tag, &ok)); + EXPECT_EQ(expect_ok, ok); + EXPECT_EQ(tag(i), got_tag); +} + class End2endTest : public ::testing::Test { protected: End2endTest() : service_(&srv_cq_) {} @@ -86,6 +98,18 @@ class End2endTest : public ::testing::Test { stub_.reset(grpc::cpp::test::util::TestService::NewStub(channel)); } + void server_ok(int i) { + verify_ok(&srv_cq_, i, true); + } + void client_ok(int i) { + verify_ok(&cli_cq_, i , true); + } + void server_fail(int i) { + verify_ok(&srv_cq_, i, false); + } + void client_fail(int i) { + verify_ok(&cli_cq_, i, false); + } CompletionQueue cli_cq_; CompletionQueue srv_cq_; std::unique_ptr stub_; @@ -94,10 +118,6 @@ class End2endTest : public ::testing::Test { std::ostringstream server_address_; }; -void* tag(int i) { - return (void*)(gpr_intptr)i; -} - TEST_F(End2endTest, SimpleRpc) { ResetStub(); @@ -117,25 +137,69 @@ TEST_F(End2endTest, SimpleRpc) { service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); - void *got_tag; - bool ok; - EXPECT_TRUE(srv_cq_.Next(&got_tag, &ok)); - EXPECT_TRUE(ok); - EXPECT_EQ(tag(2), got_tag); + server_ok(2); EXPECT_EQ(send_request.message(), recv_request.message()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - EXPECT_TRUE(srv_cq_.Next(&got_tag, &ok)); - EXPECT_TRUE(ok); - EXPECT_EQ(tag(3), got_tag); + server_ok(3); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); +} + +TEST_F(End2endTest, SimpleBidiStreaming) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + ClientContext cli_ctx; + ServerContext srv_ctx; + ServerAsyncReaderWriter srv_stream(&srv_ctx); + + send_request.set_message("Hello"); + ClientAsyncReaderWriter* cli_stream = + stub_->BidiStream(&cli_ctx, &cli_cq_, tag(1)); - EXPECT_TRUE(cli_cq_.Next(&got_tag, &ok)); - EXPECT_TRUE(ok); - EXPECT_EQ(tag(1), got_tag); + service_.RequestBidiStream( + &srv_ctx, &srv_stream, &srv_cq_, tag(2)); + server_ok(2); + client_ok(1); + + cli_stream->Write(send_request, tag(3)); + client_ok(3); + + srv_stream.Read(&recv_request, tag(4)); + server_ok(4); + EXPECT_EQ(send_request.message(), recv_request.message()); + + send_response.set_message(recv_request.message()); + srv_stream.Write(send_response, tag(5)); + server_ok(5); + + cli_stream->Read(&recv_response, tag(6)); + client_ok(6); EXPECT_EQ(send_response.message(), recv_response.message()); + + cli_stream->WritesDone(tag(7)); + client_ok(7); + + srv_stream.Read(&recv_request, tag(8)); + server_fail(8); + + srv_stream.Finish(Status::OK, tag(9)); + server_ok(9); + + cli_stream->Finish(&recv_status, tag(10)); + client_ok(10); + EXPECT_TRUE(recv_status.IsOk()); } From 005f18a6a1b2f52ba841d885f93bc2250c8683fa Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Feb 2015 10:22:33 -0800 Subject: [PATCH 105/232] change ServerAsyncReader API and add a simple clientstreaming test, it passes --- include/grpc++/server_context.h | 2 +- include/grpc++/stream.h | 20 +++++++++- src/compiler/cpp_generator.cc | 6 +-- test/cpp/end2end/async_end2end_test.cc | 54 ++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 6 deletions(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 64091a4505d..423ebf23377 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -45,7 +45,7 @@ struct grpc_call; namespace grpc { -template +template class ServerAsyncReader; template class ServerAsyncWriter; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index ecc28f62160..6ee550bd644 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -615,7 +615,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { CallOpBuffer finish_buf_; }; -template +template class ServerAsyncReader : public ServerAsyncStreamingInterface, public AsyncReaderInterface { public: @@ -637,18 +637,34 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, call_.PerformOps(&read_buf_); } - void Finish(const Status& status, void* tag) { + void Finish(const W& msg, const Status& status, void* tag) { finish_buf_.Reset(tag); if (!ctx_->sent_initial_metadata_) { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } + // The response is dropped if the status is not OK. + if (status.IsOk()) { + finish_buf_.AddSendMessage(msg); + } bool cancelled = false; finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } + void FinishWithError(const Status& status, void* tag) { + GPR_ASSERT(!status.IsOk()); + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_buf_); + } private: void BindCall(Call *call) override { call_ = *call; } diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index a34aa4e568e..2a9895e43c4 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -133,7 +133,7 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { temp.append("template class ClientWriter;\n"); temp.append("template class ServerReader;\n"); temp.append("template class ClientAsyncWriter;\n"); - temp.append("template class ServerAsyncReader;\n"); + temp.append("template class ServerAsyncReader;\n"); } if (HasServerOnlyStreaming(file)) { temp.append("template class ClientReader;\n"); @@ -267,7 +267,7 @@ void PrintHeaderServerMethodAsync( printer->Print(*vars, "void Request$Method$(" "::grpc::ServerContext* context, " - "::grpc::ServerAsyncReader< $Request$>* reader, " + "::grpc::ServerAsyncReader< $Response$, $Request$>* reader, " "::grpc::CompletionQueue* cq, void *tag);\n"); } else if (ServerOnlyStreaming(method)) { printer->Print(*vars, @@ -538,7 +538,7 @@ void PrintSourceServerAsyncMethod( printer->Print(*vars, "void $Service$::AsyncService::Request$Method$(" "::grpc::ServerContext* context, " - "::grpc::ServerAsyncReader< $Request$>* reader, " + "::grpc::ServerAsyncReader< $Response$, $Request$>* reader, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print( *vars, diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 62c7e40ed2a..b85aabf09e1 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -110,6 +110,7 @@ class End2endTest : public ::testing::Test { void client_fail(int i) { verify_ok(&cli_cq_, i, false); } + CompletionQueue cli_cq_; CompletionQueue srv_cq_; std::unique_ptr stub_; @@ -151,6 +152,59 @@ TEST_F(End2endTest, SimpleRpc) { EXPECT_TRUE(recv_status.IsOk()); } +TEST_F(End2endTest, SimpleClientStreaming) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + ClientContext cli_ctx; + ServerContext srv_ctx; + ServerAsyncReader srv_stream(&srv_ctx); + + send_request.set_message("Hello"); + ClientAsyncWriter* cli_stream = + stub_->RequestStream(&cli_ctx, &recv_response, &cli_cq_, tag(1)); + + service_.RequestRequestStream( + &srv_ctx, &srv_stream, &srv_cq_, tag(2)); + + server_ok(2); + client_ok(1); + + cli_stream->Write(send_request, tag(3)); + client_ok(3); + + srv_stream.Read(&recv_request, tag(4)); + server_ok(4); + EXPECT_EQ(send_request.message(), recv_request.message()); + + cli_stream->Write(send_request, tag(5)); + client_ok(5); + + srv_stream.Read(&recv_request, tag(6)); + server_ok(6); + + EXPECT_EQ(send_request.message(), recv_request.message()); + cli_stream->WritesDone(tag(7)); + client_ok(7); + + srv_stream.Read(&recv_request, tag(8)); + server_fail(8); + + send_response.set_message(recv_request.message()); + srv_stream.Finish(send_response, Status::OK, tag(9)); + server_ok(9); + + cli_stream->Finish(&recv_status, tag(10)); + client_ok(10); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); +} + TEST_F(End2endTest, SimpleBidiStreaming) { ResetStub(); From 07d8304f3029f825c29399996c55119ad2bc2c82 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Feb 2015 14:11:31 -0800 Subject: [PATCH 106/232] change stub API for server streaming, pass in const Request& instead of const Request* for the first request --- src/compiler/cpp_generator.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 2a9895e43c4..60dc02d7af9 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -197,10 +197,10 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, printer->Print( *vars, "::grpc::ClientReader< $Response$>* $Method$(" - "::grpc::ClientContext* context, const $Request$* request);\n"); + "::grpc::ClientContext* context, const $Request$& request);\n"); printer->Print(*vars, "::grpc::ClientAsyncReader< $Response$>* $Method$(" - "::grpc::ClientContext* context, const $Request$* request, " + "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag);\n"); } else if (BidiStreaming(method)) { printer->Print(*vars, @@ -415,25 +415,25 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, printer->Print( *vars, "::grpc::ClientReader< $Response$>* $Service$::Stub::$Method$(" - "::grpc::ClientContext* context, const $Request$* request) {\n"); + "::grpc::ClientContext* context, const $Request$& request) {\n"); printer->Print(*vars, " return new ::grpc::ClientReader< $Response$>(" "channel()," "::grpc::RpcMethod($Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " - "context, *request);\n" + "context, request);\n" "}\n\n"); printer->Print( *vars, "::grpc::ClientAsyncReader< $Response$>* $Service$::Stub::$Method$(" - "::grpc::ClientContext* context, const $Request$* request, " + "::grpc::ClientContext* context, const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, " return new ::grpc::ClientAsyncReader< $Response$>(" "channel(), cq, " "::grpc::RpcMethod($Service$_method_names[$Idx$], " "::grpc::RpcMethod::RpcType::SERVER_STREAMING), " - "context, *request, tag);\n" + "context, request, tag);\n" "}\n\n"); } else if (BidiStreaming(method)) { printer->Print( From 0e0d8e11e63629a3953ceed60278f7ff2abd21d7 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Feb 2015 14:40:41 -0800 Subject: [PATCH 107/232] add a simple server streaming e2e test, which passes --- test/cpp/end2end/async_end2end_test.cc | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index b85aabf09e1..35c068549aa 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -152,6 +152,7 @@ TEST_F(End2endTest, SimpleRpc) { EXPECT_TRUE(recv_status.IsOk()); } +// Two pings and a final pong. TEST_F(End2endTest, SimpleClientStreaming) { ResetStub(); @@ -205,6 +206,58 @@ TEST_F(End2endTest, SimpleClientStreaming) { EXPECT_TRUE(recv_status.IsOk()); } +// One ping, two pongs. +TEST_F(End2endTest, SimpleServerStreaming) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + ClientContext cli_ctx; + ServerContext srv_ctx; + ServerAsyncWriter srv_stream(&srv_ctx); + + send_request.set_message("Hello"); + ClientAsyncReader* cli_stream = + stub_->ResponseStream(&cli_ctx, send_request, &cli_cq_, tag(1)); + + service_.RequestResponseStream( + &srv_ctx, &recv_request, &srv_stream, &srv_cq_, tag(2)); + + server_ok(2); + client_ok(1); + EXPECT_EQ(send_request.message(), recv_request.message()); + + send_response.set_message(recv_request.message()); + srv_stream.Write(send_response, tag(3)); + server_ok(3); + + cli_stream->Read(&recv_response, tag(4)); + client_ok(4); + EXPECT_EQ(send_response.message(), recv_response.message()); + + srv_stream.Write(send_response, tag(5)); + server_ok(5); + + cli_stream->Read(&recv_response, tag(6)); + client_ok(6); + EXPECT_EQ(send_response.message(), recv_response.message()); + + srv_stream.Finish(Status::OK, tag(7)); + server_ok(7); + + cli_stream->Read(&recv_response, tag(8)); + client_fail(8); + + cli_stream->Finish(&recv_status, tag(9)); + client_ok(9); + + EXPECT_TRUE(recv_status.IsOk()); +} + +// One ping, one pong. TEST_F(End2endTest, SimpleBidiStreaming) { ResetStub(); From 8c22f05f219f90bc7167ef42ac981a3b010e9351 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 13 Feb 2015 15:11:57 -0800 Subject: [PATCH 108/232] Minor compile fix --- include/grpc++/server_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 423ebf23377..31b09ee7a87 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -78,7 +78,7 @@ class ServerContext final { private: friend class ::grpc::Server; - template + template friend class ::grpc::ServerAsyncReader; template friend class ::grpc::ServerAsyncWriter; From 857680be2c7bd358528a85a9a61043a907050628 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 13 Feb 2015 15:19:48 -0800 Subject: [PATCH 109/232] Compile fixes --- test/cpp/end2end/end2end_test.cc | 2 +- test/cpp/interop/client.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 4fda5808bdb..974717f6e2e 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -329,7 +329,7 @@ TEST_F(End2endTest, ResponseStream) { request.set_message("hello"); ClientReader* stream = - stub_->ResponseStream(&context, &request); + stub_->ResponseStream(&context, request); EXPECT_TRUE(stream->Read(&response)); EXPECT_EQ(response.message(), request.message() + "0"); EXPECT_TRUE(stream->Read(&response)); diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 29bbe4d931d..57a503f84f9 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -269,7 +269,7 @@ void DoResponseStreaming() { } StreamingOutputCallResponse response; std::unique_ptr> stream( - stub->StreamingOutputCall(&context, &request)); + stub->StreamingOutputCall(&context, request)); unsigned int i = 0; while (stream->Read(&response)) { @@ -299,7 +299,7 @@ void DoResponseStreamingWithSlowConsumer() { } StreamingOutputCallResponse response; std::unique_ptr> stream( - stub->StreamingOutputCall(&context, &request)); + stub->StreamingOutputCall(&context, request)); int i = 0; while (stream->Read(&response)) { From 406b32f663d14994a24abea3788d0bffce216f8a Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Fri, 13 Feb 2015 16:25:33 -0800 Subject: [PATCH 110/232] Add missing APIs and a first metadata test, and test passes --- include/grpc++/client_context.h | 2 +- include/grpc++/server_context.h | 4 + src/cpp/client/client_context.cc | 6 +- test/cpp/end2end/async_end2end_test.cc | 122 ++++++++++++++++++------- 4 files changed, 98 insertions(+), 36 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index ab5965f55a9..3912e52ecea 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -88,7 +88,7 @@ class ClientContext { void set_absolute_deadline(const system_clock::time_point &deadline); system_clock::time_point absolute_deadline(); - void StartCancel(); + void TryCancel(); private: // Disallow copy and assign. diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 423ebf23377..ec7b8062f99 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -76,6 +76,10 @@ class ServerContext final { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + std::multimap client_metadata() { + return client_metadata_; + } + private: friend class ::grpc::Server; template diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index afacc81c168..64a829630d1 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -75,6 +75,10 @@ void ClientContext::AddMetadata(const grpc::string &meta_key, send_initial_metadata_.insert(std::make_pair(meta_key, meta_value)); } -void ClientContext::StartCancel() {} +void ClientContext::TryCancel() { + if (call_) { + grpc_call_cancel(call_); + } +} } // namespace grpc diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 35c068549aa..fbf9bcb1179 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -76,9 +76,9 @@ void verify_ok(CompletionQueue* cq, int i, bool expect_ok) { EXPECT_EQ(tag(i), got_tag); } -class End2endTest : public ::testing::Test { +class AsyncEnd2endTest : public ::testing::Test { protected: - End2endTest() : service_(&srv_cq_) {} + AsyncEnd2endTest() : service_(&srv_cq_) {} void SetUp() override { int port = grpc_pick_unused_port_or_die(); @@ -111,6 +111,40 @@ class End2endTest : public ::testing::Test { verify_ok(&cli_cq_, i, false); } + void SendRpc(int num_rpcs) { + for (int i = 0; i < num_rpcs; i++) { + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); + + server_ok(2); + EXPECT_EQ(send_request.message(), recv_request.message()); + + send_response.set_message(recv_request.message()); + response_writer.Finish(send_response, Status::OK, tag(3)); + + server_ok(3); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); + } + } + CompletionQueue cli_cq_; CompletionQueue srv_cq_; std::unique_ptr stub_; @@ -119,41 +153,18 @@ class End2endTest : public ::testing::Test { std::ostringstream server_address_; }; -TEST_F(End2endTest, SimpleRpc) { +TEST_F(AsyncEnd2endTest, SimpleRpc) { ResetStub(); + SendRpc(1); +} - EchoRequest send_request; - EchoRequest recv_request; - EchoResponse send_response; - EchoResponse recv_response; - Status recv_status; - ClientContext cli_ctx; - ServerContext srv_ctx; - grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); - - send_request.set_message("Hello"); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); - - service_.RequestEcho( - &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); - - server_ok(2); - EXPECT_EQ(send_request.message(), recv_request.message()); - - send_response.set_message(recv_request.message()); - response_writer.Finish(send_response, Status::OK, tag(3)); - - server_ok(3); - - client_ok(1); - - EXPECT_EQ(send_response.message(), recv_response.message()); - EXPECT_TRUE(recv_status.IsOk()); +TEST_F(AsyncEnd2endTest, SequentialRpcs) { + ResetStub(); + SendRpc(10); } // Two pings and a final pong. -TEST_F(End2endTest, SimpleClientStreaming) { +TEST_F(AsyncEnd2endTest, SimpleClientStreaming) { ResetStub(); EchoRequest send_request; @@ -207,7 +218,7 @@ TEST_F(End2endTest, SimpleClientStreaming) { } // One ping, two pongs. -TEST_F(End2endTest, SimpleServerStreaming) { +TEST_F(AsyncEnd2endTest, SimpleServerStreaming) { ResetStub(); EchoRequest send_request; @@ -258,7 +269,7 @@ TEST_F(End2endTest, SimpleServerStreaming) { } // One ping, one pong. -TEST_F(End2endTest, SimpleBidiStreaming) { +TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) { ResetStub(); EchoRequest send_request; @@ -310,6 +321,49 @@ TEST_F(End2endTest, SimpleBidiStreaming) { EXPECT_TRUE(recv_status.IsOk()); } +// Metadata tests +TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + std::pair meta1("key1", "val1"); + std::pair meta2("key2", "val2"); + cli_ctx.AddMetadata(meta1.first, meta1.second); + cli_ctx.AddMetadata(meta2.first, meta2.second); + + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); + server_ok(2); + EXPECT_EQ(send_request.message(), recv_request.message()); + auto client_initial_metadata = srv_ctx.client_metadata(); + EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); + EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(2, client_initial_metadata.size()); + + send_response.set_message(recv_request.message()); + response_writer.Finish(send_response, Status::OK, tag(3)); + + server_ok(3); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); +} + } // namespace } // namespace testing } // namespace grpc From 73b7018ebdf546684fc916dcf87d21dd82d0b4c5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 07:36:09 -0800 Subject: [PATCH 111/232] Cleaned up --- build.json | 78 +++++++++++++++++++------------------- tools/run_tests/tests.json | 8 ++-- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/build.json b/build.json index 119bd4c54ee..5e4d806cff0 100644 --- a/build.json +++ b/build.json @@ -1645,15 +1645,15 @@ ] }, { - "name": "qps_client", + "name": "pubsub_client", "build": "test", "run": false, "language": "c++", "src": [ - "test/cpp/qps/qpstest.proto", - "test/cpp/qps/client.cc" + "examples/pubsub/main.cc" ], "deps": [ + "pubsub_client_lib", "grpc++_test_util", "grpc_test_util", "grpc++", @@ -1663,15 +1663,14 @@ ] }, { - "name": "qps_server", + "name": "pubsub_publisher_test", "build": "test", - "run": false, "language": "c++", "src": [ - "test/cpp/qps/qpstest.proto", - "test/cpp/qps/server.cc" + "examples/pubsub/publisher_test.cc" ], "deps": [ + "pubsub_client_lib", "grpc++_test_util", "grpc_test_util", "grpc++", @@ -1681,30 +1680,15 @@ ] }, { - "name": "ruby_plugin", - "build": "protoc", - "language": "c++", - "headers": [ - "src/compiler/cpp_generator.h", - "src/compiler/cpp_generator_helpers-inl.h", - "src/compiler/cpp_generator_map-inl.h", - "src/compiler/cpp_generator_string-inl.h" - ], - "src": [ - "src/compiler/ruby_generator.cc", - "src/compiler/ruby_plugin.cc" - ], - "deps": [], - "secure": false - }, - { - "name": "status_test", + "name": "pubsub_subscriber_test", "build": "test", "language": "c++", "src": [ - "test/cpp/util/status_test.cc" + "examples/pubsub/subscriber_test.cc" ], "deps": [ + "pubsub_client_lib", + "grpc++_test_util", "grpc_test_util", "grpc++", "grpc", @@ -1713,13 +1697,16 @@ ] }, { - "name": "thread_pool_test", + "name": "qps_client", "build": "test", + "run": false, "language": "c++", "src": [ - "test/cpp/server/thread_pool_test.cc" + "test/cpp/qps/qpstest.proto", + "test/cpp/qps/client.cc" ], "deps": [ + "grpc++_test_util", "grpc_test_util", "grpc++", "grpc", @@ -1728,15 +1715,15 @@ ] }, { - "name": "pubsub_client", + "name": "qps_server", "build": "test", "run": false, "language": "c++", "src": [ - "examples/pubsub/main.cc" + "test/cpp/qps/qpstest.proto", + "test/cpp/qps/server.cc" ], "deps": [ - "pubsub_client_lib", "grpc++_test_util", "grpc_test_util", "grpc++", @@ -1746,15 +1733,30 @@ ] }, { - "name": "pubsub_publisher_test", + "name": "ruby_plugin", + "build": "protoc", + "language": "c++", + "headers": [ + "src/compiler/cpp_generator.h", + "src/compiler/cpp_generator_helpers-inl.h", + "src/compiler/cpp_generator_map-inl.h", + "src/compiler/cpp_generator_string-inl.h" + ], + "src": [ + "src/compiler/ruby_generator.cc", + "src/compiler/ruby_plugin.cc" + ], + "deps": [], + "secure": false + }, + { + "name": "status_test", "build": "test", "language": "c++", "src": [ - "examples/pubsub/publisher_test.cc" + "test/cpp/util/status_test.cc" ], "deps": [ - "pubsub_client_lib", - "grpc++_test_util", "grpc_test_util", "grpc++", "grpc", @@ -1763,15 +1765,13 @@ ] }, { - "name": "pubsub_subscriber_test", + "name": "thread_pool_test", "build": "test", "language": "c++", "src": [ - "examples/pubsub/subscriber_test.cc" + "test/cpp/server/thread_pool_test.cc" ], "deps": [ - "pubsub_client_lib", - "grpc++_test_util", "grpc_test_util", "grpc++", "grpc", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 20c585ae732..9b1009fc109 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -283,19 +283,19 @@ }, { "language": "c++", - "name": "status_test" + "name": "pubsub_publisher_test" }, { "language": "c++", - "name": "thread_pool_test" + "name": "pubsub_subscriber_test" }, { "language": "c++", - "name": "pubsub_publisher_test" + "name": "status_test" }, { "language": "c++", - "name": "pubsub_subscriber_test" + "name": "thread_pool_test" }, { "language": "c", From 573523f1278a8c797c10ebb2a8b571d6891a22cc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 07:38:26 -0800 Subject: [PATCH 112/232] clang-format --- include/grpc++/client_context.h | 45 ++++++++++------ include/grpc++/completion_queue.h | 31 ++++++----- include/grpc++/config.h | 2 +- include/grpc++/impl/call.h | 25 ++++----- include/grpc++/impl/client_unary_call.h | 3 +- include/grpc++/impl/rpc_service_method.h | 15 ++---- include/grpc++/server.h | 6 +-- include/grpc++/stream.h | 67 ++++++++++++------------ src/cpp/client/channel.cc | 3 +- src/cpp/client/channel.h | 3 +- src/cpp/client/client_unary_call.cc | 4 +- src/cpp/common/call.cc | 35 ++++++------- src/cpp/common/completion_queue.cc | 4 +- src/cpp/server/async_server_context.cc | 4 +- 14 files changed, 130 insertions(+), 117 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 3912e52ecea..2813e13abea 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -60,12 +60,18 @@ class ChannelInterface; class CompletionQueue; class RpcMethod; class Status; -template class ClientReader; -template class ClientWriter; -template class ClientReaderWriter; -template class ClientAsyncReader; -template class ClientAsyncWriter; -template class ClientAsyncReaderWriter; +template +class ClientReader; +template +class ClientWriter; +template +class ClientReaderWriter; +template +class ClientAsyncReader; +template +class ClientAsyncWriter; +template +class ClientAsyncReaderWriter; class ClientContext { public: @@ -97,16 +103,23 @@ class ClientContext { friend class CallOpBuffer; friend class Channel; - template friend class ::grpc::ClientReader; - template friend class ::grpc::ClientWriter; - template friend class ::grpc::ClientReaderWriter; - template friend class ::grpc::ClientAsyncReader; - template friend class ::grpc::ClientAsyncWriter; - template friend class ::grpc::ClientAsyncReaderWriter; - friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + template + friend class ::grpc::ClientReader; + template + friend class ::grpc::ClientWriter; + template + friend class ::grpc::ClientReaderWriter; + template + friend class ::grpc::ClientAsyncReader; + template + friend class ::grpc::ClientAsyncWriter; + template + friend class ::grpc::ClientAsyncReaderWriter; + friend Status BlockingUnaryCall(ChannelInterface *channel, + const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); friend void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const google::protobuf::Message &request, diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 80874cd1e69..665f29318f7 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -81,24 +81,31 @@ class CompletionQueue { // destructed when false is returned from Next(). void Shutdown(); - grpc_completion_queue* cq() { return cq_; } + grpc_completion_queue *cq() { return cq_; } private: - template friend class ::grpc::ClientReader; - template friend class ::grpc::ClientWriter; - template friend class ::grpc::ClientReaderWriter; - template friend class ::grpc::ServerReader; - template friend class ::grpc::ServerWriter; - template friend class ::grpc::ServerReaderWriter; + template + friend class ::grpc::ClientReader; + template + friend class ::grpc::ClientWriter; + template + friend class ::grpc::ClientReaderWriter; + template + friend class ::grpc::ServerReader; + template + friend class ::grpc::ServerWriter; + template + friend class ::grpc::ServerReaderWriter; friend class ::grpc::Server; - friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); + friend Status BlockingUnaryCall(ChannelInterface *channel, + const RpcMethod &method, + ClientContext *context, + const google::protobuf::Message &request, + google::protobuf::Message *result); bool Pluck(CompletionQueueTag *tag); - grpc_completion_queue* cq_; // owned + grpc_completion_queue *cq_; // owned }; } // namespace grpc diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 1b4b463d359..663e40247d8 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -40,6 +40,6 @@ namespace grpc { typedef std::string string; -} // namespace grpc +} // namespace grpc #endif // __GRPCPP_CONFIG_H__ diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index af1c710098f..64f0f890c5f 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -73,8 +73,8 @@ class CallOpBuffer : public CompletionQueueTag { void AddClientRecvStatus(std::multimap *metadata, Status *status); void AddServerSendStatus(std::multimap *metadata, - const Status& status); - void AddServerRecvClose(bool* cancelled); + const Status &status); + void AddServerRecvClose(bool *cancelled); // INTERNAL API: @@ -85,32 +85,33 @@ class CallOpBuffer : public CompletionQueueTag { void FinalizeResult(void **tag, bool *status) override; bool got_message = false; + private: void *return_tag_ = nullptr; // Send initial metadata bool send_initial_metadata_ = false; size_t initial_metadata_count_ = 0; - grpc_metadata* initial_metadata_ = nullptr; + grpc_metadata *initial_metadata_ = nullptr; // Recv initial metadta - std::multimap* recv_initial_metadata_ = nullptr; + std::multimap *recv_initial_metadata_ = nullptr; grpc_metadata_array recv_initial_metadata_arr_ = {0, 0, nullptr}; // Send message - const google::protobuf::Message* send_message_ = nullptr; - grpc_byte_buffer* send_message_buf_ = nullptr; + const google::protobuf::Message *send_message_ = nullptr; + grpc_byte_buffer *send_message_buf_ = nullptr; // Recv message - google::protobuf::Message* recv_message_ = nullptr; - grpc_byte_buffer* recv_message_buf_ = nullptr; + google::protobuf::Message *recv_message_ = nullptr; + grpc_byte_buffer *recv_message_buf_ = nullptr; // Client send close bool client_send_close_ = false; // Client recv status - std::multimap* recv_trailing_metadata_ = nullptr; - Status* recv_status_ = nullptr; + std::multimap *recv_trailing_metadata_ = nullptr; + Status *recv_status_ = nullptr; grpc_metadata_array recv_trailing_metadata_arr_ = {0, 0, nullptr}; grpc_status_code status_code_ = GRPC_STATUS_OK; char *status_details_ = nullptr; size_t status_details_capacity_ = 0; // Server send status - const Status* send_status_ = nullptr; + const Status *send_status_ = nullptr; size_t trailing_metadata_count_ = 0; grpc_metadata *trailing_metadata_ = nullptr; int cancelled_buf_; @@ -138,7 +139,7 @@ class Call final { private: CallHook *call_hook_; CompletionQueue *cq_; - grpc_call* call_; + grpc_call *call_; }; } // namespace grpc diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 091430b884d..22a8a04c823 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -61,7 +61,6 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, const google::protobuf::Message &request, google::protobuf::Message *result); -} // namespace grpc +} // namespace grpc #endif - diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index c201676065e..bf62871b7d1 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -55,14 +55,10 @@ class MethodHandler { public: virtual ~MethodHandler() {} struct HandlerParameter { - HandlerParameter(Call *c, - ServerContext* context, + HandlerParameter(Call* c, ServerContext* context, const google::protobuf::Message* req, google::protobuf::Message* resp) - : call(c), - server_context(context), - request(req), - response(resp) {} + : call(c), server_context(context), request(req), response(resp) {} Call* call; ServerContext* server_context; const google::protobuf::Message* request; @@ -152,7 +148,8 @@ class BidiStreamingHandler : public MethodHandler { : func_(func), service_(service) {} Status RunHandler(const HandlerParameter& param) final { - ServerReaderWriter stream(param.call, param.server_context); + ServerReaderWriter stream(param.call, + param.server_context); return func_(service_, param.server_context, &stream); } @@ -195,9 +192,7 @@ class RpcServiceMethod : public RpcMethod { class RpcService { public: // Takes ownership. - void AddMethod(RpcServiceMethod* method) { - methods_.emplace_back(method); - } + void AddMethod(RpcServiceMethod* method) { methods_.emplace_back(method); } RpcServiceMethod* GetMethod(int i) { return methods_[i].get(); } int GetMethodCount() const { return methods_.size(); } diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 8050ef8c9d6..410c762375c 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -96,9 +96,9 @@ class Server final : private CallHook, // DispatchImpl void RequestAsyncCall(void* registered_method, ServerContext* context, - ::google::protobuf::Message* request, - ServerAsyncStreamingInterface* stream, - CompletionQueue* cq, void* tag); + ::google::protobuf::Message* request, + ServerAsyncStreamingInterface* stream, + CompletionQueue* cq, void* tag); // Completion queue. CompletionQueue cq_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 6ee550bd644..be5b29589fd 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -87,9 +87,8 @@ class ClientReader final : public ClientStreamingInterface, public ReaderInterface { public: // Blocking create a stream and write the first request out. - ClientReader(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request) + ClientReader(ChannelInterface* channel, const RpcMethod& method, + ClientContext* context, const google::protobuf::Message& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -113,7 +112,7 @@ class ClientReader final : public ClientStreamingInterface, context_->initial_metadata_received_ = true; } - virtual bool Read(R *msg) override { + virtual bool Read(R* msg) override { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); @@ -144,10 +143,10 @@ class ClientWriter final : public ClientStreamingInterface, public WriterInterface { public: // Blocking create a stream. - ClientWriter(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - google::protobuf::Message *response) - : context_(context), response_(response), + ClientWriter(ChannelInterface* channel, const RpcMethod& method, + ClientContext* context, google::protobuf::Message* response) + : context_(context), + response_(response), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -182,7 +181,7 @@ class ClientWriter final : public ClientStreamingInterface, private: ClientContext* context_; - google::protobuf::Message *const response_; + google::protobuf::Message* const response_; CompletionQueue cq_; Call call_; }; @@ -194,8 +193,8 @@ class ClientReaderWriter final : public ClientStreamingInterface, public ReaderInterface { public: // Blocking create a stream. - ClientReaderWriter(ChannelInterface *channel, - const RpcMethod &method, ClientContext *context) + ClientReaderWriter(ChannelInterface* channel, const RpcMethod& method, + ClientContext* context) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpBuffer buf; buf.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -217,7 +216,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, context_->initial_metadata_received_ = true; } - virtual bool Read(R *msg) override { + virtual bool Read(R* msg) override { CallOpBuffer buf; if (!context_->initial_metadata_received_) { buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); @@ -318,7 +317,7 @@ class ServerWriter final : public WriterInterface { // Server-side interface for bi-directional streaming. template class ServerReaderWriter final : public WriterInterface, - public ReaderInterface { + public ReaderInterface { public: ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {} @@ -386,12 +385,12 @@ class AsyncWriterInterface { template class ClientAsyncReader final : public ClientAsyncStreamingInterface, - public AsyncReaderInterface { + public AsyncReaderInterface { public: // Create a stream and write the first request out. - ClientAsyncReader(ChannelInterface *channel, CompletionQueue* cq, - const RpcMethod &method, ClientContext *context, - const google::protobuf::Message &request, void* tag) + ClientAsyncReader(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const google::protobuf::Message& request, void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -409,7 +408,7 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, context_->initial_metadata_received_ = true; } - void Read(R *msg, void* tag) override { + void Read(R* msg, void* tag) override { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); @@ -440,12 +439,13 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, template class ClientAsyncWriter final : public ClientAsyncStreamingInterface, - public AsyncWriterInterface { + public AsyncWriterInterface { public: - ClientAsyncWriter(ChannelInterface *channel, CompletionQueue* cq, - const RpcMethod &method, ClientContext *context, - google::protobuf::Message *response, void* tag) - : context_(context), response_(response), + ClientAsyncWriter(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + google::protobuf::Message* response, void* tag) + : context_(context), + response_(response), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -486,7 +486,7 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, private: ClientContext* context_ = nullptr; - google::protobuf::Message *const response_; + google::protobuf::Message* const response_; Call call_; CallOpBuffer init_buf_; CallOpBuffer meta_buf_; @@ -498,11 +498,12 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, // Client-side interface for bi-directional streaming. template class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, - public AsyncWriterInterface, - public AsyncReaderInterface { + public AsyncWriterInterface, + public AsyncReaderInterface { public: - ClientAsyncReaderWriter(ChannelInterface *channel, CompletionQueue* cq, - const RpcMethod &method, ClientContext *context, void* tag) + ClientAsyncReaderWriter(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + void* tag) : context_(context), call_(channel->CreateCall(method, context, cq)) { init_buf_.Reset(tag); init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); @@ -518,7 +519,7 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, context_->initial_metadata_received_ = true; } - void Read(R *msg, void* tag) override { + void Read(R* msg, void* tag) override { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); @@ -607,7 +608,7 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { } private: - void BindCall(Call *call) override { call_ = *call; } + void BindCall(Call* call) override { call_ = *call; } Call call_; ServerContext* ctx_; @@ -667,7 +668,7 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, } private: - void BindCall(Call *call) override { call_ = *call; } + void BindCall(Call* call) override { call_ = *call; } Call call_; ServerContext* ctx_; @@ -715,7 +716,7 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, } private: - void BindCall(Call *call) override { call_ = *call; } + void BindCall(Call* call) override { call_ = *call; } Call call_; ServerContext* ctx_; @@ -771,7 +772,7 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, } private: - void BindCall(Call *call) override { call_ = *call; } + void BindCall(Call* call) override { call_ = *call; } Call call_; ServerContext* ctx_; diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index da94739ea0d..440423dba96 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -93,8 +93,7 @@ void Channel::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { grpc_op ops[MAX_OPS]; buf->FillOps(ops, &nops); GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(call->call(), ops, nops, - buf)); + grpc_call_start_batch(call->call(), ops, nops, buf)); } } // namespace grpc diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 894f87698ce..c31adab7233 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -59,8 +59,7 @@ class Channel final : public ChannelInterface { virtual Call CreateCall(const RpcMethod &method, ClientContext *context, CompletionQueue *cq) override; - virtual void PerformOpsOnCall(CallOpBuffer *ops, - Call *call) override; + virtual void PerformOpsOnCall(CallOpBuffer *ops, Call *call) override; private: const grpc::string target_; diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index d68d7a9242f..51bcfdada6c 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -63,7 +63,7 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, class ClientAsyncRequest final : public CallOpBuffer { public: - void FinalizeResult(void** tag, bool* status) override { + void FinalizeResult(void **tag, bool *status) override { CallOpBuffer::FinalizeResult(tag, status); delete this; } @@ -74,7 +74,7 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, const google::protobuf::Message &request, google::protobuf::Message *result, Status *status, CompletionQueue *cq, void *tag) { - ClientAsyncRequest* buf = new ClientAsyncRequest; + ClientAsyncRequest *buf = new ClientAsyncRequest; buf->Reset(tag); Call call(channel->CreateCall(method, context, cq)); buf->AddSendInitialMetadata(context); diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index fe8859de944..df800d940dd 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -95,13 +95,13 @@ namespace { // mess. Make sure it does not happen. grpc_metadata* FillMetadataArray( std::multimap* metadata) { - if (metadata->empty()) { return nullptr; } - grpc_metadata* metadata_array = (grpc_metadata*)gpr_malloc( - metadata->size()* sizeof(grpc_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) { + 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(); @@ -114,7 +114,8 @@ void FillMetadataMap(grpc_metadata_array* arr, for (size_t i = 0; i < arr->count; i++) { // TODO(yangg) handle duplicates? metadata->insert(std::pair( - arr->metadata[i].key, {arr->metadata[i].value, arr->metadata[i].value_length})); + arr->metadata[i].key, + {arr->metadata[i].value, arr->metadata[i].value_length})); } grpc_metadata_array_destroy(arr); grpc_metadata_array_init(arr); @@ -133,8 +134,7 @@ void CallOpBuffer::AddRecvInitialMetadata( recv_initial_metadata_ = metadata; } - -void CallOpBuffer::AddSendInitialMetadata(ClientContext *ctx) { +void CallOpBuffer::AddSendInitialMetadata(ClientContext* ctx) { AddSendInitialMetadata(&ctx->send_initial_metadata_); } @@ -142,20 +142,18 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { send_message_ = &message; } -void CallOpBuffer::AddRecvMessage(google::protobuf::Message *message) { +void CallOpBuffer::AddRecvMessage(google::protobuf::Message* message) { recv_message_ = message; } -void CallOpBuffer::AddClientSendClose() { - client_send_close_ = true; -} +void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } void CallOpBuffer::AddServerRecvClose(bool* cancelled) { recv_closed_ = cancelled; } void CallOpBuffer::AddClientRecvStatus( - std::multimap* metadata, Status *status) { + std::multimap* metadata, Status* status) { recv_trailing_metadata_ = metadata; recv_status_ = status; } @@ -171,7 +169,7 @@ void CallOpBuffer::AddServerSendStatus( send_status_ = &status; } -void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { +void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) { *nops = 0; if (send_initial_metadata_) { ops[*nops].op = GRPC_OP_SEND_INITIAL_METADATA; @@ -232,7 +230,7 @@ void CallOpBuffer::FillOps(grpc_op *ops, size_t *nops) { } } -void CallOpBuffer::FinalizeResult(void **tag, bool *status) { +void CallOpBuffer::FinalizeResult(void** tag, bool* status) { // Release send buffers. if (send_message_buf_) { grpc_byte_buffer_destroy(send_message_buf_); @@ -270,15 +268,14 @@ void CallOpBuffer::FinalizeResult(void **tag, bool *status) { FillMetadataMap(&recv_trailing_metadata_arr_, recv_trailing_metadata_); *recv_status_ = Status( static_cast(status_code_), - status_details_ ? grpc::string(status_details_) - : grpc::string()); + status_details_ ? grpc::string(status_details_) : grpc::string()); } if (recv_closed_) { *recv_closed_ = cancelled_buf_ != 0; } } -Call::Call(grpc_call* call, CallHook *call_hook, CompletionQueue* cq) +Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq) : call_hook_(call_hook), cq_(cq), call_(call) {} void Call::PerformOps(CallOpBuffer* buffer) { diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index f69ddc3b7e0..4419b4b2f14 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -52,7 +52,9 @@ void CompletionQueue::Shutdown() { grpc_completion_queue_shutdown(cq_); } // Helper class so we can declare a unique_ptr with grpc_event class EventDeleter { public: - void operator()(grpc_event *ev) { if (ev) grpc_event_finish(ev); } + void operator()(grpc_event *ev) { + if (ev) grpc_event_finish(ev); + } }; bool CompletionQueue::Next(void **tag, bool *ok) { diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc index 886e794137f..096eb7aa0e0 100644 --- a/src/cpp/server/async_server_context.cc +++ b/src/cpp/server/async_server_context.cc @@ -54,8 +54,8 @@ AsyncServerContext::~AsyncServerContext() { grpc_call_destroy(call_); } void AsyncServerContext::Accept(grpc_completion_queue *cq) { GPR_ASSERT(grpc_call_server_accept_old(call_, cq, this) == GRPC_CALL_OK); - GPR_ASSERT(grpc_call_server_end_initial_metadata_old(call_, GRPC_WRITE_BUFFER_HINT) == - GRPC_CALL_OK); + GPR_ASSERT(grpc_call_server_end_initial_metadata_old( + call_, GRPC_WRITE_BUFFER_HINT) == GRPC_CALL_OK); } bool AsyncServerContext::StartRead(google::protobuf::Message *request) { From f95487fd7c6e5d8ea178009ee27957d85a6a3e7e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 10:19:40 -0800 Subject: [PATCH 113/232] Fix ASSERT condition --- src/cpp/client/client_unary_call.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 51bcfdada6c..284af33b435 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -57,7 +57,7 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, buf.AddClientSendClose(); buf.AddClientRecvStatus(&context->trailing_metadata_, &status); call.PerformOps(&buf); - GPR_ASSERT(cq.Pluck(&buf) && (buf.got_message || !status.IsOk())); + GPR_ASSERT((cq.Pluck(&buf) && buf.got_message) || !status.IsOk()); return status; } From f2c0ca4c6296dddfc46d84c8d2b422eff3531551 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 10:21:31 -0800 Subject: [PATCH 114/232] Add setter to override authority header on ClientContext --- include/grpc++/client_context.h | 9 +++++++++ src/cpp/client/channel.cc | 7 +++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 2813e13abea..4594cbaeb6f 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -94,6 +94,10 @@ class ClientContext { void set_absolute_deadline(const system_clock::time_point &deadline); system_clock::time_point absolute_deadline(); + void set_authority(const grpc::string& authority) { + authority_ = authority; + } + void TryCancel(); private: @@ -137,10 +141,15 @@ class ClientContext { gpr_timespec RawDeadline() { return absolute_deadline_; } + grpc::string authority() { + return authority_; + } + bool initial_metadata_received_ = false; grpc_call *call_; grpc_completion_queue *cq_; gpr_timespec absolute_deadline_; + grpc::string authority_; std::multimap send_initial_metadata_; std::multimap recv_initial_metadata_; std::multimap trailing_metadata_; diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 440423dba96..c4794d717d0 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -81,8 +81,11 @@ Channel::~Channel() { grpc_channel_destroy(c_channel_); } Call Channel::CreateCall(const RpcMethod &method, ClientContext *context, CompletionQueue *cq) { auto c_call = - grpc_channel_create_call(c_channel_, cq->cq(), method.name(), - target_.c_str(), context->RawDeadline()); + grpc_channel_create_call( + c_channel_, cq->cq(), method.name(), + context->authority().empty() ? target_.c_str() + : context->authority(), + context->RawDeadline()); context->set_call(c_call); return Call(c_call, this, cq); } From bb017c5568058295b5d8a1ba2054301a8ffe154b Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 10:26:15 -0800 Subject: [PATCH 115/232] should use c_str --- src/cpp/client/channel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index c4794d717d0..95b7aabc1d6 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -84,7 +84,7 @@ Call Channel::CreateCall(const RpcMethod &method, ClientContext *context, grpc_channel_create_call( c_channel_, cq->cq(), method.name(), context->authority().empty() ? target_.c_str() - : context->authority(), + : context->authority().c_str(), context->RawDeadline()); context->set_call(c_call); return Call(c_call, this, cq); From d745705fff04062fda44da1ad7eac9f6f4498495 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 10:28:36 -0800 Subject: [PATCH 116/232] formatting --- src/cpp/client/channel.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 95b7aabc1d6..b2fc0c97ee9 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -83,7 +83,7 @@ Call Channel::CreateCall(const RpcMethod &method, ClientContext *context, auto c_call = grpc_channel_create_call( c_channel_, cq->cq(), method.name(), - context->authority().empty() ? target_.c_str() + context->authority().empty() ? target_.c_str() : context->authority().c_str(), context->RawDeadline()); context->set_call(c_call); From 2cf952730daa9e167bf261276fa77fad5312c6ff Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 11:01:07 -0800 Subject: [PATCH 117/232] Deserialization success should not override earlier failure --- src/cpp/common/call.cc | 2 +- src/cpp/server/server.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index df800d940dd..9ec93bc6262 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -254,7 +254,7 @@ void CallOpBuffer::FinalizeResult(void** tag, bool* status) { if (recv_message_) { if (recv_message_buf_) { got_message = true; - *status = DeserializeProto(recv_message_buf_, recv_message_); + *status &= DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } else { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 294eeae5850..35ced54aa78 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -314,7 +314,7 @@ class Server::AsyncRequest final : public CompletionQueueTag { *tag = tag_; if (*status && request_) { if (payload_) { - *status = DeserializeProto(payload_, request_); + *status &= DeserializeProto(payload_, request_); } else { *status = false; } From 27658f41baa23b9f2fcaa963da08bdceb91ea924 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 11:47:48 -0800 Subject: [PATCH 118/232] Clear receive message buffer when adding it, so that any reused buffer will not appear when decoding fails. --- src/cpp/common/call.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 9ec93bc6262..0922a6e4603 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -31,6 +31,7 @@ * */ +#include #include #include #include @@ -144,6 +145,7 @@ void CallOpBuffer::AddSendMessage(const google::protobuf::Message& message) { void CallOpBuffer::AddRecvMessage(google::protobuf::Message* message) { recv_message_ = message; + recv_message_->Clear(); } void CallOpBuffer::AddClientSendClose() { client_send_close_ = true; } From 467d7bd414238427c051a44316d64d267c068ea3 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 12:08:43 -0800 Subject: [PATCH 119/232] When the entire op fails, the recv_message is always discarded. --- src/cpp/common/call.cc | 2 +- src/cpp/server/server.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 0922a6e4603..70daa6a3b04 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -256,7 +256,7 @@ void CallOpBuffer::FinalizeResult(void** tag, bool* status) { if (recv_message_) { if (recv_message_buf_) { got_message = true; - *status &= DeserializeProto(recv_message_buf_, recv_message_); + *status = *status && DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; } else { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 35ced54aa78..ee9a1daa8e9 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -314,7 +314,7 @@ class Server::AsyncRequest final : public CompletionQueueTag { *tag = tag_; if (*status && request_) { if (payload_) { - *status &= DeserializeProto(payload_, request_); + *status = *status && DeserializeProto(payload_, request_); } else { *status = false; } From caa5106c4f80e408a282693ad0197d8b45611d6e Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 12:09:14 -0800 Subject: [PATCH 120/232] also set got_message --- src/cpp/common/call.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 70daa6a3b04..f1142cf8e56 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -255,7 +255,7 @@ void CallOpBuffer::FinalizeResult(void** tag, bool* status) { // Parse received message if any. if (recv_message_) { if (recv_message_buf_) { - got_message = true; + got_message = *status; *status = *status && DeserializeProto(recv_message_buf_, recv_message_); grpc_byte_buffer_destroy(recv_message_buf_); recv_message_buf_ = nullptr; From ab294db7441bd112a7dba2aa1e9ceb33906a4066 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 15:00:19 -0800 Subject: [PATCH 121/232] Add some comments --- include/grpc++/completion_queue.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 665f29318f7..c5267f8563c 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -84,6 +84,8 @@ class CompletionQueue { grpc_completion_queue *cq() { return cq_; } private: + // Friend synchronous wrappers so that they can access Pluck(), which is + // a semi-private API geared towards the synchronous implementation. template friend class ::grpc::ClientReader; template @@ -103,6 +105,8 @@ class CompletionQueue { const google::protobuf::Message &request, google::protobuf::Message *result); + // Wraps grpc_completion_queue_pluck. + // Cannot be mixed with calls to Next(). bool Pluck(CompletionQueueTag *tag); grpc_completion_queue *cq_; // owned From 29f2b219a8631ed788708a326190aa3a611911e0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 17:01:24 -0800 Subject: [PATCH 122/232] Add channel argument documentation --- include/grpc/grpc.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9807de9f4bc..077b432e881 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -92,7 +92,12 @@ typedef struct { } value; } grpc_arg; -/* An array of arguments that can be passed around */ +/* An array of arguments that can be passed around. + Used to set optional channel-level configuration. + These configuration options are modelled as key-value pairs as defined + by grpc_arg; keys are strings to allow easy backwards-compatible extension + by arbitrary parties. + All evaluation is performed at channel creation time. */ typedef struct { size_t num_args; grpc_arg *args; @@ -400,7 +405,10 @@ grpc_call *grpc_channel_create_call(grpc_channel *channel, grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, size_t nops, void *tag); -/* Create a client channel */ +/* Create a client channel to 'target'. Additional channel level configuration + MAY be provided by grpc_channel_args, though the expectation is that most + clients will want to simply pass NULL. See grpc_channel_args definition + for more on this. */ grpc_channel *grpc_channel_create(const char *target, const grpc_channel_args *args); @@ -545,7 +553,8 @@ grpc_call_error grpc_server_request_call( grpc_metadata_array *request_metadata, grpc_completion_queue *completion_queue, void *tag_new); -/* Create a server */ +/* Create a server. Additional configuration for each incoming channel can + be specified with args. See grpc_channel_args for more. */ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); From a0e34a0b905c0d7330bdf903d976d258704871a4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 17:06:23 -0800 Subject: [PATCH 123/232] Expand init/destroy documentation --- include/grpc/grpc.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9807de9f4bc..2bd7415e281 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -338,10 +338,18 @@ typedef struct grpc_op { } data; } grpc_op; -/* Initialize the grpc library */ +/* Initialize the grpc library. + It is not safe to call any other grpc functions before calling this. + (To avoid overhead, little checking is done, and some things may work. We + do not warrant that they will continue to do so in future revisions of this + library). */ void grpc_init(void); -/* Shut down the grpc library */ +/* Shut down the grpc library. + No memory is used by grpc after this call returns, nor are any instructions + executing within the grpc library. + Prior to calling, all application owned grpc objects must have been + destroyed. */ void grpc_shutdown(void); grpc_completion_queue *grpc_completion_queue_create(void); From 30697c9be2ff01e9f33e0934b58877fc3d11f516 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 17 Feb 2015 17:09:14 -0800 Subject: [PATCH 124/232] Imports code of the RX library. --- .../RxLibrary/GRXImmediateWriter.h | 40 ++++++ .../RxLibrary/GRXImmediateWriter.m | 132 ++++++++++++++++++ src/objective-c/RxLibrary/GRXWriteable.h | 27 ++++ src/objective-c/RxLibrary/GRXWriteable.m | 33 +++++ .../RxLibrary/GRXWriter+Immediate.h | 33 +++++ .../RxLibrary/GRXWriter+Immediate.m | 31 ++++ .../RxLibrary/GRXWriter+Transformations.h | 9 ++ .../RxLibrary/GRXWriter+Transformations.m | 14 ++ src/objective-c/RxLibrary/GRXWriter.h | 94 +++++++++++++ src/objective-c/RxLibrary/GRXWriter.m | 79 +++++++++++ .../RxLibrary/NSEnumerator+GRXUtil.h | 18 +++ .../RxLibrary/NSEnumerator+GRXUtil.m | 21 +++ src/objective-c/RxLibrary/README.md | 8 ++ .../RxLibrary/private/GRXNSBlockEnumerator.h | 9 ++ .../RxLibrary/private/GRXNSBlockEnumerator.m | 28 ++++ .../RxLibrary/private/GRXNSFastEnumerator.h | 10 ++ .../RxLibrary/private/GRXNSFastEnumerator.m | 55 ++++++++ .../RxLibrary/private/GRXNSScalarEnumerator.h | 8 ++ .../RxLibrary/private/GRXNSScalarEnumerator.m | 24 ++++ .../transformations/GRXMappingWriter.h | 7 + .../transformations/GRXMappingWriter.m | 30 ++++ 21 files changed, 710 insertions(+) create mode 100644 src/objective-c/RxLibrary/GRXImmediateWriter.h create mode 100644 src/objective-c/RxLibrary/GRXImmediateWriter.m create mode 100644 src/objective-c/RxLibrary/GRXWriteable.h create mode 100644 src/objective-c/RxLibrary/GRXWriteable.m create mode 100644 src/objective-c/RxLibrary/GRXWriter+Immediate.h create mode 100644 src/objective-c/RxLibrary/GRXWriter+Immediate.m create mode 100644 src/objective-c/RxLibrary/GRXWriter+Transformations.h create mode 100644 src/objective-c/RxLibrary/GRXWriter+Transformations.m create mode 100644 src/objective-c/RxLibrary/GRXWriter.h create mode 100644 src/objective-c/RxLibrary/GRXWriter.m create mode 100644 src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h create mode 100644 src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m create mode 100644 src/objective-c/RxLibrary/README.md create mode 100644 src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h create mode 100644 src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m create mode 100644 src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h create mode 100644 src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m create mode 100644 src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h create mode 100644 src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m create mode 100644 src/objective-c/RxLibrary/transformations/GRXMappingWriter.h create mode 100644 src/objective-c/RxLibrary/transformations/GRXMappingWriter.m diff --git a/src/objective-c/RxLibrary/GRXImmediateWriter.h b/src/objective-c/RxLibrary/GRXImmediateWriter.h new file mode 100644 index 00000000000..568dbe65764 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXImmediateWriter.h @@ -0,0 +1,40 @@ +#import + +#import "GRXWriter.h" + +// Utility to construct GRXWriter instances from values that are immediately available when +// required. The returned writers all support pausing and early termination. +// +// Unless the writeable callback pauses them or stops them early, these writers will do all their +// interactions with the writeable before the start method returns. +@interface GRXImmediateWriter : NSObject + +// Returns a writer that pulls values from the passed NSEnumerator instance and pushes them to +// its writeable. The NSEnumerator is released when it finishes. ++ (id)writerWithEnumerator:(NSEnumerator *)enumerator; + +// Returns a writer that pushes to its writeable the successive values returned by the passed +// block. When the block first returns nil, it is released. ++ (id)writerWithValueSupplier:(id (^)())block; + +// Returns a writer that iterates over the values of the passed container and pushes them to +// its writeable. The container is released when the iteration is over. +// +// Note that the usual speed gain of NSFastEnumeration over NSEnumerator results from not having to +// call one method per element. Because GRXWriteable instances accept values one by one, that speed +// gain doesn't happen here. ++ (id)writerWithContainer:(id)container; + +// Returns a writer that sends the passed value to its writeable and then finishes (releasing the +// value). ++ (id)writerWithValue:(id)value; + +// Returns a writer that, as part of its start method, sends the passed error to the writeable +// (then releasing the error). ++ (id)writerWithError:(NSError *)error; + +// Returns a writer that, as part of its start method, finishes immediately without sending any +// values to its writeable. ++ (id)emptyWriter; + +@end diff --git a/src/objective-c/RxLibrary/GRXImmediateWriter.m b/src/objective-c/RxLibrary/GRXImmediateWriter.m new file mode 100644 index 00000000000..ebeb3f458a3 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXImmediateWriter.m @@ -0,0 +1,132 @@ +#import "GRXImmediateWriter.h" + +#import "NSEnumerator+GRXUtil.h" + +@implementation GRXImmediateWriter { + NSEnumerator *_enumerator; + NSError *_errorOrNil; + id _writeable; +} + +@synthesize state = _state; + +- (instancetype) init { + return [self initWithEnumerator:nil error:nil]; // results in an empty writer. +} + +// Designated initializer +- (instancetype)initWithEnumerator:(NSEnumerator *)enumerator error:(NSError *)errorOrNil { + if (((self = [super init]))) { + _enumerator = enumerator; + _errorOrNil = errorOrNil; + _state = GRXWriterStateNotStarted; + } + return self; +} + +#pragma mark Convenience constructors + ++ (instancetype)writerWithEnumerator:(NSEnumerator *)enumerator error:(NSError *)errorOrNil { + return [[self alloc] initWithEnumerator:enumerator error:errorOrNil]; +} + ++ (id)writerWithEnumerator:(NSEnumerator *)enumerator { + return [self writerWithEnumerator:enumerator error:nil]; +} + ++ (id)writerWithValueSupplier:(id (^)())block { + return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithValueSupplier:block]]; +} + ++ (id)writerWithContainer:(id)container { + return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithContainer:container]];; +} + ++ (id)writerWithValue:(id)value { + if (value) { + return [self writerWithEnumerator:[NSEnumerator grx_enumeratorWithSingleValue:value]]; + } else { + return [self emptyWriter]; + } +} + ++ (id)writerWithError:(NSError *)error { + if (error) { + return [self writerWithEnumerator:nil error:error]; + } else { + return [self emptyWriter]; + } +} + ++ (id)emptyWriter { + static GRXImmediateWriter *emptyWriter; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + emptyWriter = [self writerWithEnumerator:nil error:nil]; + }); + return emptyWriter; +} + +#pragma mark Conformance with GRXWriter + +// Most of the complexity in this implementation is the result of supporting pause and resumption of +// the GRXWriter. It's an important feature for instances of GRXWriter that are backed by a +// container (which may be huge), or by a NSEnumerator (which may even be infinite). + +- (void)writeUntilPausedOrStopped { + id value; + while (value = [_enumerator nextObject]) { + [_writeable didReceiveValue:value]; + // If the writeable has a reference to us, it might change our state to paused or finished. + if (_state == GRXWriterStatePaused || _state == GRXWriterStateFinished) { + return; + } + } + [self finishWithError:_errorOrNil]; +} + +- (void)startWithWriteable:(id)writeable { + _state = GRXWriterStateStarted; + _writeable = writeable; + [self writeUntilPausedOrStopped]; +} + +- (void)finishWithError:(NSError *)errorOrNil { + _state = GRXWriterStateFinished; + _enumerator = nil; + _errorOrNil = nil; + id writeable = _writeable; + _writeable = nil; + [writeable didFinishWithError:errorOrNil]; +} + +- (void)setState:(GRXWriterState)newState { + // Manual transitions are only allowed from the started or paused states. + if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { + return; + } + + switch (newState) { + case GRXWriterStateFinished: + _state = newState; + _enumerator = nil; + _errorOrNil = nil; + // Per GRXWriter's contract, setting the state to Finished manually + // means one doesn't wish the writeable to be messaged anymore. + _writeable = nil; + return; + case GRXWriterStatePaused: + _state = newState; + return; + case GRXWriterStateStarted: + if (_state == GRXWriterStatePaused) { + _state = newState; + [self writeUntilPausedOrStopped]; + } + return; + case GRXWriterStateNotStarted: + return; + } +} + +@end diff --git a/src/objective-c/RxLibrary/GRXWriteable.h b/src/objective-c/RxLibrary/GRXWriteable.h new file mode 100644 index 00000000000..bbcdb6a2ba9 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriteable.h @@ -0,0 +1,27 @@ +#import + +// A GRXWriteable is an object to which a sequence of values can be sent. The +// sequence finishes with an optional error. +@protocol GRXWriteable + +// Push the next value of the sequence to the receiving object. +// TODO(jcanizales): Name it enumerator:(id) didProduceValue:(id)? +- (void)didReceiveValue:(id)value; + +// Signal that the sequence is completed, or that an error ocurred. After this +// message is sent to the instance, neither it nor didReceiveValue: may be +// called again. +// TODO(jcanizales): enumerator:(id) didFinishWithError:(NSError*)? +- (void)didFinishWithError:(NSError *)errorOrNil; +@end + +typedef void (^GRXValueHandler)(id value); +typedef void (^GRXCompletionHandler)(NSError *errorOrNil); + +// Utility to create objects that conform to the GRXWriteable protocol, from +// blocks that handle each of the two methods of the protocol. +@interface GRXWriteable : NSObject +- (instancetype)initWithValueHandler:(GRXValueHandler)valueHandler + completionHandler:(GRXCompletionHandler)completionHandler + NS_DESIGNATED_INITIALIZER; +@end diff --git a/src/objective-c/RxLibrary/GRXWriteable.m b/src/objective-c/RxLibrary/GRXWriteable.m new file mode 100644 index 00000000000..3b4f0811aa7 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriteable.m @@ -0,0 +1,33 @@ +#import "GRXWriteable.h" + +@implementation GRXWriteable { + GRXValueHandler _valueHandler; + GRXCompletionHandler _completionHandler; +} + +- (instancetype)init { + return [self initWithValueHandler:nil completionHandler:nil]; +} + +// Designated initializer +- (instancetype)initWithValueHandler:(GRXValueHandler)valueHandler + completionHandler:(GRXCompletionHandler)completionHandler { + if ((self = [super init])) { + _valueHandler = valueHandler; + _completionHandler = completionHandler; + } + return self; +} + +- (void)didReceiveValue:(id)value { + if (_valueHandler) { + _valueHandler(value); + } +} + +- (void)didFinishWithError:(NSError *)errorOrNil { + if (_completionHandler) { + _completionHandler(errorOrNil); + } +} +@end diff --git a/src/objective-c/RxLibrary/GRXWriter+Immediate.h b/src/objective-c/RxLibrary/GRXWriter+Immediate.h new file mode 100644 index 00000000000..2d397d76559 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter+Immediate.h @@ -0,0 +1,33 @@ +#import "GRXWriter.h" + +@interface GRXWriter (Immediate) + +// Returns a writer that pulls values from the passed NSEnumerator instance and pushes them to +// its writeable. The NSEnumerator is released when it finishes. ++ (instancetype)writerWithEnumerator:(NSEnumerator *)enumerator; + +// Returns a writer that pushes to its writeable the successive values returned by the passed +// block. When the block first returns nil, it is released. ++ (instancetype)writerWithValueSupplier:(id (^)())block; + +// Returns a writer that iterates over the values of the passed container and pushes them to +// its writeable. The container is released when the iteration is over. +// +// Note that the usual speed gain of NSFastEnumeration over NSEnumerator results from not having to +// call one method per element. Because GRXWriteable instances accept values one by one, that speed +// gain doesn't happen here. ++ (instancetype)writerWithContainer:(id)container; + +// Returns a writer that sends the passed value to its writeable and then finishes (releasing the +// value). ++ (instancetype)writerWithValue:(id)value; + +// Returns a writer that, as part of its start method, sends the passed error to the writeable +// (then releasing the error). ++ (instancetype)writerWithError:(NSError *)error; + +// Returns a writer that, as part of its start method, finishes immediately without sending any +// values to its writeable. ++ (instancetype)emptyWriter; + +@end diff --git a/src/objective-c/RxLibrary/GRXWriter+Immediate.m b/src/objective-c/RxLibrary/GRXWriter+Immediate.m new file mode 100644 index 00000000000..841ea8a30f9 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter+Immediate.m @@ -0,0 +1,31 @@ +#import "GRXWriter+Immediate.h" + +#import "GRXImmediateWriter.h" + +@implementation GRXWriter (Immediate) + ++ (instancetype)writerWithEnumerator:(NSEnumerator *)enumerator { + return [[self alloc] initWithWriter:[GRXImmediateWriter writerWithEnumerator:enumerator]]; +} + ++ (instancetype)writerWithValueSupplier:(id (^)())block { + return [[self alloc] initWithWriter:[GRXImmediateWriter writerWithValueSupplier:block]]; +} + ++ (instancetype)writerWithContainer:(id)container { + return [[self alloc] initWithWriter:[GRXImmediateWriter writerWithContainer:container]]; +} + ++ (instancetype)writerWithValue:(id)value { + return [[self alloc] initWithWriter:[GRXImmediateWriter writerWithValue:value]]; +} + ++ (instancetype)writerWithError:(NSError *)error { + return [[self alloc] initWithWriter:[GRXImmediateWriter writerWithError:error]]; +} + ++ (instancetype)emptyWriter { + return [[self alloc] initWithWriter:[GRXImmediateWriter emptyWriter]]; +} + +@end diff --git a/src/objective-c/RxLibrary/GRXWriter+Transformations.h b/src/objective-c/RxLibrary/GRXWriter+Transformations.h new file mode 100644 index 00000000000..4c9335b6758 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter+Transformations.h @@ -0,0 +1,9 @@ +#import "GRXWriter.h" + +@interface GRXWriter (Transformations) + +// Returns a writer that wraps the receiver, and has all the values the receiver would write +// transformed by the provided mapping function. +- (GRXWriter *)map:(id (^)(id value))map; + +@end diff --git a/src/objective-c/RxLibrary/GRXWriter+Transformations.m b/src/objective-c/RxLibrary/GRXWriter+Transformations.m new file mode 100644 index 00000000000..30e5000afdf --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter+Transformations.m @@ -0,0 +1,14 @@ +#import "GRXWriter+Transformations.h" + +#import "transformations/GRXMappingWriter.h" + +@implementation GRXWriter (Transformations) + +- (GRXWriter *)map:(id (^)(id))map { + if (!map) { + return self; + } + return [[GRXMappingWriter alloc] initWithWriter:self map:map]; +} + +@end diff --git a/src/objective-c/RxLibrary/GRXWriter.h b/src/objective-c/RxLibrary/GRXWriter.h new file mode 100644 index 00000000000..03b3ee18cd8 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter.h @@ -0,0 +1,94 @@ +#import + +#import "GRXWriteable.h" + +typedef NS_ENUM(NSInteger, GRXWriterState) { + + // The writer has not yet been given a writeable to which it can push its + // values. To have an writer transition to the Started state, send it a + // startWithWriteable: message. + // + // An writer's state cannot be manually set to this value. + GRXWriterStateNotStarted, + + // The writer might push values to the writeable at any moment. + GRXWriterStateStarted, + + // The writer is temporarily paused, and won't send any more values to the + // writeable unless its state is set back to Started. The writer might still + // transition to the Finished state at any moment, and is allowed to send + // didFinishWithError: to its writeable. + // + // Not all implementations of writer have to support pausing, and thus + // trying to set an writer's state to this value might have no effect. + GRXWriterStatePaused, + + // The writer has released its writeable and won't interact with it anymore. + // + // One seldomly wants to set an writer's state to this value, as its + // writeable isn't notified with a didFinishWithError: message. Instead, sending + // finishWithError: to the writer will make it notify the writeable and then + // transition to this state. + GRXWriterStateFinished +}; + +// An object that conforms to this protocol can produce, on demand, a sequence +// of values. The sequence may be produced asynchronously, and it may consist of +// any number of elements, including none or an infinite number. +// +// GRXWriter is the active dual of NSEnumerator. The difference between them +// is thus whether the object plays an active or passive role during usage: A +// user of NSEnumerator pulls values off it, and passes the values to a writeable. +// A user of GRXWriter, though, just gives it a writeable, and the +// GRXWriter instance pushes values to the writeable. This makes this protocol +// suitable to represent a sequence of future values, as well as collections +// with internal iteration. +// +// An instance of GRXWriter can start producing values after a writeable is +// passed to it. It can also be commanded to finish the sequence immediately +// (with an optional error). Finally, it can be asked to pause, but the +// conforming instance is not required to oblige. +// +// Unless otherwise indicated by a conforming class, no messages should be sent +// concurrently to a GRXWriter. I.e., conforming classes aren't required to +// be thread-safe. +@protocol GRXWriter + +// This property can be used to query the current state of the writer, which +// determines how it might currently use its writeable. Some state transitions can +// be triggered by setting this property to the corresponding value, and that's +// useful for advanced use cases like pausing an writer. For more details, +// see the documentation of the enum. +@property(nonatomic) GRXWriterState state; + +// Start sending messages to the writeable. Messages may be sent before the method +// returns, or they may be sent later in the future. See GRXWriteable.h for the +// different messages a writeable can receive. +// +// If this writer draws its values from an external source (e.g. from the +// filesystem or from a server), calling this method will commonly trigger side +// effects (like network connections). +// +// This method might only be called on writers in the NotStarted state. +- (void)startWithWriteable:(id)writeable; + +// Send didFinishWithError:errorOrNil immediately to the writeable, and don't send +// any more messages to it. +// +// This method might only be called on writers in the Started or Paused +// state. +// +// TODO(jcanizales): Consider adding some guarantee about the immediacy of that +// stopping. I know I've relied on it in part of the code that uses this, but +// can't remember the details in the presence of concurrency. +- (void)finishWithError:(NSError *)errorOrNil; +@end + +// A "proxy" class that simply forwards values, completion, and errors from its +// input writer to its writeable. +// It is useful as a superclass for pipes that act as a transformation of their +// input writer, and for classes that represent objects with input and +// output sequences of values, like an RPC. +@interface GRXWriter : NSObject +- (instancetype)initWithWriter:(id)writer NS_DESIGNATED_INITIALIZER; +@end diff --git a/src/objective-c/RxLibrary/GRXWriter.m b/src/objective-c/RxLibrary/GRXWriter.m new file mode 100644 index 00000000000..67d928fed58 --- /dev/null +++ b/src/objective-c/RxLibrary/GRXWriter.m @@ -0,0 +1,79 @@ +#import "GRXWriter.h" + +@interface GRXWriter () +@end + +@implementation GRXWriter { + id _writer; + id _writeable; +} + +- (instancetype)init { + return [self initWithWriter:nil]; +} + +// Designated initializer +- (instancetype)initWithWriter:(id)writer { + if (!writer) { + [NSException raise:NSInvalidArgumentException format:@"writer can't be nil."]; + } + if ((self = [super init])) { + _writer = writer; + } + return self; +} + +// This is used to send a completion or an error to the writeable. It nillifies +// our reference to it in order to guarantee no more messages are sent to it, +// and to release it. +- (void)finishOutputWithError:(NSError *)errorOrNil { + id writeable = _writeable; + _writeable = nil; + [writeable didFinishWithError:errorOrNil]; +} + +// This is used to stop the input writer. It nillifies our reference to it +// to release it. +- (void)finishInput { + id writer = _writer; + _writer = nil; + writer.state = GRXWriterStateFinished; +} + +#pragma mark GRXWriteable implementation + +- (void)didReceiveValue:(id)value { + [_writeable didReceiveValue:value]; +} + +- (void)didFinishWithError:(NSError *)errorOrNil { + _writer = nil; + [self finishOutputWithError:errorOrNil]; +} + +#pragma mark GRXWriter implementation + +- (GRXWriterState)state { + return _writer ? _writer.state : GRXWriterStateFinished; +} + +- (void)setState:(GRXWriterState)state { + if (state == GRXWriterStateFinished) { + _writeable = nil; + [self finishInput]; + } else { + _writer.state = state; + } +} + +- (void)startWithWriteable:(id)writeable { + _writeable = writeable; + [_writer startWithWriteable:self]; +} + +- (void)finishWithError:(NSError *)errorOrNil { + [self finishOutputWithError:errorOrNil]; + [self finishInput]; +} + +@end diff --git a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h new file mode 100644 index 00000000000..ecd8f2de79d --- /dev/null +++ b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h @@ -0,0 +1,18 @@ +#import + +@interface NSEnumerator (GRXUtil) + +// Returns a NSEnumerator instance that iterates through the elements of the passed container that +// supports fast enumeration. Note that this negates the speed benefits of fast enumeration over +// NSEnumerator. It's only intended for the rare cases when one needs the latter and only has the +// former, e.g. for iteration that needs to be paused and resumed later. ++ (NSEnumerator *)grx_enumeratorWithContainer:(id)container; + +// Returns a NSEnumerator instance that provides a single object before finishing. The value is then +// released. ++ (NSEnumerator *)grx_enumeratorWithSingleValue:(id)value; + +// Returns a NSEnumerator instance that delegates the invocations of nextObject to the passed block. +// When the block first returns nil, it is released. ++ (NSEnumerator *)grx_enumeratorWithValueSupplier:(id (^)())block; +@end diff --git a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m new file mode 100644 index 00000000000..7da05d13c49 --- /dev/null +++ b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m @@ -0,0 +1,21 @@ +#import "NSEnumerator+GRXUtil.h" + +#import "private/GRXNSBlockEnumerator.h" +#import "private/GRXNSFastEnumerator.h" +#import "private/GRXNSScalarEnumerator.h" + +@implementation NSEnumerator (GRXUtil) + ++ (NSEnumerator *)grx_enumeratorWithContainer:(id)container { + // TODO(jcanizales): Consider checking if container responds to objectEnumerator and return that? + return [[GRXNSFastEnumerator alloc] initWithContainer:container]; +} + ++ (NSEnumerator *)grx_enumeratorWithSingleValue:(id)value { + return [[GRXNSScalarEnumerator alloc] initWithValue:value]; +} + ++ (NSEnumerator *)grx_enumeratorWithValueSupplier:(id (^)())block { + return [[GRXNSBlockEnumerator alloc] initWithValueSupplier:block]; +} +@end diff --git a/src/objective-c/RxLibrary/README.md b/src/objective-c/RxLibrary/README.md new file mode 100644 index 00000000000..88e90723b9b --- /dev/null +++ b/src/objective-c/RxLibrary/README.md @@ -0,0 +1,8 @@ +This is a generic Reactive Extensions library for Objective-C, created to ease +the implementation of the gRPC Objective-C runtime. + +It has no dependencies on gRPC nor other libraries, and should eventually be +moved under its own GitHub project. + +If you're trying to get started on the library, you might want to first read +GRXWriter.h and then GRXWriteable.h. diff --git a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h new file mode 100644 index 00000000000..0bb1f477648 --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h @@ -0,0 +1,9 @@ +#import + +// Concrete subclass of NSEnumerator that delegates the invocations of nextObject to a block passed +// on initialization. +@interface GRXNSBlockEnumerator : NSEnumerator +// The first time the passed block returns nil, the enumeration will end and the block will be +// released. +- (instancetype)initWithValueSupplier:(id (^)())block; +@end diff --git a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m new file mode 100644 index 00000000000..9a53531b128 --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m @@ -0,0 +1,28 @@ +#import "GRXNSBlockEnumerator.h" + +@implementation GRXNSBlockEnumerator { + id (^_block)(); +} + +- (instancetype)init { + return [self initWithValueSupplier:nil]; +} + +- (instancetype)initWithValueSupplier:(id (^)())block { + if ((self = [super init])) { + _block = block; + } + return self; +} + +- (id)nextObject { + if (!_block) { + return nil; + } + id value = _block(); + if (!value) { + _block = nil; + } + return value; +} +@end diff --git a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h new file mode 100644 index 00000000000..e5f27b1cc70 --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h @@ -0,0 +1,10 @@ +#import + +// This is a bridge to interact through NSEnumerator's interface with objects that only conform to +// NSFastEnumeration. (There's nothing specifically fast about it - you certainly don't win any +// speed by using this instead of a NSEnumerator provided by your container). +@interface GRXNSFastEnumerator : NSEnumerator +// After the iteration of the container (via the NSFastEnumeration protocol) is over, the container +// is released. If the container is modified during enumeration, an exception is thrown. +- (instancetype)initWithContainer:(id)container; +@end diff --git a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m new file mode 100644 index 00000000000..817ff34d95c --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m @@ -0,0 +1,55 @@ +#import "GRXNSFastEnumerator.h" + +@implementation GRXNSFastEnumerator { + id _container; + NSFastEnumerationState _state; + // Number of elements of the container currently in the _state.itemsPtr array. + NSUInteger _count; + // The index of the next object to return from the _state.itemsPtr array. + NSUInteger _index; + // A "buffer of one element," for the containers that enumerate their elements one by one. Those + // will set _state.itemsPtr to point to this. + // The NSFastEnumeration protocol requires it to be __unsafe_unretained, but that's alright + // because the only use we'd make of its value is to return it immediately as the result of + // nextObject. + __unsafe_unretained id _bufferValue; + // Neither NSEnumerator nor NSFastEnumeration instances are required to work correctly when the + // underlying container is mutated during iteration. The expectation is that an exception is + // thrown when that happens. So we check for mutations. + unsigned long _mutationFlag; + BOOL _mutationFlagIsSet; +} + +- (instancetype)init { + return [self initWithContainer:nil]; +} + +// Designated initializer. +- (instancetype)initWithContainer:(id)container { + NSAssert(container, @"container can't be nil"); + if ((self = [super init])) { + _container = container; + } + return self; +} + +- (id)nextObject { + if (_index == _count) { + _index = 0; + _count = [_container countByEnumeratingWithState:&_state objects:&_bufferValue count:1]; + if (_count == 0) { + // Enumeration is over. + _container = nil; + return nil; + } + if (_mutationFlagIsSet) { + NSAssert(_mutationFlag == *(_state.mutationsPtr), + @"container was mutated while being enumerated"); + } else { + _mutationFlag = *(_state.mutationsPtr); + _mutationFlagIsSet = YES; + } + } + return _state.itemsPtr[_index++]; +} +@end diff --git a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h new file mode 100644 index 00000000000..1130f52897e --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h @@ -0,0 +1,8 @@ +#import + +// Concrete subclass of NSEnumerator whose instances return a single object before finishing. +@interface GRXNSScalarEnumerator : NSEnumerator +// Param value: the single object this instance will produce. After the first invocation of +// nextObject, the value is released. +- (instancetype)initWithValue:(id)value; +@end diff --git a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m new file mode 100644 index 00000000000..b2a1afd00e6 --- /dev/null +++ b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m @@ -0,0 +1,24 @@ +#import "GRXNSScalarEnumerator.h" + +@implementation GRXNSScalarEnumerator { + id _value; +} + +- (instancetype)init { + return [self initWithValue:nil]; +} + +// Designated initializer. +- (instancetype)initWithValue:(id)value { + if ((self = [super init])) { + _value = value; + } + return self; +} + +- (id)nextObject { + id value = _value; + _value = nil; + return value; +} +@end diff --git a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h new file mode 100644 index 00000000000..13640c5bd6d --- /dev/null +++ b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h @@ -0,0 +1,7 @@ +#import "GRXWriter.h" + +// A "proxy" writer that transforms all the values of its input writer by using a mapping function. +@interface GRXMappingWriter : GRXWriter +- (instancetype)initWithWriter:(id)writer map:(id (^)(id value))map + NS_DESIGNATED_INITIALIZER; +@end diff --git a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m new file mode 100644 index 00000000000..3aa2a2503ae --- /dev/null +++ b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m @@ -0,0 +1,30 @@ +#import "GRXMappingWriter.h" + +static id (^kIdentity)(id value) = ^id(id value) { + return value; +}; + +@interface GRXWriter () +@end + +@implementation GRXMappingWriter { + id (^_map)(id value); +} + +- (instancetype)initWithWriter:(id)writer { + return [self initWithWriter:writer map:nil]; +} + +// Designated initializer +- (instancetype)initWithWriter:(id)writer map:(id (^)(id value))map { + if ((self = [super initWithWriter:writer])) { + _map = map ?: kIdentity; + } + return self; +} + +// Override +- (void)didReceiveValue:(id)value { + [super didReceiveValue:_map(value)]; +} +@end From 409e6c804bc487c4a50451fd22ac90abc7293172 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 17:46:35 -0800 Subject: [PATCH 125/232] Updates the module name in C extension, ensuring it compiles --- src/ruby/ext/grpc/rb_byte_buffer.c | 4 +- src/ruby/ext/grpc/rb_byte_buffer.h | 2 +- src/ruby/ext/grpc/rb_call.c | 12 +++--- src/ruby/ext/grpc/rb_call.h | 2 +- src/ruby/ext/grpc/rb_channel.c | 4 +- src/ruby/ext/grpc/rb_channel.h | 2 +- src/ruby/ext/grpc/rb_completion_queue.c | 4 +- src/ruby/ext/grpc/rb_completion_queue.h | 2 +- src/ruby/ext/grpc/rb_credentials.c | 4 +- src/ruby/ext/grpc/rb_credentials.h | 2 +- src/ruby/ext/grpc/rb_event.c | 8 ++-- src/ruby/ext/grpc/rb_event.h | 2 +- src/ruby/ext/grpc/rb_grpc.c | 46 +++++++++++------------ src/ruby/ext/grpc/rb_grpc.h | 7 +--- src/ruby/ext/grpc/rb_metadata.c | 4 +- src/ruby/ext/grpc/rb_metadata.h | 2 +- src/ruby/ext/grpc/rb_server.c | 4 +- src/ruby/ext/grpc/rb_server.h | 2 +- src/ruby/ext/grpc/rb_server_credentials.c | 4 +- src/ruby/ext/grpc/rb_server_credentials.h | 2 +- 20 files changed, 57 insertions(+), 62 deletions(-) diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index f73b12c417f..8586915026c 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -202,9 +202,9 @@ static VALUE grpc_rb_byte_buffer_init(VALUE self, VALUE src) { /* rb_cByteBuffer is the ruby class that proxies grpc_byte_buffer. */ VALUE rb_cByteBuffer = Qnil; -void Init_google_rpc_byte_buffer() { +void Init_grpc_byte_buffer() { rb_cByteBuffer = - rb_define_class_under(rb_mGoogleRpcCore, "ByteBuffer", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "ByteBuffer", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cByteBuffer, grpc_rb_byte_buffer_alloc); diff --git a/src/ruby/ext/grpc/rb_byte_buffer.h b/src/ruby/ext/grpc/rb_byte_buffer.h index 322c268f377..1340c355e26 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.h +++ b/src/ruby/ext/grpc/rb_byte_buffer.h @@ -42,7 +42,7 @@ extern VALUE rb_cByteBuffer; /* Initializes the ByteBuffer class. */ -void Init_google_rpc_byte_buffer(); +void Init_grpc_byte_buffer(); /* grpc_rb_byte_buffer_create_with_mark creates a grpc_rb_byte_buffer with a * ruby mark object that will be kept alive while the byte_buffer is alive. */ diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 5d723076682..af5ef25e143 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -449,9 +449,9 @@ VALUE rb_cCall = Qnil; operations; */ VALUE rb_eCallError = Qnil; -void Init_google_rpc_error_codes() { +void Init_grpc_error_codes() { /* Constants representing the error codes of grpc_call_error in grpc.h */ - VALUE rb_RpcErrors = rb_define_module_under(rb_mGoogleRpcCore, "RpcErrors"); + VALUE rb_RpcErrors = rb_define_module_under(rb_mGrpcCore, "RpcErrors"); rb_define_const(rb_RpcErrors, "OK", UINT2NUM(GRPC_CALL_OK)); rb_define_const(rb_RpcErrors, "ERROR", UINT2NUM(GRPC_CALL_ERROR)); rb_define_const(rb_RpcErrors, "NOT_ON_SERVER", @@ -500,11 +500,11 @@ void Init_google_rpc_error_codes() { rb_obj_freeze(rb_error_code_details); } -void Init_google_rpc_call() { +void Init_grpc_call() { /* CallError inherits from Exception to signal that it is non-recoverable */ rb_eCallError = - rb_define_class_under(rb_mGoogleRpcCore, "CallError", rb_eException); - rb_cCall = rb_define_class_under(rb_mGoogleRpcCore, "Call", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "CallError", rb_eException); + rb_cCall = rb_define_class_under(rb_mGrpcCore, "Call", rb_cObject); /* Prevent allocation or inialization of the Call class */ rb_define_alloc_func(rb_cCall, grpc_rb_cannot_alloc); @@ -542,7 +542,7 @@ void Init_google_rpc_call() { hash_all_calls = rb_hash_new(); rb_define_const(rb_cCall, "INTERNAL_ALL_CALLs", hash_all_calls); - Init_google_rpc_error_codes(); + Init_grpc_error_codes(); } /* Gets the call from the ruby object */ diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index 965e9eef409..3dbe0b33284 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -54,6 +54,6 @@ extern VALUE rb_cCall; extern VALUE rb_eCallError; /* Initializes the Call class. */ -void Init_google_rpc_call(); +void Init_grpc_call(); #endif /* GRPC_RB_CALL_H_ */ diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 7c98e66c33d..e63656425d9 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -227,9 +227,9 @@ static VALUE grpc_rb_channel_destroy(VALUE self) { /* rb_cChannel is the ruby class that proxies grpc_channel. */ VALUE rb_cChannel = Qnil; -void Init_google_rpc_channel() { +void Init_grpc_channel() { rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); - rb_cChannel = rb_define_class_under(rb_mGoogleRpcCore, "Channel", rb_cObject); + rb_cChannel = rb_define_class_under(rb_mGrpcCore, "Channel", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cChannel, grpc_rb_channel_alloc); diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index 6c1210e812d..93155455dcb 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -41,7 +41,7 @@ extern VALUE rb_cChannel; /* Initializes the Channel class. */ -void Init_google_rpc_channel(); +void Init_grpc_channel(); /* Gets the wrapped channel from the ruby wrapper */ grpc_channel* grpc_rb_get_wrapped_channel(VALUE v); diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 47776a991a1..e406336d17e 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -159,9 +159,9 @@ static VALUE grpc_rb_completion_queue_pluck(VALUE self, VALUE tag, /* rb_cCompletionQueue is the ruby class that proxies grpc_completion_queue. */ VALUE rb_cCompletionQueue = Qnil; -void Init_google_rpc_completion_queue() { +void Init_grpc_completion_queue() { rb_cCompletionQueue = - rb_define_class_under(rb_mGoogleRpcCore, "CompletionQueue", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "CompletionQueue", rb_cObject); /* constructor: uses an alloc func without an initializer. Using a simple alloc func works here as the grpc header does not specify any args for diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h index c563662c2d4..a8155b5f13a 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.h +++ b/src/ruby/ext/grpc/rb_completion_queue.h @@ -45,6 +45,6 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v); extern VALUE rb_cCompletionQueue; /* Initializes the CompletionQueue class. */ -void Init_google_rpc_completion_queue(); +void Init_grpc_completion_queue(); #endif /* GRPC_RB_COMPLETION_QUEUE_H_ */ diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c index 87a5d0a299c..44b2d03e6fd 100644 --- a/src/ruby/ext/grpc/rb_credentials.c +++ b/src/ruby/ext/grpc/rb_credentials.c @@ -245,9 +245,9 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) { /* rb_cCredentials is the ruby class that proxies grpc_credentials. */ VALUE rb_cCredentials = Qnil; -void Init_google_rpc_credentials() { +void Init_grpc_credentials() { rb_cCredentials = - rb_define_class_under(rb_mGoogleRpcCore, "Credentials", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "Credentials", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cCredentials, grpc_rb_credentials_alloc); diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h index fada3639d58..efa30a2a565 100644 --- a/src/ruby/ext/grpc/rb_credentials.h +++ b/src/ruby/ext/grpc/rb_credentials.h @@ -42,7 +42,7 @@ extern VALUE rb_cCredentials; /* Initializes the ruby Credentials class. */ -void Init_google_rpc_credentials(); +void Init_grpc_credentials(); /* Gets the wrapped credentials from the ruby wrapper */ grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v); diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c index 72c9dd2ec00..38a90c13e79 100644 --- a/src/ruby/ext/grpc/rb_event.c +++ b/src/ruby/ext/grpc/rb_event.c @@ -312,10 +312,10 @@ VALUE rb_cEvent = Qnil; rpc event processing. */ VALUE rb_eEventError = Qnil; -void Init_google_rpc_event() { +void Init_grpc_event() { rb_eEventError = - rb_define_class_under(rb_mGoogleRpcCore, "EventError", rb_eStandardError); - rb_cEvent = rb_define_class_under(rb_mGoogleRpcCore, "Event", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "EventError", rb_eStandardError); + rb_cEvent = rb_define_class_under(rb_mGrpcCore, "Event", rb_cObject); /* Prevent allocation or inialization from ruby. */ rb_define_alloc_func(rb_cEvent, grpc_rb_cannot_alloc); @@ -332,7 +332,7 @@ void Init_google_rpc_event() { /* Constants representing the completion types */ rb_mCompletionType = - rb_define_module_under(rb_mGoogleRpcCore, "CompletionType"); + rb_define_module_under(rb_mGrpcCore, "CompletionType"); rb_define_const(rb_mCompletionType, "QUEUE_SHUTDOWN", INT2NUM(GRPC_QUEUE_SHUTDOWN)); rb_define_const(rb_mCompletionType, "OP_COMPLETE", INT2NUM(GRPC_OP_COMPLETE)); diff --git a/src/ruby/ext/grpc/rb_event.h b/src/ruby/ext/grpc/rb_event.h index a406e9e9f17..591a3528786 100644 --- a/src/ruby/ext/grpc/rb_event.h +++ b/src/ruby/ext/grpc/rb_event.h @@ -48,6 +48,6 @@ extern VALUE rb_eEventError; VALUE grpc_rb_new_event(grpc_event *ev); /* Initializes the Event and EventError classes. */ -void Init_google_rpc_event(); +void Init_grpc_event(); #endif /* GRPC_RB_EVENT_H_ */ diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 8feefb047cc..c8e2bb5c4ae 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -153,10 +153,10 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) { return t; } -void Init_google_status_codes() { +void Init_grpc_status_codes() { /* Constants representing the status codes or grpc_status_code in status.h */ VALUE rb_mStatusCodes = - rb_define_module_under(rb_mGoogleRpcCore, "StatusCodes"); + rb_define_module_under(rb_mGrpcCore, "StatusCodes"); rb_define_const(rb_mStatusCodes, "OK", INT2NUM(GRPC_STATUS_OK)); rb_define_const(rb_mStatusCodes, "CANCELLED", INT2NUM(GRPC_STATUS_CANCELLED)); rb_define_const(rb_mStatusCodes, "UNKNOWN", INT2NUM(GRPC_STATUS_UNKNOWN)); @@ -214,11 +214,11 @@ VALUE grpc_rb_time_val_to_s(VALUE self) { } /* Adds a module with constants that map to gpr's static timeval structs. */ -void Init_google_time_consts() { +void Init_grpc_time_consts() { VALUE rb_mTimeConsts = - rb_define_module_under(rb_mGoogleRpcCore, "TimeConsts"); + rb_define_module_under(rb_mGrpcCore, "TimeConsts"); rb_cTimeVal = - rb_define_class_under(rb_mGoogleRpcCore, "TimeSpec", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "TimeSpec", rb_cObject); rb_define_const(rb_mTimeConsts, "ZERO", Data_Wrap_Struct(rb_cTimeVal, GC_NOT_MARKED, GC_DONT_FREE, (void *)&gpr_time_0)); @@ -240,37 +240,35 @@ void Init_google_time_consts() { void grpc_rb_shutdown(void *vm) { grpc_shutdown(); } -/* Initialize the Google RPC module structs */ +/* Initialize the GRPC module structs */ /* rb_sNewServerRpc is the struct that holds new server rpc details. */ VALUE rb_sNewServerRpc = Qnil; /* rb_sStatus is the struct that holds status details. */ VALUE rb_sStatus = Qnil; -/* Initialize the Google RPC module. */ -VALUE rb_mGoogle = Qnil; -VALUE rb_mGoogleRPC = Qnil; -VALUE rb_mGoogleRpcCore = Qnil; +/* Initialize the GRPC module. */ +VALUE rb_mGRPC = Qnil; +VALUE rb_mGrpcCore = Qnil; void Init_grpc() { grpc_init(); ruby_vm_at_exit(grpc_rb_shutdown); - rb_mGoogle = rb_define_module("Google"); - rb_mGoogleRPC = rb_define_module_under(rb_mGoogle, "RPC"); - rb_mGoogleRpcCore = rb_define_module_under(rb_mGoogleRPC, "Core"); + rb_mGRPC = rb_define_module("GRPC"); + rb_mGrpcCore = rb_define_module_under(rb_mGRPC, "Core"); rb_sNewServerRpc = rb_struct_define("NewServerRpc", "method", "host", "deadline", "metadata", NULL); rb_sStatus = rb_struct_define("Status", "code", "details", "metadata", NULL); - Init_google_rpc_byte_buffer(); - Init_google_rpc_event(); - Init_google_rpc_channel(); - Init_google_rpc_completion_queue(); - Init_google_rpc_call(); - Init_google_rpc_credentials(); - Init_google_rpc_metadata(); - Init_google_rpc_server(); - Init_google_rpc_server_credentials(); - Init_google_status_codes(); - Init_google_time_consts(); + Init_grpc_byte_buffer(); + Init_grpc_event(); + Init_grpc_channel(); + Init_grpc_completion_queue(); + Init_grpc_call(); + Init_grpc_credentials(); + Init_grpc_metadata(); + Init_grpc_server(); + Init_grpc_server_credentials(); + Init_grpc_status_codes(); + Init_grpc_time_consts(); } diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index d5e8930fca6..664b94fd261 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -38,11 +38,8 @@ #include #include -/* rb_mGoogle is the top-level Google module. */ -extern VALUE rb_mGoogle; - -/* rb_mGoogleRpcCore is the module containing the ruby wrapper GRPC classes. */ -extern VALUE rb_mGoogleRpcCore; +/* rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */ +extern VALUE rb_mGrpcCore; /* Class used to wrap timeval structs. */ extern VALUE rb_cTimeVal; diff --git a/src/ruby/ext/grpc/rb_metadata.c b/src/ruby/ext/grpc/rb_metadata.c index 88eb62ab738..55a429c9595 100644 --- a/src/ruby/ext/grpc/rb_metadata.c +++ b/src/ruby/ext/grpc/rb_metadata.c @@ -187,9 +187,9 @@ static VALUE grpc_rb_metadata_value(VALUE self) { /* rb_cMetadata is the Metadata class whose instances proxy grpc_metadata. */ VALUE rb_cMetadata = Qnil; -void Init_google_rpc_metadata() { +void Init_grpc_metadata() { rb_cMetadata = - rb_define_class_under(rb_mGoogleRpcCore, "Metadata", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "Metadata", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cMetadata, grpc_rb_metadata_alloc); diff --git a/src/ruby/ext/grpc/rb_metadata.h b/src/ruby/ext/grpc/rb_metadata.h index 329ef15c68a..8e452b64051 100644 --- a/src/ruby/ext/grpc/rb_metadata.h +++ b/src/ruby/ext/grpc/rb_metadata.h @@ -48,6 +48,6 @@ extern VALUE grpc_rb_metadata_create_with_mark(VALUE mark, grpc_metadata* md); grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v); /* Initializes the Metadata class. */ -void Init_google_rpc_metadata(); +void Init_grpc_metadata(); #endif /* GRPC_RB_METADATA_H_ */ diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index e68843e12b1..b2877e98e4e 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -251,8 +251,8 @@ static VALUE grpc_rb_server_add_http2_port(int argc, VALUE *argv, VALUE self) { return INT2NUM(recvd_port); } -void Init_google_rpc_server() { - rb_cServer = rb_define_class_under(rb_mGoogleRpcCore, "Server", rb_cObject); +void Init_grpc_server() { + rb_cServer = rb_define_class_under(rb_mGrpcCore, "Server", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cServer, grpc_rb_server_alloc); diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h index 92047efd187..d9c6362f8a4 100644 --- a/src/ruby/ext/grpc/rb_server.h +++ b/src/ruby/ext/grpc/rb_server.h @@ -42,7 +42,7 @@ extern VALUE rb_cServer; /* Initializes the Server class. */ -void Init_google_rpc_server(); +void Init_grpc_server(); /* Gets the wrapped server from the ruby wrapper */ grpc_server* grpc_rb_get_wrapped_server(VALUE v); diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index 4f6c67ea5e3..f825297225f 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -184,9 +184,9 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs, grpc_server_credentials. */ VALUE rb_cServerCredentials = Qnil; -void Init_google_rpc_server_credentials() { +void Init_grpc_server_credentials() { rb_cServerCredentials = - rb_define_class_under(rb_mGoogleRpcCore, "ServerCredentials", rb_cObject); + rb_define_class_under(rb_mGrpcCore, "ServerCredentials", rb_cObject); /* Allocates an object managed by the ruby runtime */ rb_define_alloc_func(rb_cServerCredentials, grpc_rb_server_credentials_alloc); diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h index 2a2e1fbc822..2be627727ab 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.h +++ b/src/ruby/ext/grpc/rb_server_credentials.h @@ -42,7 +42,7 @@ extern VALUE rb_cServerCredentials; /* Initializes the ruby ServerCredentials class. */ -void Init_google_rpc_server_credentials(); +void Init_grpc_server_credentials(); /* Gets the wrapped server_credentials from the ruby wrapper */ grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v); From 5e0efd95f785bc3a82fa2b7b67b2442625653efa Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 17 Feb 2015 18:23:58 -0800 Subject: [PATCH 126/232] Imports code of the generic gRPC client library. --- src/objective-c/GRPCClient/GRPCCall.h | 57 +++ src/objective-c/GRPCClient/GRPCCall.m | 373 ++++++++++++++++++ src/objective-c/GRPCClient/GRPCMethodName.h | 15 + src/objective-c/GRPCClient/GRPCMethodName.m | 14 + src/objective-c/GRPCClient/README.md | 4 + .../GRPCClient/private/GRPCChannel.h | 17 + .../GRPCClient/private/GRPCChannel.m | 32 ++ .../GRPCClient/private/GRPCCompletionQueue.h | 21 + .../GRPCClient/private/GRPCCompletionQueue.m | 73 ++++ .../GRPCClient/private/GRPCDelegateWrapper.h | 48 +++ .../GRPCClient/private/GRPCDelegateWrapper.m | 87 ++++ .../private/GRPCMethodName+HTTP2Encoding.h | 7 + .../private/GRPCMethodName+HTTP2Encoding.m | 11 + .../GRPCClient/private/NSData+GRPC.h | 8 + .../GRPCClient/private/NSData+GRPC.m | 53 +++ .../GRPCClient/private/NSDictionary+GRPC.h | 7 + .../GRPCClient/private/NSDictionary+GRPC.m | 23 ++ .../GRPCClient/private/NSError+GRPC.h | 41 ++ .../GRPCClient/private/NSError+GRPC.m | 18 + src/objective-c/README.md | 3 + 20 files changed, 912 insertions(+) create mode 100644 src/objective-c/GRPCClient/GRPCCall.h create mode 100644 src/objective-c/GRPCClient/GRPCCall.m create mode 100644 src/objective-c/GRPCClient/GRPCMethodName.h create mode 100644 src/objective-c/GRPCClient/GRPCMethodName.m create mode 100644 src/objective-c/GRPCClient/README.md create mode 100644 src/objective-c/GRPCClient/private/GRPCChannel.h create mode 100644 src/objective-c/GRPCClient/private/GRPCChannel.m create mode 100644 src/objective-c/GRPCClient/private/GRPCCompletionQueue.h create mode 100644 src/objective-c/GRPCClient/private/GRPCCompletionQueue.m create mode 100644 src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h create mode 100644 src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m create mode 100644 src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h create mode 100644 src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m create mode 100644 src/objective-c/GRPCClient/private/NSData+GRPC.h create mode 100644 src/objective-c/GRPCClient/private/NSData+GRPC.m create mode 100644 src/objective-c/GRPCClient/private/NSDictionary+GRPC.h create mode 100644 src/objective-c/GRPCClient/private/NSDictionary+GRPC.m create mode 100644 src/objective-c/GRPCClient/private/NSError+GRPC.h create mode 100644 src/objective-c/GRPCClient/private/NSError+GRPC.m create mode 100644 src/objective-c/README.md diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h new file mode 100644 index 00000000000..db138fd1ee3 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -0,0 +1,57 @@ +#import +#import + +@class GRPCMethodName; + +@class GRPCCall; + +// The gRPC protocol is an RPC protocol on top of HTTP2. +// +// While the most common type of RPC receives only one request message and +// returns only one response message, the protocol also supports RPCs that +// return multiple individual messages in a streaming fashion, RPCs that +// accept a stream of request messages, or RPCs with both streaming requests +// and responses. +// +// Conceptually, each gRPC call consists of a bidirectional stream of binary +// messages, with RPCs of the "non-streaming type" sending only one message in +// the corresponding direction (the protocol doesn't make any distinction). +// +// Each RPC uses a different HTTP2 stream, and thus multiple simultaneous RPCs +// can be multiplexed transparently on the same TCP connection. +@interface GRPCCall : NSObject + +// These HTTP2 headers will be passed to the server as part of this call. Each +// HTTP2 header is a name-value pair with string names and either string or binary values. +// The passed dictionary has to use NSString keys, corresponding to the header names. The +// value associated to each can be a NSString object or a NSData object. E.g.: +// +// call.requestMetadata = @{ +// @"Authorization": @"Bearer ...", +// @"SomeBinaryHeader": someData +// }; +// +// After the call is started, modifying this won't have any effect. +@property(nonatomic, readwrite) NSMutableDictionary *requestMetadata; + +// This isn't populated until the first event is delivered to the handler. +@property(atomic, readonly) NSDictionary *responseMetadata; + +// The request writer has to write NSData objects into the provided Writeable. The server will +// receive each of those separately and in order. +// A gRPC call might not complete until the request writer finishes. On the other hand, the +// request finishing doesn't necessarily make the call to finish, as the server might continue +// sending messages to the response side of the call indefinitely (depending on the semantics of +// the specific remote method called). +// To finish a call right away, invoke cancel. +- (instancetype)initWithHost:(NSString *)host + method:(GRPCMethodName *)method + requestsWriter:(id)requestsWriter NS_DESIGNATED_INITIALIZER; + +// Finishes the request side of this call, notifies the server that the RPC +// should be cancelled, and finishes the response side of the call with an error +// of code CANCELED. +- (void)cancel; + +// TODO(jcanizales): Let specify a deadline. As a category of GRXWriter? +@end diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m new file mode 100644 index 00000000000..b9248be5dbc --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -0,0 +1,373 @@ +#import "GRPCCall.h" + +#include +#include + +#import "GRPCMethodName.h" +#import "private/GRPCChannel.h" +#import "private/GRPCCompletionQueue.h" +#import "private/GRPCDelegateWrapper.h" +#import "private/GRPCMethodName+HTTP2Encoding.h" +#import "private/NSData+GRPC.h" +#import "private/NSDictionary+GRPC.h" +#import "private/NSError+GRPC.h" + +// A grpc_call_error represents a precondition failure when invoking the +// grpc_call_* functions. If one ever happens, it's a bug in this library. +// +// TODO(jcanizales): Can an application shut down gracefully when a thread other +// than the main one throws an exception? +static void AssertNoErrorInCall(grpc_call_error error) { + if (error != GRPC_CALL_OK) { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:@"Precondition of grpc_call_* not met." + userInfo:nil]; + } +} + +@interface GRPCCall () +// Makes it readwrite. +@property(atomic, strong) NSDictionary *responseMetadata; +@end + +// The following methods of a C gRPC call object aren't reentrant, and thus +// calls to them must be serialized: +// - add_metadata +// - invoke +// - start_write +// - writes_done +// - start_read +// - destroy +// The first four are called as part of responding to client commands, but +// start_read we want to call as soon as we're notified that the RPC was +// successfully established (which happens concurrently in the network queue). +// Serialization is achieved by using a private serial queue to operate the +// call object. +// Because add_metadata and invoke are called and return successfully before +// any of the other methods is called, they don't need to use the queue. +// +// Furthermore, start_write and writes_done can only be called after the +// WRITE_ACCEPTED event for any previous write is received. This is achieved by +// pausing the requests writer immediately every time it writes a value, and +// resuming it again when WRITE_ACCEPTED is received. +// +// Similarly, start_read can only be called after the READ event for any +// previous read is received. This is easier to enforce, as we're writing the +// received messages into the writeable: start_read is enqueued once upon receiving +// the CLIENT_METADATA_READ event, and then once after receiving each READ +// event. +@implementation GRPCCall { + dispatch_queue_t _callQueue; + + grpc_call *_gRPCCall; + dispatch_once_t _callAlreadyInvoked; + + GRPCChannel *_channel; + GRPCCompletionQueue *_completionQueue; + + // The C gRPC library has less guarantees on the ordering of events than we + // do. Particularly, in the face of errors, there's no ordering guarantee at + // all. This wrapper over our actual writeable ensures thread-safety and + // correct ordering. + GRPCDelegateWrapper *_responseWriteable; + id _requestWriter; +} + +@synthesize state = _state; + +- (instancetype)init { + return [self initWithHost:nil method:nil requestsWriter:nil]; +} + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host + method:(GRPCMethodName *)method + requestsWriter:(id)requestWriter { + if (!host || !method) { + [NSException raise:NSInvalidArgumentException format:@"Neither host nor method can be nil."]; + } + // TODO(jcanizales): Throw if the requestWriter was already started. + if ((self = [super init])) { + static dispatch_once_t initialization; + dispatch_once(&initialization, ^{ + grpc_init(); + }); + + _completionQueue = [GRPCCompletionQueue completionQueue]; + + _channel = [GRPCChannel channelToHost:host]; + _gRPCCall = grpc_channel_create_call_old(_channel.unmanagedChannel, + method.HTTP2Path.UTF8String, + host.UTF8String, + gpr_inf_future); + + // Serial queue to invoke the non-reentrant methods of the grpc_call object. + _callQueue = dispatch_queue_create("org.grpc.call", NULL); + + _requestWriter = requestWriter; + } + return self; +} + +#pragma mark Finish + +- (void)finishWithError:(NSError *)errorOrNil { + _requestWriter.state = GRXWriterStateFinished; + _requestWriter = nil; + if (errorOrNil) { + [_responseWriteable cancelWithError:errorOrNil]; + } else { + [_responseWriteable enqueueSuccessfulCompletion]; + } +} + +- (void)cancelCall { + // Can be called from any thread, any number of times. + AssertNoErrorInCall(grpc_call_cancel(_gRPCCall)); +} + +- (void)cancel { + [self finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeCancelled + userInfo:nil]]; + [self cancelCall]; +} + +- (void)dealloc { + grpc_call *gRPCCall = _gRPCCall; + dispatch_async(_callQueue, ^{ + grpc_call_destroy(gRPCCall); + }); +} + +#pragma mark Read messages + +// Only called from the call queue. +// The handler will be called from the network queue. +- (void)startReadWithHandler:(GRPCEventHandler)handler { + AssertNoErrorInCall(grpc_call_start_read_old(_gRPCCall, (__bridge_retained void *)handler)); +} + +// Called initially from the network queue once response headers are received, +// then "recursively" from the responseWriteable queue after each response from the +// server has been written. +// If the call is currently paused, this is a noop. Restarting the call will invoke this +// method. +// TODO(jcanizales): Rename to readResponseIfNotPaused. +- (void)startNextRead { + if (self.state == GRXWriterStatePaused) { + return; + } + __weak GRPCCall *weakSelf = self; + __weak GRPCDelegateWrapper *weakWriteable = _responseWriteable; + + dispatch_async(_callQueue, ^{ + [weakSelf startReadWithHandler:^(grpc_event *event) { + if (!event->data.read) { + // No more responses from the server. + return; + } + NSData *data = [NSData grpc_dataWithByteBuffer:event->data.read]; + if (!data) { + // The app doesn't have enough memory to hold the server response. We + // don't want to throw, because the app shouldn't crash for a behavior + // that's on the hands of any server to have. Instead we finish and ask + // the server to cancel. + // + // TODO(jcanizales): No canonical code is appropriate for this situation + // (because it's just a client problem). Use another domain and an + // appropriately-documented code. + [weakSelf finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeInternal + userInfo:nil]]; + [weakSelf cancelCall]; + return; + } + [weakWriteable enqueueMessage:data completionHandler:^{ + [weakSelf startNextRead]; + }]; + }]; + }); +} + +#pragma mark Send headers + +- (void)addHeaderWithName:(NSString *)name binaryValue:(NSData *)value { + grpc_metadata metadata; + // Safe to discard const qualifiers; we're not going to modify the contents. + metadata.key = (char *)name.UTF8String; + metadata.value = (char *)value.bytes; + metadata.value_length = value.length; + grpc_call_add_metadata_old(_gRPCCall, &metadata, 0); +} + +- (void)addHeaderWithName:(NSString *)name ASCIIValue:(NSString *)value { + grpc_metadata metadata; + // Safe to discard const qualifiers; we're not going to modify the contents. + metadata.key = (char *)name.UTF8String; + metadata.value = (char *)value.UTF8String; + // The trailing \0 isn't encoded in HTTP2. + metadata.value_length = value.length; + grpc_call_add_metadata_old(_gRPCCall, &metadata, 0); +} + +// TODO(jcanizales): Rename to commitHeaders. +- (void)sendHeaders:(NSDictionary *)metadata { + for (NSString *name in metadata) { + id value = metadata[name]; + if ([value isKindOfClass:[NSData class]]) { + [self addHeaderWithName:name binaryValue:value]; + } else if ([value isKindOfClass:[NSString class]]) { + [self addHeaderWithName:name ASCIIValue:value]; + } + } +} + +#pragma mark GRXWriteable implementation + +// Only called from the call queue. The error handler will be called from the +// network queue if the write didn't succeed. +- (void)writeMessage:(NSData *)message withErrorHandler:(void (^)())errorHandler { + + __weak GRPCCall *weakSelf = self; + GRPCEventHandler resumingHandler = ^(grpc_event *event) { + if (event->data.write_accepted != GRPC_OP_OK) { + errorHandler(); + } + // Resume the request writer (even in the case of error). + // TODO(jcanizales): No need to do it in the case of errors anymore? + GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf->_requestWriter.state = GRXWriterStateStarted; + } + }; + + grpc_byte_buffer *buffer = message.grpc_byteBuffer; + AssertNoErrorInCall(grpc_call_start_write_old(_gRPCCall, + buffer, + (__bridge_retained void *)resumingHandler, + 0)); + grpc_byte_buffer_destroy(buffer); +} + +- (void)didReceiveValue:(id)value { + // TODO(jcanizales): Throw/assert if value isn't NSData. + + // Pause the input and only resume it when the C layer notifies us that writes + // can proceed. + _requestWriter.state = GRXWriterStatePaused; + + __weak GRPCCall *weakSelf = self; + dispatch_async(_callQueue, ^{ + [weakSelf writeMessage:value withErrorHandler:^{ + [weakSelf finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeInternal + userInfo:nil]]; + }]; + }); +} + +// Only called from the call queue. The error handler will be called from the +// network queue if the requests stream couldn't be closed successfully. +- (void)finishRequestWithErrorHandler:(void (^)())errorHandler { + GRPCEventHandler handler = ^(grpc_event *event) { + if (event->data.finish_accepted != GRPC_OP_OK) { + errorHandler(); + } + }; + AssertNoErrorInCall(grpc_call_writes_done_old(_gRPCCall, (__bridge_retained void *)handler)); +} + +- (void)didFinishWithError:(NSError *)errorOrNil { + if (errorOrNil) { + [self cancel]; + } else { + __weak GRPCCall *weakSelf = self; + dispatch_async(_callQueue, ^{ + [weakSelf finishRequestWithErrorHandler:^{ + [weakSelf finishWithError:[NSError errorWithDomain:kGRPCErrorDomain + code:GRPCErrorCodeInternal + userInfo:nil]]; + }]; + }); + } +} + +#pragma mark Invoke + +// Both handlers will eventually be called, from the network queue. Writes can start immediately +// after this. +// The first one (metadataHandler), when the response headers are received. +// The second one (completionHandler), whenever the RPC finishes for any reason. +- (void)invokeCallWithMetadataHandler:(GRPCEventHandler)metadataHandler + completionHandler:(GRPCEventHandler)completionHandler { + AssertNoErrorInCall(grpc_call_invoke_old(_gRPCCall, + _completionQueue.unmanagedQueue, + (__bridge_retained void *)metadataHandler, + (__bridge_retained void *)completionHandler, + 0)); +} + +- (void)invokeCall { + __weak GRPCCall *weakSelf = self; + [self invokeCallWithMetadataHandler:^(grpc_event *event) { + // Response metadata received. + // TODO(jcanizales): Name the type of event->data.client_metadata_read + // in the C library so one can actually pass the object to a method. + grpc_metadata *entries = event->data.client_metadata_read.elements; + size_t count = event->data.client_metadata_read.count; + GRPCCall *strongSelf = weakSelf; + if (strongSelf) { + strongSelf.responseMetadata = [NSDictionary grpc_dictionaryFromMetadata:entries + count:count]; + [strongSelf startNextRead]; + } + } completionHandler:^(grpc_event *event) { + // TODO(jcanizales): Merge HTTP2 trailers into response metadata. + [weakSelf finishWithError:[NSError grpc_errorFromStatus:&event->data.finished]]; + }]; + // Now that the RPC has been initiated, request writes can start. + [_requestWriter startWithWriteable:self]; +} + +#pragma mark GRXWriter implementation + +- (void)startWithWriteable:(id)writeable { + // The following produces a retain cycle self:_responseWriteable:self, which is only + // broken when didFinishWithError: is sent to the wrapped writeable. + // Care is taken not to retain self strongly in any of the blocks used in + // the implementation of GRPCCall, so that the life of the instance is + // determined by this retain cycle. + _responseWriteable = [[GRPCDelegateWrapper alloc] initWithWriteable:writeable writer:self]; + [self sendHeaders:_requestMetadata]; + [self invokeCall]; +} + +- (void)setState:(GRXWriterState)newState { + // Manual transitions are only allowed from the started or paused states. + if (_state == GRXWriterStateNotStarted || _state == GRXWriterStateFinished) { + return; + } + + switch (newState) { + case GRXWriterStateFinished: + _state = newState; + // Per GRXWriter's contract, setting the state to Finished manually + // means one doesn't wish the writeable to be messaged anymore. + [_responseWriteable cancelSilently]; + _responseWriteable = nil; + return; + case GRXWriterStatePaused: + _state = newState; + return; + case GRXWriterStateStarted: + if (_state == GRXWriterStatePaused) { + _state = newState; + [self startNextRead]; + } + return; + case GRXWriterStateNotStarted: + return; + } +} +@end diff --git a/src/objective-c/GRPCClient/GRPCMethodName.h b/src/objective-c/GRPCClient/GRPCMethodName.h new file mode 100644 index 00000000000..4fb86d20991 --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCMethodName.h @@ -0,0 +1,15 @@ +#import + +// See the README file for an introduction to this library. + +// A fully-qualified gRPC method name. Full qualification is needed because a gRPC endpoint can +// implement multiple interfaces. +// TODO(jcanizales): Is this proto-specific, or actual part of gRPC? If the former, move one layer up. +@interface GRPCMethodName : NSObject +@property(nonatomic, readonly) NSString *package; +@property(nonatomic, readonly) NSString *interface; +@property(nonatomic, readonly) NSString *method; +- (instancetype)initWithPackage:(NSString *)package + interface:(NSString *)interface + method:(NSString *)method; +@end diff --git a/src/objective-c/GRPCClient/GRPCMethodName.m b/src/objective-c/GRPCClient/GRPCMethodName.m new file mode 100644 index 00000000000..be9fd4b85bc --- /dev/null +++ b/src/objective-c/GRPCClient/GRPCMethodName.m @@ -0,0 +1,14 @@ +#import "GRPCMethodName.h" + +@implementation GRPCMethodName +- (instancetype)initWithPackage:(NSString *)package + interface:(NSString *)interface + method:(NSString *)method { + if ((self = [super init])) { + _package = [package copy]; + _interface = [interface copy]; + _method = [method copy]; + } + return self; +} +@end diff --git a/src/objective-c/GRPCClient/README.md b/src/objective-c/GRPCClient/README.md new file mode 100644 index 00000000000..9b87f0316cf --- /dev/null +++ b/src/objective-c/GRPCClient/README.md @@ -0,0 +1,4 @@ +This is a generic gRPC client for Objective-C on iOS. + +If you're trying to get started with the library or with gRPC, you should first +read GRPCCall.h. diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h new file mode 100644 index 00000000000..8772acc12fb --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -0,0 +1,17 @@ +#import + +struct grpc_channel; + +// Each separate instance of this class represents at least one TCP +// connection to the provided host. To create a grpc_call, pass the +// value of the unmanagedChannel property to grpc_channel_create_call. +// Release this object when the call is finished. +@interface GRPCChannel : NSObject +@property(nonatomic, readonly) struct grpc_channel *unmanagedChannel; + +// Convenience constructor to allow for reuse of connections. ++ (instancetype)channelToHost:(NSString *)host; + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host; +@end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m new file mode 100644 index 00000000000..af4a01ee05d --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -0,0 +1,32 @@ +#import "GRPCChannel.h" + +#import + +@implementation GRPCChannel + ++ (instancetype)channelToHost:(NSString *)host { + // TODO(jcanizales): Reuse channels. + return [[self alloc] initWithHost:host]; +} + +- (instancetype)init { + return [self initWithHost:nil]; +} + +// Designated initializer +- (instancetype)initWithHost:(NSString *)host { + if (!host) { + [NSException raise:NSInvalidArgumentException format:@"Host can't be nil."]; + } + if ((self = [super init])) { + _unmanagedChannel = grpc_channel_create(host.UTF8String, NULL); + } + return self; +} + +- (void)dealloc { + // TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely, + // as in the past that made this call to crash. + grpc_channel_destroy(_unmanagedChannel); +} +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h new file mode 100644 index 00000000000..503df94dd49 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h @@ -0,0 +1,21 @@ +#import + +struct grpc_completion_queue; +struct grpc_event; + +typedef void(^GRPCEventHandler)(struct grpc_event *event); + +// This class lets one more easily use grpc_completion_queue. To use it, pass +// the value of the unmanagedQueue property of an instance of this class to +// grpc_call_start_invoke. Then for every grpc_call_* method that accepts a tag, +// you can pass a block of type GRPCEventHandler (remembering to cast it using +// __bridge_retained). The block is guaranteed to eventually be called, by a +// concurrent queue, and then released. Each such block is passed a pointer to +// the grpc_event that carried it (in event->tag). +// Release the GRPCCompletionQueue object only after you are not going to pass +// any more blocks to the grpc_call that's using it. +@interface GRPCCompletionQueue : NSObject +@property(nonatomic, readonly) struct grpc_completion_queue *unmanagedQueue; + ++ (instancetype)completionQueue; +@end diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m new file mode 100644 index 00000000000..d2508daec42 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -0,0 +1,73 @@ +#import "GRPCCompletionQueue.h" + +#import + +@implementation GRPCCompletionQueue + ++ (instancetype)completionQueue { + // TODO(jcanizales): Reuse completion queues to consume only one thread, + // instead of one per call. + return [[self alloc] init]; +} + +- (instancetype)init { + if ((self = [super init])) { + _unmanagedQueue = grpc_completion_queue_create(); + + // This is for the following block to capture the pointer by value (instead + // of retaining self and doing self->_unmanagedQueue). This is essential + // because the block doesn't end until after grpc_completion_queue_shutdown + // is called, and we only want that to happen after nobody's using the queue + // anymore (i.e. on self dealloc). So the block would never end if it + // retained self. + grpc_completion_queue *unmanagedQueue = _unmanagedQueue; + + // Start a loop on a concurrent queue to read events from the completion + // queue and dispatch each. + static dispatch_once_t initialization; + static dispatch_queue_t gDefaultConcurrentQueue; + dispatch_once(&initialization, ^{ + gDefaultConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); + }); + dispatch_async(gDefaultConcurrentQueue, ^{ + while (YES) { + // The following call blocks until an event is available. + grpc_event *event = grpc_completion_queue_next(unmanagedQueue, gpr_inf_future); + switch (event->type) { + case GRPC_WRITE_ACCEPTED: + case GRPC_FINISH_ACCEPTED: + case GRPC_CLIENT_METADATA_READ: + case GRPC_READ: + case GRPC_FINISHED: + if (event->tag) { + GRPCEventHandler handler = (__bridge_transfer GRPCEventHandler) event->tag; + handler(event); + } + grpc_event_finish(event); + continue; + case GRPC_QUEUE_SHUTDOWN: + grpc_completion_queue_destroy(unmanagedQueue); + grpc_event_finish(event); + return; + case GRPC_SERVER_RPC_NEW: + NSAssert(NO, @"C gRPC library produced a server-only event."); + continue; + } + // This means the C gRPC library produced an event that wasn't known + // when this library was written. To preserve evolvability, ignore the + // unknown event on release builds. + NSAssert(NO, @"C gRPC library produced an unknown event."); + }; + }); + } + return self; +} + +- (void)dealloc { + // This makes the completion queue produce a GRPC_QUEUE_SHUTDOWN event *after* + // all other pending events are flushed. What this means is all the blocks + // passed to the gRPC C library as void* are eventually called, even if some + // are called after self is dealloc'd. + grpc_completion_queue_shutdown(_unmanagedQueue); +} +@end diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h new file mode 100644 index 00000000000..70a07f817f4 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h @@ -0,0 +1,48 @@ +#import + +@protocol GRXWriteable; +@protocol GRXWriter; + +// This is a thread-safe wrapper over a GRXWriteable instance. It lets one +// enqueue calls to a GRXWriteable instance for the main thread, guaranteeing +// that didFinishWithError: is the last message sent to it (no matter what +// messages are sent to the wrapper, in what order, nor from which thread). It +// also guarantees that, if cancelWithError: is called from the main thread +// (e.g. by the app cancelling the writes), no further messages are sent to the +// writeable except didFinishWithError:. +// +// TODO(jcanizales): Let the user specify another queue for the writeable +// callbacks. +// TODO(jcanizales): Rename to GRXWriteableWrapper and move to the Rx library. +@interface GRPCDelegateWrapper : NSObject + +// The GRXWriteable passed is the wrapped writeable. +// Both the GRXWriter instance and the GRXWriteable instance are retained until +// didFinishWithError: is sent to the writeable, and released after that. +// This is used to create a retain cycle that keeps both objects alive until the +// writing is explicitly finished. +- (instancetype)initWithWriteable:(id)writeable writer:(id)writer + NS_DESIGNATED_INITIALIZER; + +// Enqueues didReceiveValue: to be sent to the writeable in the main thread. +// The passed handler is invoked from the main thread after didReceiveValue: +// returns. +- (void)enqueueMessage:(NSData *)message completionHandler:(void (^)())handler; + +// Enqueues didFinishWithError:nil to be sent to the writeable in the main +// thread. After that message is sent to the writeable, all other methods of +// this object are effectively noops. +- (void)enqueueSuccessfulCompletion; + +// If the writeable has not yet received a didFinishWithError: message, this +// will enqueue one to be sent to it in the main thread, and cancel all other +// pending messages to the writeable enqueued by this object (both past and +// future). +// The error argument cannot be nil. +- (void)cancelWithError:(NSError *)error; + +// Cancels all pending messages to the writeable enqueued by this object (both +// past and future). Because the writeable won't receive didFinishWithError:, +// this also releases the writeable and the writer. +- (void)cancelSilently; +@end diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m new file mode 100644 index 00000000000..7c64850d7e8 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m @@ -0,0 +1,87 @@ +#import "GRPCDelegateWrapper.h" + +#import + +@interface GRPCDelegateWrapper () +// These are atomic so that cancellation can nillify them from any thread. +@property(atomic, strong) id writeable; +@property(atomic, strong) id writer; +@end + +@implementation GRPCDelegateWrapper { + dispatch_queue_t _writeableQueue; + // This ensures that didFinishWithError: is only sent once to the writeable. + dispatch_once_t _alreadyFinished; +} + +- (instancetype)init { + return [self initWithWriteable:nil writer:nil]; +} + +// Designated initializer +- (instancetype)initWithWriteable:(id)writeable writer:(id)writer { + if (self = [super init]) { + _writeableQueue = dispatch_get_main_queue(); + _writeable = writeable; + _writer = writer; + } + return self; +} + +- (void)enqueueMessage:(NSData *)message completionHandler:(void (^)())handler { + dispatch_async(_writeableQueue, ^{ + // We're racing a possible cancellation performed by another thread. To turn + // all already-enqueued messages into noops, cancellation nillifies the + // writeable property. If we get it before it's nil, we won + // the race. + id writeable = self.writeable; + if (writeable) { + [writeable didReceiveValue:message]; + handler(); + } + }); +} + +- (void)enqueueSuccessfulCompletion { + dispatch_async(_writeableQueue, ^{ + dispatch_once(&_alreadyFinished, ^{ + // Cancellation is now impossible. None of the other three blocks can run + // concurrently with this one. + [self.writeable didFinishWithError:nil]; + // Break the retain cycle with writer, and skip any possible message to the + // wrapped writeable enqueued after this one. + self.writeable = nil; + self.writer = nil; + }); + }); +} + +- (void)cancelWithError:(NSError *)error { + NSAssert(error, @"For a successful completion, use enqueueSuccessfulCompletion."); + dispatch_once(&_alreadyFinished, ^{ + // Skip any of the still-enqueued messages to the wrapped writeable. We use + // the atomic setter to nillify writer and writeable because we might be + // running concurrently with the blocks in _writeableQueue, and assignment + // with ARC isn't atomic. + id writeable = self.writeable; + self.writeable = nil; + + dispatch_async(_writeableQueue, ^{ + [writeable didFinishWithError:error]; + // Break the retain cycle with writer. + self.writer = nil; + }); + }); +} + +- (void)cancelSilently { + dispatch_once(&_alreadyFinished, ^{ + // Skip any of the still-enqueued messages to the wrapped writeable. We use + // the atomic setter to nillify writer and writeable because we might be + // running concurrently with the blocks in _writeableQueue, and assignment + // with ARC isn't atomic. + self.writeable = nil; + self.writer = nil; + }); +} +@end diff --git a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h new file mode 100644 index 00000000000..504c669f920 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h @@ -0,0 +1,7 @@ +#import + +#import "GRPCMethodName.h" + +@interface GRPCMethodName (HTTP2Encoding) +- (NSString *)HTTP2Path; +@end diff --git a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m new file mode 100644 index 00000000000..2e9fe8d60b1 --- /dev/null +++ b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m @@ -0,0 +1,11 @@ +#import "GRPCMethodName+HTTP2Encoding.h" + +@implementation GRPCMethodName (HTTP2Encoding) +- (NSString *)HTTP2Path { + if (self.package) { + return [NSString stringWithFormat:@"/%@.%@/%@", self.package, self.interface, self.method]; + } else { + return [NSString stringWithFormat:@"/%@/%@", self.interface, self.method]; + } +} +@end diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.h b/src/objective-c/GRPCClient/private/NSData+GRPC.h new file mode 100644 index 00000000000..8cb7b76ebca --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.h @@ -0,0 +1,8 @@ +#import + +struct grpc_byte_buffer; + +@interface NSData (GRPC) ++ (instancetype)grpc_dataWithByteBuffer:(struct grpc_byte_buffer *)buffer; +- (struct grpc_byte_buffer *)grpc_byteBuffer; +@end diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m new file mode 100644 index 00000000000..47f7a07d7a8 --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m @@ -0,0 +1,53 @@ +#import "NSData+GRPC.h" + +#include +#include + +// TODO(jcanizales): Move these two incantations to the C library. + +static void CopyByteBufferToCharArray(grpc_byte_buffer *buffer, char *array) { + size_t offset = 0; + grpc_byte_buffer_reader *reader = grpc_byte_buffer_reader_create(buffer); + gpr_slice next; + while (grpc_byte_buffer_reader_next(reader, &next) != 0){ + memcpy(array + offset, GPR_SLICE_START_PTR(next), (size_t) GPR_SLICE_LENGTH(next)); + offset += GPR_SLICE_LENGTH(next); + gpr_slice_unref(next); + } + grpc_byte_buffer_reader_destroy(reader); +} + +static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array, size_t length) { + gpr_slice slice = gpr_slice_from_copied_buffer(array, length); + grpc_byte_buffer *buffer = grpc_byte_buffer_create(&slice, 1); + gpr_slice_unref(slice); + return buffer; +} + +@implementation NSData (GRPC) ++ (instancetype)grpc_dataWithByteBuffer:(grpc_byte_buffer *)buffer { + NSUInteger length = grpc_byte_buffer_length(buffer); + char *array = malloc(length * sizeof(*array)); + if (!array) { + // TODO(jcanizales): grpc_byte_buffer is reference-counted, so we can + // prevent this memory problem by implementing a subclass of NSData + // that wraps the grpc_byte_buffer. Then enumerateByteRangesUsingBlock: + // can be implemented using a grpc_byte_buffer_reader. + return nil; + } + CopyByteBufferToCharArray(buffer, array); + return [self dataWithBytesNoCopy:array length:length freeWhenDone:YES]; +} + +- (grpc_byte_buffer *)grpc_byteBuffer { + // Some implementations of NSData, as well as grpc_byte_buffer, support O(1) + // appending of byte arrays by not using internally a single contiguous memory + // block for representation. + // The following implementation is thus not optimal, sometimes requiring two + // copies (one by self.bytes and another by gpr_slice_from_copied_buffer). + // If it turns out to be an issue, we can use enumerateByteRangesUsingblock: + // to create an array of gpr_slice objects to pass to grpc_byte_buffer_create. + // That would make it do exactly one copy, always. + return CopyCharArrayToNewByteBuffer((const char *)self.bytes, (size_t)self.length); +} +@end diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h new file mode 100644 index 00000000000..b717b108e4b --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h @@ -0,0 +1,7 @@ +#import + +struct grpc_metadata; + +@interface NSDictionary (GRPC) ++ (instancetype)grpc_dictionaryFromMetadata:(struct grpc_metadata *)entries count:(size_t)count; +@end diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m new file mode 100644 index 00000000000..a24396d3a95 --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m @@ -0,0 +1,23 @@ +#import "NSDictionary+GRPC.h" + +#include + +@implementation NSDictionary (GRPC) ++ (instancetype)grpc_dictionaryFromMetadata:(grpc_metadata *)entries count:(size_t)count { + NSMutableDictionary *metadata = [NSMutableDictionary dictionaryWithCapacity:count]; + for (grpc_metadata *entry = entries; entry < entries + count; entry++) { + // TODO(jcanizales): Verify in a C library test that it's converting header names to lower case automatically. + NSString *name = [NSString stringWithUTF8String:entry->key]; + if (!name) { + continue; + } + if (!metadata[name]) { + metadata[name] = [NSMutableArray array]; + } + // TODO(jcanizales): Should we use a non-copy constructor? + [metadata[name] addObject:[NSData dataWithBytes:entry->value + length:entry->value_length]]; + } + return metadata; +} +@end diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.h b/src/objective-c/GRPCClient/private/NSError+GRPC.h new file mode 100644 index 00000000000..949d1dd819f --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSError+GRPC.h @@ -0,0 +1,41 @@ +#import + +// TODO(jcanizales): Make the domain string public. +extern NSString *const kGRPCErrorDomain; + +// TODO(jcanizales): Make this public and document each code. +typedef NS_ENUM(NSInteger, GRPCErrorCode) { + GRPCErrorCodeCancelled = 1, + GRPCErrorCodeUnknown = 2, + GRPCErrorCodeInvalidArgument = 3, + GRPCErrorCodeDeadlineExceeded = 4, + GRPCErrorCodeNotFound = 5, + GRPCErrorCodeAlreadyExists = 6, + GRPCErrorCodePermissionDenied = 7, + GRPCErrorCodeUnauthenticated = 16, + GRPCErrorCodeResourceExhausted = 8, + GRPCErrorCodeFailedPrecondition = 9, + GRPCErrorCodeAborted = 10, + GRPCErrorCodeOutOfRange = 11, + GRPCErrorCodeUnimplemented = 12, + GRPCErrorCodeInternal = 13, + GRPCErrorCodeUnavailable = 14, + GRPCErrorCodeDataLoss = 15 +}; + +// TODO(jcanizales): This is conflating trailing metadata with Status details. Fix it once there's +// a decision on how to codify Status. +#include +struct grpc_metadata; +struct grpc_status { + grpc_status_code status; + const char *details; + size_t metadata_count; + struct grpc_metadata *metadata_elements; +}; + +@interface NSError (GRPC) +// Returns nil if the status is OK. Otherwise, a NSError whose code is one of +// GRPCErrorCode and whose domain is kGRPCErrorDomain. ++ (instancetype)grpc_errorFromStatus:(struct grpc_status *)status; +@end diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.m b/src/objective-c/GRPCClient/private/NSError+GRPC.m new file mode 100644 index 00000000000..73ce112f151 --- /dev/null +++ b/src/objective-c/GRPCClient/private/NSError+GRPC.m @@ -0,0 +1,18 @@ +#import "NSError+GRPC.h" + +#include + +NSString *const kGRPCErrorDomain = @"org.grpc"; + +@implementation NSError (GRPC) ++ (instancetype)grpc_errorFromStatus:(struct grpc_status *)status { + if (status->status == GRPC_STATUS_OK) { + return nil; + } + NSString *message = + [NSString stringWithFormat:@"Code=%i Message='%s'", status->status, status->details]; + return [NSError errorWithDomain:kGRPCErrorDomain + code:status->status + userInfo:@{NSLocalizedDescriptionKey: message}]; +} +@end diff --git a/src/objective-c/README.md b/src/objective-c/README.md new file mode 100644 index 00000000000..05e9f2b4dc9 --- /dev/null +++ b/src/objective-c/README.md @@ -0,0 +1,3 @@ +gRPC implementation for Objective-C on iOS + +This is a work in progress. From 7e7911f70dd4889a3a0c79e42691458e024d460c Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 18:28:23 -0800 Subject: [PATCH 127/232] Updates the module name in the idiomatic and stub layers --- src/ruby/lib/grpc.rb | 2 +- src/ruby/lib/grpc/auth/compute_engine.rb | 60 +- src/ruby/lib/grpc/auth/service_account.rb | 42 +- src/ruby/lib/grpc/core/event.rb | 21 +- src/ruby/lib/grpc/core/time_consts.rb | 69 +- src/ruby/lib/grpc/errors.rb | 50 +- src/ruby/lib/grpc/generic/active_call.rb | 904 ++++++++++----------- src/ruby/lib/grpc/generic/bidi_call.rb | 318 ++++---- src/ruby/lib/grpc/generic/client_stub.rb | 704 ++++++++-------- src/ruby/lib/grpc/generic/rpc_desc.rb | 201 +++-- src/ruby/lib/grpc/generic/rpc_server.rb | 640 ++++++++------- src/ruby/lib/grpc/generic/service.rb | 312 ++++--- src/ruby/lib/grpc/logconfig.rb | 6 +- src/ruby/lib/grpc/version.rb | 8 +- src/ruby/spec/auth/compute_engine_spec.rb | 4 +- src/ruby/spec/auth/service_account_spec.rb | 4 +- 16 files changed, 1663 insertions(+), 1682 deletions(-) diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 758ac0c2d16..21253848a7d 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -41,4 +41,4 @@ require 'grpc/generic/service' require 'grpc/generic/rpc_server' # alias GRPC -GRPC = Google::RPC +GRPC = GRPC diff --git a/src/ruby/lib/grpc/auth/compute_engine.rb b/src/ruby/lib/grpc/auth/compute_engine.rb index 9004bef46e5..5cb1e1a4dcf 100644 --- a/src/ruby/lib/grpc/auth/compute_engine.rb +++ b/src/ruby/lib/grpc/auth/compute_engine.rb @@ -30,39 +30,37 @@ require 'faraday' require 'grpc/auth/signet' -module Google - module RPC - # Module Auth provides classes that provide Google-specific authentication - # used to access Google gRPC services. - module Auth - # Extends Signet::OAuth2::Client so that the auth token is obtained from - # the GCE metadata server. - class GCECredentials < Signet::OAuth2::Client - COMPUTE_AUTH_TOKEN_URI = 'http://metadata/computeMetadata/v1/'\ - 'instance/service-accounts/default/token' - COMPUTE_CHECK_URI = 'http://metadata.google.internal' +module GRPC + # Module Auth provides classes that provide Google-specific authentication + # used to access Google gRPC services. + module Auth + # Extends Signet::OAuth2::Client so that the auth token is obtained from + # the GCE metadata server. + class GCECredentials < Signet::OAuth2::Client + COMPUTE_AUTH_TOKEN_URI = 'http://metadata/computeMetadata/v1/'\ + 'instance/service-accounts/default/token' + COMPUTE_CHECK_URI = 'http://metadata.google.internal' - # Detect if this appear to be a GCE instance, by checking if metadata - # is available - def self.on_gce?(options = {}) - c = options[:connection] || Faraday.default_connection - resp = c.get(COMPUTE_CHECK_URI) - return false unless resp.status == 200 - return false unless resp.headers.key?('Metadata-Flavor') - return resp.headers['Metadata-Flavor'] == 'Google' - rescue Faraday::ConnectionFailed - return false - end + # Detect if this appear to be a GCE instance, by checking if metadata + # is available + def self.on_gce?(options = {}) + c = options[:connection] || Faraday.default_connection + resp = c.get(COMPUTE_CHECK_URI) + return false unless resp.status == 200 + return false unless resp.headers.key?('Metadata-Flavor') + return resp.headers['Metadata-Flavor'] == 'Google' + rescue Faraday::ConnectionFailed + return false + end - # Overrides the super class method to change how access tokens are - # fetched. - def fetch_access_token(options = {}) - c = options[:connection] || Faraday.default_connection - c.headers = { 'Metadata-Flavor' => 'Google' } - resp = c.get(COMPUTE_AUTH_TOKEN_URI) - Signet::OAuth2.parse_credentials(resp.body, - resp.headers['content-type']) - end + # Overrides the super class method to change how access tokens are + # fetched. + def fetch_access_token(options = {}) + c = options[:connection] || Faraday.default_connection + c.headers = { 'Metadata-Flavor' => 'Google' } + resp = c.get(COMPUTE_AUTH_TOKEN_URI) + Signet::OAuth2.parse_credentials(resp.body, + resp.headers['content-type']) end end end diff --git a/src/ruby/lib/grpc/auth/service_account.rb b/src/ruby/lib/grpc/auth/service_account.rb index 35b5cbfe2de..14b81a9e034 100644 --- a/src/ruby/lib/grpc/auth/service_account.rb +++ b/src/ruby/lib/grpc/auth/service_account.rb @@ -39,29 +39,27 @@ def read_json_key(json_key_io) [json_key['private_key'], json_key['client_email']] end -module Google - module RPC - # Module Auth provides classes that provide Google-specific authentication - # used to access Google gRPC services. - module Auth - # Authenticates requests using Google's Service Account credentials. - # (cf https://developers.google.com/accounts/docs/OAuth2ServiceAccount) - class ServiceAccountCredentials < Signet::OAuth2::Client - TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v3/token' - AUDIENCE = TOKEN_CRED_URI +module GRPC + # Module Auth provides classes that provide Google-specific authentication + # used to access Google gRPC services. + module Auth + # Authenticates requests using Google's Service Account credentials. + # (cf https://developers.google.com/accounts/docs/OAuth2ServiceAccount) + class ServiceAccountCredentials < Signet::OAuth2::Client + TOKEN_CRED_URI = 'https://www.googleapis.com/oauth2/v3/token' + AUDIENCE = TOKEN_CRED_URI - # Initializes a ServiceAccountCredentials. - # - # @param scope [string|array] the scope(s) to access - # @param json_key_io [IO] an IO from which the JSON key can be read - def initialize(scope, json_key_io) - private_key, client_email = read_json_key(json_key_io) - super(token_credential_uri: TOKEN_CRED_URI, - audience: AUDIENCE, - scope: scope, - issuer: client_email, - signing_key: OpenSSL::PKey::RSA.new(private_key)) - end + # Initializes a ServiceAccountCredentials. + # + # @param scope [string|array] the scope(s) to access + # @param json_key_io [IO] an IO from which the JSON key can be read + def initialize(scope, json_key_io) + private_key, client_email = read_json_key(json_key_io) + super(token_credential_uri: TOKEN_CRED_URI, + audience: AUDIENCE, + scope: scope, + issuer: client_email, + signing_key: OpenSSL::PKey::RSA.new(private_key)) end end end diff --git a/src/ruby/lib/grpc/core/event.rb b/src/ruby/lib/grpc/core/event.rb index 9a333589c21..27df86b4b6d 100644 --- a/src/ruby/lib/grpc/core/event.rb +++ b/src/ruby/lib/grpc/core/event.rb @@ -27,16 +27,17 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -module Google - module RPC - module Core - # Event is a class defined in the c extension - # - # Here, we add an inspect method. - class Event - def inspect - "<#{self.class}: type:#{type}, tag:#{tag} result:#{result}>" - end +require 'grpc' + +# GRPC contains the General RPC module. +module GRPC + module Core + # Event is a class defined in the c extension + # + # Here, we add an inspect method. + class Event + def inspect + "<#{self.class}: type:#{type}, tag:#{tag} result:#{result}>" end end end diff --git a/src/ruby/lib/grpc/core/time_consts.rb b/src/ruby/lib/grpc/core/time_consts.rb index 6876dcb02eb..3f3414cfda7 100644 --- a/src/ruby/lib/grpc/core/time_consts.rb +++ b/src/ruby/lib/grpc/core/time_consts.rb @@ -29,44 +29,43 @@ require 'grpc' -module Google - module RPC - module Core - # TimeConsts is a module from the C extension. +# GRPC contains the General RPC module. +module GRPC + module Core + # TimeConsts is a module from the C extension. + # + # Here it's re-opened to add a utility func. + module TimeConsts + # Converts a time delta to an absolute deadline. # - # Here it's re-opened to add a utility func. - module TimeConsts - # Converts a time delta to an absolute deadline. - # - # Assumes timeish is a relative time, and converts its to an absolute, - # with following exceptions: - # - # * if timish is one of the TimeConsts.TimeSpec constants the value is - # preserved. - # * timish < 0 => TimeConsts.INFINITE_FUTURE - # * timish == 0 => TimeConsts.ZERO - # - # @param timeish [Number|TimeSpec] - # @return timeish [Number|TimeSpec] - def from_relative_time(timeish) - if timeish.is_a? TimeSpec - timeish - elsif timeish.nil? - TimeConsts::ZERO - elsif !timeish.is_a? Numeric - fail(TypeError, - "Cannot make an absolute deadline from #{timeish.inspect}") - elsif timeish < 0 - TimeConsts::INFINITE_FUTURE - elsif timeish == 0 - TimeConsts::ZERO - else - Time.now + timeish - end + # Assumes timeish is a relative time, and converts its to an absolute, + # with following exceptions: + # + # * if timish is one of the TimeConsts.TimeSpec constants the value is + # preserved. + # * timish < 0 => TimeConsts.INFINITE_FUTURE + # * timish == 0 => TimeConsts.ZERO + # + # @param timeish [Number|TimeSpec] + # @return timeish [Number|TimeSpec] + def from_relative_time(timeish) + if timeish.is_a? TimeSpec + timeish + elsif timeish.nil? + TimeConsts::ZERO + elsif !timeish.is_a? Numeric + fail(TypeError, + "Cannot make an absolute deadline from #{timeish.inspect}") + elsif timeish < 0 + TimeConsts::INFINITE_FUTURE + elsif timeish == 0 + TimeConsts::ZERO + else + Time.now + timeish end - - module_function :from_relative_time end + + module_function :from_relative_time end end end diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index 70a92bfed77..c2356b7004e 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -29,35 +29,33 @@ require 'grpc' -module Google - # Google::RPC contains the General RPC module. - module RPC - # OutOfTime is an exception class that indicates that an RPC exceeded its - # deadline. - OutOfTime = Class.new(StandardError) +# GRPC contains the General RPC module. +module GRPC + # OutOfTime is an exception class that indicates that an RPC exceeded its + # deadline. + OutOfTime = Class.new(StandardError) - # BadStatus is an exception class that indicates that an error occurred at - # either end of a GRPC connection. When raised, it indicates that a status - # error should be returned to the other end of a GRPC connection; when - # caught it means that this end received a status error. - class BadStatus < StandardError - attr_reader :code, :details + # BadStatus is an exception class that indicates that an error occurred at + # either end of a GRPC connection. When raised, it indicates that a status + # error should be returned to the other end of a GRPC connection; when + # caught it means that this end received a status error. + class BadStatus < StandardError + attr_reader :code, :details - # @param code [Numeric] the status code - # @param details [String] the details of the exception - def initialize(code, details = 'unknown cause') - super("#{code}:#{details}") - @code = code - @details = details - end + # @param code [Numeric] the status code + # @param details [String] the details of the exception + def initialize(code, details = 'unknown cause') + super("#{code}:#{details}") + @code = code + @details = details + end - # Converts the exception to a GRPC::Status for use in the networking - # wrapper layer. - # - # @return [Status] with the same code and details - def to_status - Status.new(code, details) - end + # Converts the exception to a GRPC::Status for use in the networking + # wrapper layer. + # + # @return [Status] with the same code and details + def to_status + Status.new(code, details) end end end diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index 6c2b6e91c24..5a4f129dce0 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -36,502 +36,500 @@ def assert_event_type(ev, want) fail "Unexpected rpc event: got #{got}, want #{want}" unless got == want end -module Google - # Google::RPC contains the General RPC module. - module RPC - # The ActiveCall class provides simple methods for sending marshallable - # data to a call - class ActiveCall - include Core::CompletionType - include Core::StatusCodes - include Core::TimeConsts - attr_reader(:deadline) - - # client_invoke begins a client invocation. - # - # Flow Control note: this blocks until flow control accepts that client - # request can go ahead. - # - # deadline is the absolute deadline for the call. - # - # == Keyword Arguments == - # any keyword arguments are treated as metadata to be sent to the server - # if a keyword value is a list, multiple metadata for it's key are sent - # - # @param call [Call] a call on which to start and invocation - # @param q [CompletionQueue] the completion queue - # @param deadline [Fixnum,TimeSpec] the deadline - def self.client_invoke(call, q, _deadline, **kw) - fail(ArgumentError, 'not a call') unless call.is_a? Core::Call - unless q.is_a? Core::CompletionQueue - fail(ArgumentError, 'not a CompletionQueue') - end - call.add_metadata(kw) if kw.length > 0 - client_metadata_read = Object.new - finished_tag = Object.new - call.invoke(q, client_metadata_read, finished_tag) - [finished_tag, client_metadata_read] - end - - # Creates an ActiveCall. - # - # ActiveCall should only be created after a call is accepted. That - # means different things on a client and a server. On the client, the - # call is accepted after calling call.invoke. On the server, this is - # after call.accept. - # - # #initialize cannot determine if the call is accepted or not; so if a - # call that's not accepted is used here, the error won't be visible until - # the ActiveCall methods are called. - # - # deadline is the absolute deadline for the call. - # - # @param call [Call] the call used by the ActiveCall - # @param q [CompletionQueue] the completion queue used to accept - # the call - # @param marshal [Function] f(obj)->string that marshal requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Fixnum] the deadline for the call to complete - # @param finished_tag [Object] the object used as the call's finish tag, - # if the call has begun - # @param read_metadata_tag [Object] the object used as the call's finish - # tag, if the call has begun - # @param started [true|false] indicates if the call has begun - def initialize(call, q, marshal, unmarshal, deadline, finished_tag: nil, - read_metadata_tag: nil, started: true) - fail(ArgumentError, 'not a call') unless call.is_a? Core::Call - unless q.is_a? Core::CompletionQueue - fail(ArgumentError, 'not a CompletionQueue') - end - @call = call - @cq = q - @deadline = deadline - @finished_tag = finished_tag - @read_metadata_tag = read_metadata_tag - @marshal = marshal - @started = started - @unmarshal = unmarshal +# GRPC contains the General RPC module. +module GRPC + # The ActiveCall class provides simple methods for sending marshallable + # data to a call + class ActiveCall + include Core::CompletionType + include Core::StatusCodes + include Core::TimeConsts + attr_reader(:deadline) + + # client_invoke begins a client invocation. + # + # Flow Control note: this blocks until flow control accepts that client + # request can go ahead. + # + # deadline is the absolute deadline for the call. + # + # == Keyword Arguments == + # any keyword arguments are treated as metadata to be sent to the server + # if a keyword value is a list, multiple metadata for it's key are sent + # + # @param call [Call] a call on which to start and invocation + # @param q [CompletionQueue] the completion queue + # @param deadline [Fixnum,TimeSpec] the deadline + def self.client_invoke(call, q, _deadline, **kw) + fail(ArgumentError, 'not a call') unless call.is_a? Core::Call + unless q.is_a? Core::CompletionQueue + fail(ArgumentError, 'not a CompletionQueue') end + call.add_metadata(kw) if kw.length > 0 + client_metadata_read = Object.new + finished_tag = Object.new + call.invoke(q, client_metadata_read, finished_tag) + [finished_tag, client_metadata_read] + end - # Obtains the status of the call. - # - # this value is nil until the call completes - # @return this call's status - def status - @call.status + # Creates an ActiveCall. + # + # ActiveCall should only be created after a call is accepted. That + # means different things on a client and a server. On the client, the + # call is accepted after calling call.invoke. On the server, this is + # after call.accept. + # + # #initialize cannot determine if the call is accepted or not; so if a + # call that's not accepted is used here, the error won't be visible until + # the ActiveCall methods are called. + # + # deadline is the absolute deadline for the call. + # + # @param call [Call] the call used by the ActiveCall + # @param q [CompletionQueue] the completion queue used to accept + # the call + # @param marshal [Function] f(obj)->string that marshal requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Fixnum] the deadline for the call to complete + # @param finished_tag [Object] the object used as the call's finish tag, + # if the call has begun + # @param read_metadata_tag [Object] the object used as the call's finish + # tag, if the call has begun + # @param started [true|false] indicates if the call has begun + def initialize(call, q, marshal, unmarshal, deadline, finished_tag: nil, + read_metadata_tag: nil, started: true) + fail(ArgumentError, 'not a call') unless call.is_a? Core::Call + unless q.is_a? Core::CompletionQueue + fail(ArgumentError, 'not a CompletionQueue') end + @call = call + @cq = q + @deadline = deadline + @finished_tag = finished_tag + @read_metadata_tag = read_metadata_tag + @marshal = marshal + @started = started + @unmarshal = unmarshal + end - # Obtains the metadata of the call. - # - # At the start of the call this will be nil. During the call this gets - # some values as soon as the other end of the connection acknowledges the - # request. - # - # @return this calls's metadata - def metadata - @call.metadata - end + # Obtains the status of the call. + # + # this value is nil until the call completes + # @return this call's status + def status + @call.status + end - # Cancels the call. - # - # Cancels the call. The call does not return any result, but once this it - # has been called, the call should eventually terminate. Due to potential - # races between the execution of the cancel and the in-flight request, the - # result of the call after calling #cancel is indeterminate: - # - # - the call may terminate with a BadStatus exception, with code=CANCELLED - # - the call may terminate with OK Status, and return a response - # - the call may terminate with a different BadStatus exception if that - # was happening - def cancel - @call.cancel - end + # Obtains the metadata of the call. + # + # At the start of the call this will be nil. During the call this gets + # some values as soon as the other end of the connection acknowledges the + # request. + # + # @return this calls's metadata + def metadata + @call.metadata + end - # indicates if the call is shutdown - def shutdown - @shutdown ||= false - end + # Cancels the call. + # + # Cancels the call. The call does not return any result, but once this it + # has been called, the call should eventually terminate. Due to potential + # races between the execution of the cancel and the in-flight request, the + # result of the call after calling #cancel is indeterminate: + # + # - the call may terminate with a BadStatus exception, with code=CANCELLED + # - the call may terminate with OK Status, and return a response + # - the call may terminate with a different BadStatus exception if that + # was happening + def cancel + @call.cancel + end - # indicates if the call is cancelled. - def cancelled - @cancelled ||= false - end + # indicates if the call is shutdown + def shutdown + @shutdown ||= false + end - # multi_req_view provides a restricted view of this ActiveCall for use - # in a server client-streaming handler. - def multi_req_view - MultiReqView.new(self) - end + # indicates if the call is cancelled. + def cancelled + @cancelled ||= false + end - # single_req_view provides a restricted view of this ActiveCall for use in - # a server request-response handler. - def single_req_view - SingleReqView.new(self) - end + # multi_req_view provides a restricted view of this ActiveCall for use + # in a server client-streaming handler. + def multi_req_view + MultiReqView.new(self) + end - # operation provides a restricted view of this ActiveCall for use as - # a Operation. - def operation - Operation.new(self) - end + # single_req_view provides a restricted view of this ActiveCall for use in + # a server request-response handler. + def single_req_view + SingleReqView.new(self) + end - # writes_done indicates that all writes are completed. - # - # It blocks until the remote endpoint acknowledges by sending a FINISHED - # event, unless assert_finished is set to false. Any calls to - # #remote_send after this call will fail. - # - # @param assert_finished [true, false] when true(default), waits for - # FINISHED. - def writes_done(assert_finished = true) - @call.writes_done(self) - ev = @cq.pluck(self, INFINITE_FUTURE) - begin - assert_event_type(ev, FINISH_ACCEPTED) - logger.debug("Writes done: waiting for finish? #{assert_finished}") - ensure - ev.close - end + # operation provides a restricted view of this ActiveCall for use as + # a Operation. + def operation + Operation.new(self) + end - return unless assert_finished - ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) - fail 'unexpected nil event' if ev.nil? + # writes_done indicates that all writes are completed. + # + # It blocks until the remote endpoint acknowledges by sending a FINISHED + # event, unless assert_finished is set to false. Any calls to + # #remote_send after this call will fail. + # + # @param assert_finished [true, false] when true(default), waits for + # FINISHED. + def writes_done(assert_finished = true) + @call.writes_done(self) + ev = @cq.pluck(self, INFINITE_FUTURE) + begin + assert_event_type(ev, FINISH_ACCEPTED) + logger.debug("Writes done: waiting for finish? #{assert_finished}") + ensure ev.close - @call.status end - # finished waits until the call is completed. - # - # It blocks until the remote endpoint acknowledges by sending a FINISHED - # event. - def finished - ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) - begin - fail "unexpected event: #{ev.inspect}" unless ev.type == FINISHED - if @call.metadata.nil? - @call.metadata = ev.result.metadata - else - @call.metadata.merge!(ev.result.metadata) - end - - if ev.result.code != Core::StatusCodes::OK - fail BadStatus.new(ev.result.code, ev.result.details) - end - res = ev.result - ensure - ev.close - end - res - end + return unless assert_finished + ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) + fail 'unexpected nil event' if ev.nil? + ev.close + @call.status + end - # remote_send sends a request to the remote endpoint. - # - # It blocks until the remote endpoint acknowledges by sending a - # WRITE_ACCEPTED. req can be marshalled already. - # - # @param req [Object, String] the object to send or it's marshal form. - # @param marshalled [false, true] indicates if the object is already - # marshalled. - def remote_send(req, marshalled = false) - assert_queue_is_ready - logger.debug("sending #{req.inspect}, marshalled? #{marshalled}") - if marshalled - payload = req + # finished waits until the call is completed. + # + # It blocks until the remote endpoint acknowledges by sending a FINISHED + # event. + def finished + ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) + begin + fail "unexpected event: #{ev.inspect}" unless ev.type == FINISHED + if @call.metadata.nil? + @call.metadata = ev.result.metadata else - payload = @marshal.call(req) - end - @call.start_write(Core::ByteBuffer.new(payload), self) - - # call queue#pluck, and wait for WRITE_ACCEPTED, so as not to return - # until the flow control allows another send on this call. - ev = @cq.pluck(self, INFINITE_FUTURE) - begin - assert_event_type(ev, WRITE_ACCEPTED) - ensure - ev.close + @call.metadata.merge!(ev.result.metadata) end - end - # send_status sends a status to the remote endpoint - # - # @param code [int] the status code to send - # @param details [String] details - # @param assert_finished [true, false] when true(default), waits for - # FINISHED. - def send_status(code = OK, details = '', assert_finished = false) - assert_queue_is_ready - @call.start_write_status(code, details, self) - ev = @cq.pluck(self, INFINITE_FUTURE) - begin - assert_event_type(ev, FINISH_ACCEPTED) - ensure - ev.close + if ev.result.code != Core::StatusCodes::OK + fail BadStatus.new(ev.result.code, ev.result.details) end - logger.debug("Status sent: #{code}:'#{details}'") - return finished if assert_finished - nil + res = ev.result + ensure + ev.close end + res + end - # remote_read reads a response from the remote endpoint. - # - # It blocks until the remote endpoint sends a READ or FINISHED event. On - # a READ, it returns the response after unmarshalling it. On - # FINISHED, it returns nil if the status is OK, otherwise raising - # BadStatus - def remote_read - if @call.metadata.nil? && !@read_metadata_tag.nil? - ev = @cq.pluck(@read_metadata_tag, INFINITE_FUTURE) - assert_event_type(ev, CLIENT_METADATA_READ) - @call.metadata = ev.result - @read_metadata_tag = nil - end + # remote_send sends a request to the remote endpoint. + # + # It blocks until the remote endpoint acknowledges by sending a + # WRITE_ACCEPTED. req can be marshalled already. + # + # @param req [Object, String] the object to send or it's marshal form. + # @param marshalled [false, true] indicates if the object is already + # marshalled. + def remote_send(req, marshalled = false) + assert_queue_is_ready + logger.debug("sending #{req.inspect}, marshalled? #{marshalled}") + if marshalled + payload = req + else + payload = @marshal.call(req) + end + @call.start_write(Core::ByteBuffer.new(payload), self) + + # call queue#pluck, and wait for WRITE_ACCEPTED, so as not to return + # until the flow control allows another send on this call. + ev = @cq.pluck(self, INFINITE_FUTURE) + begin + assert_event_type(ev, WRITE_ACCEPTED) + ensure + ev.close + end + end - @call.start_read(self) - ev = @cq.pluck(self, INFINITE_FUTURE) - begin - assert_event_type(ev, READ) - logger.debug("received req: #{ev.result.inspect}") - unless ev.result.nil? - logger.debug("received req.to_s: #{ev.result}") - res = @unmarshal.call(ev.result.to_s) - logger.debug("received_req (unmarshalled): #{res.inspect}") - return res - end - ensure - ev.close - end - logger.debug('found nil; the final response has been sent') - nil + # send_status sends a status to the remote endpoint + # + # @param code [int] the status code to send + # @param details [String] details + # @param assert_finished [true, false] when true(default), waits for + # FINISHED. + def send_status(code = OK, details = '', assert_finished = false) + assert_queue_is_ready + @call.start_write_status(code, details, self) + ev = @cq.pluck(self, INFINITE_FUTURE) + begin + assert_event_type(ev, FINISH_ACCEPTED) + ensure + ev.close end + logger.debug("Status sent: #{code}:'#{details}'") + return finished if assert_finished + nil + end - # each_remote_read passes each response to the given block or returns an - # enumerator the responses if no block is given. - # - # == Enumerator == - # - # * #next blocks until the remote endpoint sends a READ or FINISHED - # * for each read, enumerator#next yields the response - # * on status - # * if it's is OK, enumerator#next raises StopException - # * if is not OK, enumerator#next raises RuntimeException - # - # == Block == - # - # * if provided it is executed for each response - # * the call blocks until no more responses are provided - # - # @return [Enumerator] if no block was given - def each_remote_read - return enum_for(:each_remote_read) unless block_given? - loop do - resp = remote_read - break if resp.is_a? Struct::Status # is an OK status - break if resp.nil? # the last response was received - yield resp - end + # remote_read reads a response from the remote endpoint. + # + # It blocks until the remote endpoint sends a READ or FINISHED event. On + # a READ, it returns the response after unmarshalling it. On + # FINISHED, it returns nil if the status is OK, otherwise raising + # BadStatus + def remote_read + if @call.metadata.nil? && !@read_metadata_tag.nil? + ev = @cq.pluck(@read_metadata_tag, INFINITE_FUTURE) + assert_event_type(ev, CLIENT_METADATA_READ) + @call.metadata = ev.result + @read_metadata_tag = nil end - # each_remote_read_then_finish passes each response to the given block or - # returns an enumerator of the responses if no block is given. - # - # It is like each_remote_read, but it blocks on finishing on detecting - # the final message. - # - # == Enumerator == - # - # * #next blocks until the remote endpoint sends a READ or FINISHED - # * for each read, enumerator#next yields the response - # * on status - # * if it's is OK, enumerator#next raises StopException - # * if is not OK, enumerator#next raises RuntimeException - # - # == Block == - # - # * if provided it is executed for each response - # * the call blocks until no more responses are provided - # - # @return [Enumerator] if no block was given - def each_remote_read_then_finish - return enum_for(:each_remote_read_then_finish) unless block_given? - loop do - resp = remote_read - break if resp.is_a? Struct::Status # is an OK status - if resp.nil? # the last response was received, but not finished yet - finished - break - end - yield resp + @call.start_read(self) + ev = @cq.pluck(self, INFINITE_FUTURE) + begin + assert_event_type(ev, READ) + logger.debug("received req: #{ev.result.inspect}") + unless ev.result.nil? + logger.debug("received req.to_s: #{ev.result}") + res = @unmarshal.call(ev.result.to_s) + logger.debug("received_req (unmarshalled): #{res.inspect}") + return res end + ensure + ev.close end + logger.debug('found nil; the final response has been sent') + nil + end - # request_response sends a request to a GRPC server, and returns the - # response. - # - # == Keyword Arguments == - # any keyword arguments are treated as metadata to be sent to the server - # if a keyword value is a list, multiple metadata for it's key are sent - # - # @param req [Object] the request sent to the server - # @return [Object] the response received from the server - def request_response(req, **kw) - start_call(**kw) unless @started - remote_send(req) - writes_done(false) - response = remote_read - finished unless response.is_a? Struct::Status - response + # each_remote_read passes each response to the given block or returns an + # enumerator the responses if no block is given. + # + # == Enumerator == + # + # * #next blocks until the remote endpoint sends a READ or FINISHED + # * for each read, enumerator#next yields the response + # * on status + # * if it's is OK, enumerator#next raises StopException + # * if is not OK, enumerator#next raises RuntimeException + # + # == Block == + # + # * if provided it is executed for each response + # * the call blocks until no more responses are provided + # + # @return [Enumerator] if no block was given + def each_remote_read + return enum_for(:each_remote_read) unless block_given? + loop do + resp = remote_read + break if resp.is_a? Struct::Status # is an OK status + break if resp.nil? # the last response was received + yield resp end + end - # client_streamer sends a stream of requests to a GRPC server, and - # returns a single response. - # - # requests provides an 'iterable' of Requests. I.e. it follows Ruby's - # #each enumeration protocol. In the simplest case, requests will be an - # array of marshallable objects; in typical case it will be an Enumerable - # that allows dynamic construction of the marshallable objects. - # - # == Keyword Arguments == - # any keyword arguments are treated as metadata to be sent to the server - # if a keyword value is a list, multiple metadata for it's key are sent - # - # @param requests [Object] an Enumerable of requests to send - # @return [Object] the response received from the server - def client_streamer(requests, **kw) - start_call(**kw) unless @started - requests.each { |r| remote_send(r) } - writes_done(false) - response = remote_read - finished unless response.is_a? Struct::Status - response + # each_remote_read_then_finish passes each response to the given block or + # returns an enumerator of the responses if no block is given. + # + # It is like each_remote_read, but it blocks on finishing on detecting + # the final message. + # + # == Enumerator == + # + # * #next blocks until the remote endpoint sends a READ or FINISHED + # * for each read, enumerator#next yields the response + # * on status + # * if it's is OK, enumerator#next raises StopException + # * if is not OK, enumerator#next raises RuntimeException + # + # == Block == + # + # * if provided it is executed for each response + # * the call blocks until no more responses are provided + # + # @return [Enumerator] if no block was given + def each_remote_read_then_finish + return enum_for(:each_remote_read_then_finish) unless block_given? + loop do + resp = remote_read + break if resp.is_a? Struct::Status # is an OK status + if resp.nil? # the last response was received, but not finished yet + finished + break + end + yield resp end + end - # server_streamer sends one request to the GRPC server, which yields a - # stream of responses. - # - # responses provides an enumerator over the streamed responses, i.e. it - # follows Ruby's #each iteration protocol. The enumerator blocks while - # waiting for each response, stops when the server signals that no - # further responses will be supplied. If the implicit block is provided, - # it is executed with each response as the argument and no result is - # returned. - # - # == Keyword Arguments == - # any keyword arguments are treated as metadata to be sent to the server - # if a keyword value is a list, multiple metadata for it's key are sent - # any keyword arguments are treated as metadata to be sent to the server. - # - # @param req [Object] the request sent to the server - # @return [Enumerator|nil] a response Enumerator - def server_streamer(req, **kw) - start_call(**kw) unless @started - remote_send(req) - writes_done(false) - replies = enum_for(:each_remote_read_then_finish) - return replies unless block_given? - replies.each { |r| yield r } - end + # request_response sends a request to a GRPC server, and returns the + # response. + # + # == Keyword Arguments == + # any keyword arguments are treated as metadata to be sent to the server + # if a keyword value is a list, multiple metadata for it's key are sent + # + # @param req [Object] the request sent to the server + # @return [Object] the response received from the server + def request_response(req, **kw) + start_call(**kw) unless @started + remote_send(req) + writes_done(false) + response = remote_read + finished unless response.is_a? Struct::Status + response + end - # bidi_streamer sends a stream of requests to the GRPC server, and yields - # a stream of responses. - # - # This method takes an Enumerable of requests, and returns and enumerable - # of responses. - # - # == requests == - # - # requests provides an 'iterable' of Requests. I.e. it follows Ruby's - # #each enumeration protocol. In the simplest case, requests will be an - # array of marshallable objects; in typical case it will be an - # Enumerable that allows dynamic construction of the marshallable - # objects. - # - # == responses == - # - # This is an enumerator of responses. I.e, its #next method blocks - # waiting for the next response. Also, if at any point the block needs - # to consume all the remaining responses, this can be done using #each or - # #collect. Calling #each or #collect should only be done if - # the_call#writes_done has been called, otherwise the block will loop - # forever. - # - # == Keyword Arguments == - # any keyword arguments are treated as metadata to be sent to the server - # if a keyword value is a list, multiple metadata for it's key are sent - # - # @param requests [Object] an Enumerable of requests to send - # @return [Enumerator, nil] a response Enumerator - def bidi_streamer(requests, **kw, &blk) - start_call(**kw) unless @started - bd = BidiCall.new(@call, @cq, @marshal, @unmarshal, @deadline, - @finished_tag) - bd.run_on_client(requests, &blk) - end + # client_streamer sends a stream of requests to a GRPC server, and + # returns a single response. + # + # requests provides an 'iterable' of Requests. I.e. it follows Ruby's + # #each enumeration protocol. In the simplest case, requests will be an + # array of marshallable objects; in typical case it will be an Enumerable + # that allows dynamic construction of the marshallable objects. + # + # == Keyword Arguments == + # any keyword arguments are treated as metadata to be sent to the server + # if a keyword value is a list, multiple metadata for it's key are sent + # + # @param requests [Object] an Enumerable of requests to send + # @return [Object] the response received from the server + def client_streamer(requests, **kw) + start_call(**kw) unless @started + requests.each { |r| remote_send(r) } + writes_done(false) + response = remote_read + finished unless response.is_a? Struct::Status + response + end - # run_server_bidi orchestrates a BiDi stream processing on a server. - # - # N.B. gen_each_reply is a func(Enumerable) - # - # It takes an enumerable of requests as an arg, in case there is a - # relationship between the stream of requests and the stream of replies. - # - # This does not mean that must necessarily be one. E.g, the replies - # produced by gen_each_reply could ignore the received_msgs - # - # @param gen_each_reply [Proc] generates the BiDi stream replies - def run_server_bidi(gen_each_reply) - bd = BidiCall.new(@call, @cq, @marshal, @unmarshal, @deadline, - @finished_tag) - bd.run_on_server(gen_each_reply) - end + # server_streamer sends one request to the GRPC server, which yields a + # stream of responses. + # + # responses provides an enumerator over the streamed responses, i.e. it + # follows Ruby's #each iteration protocol. The enumerator blocks while + # waiting for each response, stops when the server signals that no + # further responses will be supplied. If the implicit block is provided, + # it is executed with each response as the argument and no result is + # returned. + # + # == Keyword Arguments == + # any keyword arguments are treated as metadata to be sent to the server + # if a keyword value is a list, multiple metadata for it's key are sent + # any keyword arguments are treated as metadata to be sent to the server. + # + # @param req [Object] the request sent to the server + # @return [Enumerator|nil] a response Enumerator + def server_streamer(req, **kw) + start_call(**kw) unless @started + remote_send(req) + writes_done(false) + replies = enum_for(:each_remote_read_then_finish) + return replies unless block_given? + replies.each { |r| yield r } + end + + # bidi_streamer sends a stream of requests to the GRPC server, and yields + # a stream of responses. + # + # This method takes an Enumerable of requests, and returns and enumerable + # of responses. + # + # == requests == + # + # requests provides an 'iterable' of Requests. I.e. it follows Ruby's + # #each enumeration protocol. In the simplest case, requests will be an + # array of marshallable objects; in typical case it will be an + # Enumerable that allows dynamic construction of the marshallable + # objects. + # + # == responses == + # + # This is an enumerator of responses. I.e, its #next method blocks + # waiting for the next response. Also, if at any point the block needs + # to consume all the remaining responses, this can be done using #each or + # #collect. Calling #each or #collect should only be done if + # the_call#writes_done has been called, otherwise the block will loop + # forever. + # + # == Keyword Arguments == + # any keyword arguments are treated as metadata to be sent to the server + # if a keyword value is a list, multiple metadata for it's key are sent + # + # @param requests [Object] an Enumerable of requests to send + # @return [Enumerator, nil] a response Enumerator + def bidi_streamer(requests, **kw, &blk) + start_call(**kw) unless @started + bd = BidiCall.new(@call, @cq, @marshal, @unmarshal, @deadline, + @finished_tag) + bd.run_on_client(requests, &blk) + end - private + # run_server_bidi orchestrates a BiDi stream processing on a server. + # + # N.B. gen_each_reply is a func(Enumerable) + # + # It takes an enumerable of requests as an arg, in case there is a + # relationship between the stream of requests and the stream of replies. + # + # This does not mean that must necessarily be one. E.g, the replies + # produced by gen_each_reply could ignore the received_msgs + # + # @param gen_each_reply [Proc] generates the BiDi stream replies + def run_server_bidi(gen_each_reply) + bd = BidiCall.new(@call, @cq, @marshal, @unmarshal, @deadline, + @finished_tag) + bd.run_on_server(gen_each_reply) + end - def start_call(**kw) - tags = ActiveCall.client_invoke(@call, @cq, @deadline, **kw) - @finished_tag, @read_metadata_tag = tags - @started = true - end + private - def self.view_class(*visible_methods) - Class.new do - extend ::Forwardable - def_delegators :@wrapped, *visible_methods + def start_call(**kw) + tags = ActiveCall.client_invoke(@call, @cq, @deadline, **kw) + @finished_tag, @read_metadata_tag = tags + @started = true + end - # @param wrapped [ActiveCall] the call whose methods are shielded - def initialize(wrapped) - @wrapped = wrapped - end + def self.view_class(*visible_methods) + Class.new do + extend ::Forwardable + def_delegators :@wrapped, *visible_methods + + # @param wrapped [ActiveCall] the call whose methods are shielded + def initialize(wrapped) + @wrapped = wrapped end end + end - # SingleReqView limits access to an ActiveCall's methods for use in server - # handlers that receive just one request. - SingleReqView = view_class(:cancelled, :deadline) - - # MultiReqView limits access to an ActiveCall's methods for use in - # server client_streamer handlers. - MultiReqView = view_class(:cancelled, :deadline, :each_queued_msg, - :each_remote_read) - - # Operation limits access to an ActiveCall's methods for use as - # a Operation on the client. - Operation = view_class(:cancel, :cancelled, :deadline, :execute, - :metadata, :status) - - # confirms that no events are enqueued, and that the queue is not - # shutdown. - def assert_queue_is_ready - ev = nil - begin - ev = @cq.pluck(self, ZERO) - fail "unexpected event #{ev.inspect}" unless ev.nil? - rescue OutOfTime - logging.debug('timed out waiting for next event') - # expected, nothing should be on the queue and the deadline was ZERO, - # except things using another tag - ensure - ev.close unless ev.nil? - end + # SingleReqView limits access to an ActiveCall's methods for use in server + # handlers that receive just one request. + SingleReqView = view_class(:cancelled, :deadline) + + # MultiReqView limits access to an ActiveCall's methods for use in + # server client_streamer handlers. + MultiReqView = view_class(:cancelled, :deadline, :each_queued_msg, + :each_remote_read) + + # Operation limits access to an ActiveCall's methods for use as + # a Operation on the client. + Operation = view_class(:cancel, :cancelled, :deadline, :execute, + :metadata, :status) + + # confirms that no events are enqueued, and that the queue is not + # shutdown. + def assert_queue_is_ready + ev = nil + begin + ev = @cq.pluck(self, ZERO) + fail "unexpected event #{ev.inspect}" unless ev.nil? + rescue OutOfTime + logging.debug('timed out waiting for next event') + # expected, nothing should be on the queue and the deadline was ZERO, + # except things using another tag + ensure + ev.close unless ev.nil? end end end diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb index 099d57151c0..8350690fdf3 100644 --- a/src/ruby/lib/grpc/generic/bidi_call.rb +++ b/src/ruby/lib/grpc/generic/bidi_call.rb @@ -36,186 +36,184 @@ def assert_event_type(ev, want) fail("Unexpected rpc event: got #{got}, want #{want}") unless got == want end -module Google - # Google::RPC contains the General RPC module. - module RPC - # The BiDiCall class orchestrates exection of a BiDi stream on a client or - # server. - class BidiCall - include Core::CompletionType - include Core::StatusCodes - include Core::TimeConsts +# GRPC contains the General RPC module. +module GRPC + # The BiDiCall class orchestrates exection of a BiDi stream on a client or + # server. + class BidiCall + include Core::CompletionType + include Core::StatusCodes + include Core::TimeConsts - # Creates a BidiCall. - # - # BidiCall should only be created after a call is accepted. That means - # different things on a client and a server. On the client, the call is - # accepted after call.invoke. On the server, this is after call.accept. - # - # #initialize cannot determine if the call is accepted or not; so if a - # call that's not accepted is used here, the error won't be visible until - # the BidiCall#run is called. - # - # deadline is the absolute deadline for the call. - # - # @param call [Call] the call used by the ActiveCall - # @param q [CompletionQueue] the completion queue used to accept - # the call - # @param marshal [Function] f(obj)->string that marshal requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Fixnum] the deadline for the call to complete - # @param finished_tag [Object] the object used as the call's finish tag, - def initialize(call, q, marshal, unmarshal, deadline, finished_tag) - fail(ArgumentError, 'not a call') unless call.is_a? Core::Call - unless q.is_a? Core::CompletionQueue - fail(ArgumentError, 'not a CompletionQueue') - end - @call = call - @cq = q - @deadline = deadline - @finished_tag = finished_tag - @marshal = marshal - @readq = Queue.new - @unmarshal = unmarshal + # Creates a BidiCall. + # + # BidiCall should only be created after a call is accepted. That means + # different things on a client and a server. On the client, the call is + # accepted after call.invoke. On the server, this is after call.accept. + # + # #initialize cannot determine if the call is accepted or not; so if a + # call that's not accepted is used here, the error won't be visible until + # the BidiCall#run is called. + # + # deadline is the absolute deadline for the call. + # + # @param call [Call] the call used by the ActiveCall + # @param q [CompletionQueue] the completion queue used to accept + # the call + # @param marshal [Function] f(obj)->string that marshal requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Fixnum] the deadline for the call to complete + # @param finished_tag [Object] the object used as the call's finish tag, + def initialize(call, q, marshal, unmarshal, deadline, finished_tag) + fail(ArgumentError, 'not a call') unless call.is_a? Core::Call + unless q.is_a? Core::CompletionQueue + fail(ArgumentError, 'not a CompletionQueue') end + @call = call + @cq = q + @deadline = deadline + @finished_tag = finished_tag + @marshal = marshal + @readq = Queue.new + @unmarshal = unmarshal + end - # Begins orchestration of the Bidi stream for a client sending requests. - # - # The method either returns an Enumerator of the responses, or accepts a - # block that can be invoked with each response. - # - # @param requests the Enumerable of requests to send - # @return an Enumerator of requests to yield - def run_on_client(requests, &blk) - enq_th = start_write_loop(requests) - loop_th = start_read_loop - replies = each_queued_msg - return replies if blk.nil? - replies.each { |r| blk.call(r) } - enq_th.join - loop_th.join - end + # Begins orchestration of the Bidi stream for a client sending requests. + # + # The method either returns an Enumerator of the responses, or accepts a + # block that can be invoked with each response. + # + # @param requests the Enumerable of requests to send + # @return an Enumerator of requests to yield + def run_on_client(requests, &blk) + enq_th = start_write_loop(requests) + loop_th = start_read_loop + replies = each_queued_msg + return replies if blk.nil? + replies.each { |r| blk.call(r) } + enq_th.join + loop_th.join + end - # Begins orchestration of the Bidi stream for a server generating replies. - # - # N.B. gen_each_reply is a func(Enumerable) - # - # It takes an enumerable of requests as an arg, in case there is a - # relationship between the stream of requests and the stream of replies. - # - # This does not mean that must necessarily be one. E.g, the replies - # produced by gen_each_reply could ignore the received_msgs - # - # @param gen_each_reply [Proc] generates the BiDi stream replies. - def run_on_server(gen_each_reply) - replys = gen_each_reply.call(each_queued_msg) - enq_th = start_write_loop(replys, is_client: false) - loop_th = start_read_loop - loop_th.join - enq_th.join - end + # Begins orchestration of the Bidi stream for a server generating replies. + # + # N.B. gen_each_reply is a func(Enumerable) + # + # It takes an enumerable of requests as an arg, in case there is a + # relationship between the stream of requests and the stream of replies. + # + # This does not mean that must necessarily be one. E.g, the replies + # produced by gen_each_reply could ignore the received_msgs + # + # @param gen_each_reply [Proc] generates the BiDi stream replies. + def run_on_server(gen_each_reply) + replys = gen_each_reply.call(each_queued_msg) + enq_th = start_write_loop(replys, is_client: false) + loop_th = start_read_loop + loop_th.join + enq_th.join + end - private + private - END_OF_READS = :end_of_reads - END_OF_WRITES = :end_of_writes + END_OF_READS = :end_of_reads + END_OF_WRITES = :end_of_writes - # each_queued_msg yields each message on this instances readq - # - # - messages are added to the readq by #read_loop - # - iteration ends when the instance itself is added - def each_queued_msg - return enum_for(:each_queued_msg) unless block_given? - count = 0 - loop do - logger.debug("each_queued_msg: msg##{count}") - count += 1 - req = @readq.pop - throw req if req.is_a? StandardError - break if req.equal?(END_OF_READS) - yield req - end + # each_queued_msg yields each message on this instances readq + # + # - messages are added to the readq by #read_loop + # - iteration ends when the instance itself is added + def each_queued_msg + return enum_for(:each_queued_msg) unless block_given? + count = 0 + loop do + logger.debug("each_queued_msg: msg##{count}") + count += 1 + req = @readq.pop + throw req if req.is_a? StandardError + break if req.equal?(END_OF_READS) + yield req end + end - # during bidi-streaming, read the requests to send from a separate thread - # read so that read_loop does not block waiting for requests to read. - def start_write_loop(requests, is_client: true) - Thread.new do # TODO: run on a thread pool - write_tag = Object.new - begin - count = 0 - requests.each do |req| - count += 1 - payload = @marshal.call(req) - @call.start_write(Core::ByteBuffer.new(payload), write_tag) - ev = @cq.pluck(write_tag, INFINITE_FUTURE) - begin - assert_event_type(ev, WRITE_ACCEPTED) - ensure - ev.close - end + # during bidi-streaming, read the requests to send from a separate thread + # read so that read_loop does not block waiting for requests to read. + def start_write_loop(requests, is_client: true) + Thread.new do # TODO: run on a thread pool + write_tag = Object.new + begin + count = 0 + requests.each do |req| + count += 1 + payload = @marshal.call(req) + @call.start_write(Core::ByteBuffer.new(payload), write_tag) + ev = @cq.pluck(write_tag, INFINITE_FUTURE) + begin + assert_event_type(ev, WRITE_ACCEPTED) + ensure + ev.close end - if is_client - @call.writes_done(write_tag) - ev = @cq.pluck(write_tag, INFINITE_FUTURE) - begin - assert_event_type(ev, FINISH_ACCEPTED) - ensure - ev.close - end - logger.debug("bidi-client: sent #{count} reqs, waiting to finish") - ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) - begin - assert_event_type(ev, FINISHED) - ensure - ev.close - end - logger.debug('bidi-client: finished received') + end + if is_client + @call.writes_done(write_tag) + ev = @cq.pluck(write_tag, INFINITE_FUTURE) + begin + assert_event_type(ev, FINISH_ACCEPTED) + ensure + ev.close end - rescue StandardError => e - logger.warn('bidi: write_loop failed') - logger.warn(e) + logger.debug("bidi-client: sent #{count} reqs, waiting to finish") + ev = @cq.pluck(@finished_tag, INFINITE_FUTURE) + begin + assert_event_type(ev, FINISHED) + ensure + ev.close + end + logger.debug('bidi-client: finished received') end + rescue StandardError => e + logger.warn('bidi: write_loop failed') + logger.warn(e) end end + end - # starts the read loop - def start_read_loop - Thread.new do - begin - read_tag = Object.new - count = 0 - - # queue the initial read before beginning the loop - loop do - logger.debug("waiting for read #{count}") - count += 1 - @call.start_read(read_tag) - ev = @cq.pluck(read_tag, INFINITE_FUTURE) - begin - assert_event_type(ev, READ) + # starts the read loop + def start_read_loop + Thread.new do + begin + read_tag = Object.new + count = 0 - # handle the next event. - if ev.result.nil? - @readq.push(END_OF_READS) - logger.debug('done reading!') - break - end + # queue the initial read before beginning the loop + loop do + logger.debug("waiting for read #{count}") + count += 1 + @call.start_read(read_tag) + ev = @cq.pluck(read_tag, INFINITE_FUTURE) + begin + assert_event_type(ev, READ) - # push the latest read onto the queue and continue reading - logger.debug("received req: #{ev.result}") - res = @unmarshal.call(ev.result.to_s) - @readq.push(res) - ensure - ev.close + # handle the next event. + if ev.result.nil? + @readq.push(END_OF_READS) + logger.debug('done reading!') + break end - end - rescue StandardError => e - logger.warn('bidi: read_loop failed') - logger.warn(e) - @readq.push(e) # let each_queued_msg terminate with this error + # push the latest read onto the queue and continue reading + logger.debug("received req: #{ev.result}") + res = @unmarshal.call(ev.result.to_s) + @readq.push(res) + ensure + ev.close + end end + + rescue StandardError => e + logger.warn('bidi: read_loop failed') + logger.warn(e) + @readq.push(e) # let each_queued_msg terminate with this error end end end diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index 7e13de19ca5..1a4ed58fa3f 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -30,381 +30,379 @@ require 'grpc/generic/active_call' require 'xray/thread_dump_signal_handler' -module Google - # Google::RPC contains the General RPC module. - module RPC - # ClientStub represents an endpoint used to send requests to GRPC servers. - class ClientStub - include Core::StatusCodes +# GRPC contains the General RPC module. +module GRPC + # ClientStub represents an endpoint used to send requests to GRPC servers. + class ClientStub + include Core::StatusCodes - # Default deadline is 5 seconds. - DEFAULT_DEADLINE = 5 + # Default deadline is 5 seconds. + DEFAULT_DEADLINE = 5 - # Creates a new ClientStub. - # - # Minimally, a stub is created with the just the host of the gRPC service - # it wishes to access, e.g., - # - # my_stub = ClientStub.new(example.host.com:50505) - # - # Any arbitrary keyword arguments are treated as channel arguments used to - # configure the RPC connection to the host. - # - # There are some specific keyword args that are not used to configure the - # channel: - # - # - :channel_override - # when present, this must be a pre-created GRPC::Channel. If it's - # present the host and arbitrary keyword arg areignored, and the RPC - # connection uses this channel. - # - # - :deadline - # when present, this is the default deadline used for calls - # - # - :update_metadata - # when present, this a func that takes a hash and returns a hash - # it can be used to update metadata, i.e, remove, change or update - # amend metadata values. - # - # @param host [String] the host the stub connects to - # @param q [Core::CompletionQueue] used to wait for events - # @param channel_override [Core::Channel] a pre-created channel - # @param deadline [Number] the default deadline to use in requests - # @param creds [Core::Credentials] the channel - # @param update_metadata a func that updates metadata as described above - # @param kw [KeywordArgs]the channel arguments - def initialize(host, q, - channel_override:nil, - deadline: DEFAULT_DEADLINE, - creds: nil, - update_metadata: nil, - **kw) - unless q.is_a? Core::CompletionQueue - fail(ArgumentError, 'not a CompletionQueue') - end - @queue = q + # Creates a new ClientStub. + # + # Minimally, a stub is created with the just the host of the gRPC service + # it wishes to access, e.g., + # + # my_stub = ClientStub.new(example.host.com:50505) + # + # Any arbitrary keyword arguments are treated as channel arguments used to + # configure the RPC connection to the host. + # + # There are some specific keyword args that are not used to configure the + # channel: + # + # - :channel_override + # when present, this must be a pre-created GRPC::Channel. If it's + # present the host and arbitrary keyword arg areignored, and the RPC + # connection uses this channel. + # + # - :deadline + # when present, this is the default deadline used for calls + # + # - :update_metadata + # when present, this a func that takes a hash and returns a hash + # it can be used to update metadata, i.e, remove, change or update + # amend metadata values. + # + # @param host [String] the host the stub connects to + # @param q [Core::CompletionQueue] used to wait for events + # @param channel_override [Core::Channel] a pre-created channel + # @param deadline [Number] the default deadline to use in requests + # @param creds [Core::Credentials] the channel + # @param update_metadata a func that updates metadata as described above + # @param kw [KeywordArgs]the channel arguments + def initialize(host, q, + channel_override:nil, + deadline: DEFAULT_DEADLINE, + creds: nil, + update_metadata: nil, + **kw) + unless q.is_a? Core::CompletionQueue + fail(ArgumentError, 'not a CompletionQueue') + end + @queue = q - # set the channel instance - if !channel_override.nil? - ch = channel_override - fail(ArgumentError, 'not a Channel') unless ch.is_a? Core::Channel + # set the channel instance + if !channel_override.nil? + ch = channel_override + fail(ArgumentError, 'not a Channel') unless ch.is_a? Core::Channel + else + if creds.nil? + ch = Core::Channel.new(host, kw) + elsif !creds.is_a?(Core::Credentials) + fail(ArgumentError, 'not a Credentials') else - if creds.nil? - ch = Core::Channel.new(host, kw) - elsif !creds.is_a?(Core::Credentials) - fail(ArgumentError, 'not a Credentials') - else - ch = Core::Channel.new(host, kw, creds) - end + ch = Core::Channel.new(host, kw, creds) end - @ch = ch - - @update_metadata = nil - unless update_metadata.nil? - unless update_metadata.is_a? Proc - fail(ArgumentError, 'update_metadata is not a Proc') - end - @update_metadata = update_metadata - end - - @host = host - @deadline = deadline end + @ch = ch - # request_response sends a request to a GRPC server, and returns the - # response. - # - # == Flow Control == - # This is a blocking call. - # - # * it does not return until a response is received. - # - # * the requests is sent only when GRPC core's flow control allows it to - # be sent. - # - # == Errors == - # An RuntimeError is raised if - # - # * the server responds with a non-OK status - # - # * the deadline is exceeded - # - # == Return Value == - # - # If return_op is false, the call returns the response - # - # If return_op is true, the call returns an Operation, calling execute - # on the Operation returns the response. - # - # == Keyword Args == - # - # Unspecified keyword arguments are treated as metadata to be sent to the - # server. - # - # @param method [String] the RPC method to call on the GRPC server - # @param req [Object] the request sent to the server - # @param marshal [Function] f(obj)->string that marshals requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Numeric] (optional) the max completion time in seconds - # @param return_op [true|false] return an Operation if true - # @return [Object] the response received from the server - def request_response(method, req, marshal, unmarshal, deadline = nil, - return_op: false, **kw) - c = new_active_call(method, marshal, unmarshal, deadline || @deadline) - md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) - return c.request_response(req, **md) unless return_op - - # return the operation view of the active_call; define #execute as a - # new method for this instance that invokes #request_response. - op = c.operation - op.define_singleton_method(:execute) do - c.request_response(req, **md) + @update_metadata = nil + unless update_metadata.nil? + unless update_metadata.is_a? Proc + fail(ArgumentError, 'update_metadata is not a Proc') end - op + @update_metadata = update_metadata end - # client_streamer sends a stream of requests to a GRPC server, and - # returns a single response. - # - # requests provides an 'iterable' of Requests. I.e. it follows Ruby's - # #each enumeration protocol. In the simplest case, requests will be an - # array of marshallable objects; in typical case it will be an Enumerable - # that allows dynamic construction of the marshallable objects. - # - # == Flow Control == - # This is a blocking call. - # - # * it does not return until a response is received. - # - # * each requests is sent only when GRPC core's flow control allows it to - # be sent. - # - # == Errors == - # An RuntimeError is raised if - # - # * the server responds with a non-OK status - # - # * the deadline is exceeded - # - # == Return Value == - # - # If return_op is false, the call consumes the requests and returns - # the response. - # - # If return_op is true, the call returns the response. - # - # == Keyword Args == - # - # Unspecified keyword arguments are treated as metadata to be sent to the - # server. - # - # @param method [String] the RPC method to call on the GRPC server - # @param requests [Object] an Enumerable of requests to send - # @param marshal [Function] f(obj)->string that marshals requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Numeric] the max completion time in seconds - # @param return_op [true|false] return an Operation if true - # @return [Object|Operation] the response received from the server - def client_streamer(method, requests, marshal, unmarshal, deadline = nil, - return_op: false, **kw) - c = new_active_call(method, marshal, unmarshal, deadline || @deadline) - md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) - return c.client_streamer(requests, **md) unless return_op + @host = host + @deadline = deadline + end + + # request_response sends a request to a GRPC server, and returns the + # response. + # + # == Flow Control == + # This is a blocking call. + # + # * it does not return until a response is received. + # + # * the requests is sent only when GRPC core's flow control allows it to + # be sent. + # + # == Errors == + # An RuntimeError is raised if + # + # * the server responds with a non-OK status + # + # * the deadline is exceeded + # + # == Return Value == + # + # If return_op is false, the call returns the response + # + # If return_op is true, the call returns an Operation, calling execute + # on the Operation returns the response. + # + # == Keyword Args == + # + # Unspecified keyword arguments are treated as metadata to be sent to the + # server. + # + # @param method [String] the RPC method to call on the GRPC server + # @param req [Object] the request sent to the server + # @param marshal [Function] f(obj)->string that marshals requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Numeric] (optional) the max completion time in seconds + # @param return_op [true|false] return an Operation if true + # @return [Object] the response received from the server + def request_response(method, req, marshal, unmarshal, deadline = nil, + return_op: false, **kw) + c = new_active_call(method, marshal, unmarshal, deadline || @deadline) + md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) + return c.request_response(req, **md) unless return_op - # return the operation view of the active_call; define #execute as a - # new method for this instance that invokes #client_streamer. - op = c.operation - op.define_singleton_method(:execute) do - c.client_streamer(requests, **md) - end - op + # return the operation view of the active_call; define #execute as a + # new method for this instance that invokes #request_response. + op = c.operation + op.define_singleton_method(:execute) do + c.request_response(req, **md) end + op + end - # server_streamer sends one request to the GRPC server, which yields a - # stream of responses. - # - # responses provides an enumerator over the streamed responses, i.e. it - # follows Ruby's #each iteration protocol. The enumerator blocks while - # waiting for each response, stops when the server signals that no - # further responses will be supplied. If the implicit block is provided, - # it is executed with each response as the argument and no result is - # returned. - # - # == Flow Control == - # This is a blocking call. - # - # * the request is sent only when GRPC core's flow control allows it to - # be sent. - # - # * the request will not complete until the server sends the final - # response followed by a status message. - # - # == Errors == - # An RuntimeError is raised if - # - # * the server responds with a non-OK status when any response is - # * retrieved - # - # * the deadline is exceeded - # - # == Return Value == - # - # if the return_op is false, the return value is an Enumerator of the - # results, unless a block is provided, in which case the block is - # executed with each response. - # - # if return_op is true, the function returns an Operation whose #execute - # method runs server streamer call. Again, Operation#execute either - # calls the given block with each response or returns an Enumerator of the - # responses. - # - # == Keyword Args == - # - # Unspecified keyword arguments are treated as metadata to be sent to the - # server. - # - # @param method [String] the RPC method to call on the GRPC server - # @param req [Object] the request sent to the server - # @param marshal [Function] f(obj)->string that marshals requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Numeric] the max completion time in seconds - # @param return_op [true|false]return an Operation if true - # @param blk [Block] when provided, is executed for each response - # @return [Enumerator|Operation|nil] as discussed above - def server_streamer(method, req, marshal, unmarshal, deadline = nil, - return_op: false, **kw, &blk) - c = new_active_call(method, marshal, unmarshal, deadline || @deadline) - md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) - return c.server_streamer(req, **md, &blk) unless return_op + # client_streamer sends a stream of requests to a GRPC server, and + # returns a single response. + # + # requests provides an 'iterable' of Requests. I.e. it follows Ruby's + # #each enumeration protocol. In the simplest case, requests will be an + # array of marshallable objects; in typical case it will be an Enumerable + # that allows dynamic construction of the marshallable objects. + # + # == Flow Control == + # This is a blocking call. + # + # * it does not return until a response is received. + # + # * each requests is sent only when GRPC core's flow control allows it to + # be sent. + # + # == Errors == + # An RuntimeError is raised if + # + # * the server responds with a non-OK status + # + # * the deadline is exceeded + # + # == Return Value == + # + # If return_op is false, the call consumes the requests and returns + # the response. + # + # If return_op is true, the call returns the response. + # + # == Keyword Args == + # + # Unspecified keyword arguments are treated as metadata to be sent to the + # server. + # + # @param method [String] the RPC method to call on the GRPC server + # @param requests [Object] an Enumerable of requests to send + # @param marshal [Function] f(obj)->string that marshals requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Numeric] the max completion time in seconds + # @param return_op [true|false] return an Operation if true + # @return [Object|Operation] the response received from the server + def client_streamer(method, requests, marshal, unmarshal, deadline = nil, + return_op: false, **kw) + c = new_active_call(method, marshal, unmarshal, deadline || @deadline) + md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) + return c.client_streamer(requests, **md) unless return_op - # return the operation view of the active_call; define #execute - # as a new method for this instance that invokes #server_streamer - op = c.operation - op.define_singleton_method(:execute) do - c.server_streamer(req, **md, &blk) - end - op + # return the operation view of the active_call; define #execute as a + # new method for this instance that invokes #client_streamer. + op = c.operation + op.define_singleton_method(:execute) do + c.client_streamer(requests, **md) end + op + end - # bidi_streamer sends a stream of requests to the GRPC server, and yields - # a stream of responses. - # - # This method takes an Enumerable of requests, and returns and enumerable - # of responses. - # - # == requests == - # - # requests provides an 'iterable' of Requests. I.e. it follows Ruby's - # #each enumeration protocol. In the simplest case, requests will be an - # array of marshallable objects; in typical case it will be an - # Enumerable that allows dynamic construction of the marshallable - # objects. - # - # == responses == - # - # This is an enumerator of responses. I.e, its #next method blocks - # waiting for the next response. Also, if at any point the block needs - # to consume all the remaining responses, this can be done using #each or - # #collect. Calling #each or #collect should only be done if - # the_call#writes_done has been called, otherwise the block will loop - # forever. - # - # == Flow Control == - # This is a blocking call. - # - # * the call completes when the next call to provided block returns - # * [False] - # - # * the execution block parameters are two objects for sending and - # receiving responses, each of which blocks waiting for flow control. - # E.g, calles to bidi_call#remote_send will wait until flow control - # allows another write before returning; and obviously calls to - # responses#next block until the next response is available. - # - # == Termination == - # - # As well as sending and receiving messages, the block passed to the - # function is also responsible for: - # - # * calling bidi_call#writes_done to indicate no further reqs will be - # sent. - # - # * returning false if once the bidi stream is functionally completed. - # - # Note that response#next will indicate that there are no further - # responses by throwing StopIteration, but can only happen either - # if bidi_call#writes_done is called. - # - # To terminate the RPC correctly the block: - # - # * must call bidi#writes_done and then - # - # * either return false as soon as there is no need for other responses - # - # * loop on responses#next until no further responses are available - # - # == Errors == - # An RuntimeError is raised if - # - # * the server responds with a non-OK status when any response is - # * retrieved - # - # * the deadline is exceeded - # - # - # == Keyword Args == - # - # Unspecified keyword arguments are treated as metadata to be sent to the - # server. - # - # == Return Value == - # - # if the return_op is false, the return value is an Enumerator of the - # results, unless a block is provided, in which case the block is - # executed with each response. - # - # if return_op is true, the function returns an Operation whose #execute - # method runs the Bidi call. Again, Operation#execute either calls a - # given block with each response or returns an Enumerator of the - # responses. - # - # @param method [String] the RPC method to call on the GRPC server - # @param requests [Object] an Enumerable of requests to send - # @param marshal [Function] f(obj)->string that marshals requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [Numeric] (optional) the max completion time in seconds - # @param blk [Block] when provided, is executed for each response - # @param return_op [true|false] return an Operation if true - # @return [Enumerator|nil|Operation] as discussed above - def bidi_streamer(method, requests, marshal, unmarshal, deadline = nil, + # server_streamer sends one request to the GRPC server, which yields a + # stream of responses. + # + # responses provides an enumerator over the streamed responses, i.e. it + # follows Ruby's #each iteration protocol. The enumerator blocks while + # waiting for each response, stops when the server signals that no + # further responses will be supplied. If the implicit block is provided, + # it is executed with each response as the argument and no result is + # returned. + # + # == Flow Control == + # This is a blocking call. + # + # * the request is sent only when GRPC core's flow control allows it to + # be sent. + # + # * the request will not complete until the server sends the final + # response followed by a status message. + # + # == Errors == + # An RuntimeError is raised if + # + # * the server responds with a non-OK status when any response is + # * retrieved + # + # * the deadline is exceeded + # + # == Return Value == + # + # if the return_op is false, the return value is an Enumerator of the + # results, unless a block is provided, in which case the block is + # executed with each response. + # + # if return_op is true, the function returns an Operation whose #execute + # method runs server streamer call. Again, Operation#execute either + # calls the given block with each response or returns an Enumerator of the + # responses. + # + # == Keyword Args == + # + # Unspecified keyword arguments are treated as metadata to be sent to the + # server. + # + # @param method [String] the RPC method to call on the GRPC server + # @param req [Object] the request sent to the server + # @param marshal [Function] f(obj)->string that marshals requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Numeric] the max completion time in seconds + # @param return_op [true|false]return an Operation if true + # @param blk [Block] when provided, is executed for each response + # @return [Enumerator|Operation|nil] as discussed above + def server_streamer(method, req, marshal, unmarshal, deadline = nil, return_op: false, **kw, &blk) - c = new_active_call(method, marshal, unmarshal, deadline || @deadline) - md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) - return c.bidi_streamer(requests, **md, &blk) unless return_op + c = new_active_call(method, marshal, unmarshal, deadline || @deadline) + md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) + return c.server_streamer(req, **md, &blk) unless return_op - # return the operation view of the active_call; define #execute - # as a new method for this instance that invokes #bidi_streamer - op = c.operation - op.define_singleton_method(:execute) do - c.bidi_streamer(requests, **md, &blk) - end - op + # return the operation view of the active_call; define #execute + # as a new method for this instance that invokes #server_streamer + op = c.operation + op.define_singleton_method(:execute) do + c.server_streamer(req, **md, &blk) end + op + end - private + # bidi_streamer sends a stream of requests to the GRPC server, and yields + # a stream of responses. + # + # This method takes an Enumerable of requests, and returns and enumerable + # of responses. + # + # == requests == + # + # requests provides an 'iterable' of Requests. I.e. it follows Ruby's + # #each enumeration protocol. In the simplest case, requests will be an + # array of marshallable objects; in typical case it will be an + # Enumerable that allows dynamic construction of the marshallable + # objects. + # + # == responses == + # + # This is an enumerator of responses. I.e, its #next method blocks + # waiting for the next response. Also, if at any point the block needs + # to consume all the remaining responses, this can be done using #each or + # #collect. Calling #each or #collect should only be done if + # the_call#writes_done has been called, otherwise the block will loop + # forever. + # + # == Flow Control == + # This is a blocking call. + # + # * the call completes when the next call to provided block returns + # * [False] + # + # * the execution block parameters are two objects for sending and + # receiving responses, each of which blocks waiting for flow control. + # E.g, calles to bidi_call#remote_send will wait until flow control + # allows another write before returning; and obviously calls to + # responses#next block until the next response is available. + # + # == Termination == + # + # As well as sending and receiving messages, the block passed to the + # function is also responsible for: + # + # * calling bidi_call#writes_done to indicate no further reqs will be + # sent. + # + # * returning false if once the bidi stream is functionally completed. + # + # Note that response#next will indicate that there are no further + # responses by throwing StopIteration, but can only happen either + # if bidi_call#writes_done is called. + # + # To terminate the RPC correctly the block: + # + # * must call bidi#writes_done and then + # + # * either return false as soon as there is no need for other responses + # + # * loop on responses#next until no further responses are available + # + # == Errors == + # An RuntimeError is raised if + # + # * the server responds with a non-OK status when any response is + # * retrieved + # + # * the deadline is exceeded + # + # + # == Keyword Args == + # + # Unspecified keyword arguments are treated as metadata to be sent to the + # server. + # + # == Return Value == + # + # if the return_op is false, the return value is an Enumerator of the + # results, unless a block is provided, in which case the block is + # executed with each response. + # + # if return_op is true, the function returns an Operation whose #execute + # method runs the Bidi call. Again, Operation#execute either calls a + # given block with each response or returns an Enumerator of the + # responses. + # + # @param method [String] the RPC method to call on the GRPC server + # @param requests [Object] an Enumerable of requests to send + # @param marshal [Function] f(obj)->string that marshals requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [Numeric] (optional) the max completion time in seconds + # @param blk [Block] when provided, is executed for each response + # @param return_op [true|false] return an Operation if true + # @return [Enumerator|nil|Operation] as discussed above + def bidi_streamer(method, requests, marshal, unmarshal, deadline = nil, + return_op: false, **kw, &blk) + c = new_active_call(method, marshal, unmarshal, deadline || @deadline) + md = @update_metadata.nil? ? kw : @update_metadata.call(kw.clone) + return c.bidi_streamer(requests, **md, &blk) unless return_op - # Creates a new active stub - # - # @param ch [GRPC::Channel] the channel used to create the stub. - # @param marshal [Function] f(obj)->string that marshals requests - # @param unmarshal [Function] f(string)->obj that unmarshals responses - # @param deadline [TimeConst] - def new_active_call(ch, marshal, unmarshal, deadline = nil) - absolute_deadline = Core::TimeConsts.from_relative_time(deadline) - call = @ch.create_call(ch, @host, absolute_deadline) - ActiveCall.new(call, @queue, marshal, unmarshal, absolute_deadline, - started: false) + # return the operation view of the active_call; define #execute + # as a new method for this instance that invokes #bidi_streamer + op = c.operation + op.define_singleton_method(:execute) do + c.bidi_streamer(requests, **md, &blk) end + op + end + + private + + # Creates a new active stub + # + # @param ch [GRPC::Channel] the channel used to create the stub. + # @param marshal [Function] f(obj)->string that marshals requests + # @param unmarshal [Function] f(string)->obj that unmarshals responses + # @param deadline [TimeConst] + def new_active_call(ch, marshal, unmarshal, deadline = nil) + absolute_deadline = Core::TimeConsts.from_relative_time(deadline) + call = @ch.create_call(ch, @host, absolute_deadline) + ActiveCall.new(call, @queue, marshal, unmarshal, absolute_deadline, + started: false) end end end diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index 876397a6e70..6d8bdeb3cc3 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -29,123 +29,122 @@ require 'grpc/grpc' -module Google - module RPC - # RpcDesc is a Descriptor of an RPC method. - class RpcDesc < Struct.new(:name, :input, :output, :marshal_method, - :unmarshal_method) - include Core::StatusCodes +# GRPC contains the General RPC module. +module GRPC + # RpcDesc is a Descriptor of an RPC method. + class RpcDesc < Struct.new(:name, :input, :output, :marshal_method, + :unmarshal_method) + include Core::StatusCodes - # Used to wrap a message class to indicate that it needs to be streamed. - class Stream - attr_accessor :type + # Used to wrap a message class to indicate that it needs to be streamed. + class Stream + attr_accessor :type - def initialize(type) - @type = type - end + def initialize(type) + @type = type end + end - # @return [Proc] { |instance| marshalled(instance) } - def marshal_proc - proc { |o| o.class.method(marshal_method).call(o).to_s } - end + # @return [Proc] { |instance| marshalled(instance) } + def marshal_proc + proc { |o| o.class.method(marshal_method).call(o).to_s } + end - # @param [:input, :output] target determines whether to produce the an - # unmarshal Proc for the rpc input parameter or - # its output parameter - # - # @return [Proc] An unmarshal proc { |marshalled(instance)| instance } - def unmarshal_proc(target) - fail ArgumentError unless [:input, :output].include?(target) - unmarshal_class = method(target).call - unmarshal_class = unmarshal_class.type if unmarshal_class.is_a? Stream - proc { |o| unmarshal_class.method(unmarshal_method).call(o) } - end + # @param [:input, :output] target determines whether to produce the an + # unmarshal Proc for the rpc input parameter or + # its output parameter + # + # @return [Proc] An unmarshal proc { |marshalled(instance)| instance } + def unmarshal_proc(target) + fail ArgumentError unless [:input, :output].include?(target) + unmarshal_class = method(target).call + unmarshal_class = unmarshal_class.type if unmarshal_class.is_a? Stream + proc { |o| unmarshal_class.method(unmarshal_method).call(o) } + end - def run_server_method(active_call, mth) - # While a server method is running, it might be cancelled, its deadline - # might be reached, the handler could throw an unknown error, or a - # well-behaved handler could throw a StatusError. - if request_response? - req = active_call.remote_read - resp = mth.call(req, active_call.single_req_view) - active_call.remote_send(resp) - elsif client_streamer? - resp = mth.call(active_call.multi_req_view) - active_call.remote_send(resp) - elsif server_streamer? - req = active_call.remote_read - replys = mth.call(req, active_call.single_req_view) - replys.each { |r| active_call.remote_send(r) } - else # is a bidi_stream - active_call.run_server_bidi(mth) - end - send_status(active_call, OK, 'OK') - rescue BadStatus => e - # this is raised by handlers that want GRPC to send an application - # error code and detail message. - logger.debug("app err: #{active_call}, status:#{e.code}:#{e.details}") - send_status(active_call, e.code, e.details) - rescue Core::CallError => e - # This is raised by GRPC internals but should rarely, if ever happen. - # Log it, but don't notify the other endpoint.. - logger.warn("failed call: #{active_call}\n#{e}") - rescue OutOfTime - # This is raised when active_call#method.call exceeeds the deadline - # event. Send a status of deadline exceeded - logger.warn("late call: #{active_call}") - send_status(active_call, DEADLINE_EXCEEDED, 'late') - rescue Core::EventError => e - # This is raised by GRPC internals but should rarely, if ever happen. - # Log it, but don't notify the other endpoint.. - logger.warn("failed call: #{active_call}\n#{e}") - rescue StandardError => e - # This will usuaally be an unhandled error in the handling code. - # Send back a UNKNOWN status to the client - logger.warn("failed handler: #{active_call}; sending status:UNKNOWN") - logger.warn(e) - send_status(active_call, UNKNOWN, 'no reason given') + def run_server_method(active_call, mth) + # While a server method is running, it might be cancelled, its deadline + # might be reached, the handler could throw an unknown error, or a + # well-behaved handler could throw a StatusError. + if request_response? + req = active_call.remote_read + resp = mth.call(req, active_call.single_req_view) + active_call.remote_send(resp) + elsif client_streamer? + resp = mth.call(active_call.multi_req_view) + active_call.remote_send(resp) + elsif server_streamer? + req = active_call.remote_read + replys = mth.call(req, active_call.single_req_view) + replys.each { |r| active_call.remote_send(r) } + else # is a bidi_stream + active_call.run_server_bidi(mth) end + send_status(active_call, OK, 'OK') + rescue BadStatus => e + # this is raised by handlers that want GRPC to send an application + # error code and detail message. + logger.debug("app err: #{active_call}, status:#{e.code}:#{e.details}") + send_status(active_call, e.code, e.details) + rescue Core::CallError => e + # This is raised by GRPC internals but should rarely, if ever happen. + # Log it, but don't notify the other endpoint.. + logger.warn("failed call: #{active_call}\n#{e}") + rescue OutOfTime + # This is raised when active_call#method.call exceeeds the deadline + # event. Send a status of deadline exceeded + logger.warn("late call: #{active_call}") + send_status(active_call, DEADLINE_EXCEEDED, 'late') + rescue Core::EventError => e + # This is raised by GRPC internals but should rarely, if ever happen. + # Log it, but don't notify the other endpoint.. + logger.warn("failed call: #{active_call}\n#{e}") + rescue StandardError => e + # This will usuaally be an unhandled error in the handling code. + # Send back a UNKNOWN status to the client + logger.warn("failed handler: #{active_call}; sending status:UNKNOWN") + logger.warn(e) + send_status(active_call, UNKNOWN, 'no reason given') + end - def assert_arity_matches(mth) - if request_response? || server_streamer? - if mth.arity != 2 - fail arity_error(mth, 2, "should be #{mth.name}(req, call)") - end - else - if mth.arity != 1 - fail arity_error(mth, 1, "should be #{mth.name}(call)") - end + def assert_arity_matches(mth) + if request_response? || server_streamer? + if mth.arity != 2 + fail arity_error(mth, 2, "should be #{mth.name}(req, call)") + end + else + if mth.arity != 1 + fail arity_error(mth, 1, "should be #{mth.name}(call)") end end + end - def request_response? - !input.is_a?(Stream) && !output.is_a?(Stream) - end + def request_response? + !input.is_a?(Stream) && !output.is_a?(Stream) + end - def client_streamer? - input.is_a?(Stream) && !output.is_a?(Stream) - end + def client_streamer? + input.is_a?(Stream) && !output.is_a?(Stream) + end - def server_streamer? - !input.is_a?(Stream) && output.is_a?(Stream) - end + def server_streamer? + !input.is_a?(Stream) && output.is_a?(Stream) + end - def bidi_streamer? - input.is_a?(Stream) && output.is_a?(Stream) - end + def bidi_streamer? + input.is_a?(Stream) && output.is_a?(Stream) + end - def arity_error(mth, want, msg) - "##{mth.name}: bad arg count; got:#{mth.arity}, want:#{want}, #{msg}" - end + def arity_error(mth, want, msg) + "##{mth.name}: bad arg count; got:#{mth.arity}, want:#{want}, #{msg}" + end - def send_status(active_client, code, details) - details = 'Not sure why' if details.nil? - active_client.send_status(code, details) - rescue StandardError => e - logger.warn("Could not send status #{code}:#{details}") - logger.warn(e) - end + def send_status(active_client, code, details) + details = 'Not sure why' if details.nil? + active_client.send_status(code, details) + rescue StandardError => e + logger.warn("Could not send status #{code}:#{details}") + logger.warn(e) end end end diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 40c5ec118e3..dd40eba57f0 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -33,372 +33,370 @@ require 'grpc/generic/service' require 'thread' require 'xray/thread_dump_signal_handler' -module Google - # Google::RPC contains the General RPC module. - module RPC - # RpcServer hosts a number of services and makes them available on the - # network. - class RpcServer - include Core::CompletionType - include Core::TimeConsts - extend ::Forwardable - - def_delegators :@server, :add_http2_port - - # Default thread pool size is 3 - DEFAULT_POOL_SIZE = 3 - - # Default max_waiting_requests size is 20 - DEFAULT_MAX_WAITING_REQUESTS = 20 - - # Creates a new RpcServer. - # - # The RPC server is configured using keyword arguments. - # - # There are some specific keyword args used to configure the RpcServer - # instance, however other arbitrary are allowed and when present are used - # to configure the listeninng connection set up by the RpcServer. - # - # * server_override: which if passed must be a [GRPC::Core::Server]. When - # present. - # - # * poll_period: when present, the server polls for new events with this - # period - # - # * pool_size: the size of the thread pool the server uses to run its - # threads - # - # * completion_queue_override: when supplied, this will be used as the - # completion_queue that the server uses to receive network events, - # otherwise its creates a new instance itself - # - # * creds: [GRPC::Core::ServerCredentials] - # the credentials used to secure the server - # - # * max_waiting_requests: the maximum number of requests that are not - # being handled to allow. When this limit is exceeded, the server responds - # with not available to new requests - def initialize(pool_size:DEFAULT_POOL_SIZE, - max_waiting_requests:DEFAULT_MAX_WAITING_REQUESTS, - poll_period:INFINITE_FUTURE, - completion_queue_override:nil, - creds:nil, - server_override:nil, - **kw) - if completion_queue_override.nil? - cq = Core::CompletionQueue.new - else - cq = completion_queue_override - unless cq.is_a? Core::CompletionQueue - fail(ArgumentError, 'not a CompletionQueue') - end +# GRPC contains the General RPC module. +module GRPC + # RpcServer hosts a number of services and makes them available on the + # network. + class RpcServer + include Core::CompletionType + include Core::TimeConsts + extend ::Forwardable + + def_delegators :@server, :add_http2_port + + # Default thread pool size is 3 + DEFAULT_POOL_SIZE = 3 + + # Default max_waiting_requests size is 20 + DEFAULT_MAX_WAITING_REQUESTS = 20 + + # Creates a new RpcServer. + # + # The RPC server is configured using keyword arguments. + # + # There are some specific keyword args used to configure the RpcServer + # instance, however other arbitrary are allowed and when present are used + # to configure the listeninng connection set up by the RpcServer. + # + # * server_override: which if passed must be a [GRPC::Core::Server]. When + # present. + # + # * poll_period: when present, the server polls for new events with this + # period + # + # * pool_size: the size of the thread pool the server uses to run its + # threads + # + # * completion_queue_override: when supplied, this will be used as the + # completion_queue that the server uses to receive network events, + # otherwise its creates a new instance itself + # + # * creds: [GRPC::Core::ServerCredentials] + # the credentials used to secure the server + # + # * max_waiting_requests: the maximum number of requests that are not + # being handled to allow. When this limit is exceeded, the server responds + # with not available to new requests + def initialize(pool_size:DEFAULT_POOL_SIZE, + max_waiting_requests:DEFAULT_MAX_WAITING_REQUESTS, + poll_period:INFINITE_FUTURE, + completion_queue_override:nil, + creds:nil, + server_override:nil, + **kw) + if completion_queue_override.nil? + cq = Core::CompletionQueue.new + else + cq = completion_queue_override + unless cq.is_a? Core::CompletionQueue + fail(ArgumentError, 'not a CompletionQueue') end - @cq = cq + end + @cq = cq - if server_override.nil? - if creds.nil? - srv = Core::Server.new(@cq, kw) - elsif !creds.is_a? Core::ServerCredentials - fail(ArgumentError, 'not a ServerCredentials') - else - srv = Core::Server.new(@cq, kw, creds) - end + if server_override.nil? + if creds.nil? + srv = Core::Server.new(@cq, kw) + elsif !creds.is_a? Core::ServerCredentials + fail(ArgumentError, 'not a ServerCredentials') else - srv = server_override - fail(ArgumentError, 'not a Server') unless srv.is_a? Core::Server + srv = Core::Server.new(@cq, kw, creds) end - @server = srv - - @pool_size = pool_size - @max_waiting_requests = max_waiting_requests - @poll_period = poll_period - @run_mutex = Mutex.new - @run_cond = ConditionVariable.new - @pool = Pool.new(@pool_size) + else + srv = server_override + fail(ArgumentError, 'not a Server') unless srv.is_a? Core::Server end + @server = srv + + @pool_size = pool_size + @max_waiting_requests = max_waiting_requests + @poll_period = poll_period + @run_mutex = Mutex.new + @run_cond = ConditionVariable.new + @pool = Pool.new(@pool_size) + end - # stops a running server - # - # the call has no impact if the server is already stopped, otherwise - # server's current call loop is it's last. - def stop - return unless @running - @stopped = true - @pool.stop - end + # stops a running server + # + # the call has no impact if the server is already stopped, otherwise + # server's current call loop is it's last. + def stop + return unless @running + @stopped = true + @pool.stop + end - # determines if the server is currently running - def running? - @running ||= false - end + # determines if the server is currently running + def running? + @running ||= false + end - # Is called from other threads to wait for #run to start up the server. - # - # If run has not been called, this returns immediately. - # - # @param timeout [Numeric] number of seconds to wait - # @result [true, false] true if the server is running, false otherwise - def wait_till_running(timeout = 0.1) - end_time, sleep_period = Time.now + timeout, (1.0 * timeout) / 100 - while Time.now < end_time - @run_mutex.synchronize { @run_cond.wait(@run_mutex) } unless running? - sleep(sleep_period) - end - running? + # Is called from other threads to wait for #run to start up the server. + # + # If run has not been called, this returns immediately. + # + # @param timeout [Numeric] number of seconds to wait + # @result [true, false] true if the server is running, false otherwise + def wait_till_running(timeout = 0.1) + end_time, sleep_period = Time.now + timeout, (1.0 * timeout) / 100 + while Time.now < end_time + @run_mutex.synchronize { @run_cond.wait(@run_mutex) } unless running? + sleep(sleep_period) end + running? + end - # determines if the server is currently stopped - def stopped? - @stopped ||= false - end + # determines if the server is currently stopped + def stopped? + @stopped ||= false + end - # handle registration of classes - # - # service is either a class that includes GRPC::GenericService and whose - # #new function can be called without argument or any instance of such a - # class. - # - # E.g, after - # - # class Divider - # include GRPC::GenericService - # rpc :div DivArgs, DivReply # single request, single response - # def initialize(optional_arg='default option') # no args - # ... - # end - # - # srv = GRPC::RpcServer.new(...) - # - # # Either of these works - # - # srv.handle(Divider) - # - # # or - # - # srv.handle(Divider.new('replace optional arg')) - # - # It raises RuntimeError: - # - if service is not valid service class or object - # - its handler methods are already registered - # - if the server is already running - # - # @param service [Object|Class] a service class or object as described - # above - def handle(service) - fail 'cannot add services if the server is running' if running? - fail 'cannot add services if the server is stopped' if stopped? - cls = service.is_a?(Class) ? service : service.class - assert_valid_service_class(cls) - add_rpc_descs_for(service) - end + # handle registration of classes + # + # service is either a class that includes GRPC::GenericService and whose + # #new function can be called without argument or any instance of such a + # class. + # + # E.g, after + # + # class Divider + # include GRPC::GenericService + # rpc :div DivArgs, DivReply # single request, single response + # def initialize(optional_arg='default option') # no args + # ... + # end + # + # srv = GRPC::RpcServer.new(...) + # + # # Either of these works + # + # srv.handle(Divider) + # + # # or + # + # srv.handle(Divider.new('replace optional arg')) + # + # It raises RuntimeError: + # - if service is not valid service class or object + # - its handler methods are already registered + # - if the server is already running + # + # @param service [Object|Class] a service class or object as described + # above + def handle(service) + fail 'cannot add services if the server is running' if running? + fail 'cannot add services if the server is stopped' if stopped? + cls = service.is_a?(Class) ? service : service.class + assert_valid_service_class(cls) + add_rpc_descs_for(service) + end - # runs the server - # - # - if no rpc_descs are registered, this exits immediately, otherwise it - # continues running permanently and does not return until program exit. - # - # - #running? returns true after this is called, until #stop cause the - # the server to stop. - def run - if rpc_descs.size == 0 - logger.warn('did not run as no services were present') - return - end - @run_mutex.synchronize do - @running = true - @run_cond.signal + # runs the server + # + # - if no rpc_descs are registered, this exits immediately, otherwise it + # continues running permanently and does not return until program exit. + # + # - #running? returns true after this is called, until #stop cause the + # the server to stop. + def run + if rpc_descs.size == 0 + logger.warn('did not run as no services were present') + return + end + @run_mutex.synchronize do + @running = true + @run_cond.signal + end + @pool.start + @server.start + server_tag = Object.new + until stopped? + @server.request_call(server_tag) + ev = @cq.pluck(server_tag, @poll_period) + next if ev.nil? + if ev.type != SERVER_RPC_NEW + logger.warn("bad evt: got:#{ev.type}, want:#{SERVER_RPC_NEW}") + ev.close + next end - @pool.start - @server.start - server_tag = Object.new - until stopped? - @server.request_call(server_tag) - ev = @cq.pluck(server_tag, @poll_period) - next if ev.nil? - if ev.type != SERVER_RPC_NEW - logger.warn("bad evt: got:#{ev.type}, want:#{SERVER_RPC_NEW}") - ev.close - next - end - c = new_active_server_call(ev.call, ev.result) - unless c.nil? - mth = ev.result.method.to_sym - ev.close - @pool.schedule(c) do |call| - rpc_descs[mth].run_server_method(call, rpc_handlers[mth]) - end + c = new_active_server_call(ev.call, ev.result) + unless c.nil? + mth = ev.result.method.to_sym + ev.close + @pool.schedule(c) do |call| + rpc_descs[mth].run_server_method(call, rpc_handlers[mth]) end end - @running = false end + @running = false + end - def new_active_server_call(call, new_server_rpc) - # Accept the call. This is necessary even if a status is to be sent - # back immediately - finished_tag = Object.new - call_queue = Core::CompletionQueue.new - call.metadata = new_server_rpc.metadata # store the metadata - call.server_accept(call_queue, finished_tag) - call.server_end_initial_metadata - - # Send UNAVAILABLE if there are too many unprocessed jobs - jobs_count, max = @pool.jobs_waiting, @max_waiting_requests - logger.info("waiting: #{jobs_count}, max: #{max}") - if @pool.jobs_waiting > @max_waiting_requests - logger.warn("NOT AVAILABLE: too many jobs_waiting: #{new_server_rpc}") - noop = proc { |x| x } - c = ActiveCall.new(call, call_queue, noop, noop, - new_server_rpc.deadline, - finished_tag: finished_tag) - c.send_status(StatusCodes::UNAVAILABLE, '') - return nil - end - - # Send NOT_FOUND if the method does not exist - mth = new_server_rpc.method.to_sym - unless rpc_descs.key?(mth) - logger.warn("NOT_FOUND: #{new_server_rpc}") - noop = proc { |x| x } - c = ActiveCall.new(call, call_queue, noop, noop, - new_server_rpc.deadline, - finished_tag: finished_tag) - c.send_status(StatusCodes::NOT_FOUND, '') - return nil - end + def new_active_server_call(call, new_server_rpc) + # Accept the call. This is necessary even if a status is to be sent + # back immediately + finished_tag = Object.new + call_queue = Core::CompletionQueue.new + call.metadata = new_server_rpc.metadata # store the metadata + call.server_accept(call_queue, finished_tag) + call.server_end_initial_metadata + + # Send UNAVAILABLE if there are too many unprocessed jobs + jobs_count, max = @pool.jobs_waiting, @max_waiting_requests + logger.info("waiting: #{jobs_count}, max: #{max}") + if @pool.jobs_waiting > @max_waiting_requests + logger.warn("NOT AVAILABLE: too many jobs_waiting: #{new_server_rpc}") + noop = proc { |x| x } + c = ActiveCall.new(call, call_queue, noop, noop, + new_server_rpc.deadline, + finished_tag: finished_tag) + c.send_status(StatusCodes::UNAVAILABLE, '') + return nil + end - # Create the ActiveCall - rpc_desc = rpc_descs[mth] - logger.info("deadline is #{new_server_rpc.deadline}; (now=#{Time.now})") - ActiveCall.new(call, call_queue, - rpc_desc.marshal_proc, rpc_desc.unmarshal_proc(:input), - new_server_rpc.deadline, finished_tag: finished_tag) + # Send NOT_FOUND if the method does not exist + mth = new_server_rpc.method.to_sym + unless rpc_descs.key?(mth) + logger.warn("NOT_FOUND: #{new_server_rpc}") + noop = proc { |x| x } + c = ActiveCall.new(call, call_queue, noop, noop, + new_server_rpc.deadline, + finished_tag: finished_tag) + c.send_status(StatusCodes::NOT_FOUND, '') + return nil end - # Pool is a simple thread pool for running server requests. - class Pool - def initialize(size) - fail 'pool size must be positive' unless size > 0 - @jobs = Queue.new - @size = size - @stopped = false - @stop_mutex = Mutex.new - @stop_cond = ConditionVariable.new - @workers = [] - end + # Create the ActiveCall + rpc_desc = rpc_descs[mth] + logger.info("deadline is #{new_server_rpc.deadline}; (now=#{Time.now})") + ActiveCall.new(call, call_queue, + rpc_desc.marshal_proc, rpc_desc.unmarshal_proc(:input), + new_server_rpc.deadline, finished_tag: finished_tag) + end - # Returns the number of jobs waiting - def jobs_waiting - @jobs.size - end + # Pool is a simple thread pool for running server requests. + class Pool + def initialize(size) + fail 'pool size must be positive' unless size > 0 + @jobs = Queue.new + @size = size + @stopped = false + @stop_mutex = Mutex.new + @stop_cond = ConditionVariable.new + @workers = [] + end - # Runs the given block on the queue with the provided args. - # - # @param args the args passed blk when it is called - # @param blk the block to call - def schedule(*args, &blk) - fail 'already stopped' if @stopped - return if blk.nil? - logger.info('schedule another job') - @jobs << [blk, args] - end + # Returns the number of jobs waiting + def jobs_waiting + @jobs.size + end + + # Runs the given block on the queue with the provided args. + # + # @param args the args passed blk when it is called + # @param blk the block to call + def schedule(*args, &blk) + fail 'already stopped' if @stopped + return if blk.nil? + logger.info('schedule another job') + @jobs << [blk, args] + end - # Starts running the jobs in the thread pool. - def start - fail 'already stopped' if @stopped - until @workers.size == @size.to_i - next_thread = Thread.new do - catch(:exit) do # allows { throw :exit } to kill a thread - loop do - begin - blk, args = @jobs.pop - blk.call(*args) - rescue StandardError => e - logger.warn('Error in worker thread') - logger.warn(e) - end + # Starts running the jobs in the thread pool. + def start + fail 'already stopped' if @stopped + until @workers.size == @size.to_i + next_thread = Thread.new do + catch(:exit) do # allows { throw :exit } to kill a thread + loop do + begin + blk, args = @jobs.pop + blk.call(*args) + rescue StandardError => e + logger.warn('Error in worker thread') + logger.warn(e) end end + end - # removes the threads from workers, and signal when all the - # threads are complete. - @stop_mutex.synchronize do - @workers.delete(Thread.current) - @stop_cond.signal if @workers.size == 0 - end + # removes the threads from workers, and signal when all the + # threads are complete. + @stop_mutex.synchronize do + @workers.delete(Thread.current) + @stop_cond.signal if @workers.size == 0 end - @workers << next_thread end + @workers << next_thread end + end - # Stops the jobs in the pool - def stop - logger.info('stopping, will wait for all the workers to exit') - @workers.size.times { schedule { throw :exit } } - @stopped = true + # Stops the jobs in the pool + def stop + logger.info('stopping, will wait for all the workers to exit') + @workers.size.times { schedule { throw :exit } } + @stopped = true - # TODO: allow configuration of the keepalive period - keep_alive = 5 - @stop_mutex.synchronize do - @stop_cond.wait(@stop_mutex, keep_alive) if @workers.size > 0 - end + # TODO: allow configuration of the keepalive period + keep_alive = 5 + @stop_mutex.synchronize do + @stop_cond.wait(@stop_mutex, keep_alive) if @workers.size > 0 + end - # Forcibly shutdown any threads that are still alive. - if @workers.size > 0 - logger.warn("forcibly terminating #{@workers.size} worker(s)") - @workers.each do |t| - next unless t.alive? - begin - t.exit - rescue StandardError => e - logger.warn('error while terminating a worker') - logger.warn(e) - end + # Forcibly shutdown any threads that are still alive. + if @workers.size > 0 + logger.warn("forcibly terminating #{@workers.size} worker(s)") + @workers.each do |t| + next unless t.alive? + begin + t.exit + rescue StandardError => e + logger.warn('error while terminating a worker') + logger.warn(e) end end - - logger.info('stopped, all workers are shutdown') end + + logger.info('stopped, all workers are shutdown') end + end - protected + protected - def rpc_descs - @rpc_descs ||= {} - end + def rpc_descs + @rpc_descs ||= {} + end - def rpc_handlers - @rpc_handlers ||= {} - end + def rpc_handlers + @rpc_handlers ||= {} + end - private + private - def assert_valid_service_class(cls) - unless cls.include?(GenericService) - fail "#{cls} should 'include GenericService'" - end - if cls.rpc_descs.size == 0 - fail "#{cls} should specify some rpc descriptions" - end - cls.assert_rpc_descs_have_methods + def assert_valid_service_class(cls) + unless cls.include?(GenericService) + fail "#{cls} should 'include GenericService'" + end + if cls.rpc_descs.size == 0 + fail "#{cls} should specify some rpc descriptions" end + cls.assert_rpc_descs_have_methods + end - def add_rpc_descs_for(service) - cls = service.is_a?(Class) ? service : service.class - specs = rpc_descs - handlers = rpc_handlers - cls.rpc_descs.each_pair do |name, spec| - route = "/#{cls.service_name}/#{name}".to_sym - if specs.key? route - fail "Cannot add rpc #{route} from #{spec}, already registered" + def add_rpc_descs_for(service) + cls = service.is_a?(Class) ? service : service.class + specs = rpc_descs + handlers = rpc_handlers + cls.rpc_descs.each_pair do |name, spec| + route = "/#{cls.service_name}/#{name}".to_sym + if specs.key? route + fail "Cannot add rpc #{route} from #{spec}, already registered" + else + specs[route] = spec + if service.is_a?(Class) + handlers[route] = cls.new.method(name.to_s.underscore.to_sym) else - specs[route] = spec - if service.is_a?(Class) - handlers[route] = cls.new.method(name.to_s.underscore.to_sym) - else - handlers[route] = service.method(name.to_s.underscore.to_sym) - end - logger.info("handling #{route} with #{handlers[route]}") + handlers[route] = service.method(name.to_s.underscore.to_sym) end + logger.info("handling #{route} with #{handlers[route]}") end end end diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index ff37617ccfa..f0b85a0fa20 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -48,188 +48,186 @@ class String end end -module Google - # Google::RPC contains the General RPC module. - module RPC - # Provides behaviour used to implement schema-derived service classes. - # - # Is intended to be used to support both client and server - # IDL-schema-derived servers. - module GenericService - # Used to indicate that a name has already been specified - class DuplicateRpcName < StandardError - def initialize(name) - super("rpc (#{name}) is already defined") - end +# GRPC contains the General RPC module. +module GRPC + # Provides behaviour used to implement schema-derived service classes. + # + # Is intended to be used to support both client and server + # IDL-schema-derived servers. + module GenericService + # Used to indicate that a name has already been specified + class DuplicateRpcName < StandardError + def initialize(name) + super("rpc (#{name}) is already defined") end + end - # Provides a simple DSL to describe RPC services. + # Provides a simple DSL to describe RPC services. + # + # E.g, a Maths service that uses the serializable messages DivArgs, + # DivReply and Num might define its endpoint uses the following way: + # + # rpc :div DivArgs, DivReply # single request, single response + # rpc :sum stream(Num), Num # streamed input, single response + # rpc :fib FibArgs, stream(Num) # single request, streamed response + # rpc :div_many stream(DivArgs), stream(DivReply) + # # streamed req and resp + # + # Each 'rpc' adds an RpcDesc to classes including this module, and + # #assert_rpc_descs_have_methods is used to ensure the including class + # provides methods with signatures that support all the descriptors. + module Dsl + # This configures the method names that the serializable message + # implementation uses to marshal and unmarshal messages. # - # E.g, a Maths service that uses the serializable messages DivArgs, - # DivReply and Num might define its endpoint uses the following way: + # - unmarshal_class method must be a class method on the serializable + # message type that takes a string (byte stream) and produces and object # - # rpc :div DivArgs, DivReply # single request, single response - # rpc :sum stream(Num), Num # streamed input, single response - # rpc :fib FibArgs, stream(Num) # single request, streamed response - # rpc :div_many stream(DivArgs), stream(DivReply) - # # streamed req and resp + # - marshal_class_method is called on a serializable message instance + # and produces a serialized string. # - # Each 'rpc' adds an RpcDesc to classes including this module, and - # #assert_rpc_descs_have_methods is used to ensure the including class - # provides methods with signatures that support all the descriptors. - module Dsl - # This configures the method names that the serializable message - # implementation uses to marshal and unmarshal messages. - # - # - unmarshal_class method must be a class method on the serializable - # message type that takes a string (byte stream) and produces and object - # - # - marshal_class_method is called on a serializable message instance - # and produces a serialized string. - # - # The Dsl verifies that the types in the descriptor have both the - # unmarshal and marshal methods. - attr_writer(:marshal_class_method, :unmarshal_class_method) - - # This allows configuration of the service name. - attr_accessor(:service_name) - - # Adds an RPC spec. - # - # Takes the RPC name and the classes representing the types to be - # serialized, and adds them to the including classes rpc_desc hash. - # - # input and output should both have the methods #marshal and #unmarshal - # that are responsible for writing and reading an object instance from a - # byte buffer respectively. - # - # @param name [String] the name of the rpc - # @param input [Object] the input parameter's class - # @param output [Object] the output parameter's class - def rpc(name, input, output) - fail(DuplicateRpcName, name) if rpc_descs.key? name - assert_can_marshal(input) - assert_can_marshal(output) - rpc_descs[name] = RpcDesc.new(name, input, output, - marshal_class_method, - unmarshal_class_method) - end + # The Dsl verifies that the types in the descriptor have both the + # unmarshal and marshal methods. + attr_writer(:marshal_class_method, :unmarshal_class_method) - def inherited(subclass) - # Each subclass should have a distinct class variable with its own - # rpc_descs - subclass.rpc_descs.merge!(rpc_descs) - subclass.service_name = service_name - end + # This allows configuration of the service name. + attr_accessor(:service_name) - # the name of the instance method used to marshal events to a byte - # stream. - def marshal_class_method - @marshal_class_method ||= :marshal - end + # Adds an RPC spec. + # + # Takes the RPC name and the classes representing the types to be + # serialized, and adds them to the including classes rpc_desc hash. + # + # input and output should both have the methods #marshal and #unmarshal + # that are responsible for writing and reading an object instance from a + # byte buffer respectively. + # + # @param name [String] the name of the rpc + # @param input [Object] the input parameter's class + # @param output [Object] the output parameter's class + def rpc(name, input, output) + fail(DuplicateRpcName, name) if rpc_descs.key? name + assert_can_marshal(input) + assert_can_marshal(output) + rpc_descs[name] = RpcDesc.new(name, input, output, + marshal_class_method, + unmarshal_class_method) + end - # the name of the class method used to unmarshal from a byte stream. - def unmarshal_class_method - @unmarshal_class_method ||= :unmarshal - end + def inherited(subclass) + # Each subclass should have a distinct class variable with its own + # rpc_descs + subclass.rpc_descs.merge!(rpc_descs) + subclass.service_name = service_name + end - def assert_can_marshal(cls) - cls = cls.type if cls.is_a? RpcDesc::Stream - mth = unmarshal_class_method - unless cls.methods.include? mth - fail(ArgumentError, "#{cls} needs #{cls}.#{mth}") - end - mth = marshal_class_method - return if cls.methods.include? mth + # the name of the instance method used to marshal events to a byte + # stream. + def marshal_class_method + @marshal_class_method ||= :marshal + end + + # the name of the class method used to unmarshal from a byte stream. + def unmarshal_class_method + @unmarshal_class_method ||= :unmarshal + end + + def assert_can_marshal(cls) + cls = cls.type if cls.is_a? RpcDesc::Stream + mth = unmarshal_class_method + unless cls.methods.include? mth fail(ArgumentError, "#{cls} needs #{cls}.#{mth}") end + mth = marshal_class_method + return if cls.methods.include? mth + fail(ArgumentError, "#{cls} needs #{cls}.#{mth}") + end - # @param cls [Class] the class of a serializable type - # @return cls wrapped in a RpcDesc::Stream - def stream(cls) - assert_can_marshal(cls) - RpcDesc::Stream.new(cls) - end + # @param cls [Class] the class of a serializable type + # @return cls wrapped in a RpcDesc::Stream + def stream(cls) + assert_can_marshal(cls) + RpcDesc::Stream.new(cls) + end - # the RpcDescs defined for this GenericService, keyed by name. - def rpc_descs - @rpc_descs ||= {} - end + # the RpcDescs defined for this GenericService, keyed by name. + def rpc_descs + @rpc_descs ||= {} + end - # Creates a rpc client class with methods for accessing the methods - # currently in rpc_descs. - def rpc_stub_class - descs = rpc_descs - route_prefix = service_name - Class.new(ClientStub) do - # @param host [String] the host the stub connects to - # @param kw [KeywordArgs] the channel arguments, plus any optional - # args for configuring the client's channel - def initialize(host, **kw) - super(host, Core::CompletionQueue.new, **kw) - end + # Creates a rpc client class with methods for accessing the methods + # currently in rpc_descs. + def rpc_stub_class + descs = rpc_descs + route_prefix = service_name + Class.new(ClientStub) do + # @param host [String] the host the stub connects to + # @param kw [KeywordArgs] the channel arguments, plus any optional + # args for configuring the client's channel + def initialize(host, **kw) + super(host, Core::CompletionQueue.new, **kw) + end - # Used define_method to add a method for each rpc_desc. Each method - # calls the base class method for the given descriptor. - descs.each_pair do |name, desc| - mth_name = name.to_s.underscore.to_sym - marshal = desc.marshal_proc - unmarshal = desc.unmarshal_proc(:output) - route = "/#{route_prefix}/#{name}" - if desc.request_response? - define_method(mth_name) do |req, deadline = nil| - logger.debug("calling #{@host}:#{route}") - request_response(route, req, marshal, unmarshal, deadline) - end - elsif desc.client_streamer? - define_method(mth_name) do |reqs, deadline = nil| - logger.debug("calling #{@host}:#{route}") - client_streamer(route, reqs, marshal, unmarshal, deadline) - end - elsif desc.server_streamer? - define_method(mth_name) do |req, deadline = nil, &blk| - logger.debug("calling #{@host}:#{route}") - server_streamer(route, req, marshal, unmarshal, deadline, - &blk) - end - else # is a bidi_stream - define_method(mth_name) do |reqs, deadline = nil, &blk| - logger.debug("calling #{@host}:#{route}") - bidi_streamer(route, reqs, marshal, unmarshal, deadline, &blk) - end + # Used define_method to add a method for each rpc_desc. Each method + # calls the base class method for the given descriptor. + descs.each_pair do |name, desc| + mth_name = name.to_s.underscore.to_sym + marshal = desc.marshal_proc + unmarshal = desc.unmarshal_proc(:output) + route = "/#{route_prefix}/#{name}" + if desc.request_response? + define_method(mth_name) do |req, deadline = nil| + logger.debug("calling #{@host}:#{route}") + request_response(route, req, marshal, unmarshal, deadline) + end + elsif desc.client_streamer? + define_method(mth_name) do |reqs, deadline = nil| + logger.debug("calling #{@host}:#{route}") + client_streamer(route, reqs, marshal, unmarshal, deadline) + end + elsif desc.server_streamer? + define_method(mth_name) do |req, deadline = nil, &blk| + logger.debug("calling #{@host}:#{route}") + server_streamer(route, req, marshal, unmarshal, deadline, + &blk) + end + else # is a bidi_stream + define_method(mth_name) do |reqs, deadline = nil, &blk| + logger.debug("calling #{@host}:#{route}") + bidi_streamer(route, reqs, marshal, unmarshal, deadline, &blk) end end end end + end - # Asserts that the appropriate methods are defined for each added rpc - # spec. Is intended to aid verifying that server classes are correctly - # implemented. - def assert_rpc_descs_have_methods - rpc_descs.each_pair do |m, spec| - mth_name = m.to_s.underscore.to_sym - unless instance_methods.include?(mth_name) - fail "#{self} does not provide instance method '#{mth_name}'" - end - spec.assert_arity_matches(instance_method(mth_name)) + # Asserts that the appropriate methods are defined for each added rpc + # spec. Is intended to aid verifying that server classes are correctly + # implemented. + def assert_rpc_descs_have_methods + rpc_descs.each_pair do |m, spec| + mth_name = m.to_s.underscore.to_sym + unless instance_methods.include?(mth_name) + fail "#{self} does not provide instance method '#{mth_name}'" end + spec.assert_arity_matches(instance_method(mth_name)) end end + end - def self.included(o) - o.extend(Dsl) - # Update to the use the service name including module. Proivde a default - # that can be nil e,g. when modules are declared dynamically. - return unless o.service_name.nil? - if o.name.nil? - o.service_name = 'GenericService' + def self.included(o) + o.extend(Dsl) + # Update to the use the service name including module. Proivde a default + # that can be nil e,g. when modules are declared dynamically. + return unless o.service_name.nil? + if o.name.nil? + o.service_name = 'GenericService' + else + modules = o.name.split('::') + if modules.length > 2 + o.service_name = modules[modules.length - 2] else - modules = o.name.split('::') - if modules.length > 2 - o.service_name = modules[modules.length - 2] - else - o.service_name = modules.first - end + o.service_name = modules.first end end end diff --git a/src/ruby/lib/grpc/logconfig.rb b/src/ruby/lib/grpc/logconfig.rb index 6442f23e895..cf280feae64 100644 --- a/src/ruby/lib/grpc/logconfig.rb +++ b/src/ruby/lib/grpc/logconfig.rb @@ -35,6 +35,6 @@ Logging.logger.root.appenders = Logging.appenders.stdout Logging.logger.root.level = :info # TODO: provide command-line configuration for logging -Logging.logger['Google::RPC'].level = :debug -Logging.logger['Google::RPC::ActiveCall'].level = :info -Logging.logger['Google::RPC::BidiCall'].level = :info +Logging.logger['GRPC'].level = :debug +Logging.logger['GRPC::ActiveCall'].level = :info +Logging.logger['GRPC::BidiCall'].level = :info diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index dd526e583a6..0107bc4ada0 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -27,9 +27,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -module Google - # Google::RPC contains the General RPC module. - module RPC - VERSION = '0.0.1' - end +# GRPC contains the General RPC module. +module GRPC + VERSION = '0.0.1' end diff --git a/src/ruby/spec/auth/compute_engine_spec.rb b/src/ruby/spec/auth/compute_engine_spec.rb index 9e0b4660fa5..c43214d0861 100644 --- a/src/ruby/spec/auth/compute_engine_spec.rb +++ b/src/ruby/spec/auth/compute_engine_spec.rb @@ -36,9 +36,9 @@ require 'faraday' require 'grpc/auth/compute_engine' require 'spec_helper' -describe Google::RPC::Auth::GCECredentials do +describe GRPC::Auth::GCECredentials do MD_URI = '/computeMetadata/v1/instance/service-accounts/default/token' - GCECredentials = Google::RPC::Auth::GCECredentials + GCECredentials = GRPC::Auth::GCECredentials before(:example) do @client = GCECredentials.new diff --git a/src/ruby/spec/auth/service_account_spec.rb b/src/ruby/spec/auth/service_account_spec.rb index cbc6a73ac20..2f14a1ae053 100644 --- a/src/ruby/spec/auth/service_account_spec.rb +++ b/src/ruby/spec/auth/service_account_spec.rb @@ -38,7 +38,7 @@ require 'multi_json' require 'openssl' require 'spec_helper' -describe Google::RPC::Auth::ServiceAccountCredentials do +describe GRPC::Auth::ServiceAccountCredentials do before(:example) do @key = OpenSSL::PKey::RSA.new(2048) cred_json = { @@ -49,7 +49,7 @@ describe Google::RPC::Auth::ServiceAccountCredentials do type: 'service_account' } cred_json_text = MultiJson.dump(cred_json) - @client = Google::RPC::Auth::ServiceAccountCredentials.new( + @client = GRPC::Auth::ServiceAccountCredentials.new( 'https://www.googleapis.com/auth/userinfo.profile', StringIO.new(cred_json_text)) end From 91be1a8d61b69a11af65ceba70428a7bb7640b80 Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Tue, 17 Feb 2015 18:44:22 -0800 Subject: [PATCH 128/232] Adding new tests into docker runs --- tools/gce_setup/cloud_prod_runner.sh | 2 +- tools/gce_setup/grpc_docker.sh | 6 +++--- tools/gce_setup/interop_test_runner.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index 200f859ede5..2abbc8d3cc6 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -2,7 +2,7 @@ main() { source grpc_docker.sh - test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming) + test_cases=(large_unary empty_unary client_streaming server_streaming service_account_creds compute_engine_creds) clients=(cxx java go ruby node) for test_case in "${test_cases[@]}" do diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 1c38582cb81..eecb37a6ee1 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -321,7 +321,7 @@ grpc_interop_test_flags() { echo "$FUNCNAME: missing arg: test_case" 1>&2 return 1 } - echo "--server_host_override=foo.test.google.fr --server_host=$server_ip --server_port=$port --test_case=$test_case" + echo "--server_host=$server_ip --server_port=$port --test_case=$test_case" } # checks the positional args and assigns them to variables visible in the caller @@ -945,7 +945,7 @@ grpc_cloud_prod_auth_compute_engine_creds_gen_ruby_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_interop_gen_go_cmd() { local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd /go/src/github.com/google/grpc-go/rpc/interop/client" + local test_script="cd src/google.golang.org/grpc/interop/client" local test_script+=" && go run client.go --use_tls=true" local the_cmd="$cmd_prefix '$test_script $@'" echo $the_cmd @@ -958,7 +958,7 @@ grpc_interop_gen_go_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_cloud_prod_gen_go_cmd() { local cmd_prefix="sudo docker run grpc/go /bin/bash -c" - local test_script="cd /go/src/github.com/google/grpc-go/rpc/interop/client" + local test_script="cd src/google.golang.org/grpc/interop/client" local test_script+=" && go run client.go --use_tls=true" local gfe_flags=" --tls_ca_file=\"\" --tls_server_name=\"\" --server_port=443 --server_host=grpc-test.sandbox.google.com" local the_cmd="$cmd_prefix '$test_script $gfe_flags $@'" diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index 9ddbac75aa5..060e07034c7 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -6,7 +6,7 @@ echo $result_file_name main() { source grpc_docker.sh - test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming) + test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming cancel_after_being cancel_after_first_response) clients=(cxx java go ruby node) servers=(cxx java go ruby node python) for test_case in "${test_cases[@]}" From d1a8cc082acac3a01defa365b1ae98bc40c5ea3a Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 17 Feb 2015 19:24:36 -0800 Subject: [PATCH 129/232] Adds podspec for RxLibrary and sample app --- src/objective-c/.gitignore | 18 + src/objective-c/RxLibrary/RxLibrary.podspec | 12 + src/objective-c/examples/Sample/Podfile | 12 + src/objective-c/examples/Sample/Podfile.lock | 14 + .../Public/RxLibrary/GRXImmediateWriter.h | 1 + .../Headers/Public/RxLibrary/GRXWriteable.h | 1 + .../Public/RxLibrary/GRXWriter+Immediate.h | 1 + .../RxLibrary/GRXWriter+Transformations.h | 1 + .../Pods/Headers/Public/RxLibrary/GRXWriter.h | 1 + .../Public/RxLibrary/NSEnumerator+GRXUtil.h | 1 + .../Pods/Local Podspecs/RxLibrary.podspec | 12 + .../examples/Sample/Pods/Manifest.lock | 14 + .../Pods/Pods.xcodeproj/project.pbxproj | 2568 +++++++++++++++++ .../Pods-RxLibrary-Private.xcconfig | 5 + .../Pods-RxLibrary/Pods-RxLibrary-dummy.m | 5 + .../Pods-RxLibrary/Pods-RxLibrary-prefix.pch | 5 + .../Pods-RxLibrary/Pods-RxLibrary.xcconfig | 0 .../Pods-Sample-RxLibrary-Private.xcconfig | 5 + .../Pods-Sample-RxLibrary-dummy.m | 5 + .../Pods-Sample-RxLibrary-prefix.pch | 5 + .../Pods-Sample-RxLibrary.xcconfig | 0 .../Pods-Sample-acknowledgements.markdown | 3 + .../Pods-Sample-acknowledgements.plist | 29 + .../Pods-Sample/Pods-Sample-dummy.m | 5 + .../Pods-Sample/Pods-Sample-environment.h | 14 + .../Pods-Sample/Pods-Sample-resources.sh | 74 + .../Pods-Sample/Pods-Sample.debug.xcconfig | 6 + .../Pods-Sample/Pods-Sample.release.xcconfig | 6 + ...ods-SampleTests-RxLibrary-Private.xcconfig | 5 + .../Pods-SampleTests-RxLibrary-dummy.m | 5 + .../Pods-SampleTests-RxLibrary-prefix.pch | 5 + .../Pods-SampleTests-RxLibrary.xcconfig | 0 ...Pods-SampleTests-acknowledgements.markdown | 3 + .../Pods-SampleTests-acknowledgements.plist | 29 + .../Pods-SampleTests/Pods-SampleTests-dummy.m | 5 + .../Pods-SampleTests-environment.h | 14 + .../Pods-SampleTests-resources.sh | 74 + .../Pods-SampleTests.debug.xcconfig | 6 + .../Pods-SampleTests.release.xcconfig | 6 + .../Pods/Pods-acknowledgements.markdown | 3 + .../Pods/Pods-acknowledgements.plist | 29 + .../Target Support Files/Pods/Pods-dummy.m | 5 + .../Pods/Pods-environment.h | 14 + .../Pods/Pods-resources.sh | 74 + .../Pods/Pods.debug.xcconfig | 6 + .../Pods/Pods.release.xcconfig | 6 + src/objective-c/examples/Sample/README.md | 2 + .../Sample/Sample.xcodeproj/project.pbxproj | 955 ++++++ .../contents.xcworkspacedata | 7 + .../contents.xcworkspacedata | 10 + .../examples/Sample/Sample/AppDelegate.h | 17 + .../examples/Sample/Sample/AppDelegate.m | 45 + .../Sample/Sample/Base.lproj/LaunchScreen.xib | 41 + .../Sample/Sample/Base.lproj/Main.storyboard | 25 + .../AppIcon.appiconset/Contents.json | 68 + .../examples/Sample/Sample/Info.plist | 47 + .../examples/Sample/Sample/ViewController.h | 15 + .../examples/Sample/Sample/ViewController.m | 27 + src/objective-c/examples/Sample/Sample/main.m | 16 + .../examples/Sample/SampleTests/Info.plist | 24 + .../examples/Sample/SampleTests/SampleTests.m | 40 + 61 files changed, 4451 insertions(+) create mode 100644 src/objective-c/.gitignore create mode 100644 src/objective-c/RxLibrary/RxLibrary.podspec create mode 100644 src/objective-c/examples/Sample/Podfile create mode 100644 src/objective-c/examples/Sample/Podfile.lock create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXImmediateWriter.h create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriteable.h create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Immediate.h create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Transformations.h create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter.h create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/NSEnumerator+GRXUtil.h create mode 100644 src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec create mode 100644 src/objective-c/examples/Sample/Pods/Manifest.lock create mode 100644 src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-Private.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.markdown create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.plist create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-environment.h create mode 100755 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.markdown create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.plist create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-environment.h create mode 100755 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-resources.sh create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.debug.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.release.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-dummy.m create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-environment.h create mode 100755 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-resources.sh create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.debug.xcconfig create mode 100644 src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.release.xcconfig create mode 100644 src/objective-c/examples/Sample/README.md create mode 100644 src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj create mode 100644 src/objective-c/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 src/objective-c/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata create mode 100644 src/objective-c/examples/Sample/Sample/AppDelegate.h create mode 100644 src/objective-c/examples/Sample/Sample/AppDelegate.m create mode 100644 src/objective-c/examples/Sample/Sample/Base.lproj/LaunchScreen.xib create mode 100644 src/objective-c/examples/Sample/Sample/Base.lproj/Main.storyboard create mode 100644 src/objective-c/examples/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 src/objective-c/examples/Sample/Sample/Info.plist create mode 100644 src/objective-c/examples/Sample/Sample/ViewController.h create mode 100644 src/objective-c/examples/Sample/Sample/ViewController.m create mode 100644 src/objective-c/examples/Sample/Sample/main.m create mode 100644 src/objective-c/examples/Sample/SampleTests/Info.plist create mode 100644 src/objective-c/examples/Sample/SampleTests/SampleTests.m diff --git a/src/objective-c/.gitignore b/src/objective-c/.gitignore new file mode 100644 index 00000000000..ec839c09ebd --- /dev/null +++ b/src/objective-c/.gitignore @@ -0,0 +1,18 @@ +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate diff --git a/src/objective-c/RxLibrary/RxLibrary.podspec b/src/objective-c/RxLibrary/RxLibrary.podspec new file mode 100644 index 00000000000..4e1f64e35f5 --- /dev/null +++ b/src/objective-c/RxLibrary/RxLibrary.podspec @@ -0,0 +1,12 @@ +Pod::Spec.new do |s| + s.name = 'RxLibrary' + s.version = '0.0.1' + s.summary = 'Reactive Extensions library for iOS' + s.author = { + 'Jorge Canizales' => 'jcanizales@google.com' + } + s.source_files = '*.{h,m}' + s.platform = :ios + s.ios.deployment_target = '6.0' + s.requires_arc = true +end diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile new file mode 100644 index 00000000000..fa989879102 --- /dev/null +++ b/src/objective-c/examples/Sample/Podfile @@ -0,0 +1,12 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +pod 'RxLibrary', :path => "../../RxLibrary" + +target 'Sample' do + +end + +target 'SampleTests' do + +end diff --git a/src/objective-c/examples/Sample/Podfile.lock b/src/objective-c/examples/Sample/Podfile.lock new file mode 100644 index 00000000000..9bc407dafab --- /dev/null +++ b/src/objective-c/examples/Sample/Podfile.lock @@ -0,0 +1,14 @@ +PODS: + - RxLibrary (0.0.1) + +DEPENDENCIES: + - RxLibrary (from `../../RxLibrary`) + +EXTERNAL SOURCES: + RxLibrary: + :path: ../../RxLibrary + +SPEC CHECKSUMS: + RxLibrary: fc24868ee72616e8c4e58128b439811fdade0da4 + +COCOAPODS: 0.35.0 diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXImmediateWriter.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXImmediateWriter.h new file mode 120000 index 00000000000..915b0e4f90a --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXImmediateWriter.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/GRXImmediateWriter.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriteable.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriteable.h new file mode 120000 index 00000000000..cb275199fce --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriteable.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/GRXWriteable.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Immediate.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Immediate.h new file mode 120000 index 00000000000..fe5e740afbc --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Immediate.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/GRXWriter+Immediate.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Transformations.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Transformations.h new file mode 120000 index 00000000000..c57168c9efd --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter+Transformations.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/GRXWriter+Transformations.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter.h new file mode 120000 index 00000000000..c4f657e5678 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXWriter.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/GRXWriter.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/NSEnumerator+GRXUtil.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/NSEnumerator+GRXUtil.h new file mode 120000 index 00000000000..97c6aaeeecc --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/NSEnumerator+GRXUtil.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/NSEnumerator+GRXUtil.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec b/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec new file mode 100644 index 00000000000..4e1f64e35f5 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec @@ -0,0 +1,12 @@ +Pod::Spec.new do |s| + s.name = 'RxLibrary' + s.version = '0.0.1' + s.summary = 'Reactive Extensions library for iOS' + s.author = { + 'Jorge Canizales' => 'jcanizales@google.com' + } + s.source_files = '*.{h,m}' + s.platform = :ios + s.ios.deployment_target = '6.0' + s.requires_arc = true +end diff --git a/src/objective-c/examples/Sample/Pods/Manifest.lock b/src/objective-c/examples/Sample/Pods/Manifest.lock new file mode 100644 index 00000000000..9bc407dafab --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Manifest.lock @@ -0,0 +1,14 @@ +PODS: + - RxLibrary (0.0.1) + +DEPENDENCIES: + - RxLibrary (from `../../RxLibrary`) + +EXTERNAL SOURCES: + RxLibrary: + :path: ../../RxLibrary + +SPEC CHECKSUMS: + RxLibrary: fc24868ee72616e8c4e58128b439811fdade0da4 + +COCOAPODS: 0.35.0 diff --git a/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..426cb991de2 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,2568 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 00061C3922BA01C61542886C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXWriter+Immediate.m + sourceTree + <group> + + 0014294E408866C876275712 + + fileRef + 00061C3922BA01C61542886C + isa + PBXBuildFile + + 033F82759B99EF3786C6C3AB + + fileRef + EBD4E0AE1D9C793A8420AA8F + isa + PBXBuildFile + + 073184615871F8C7E53BF14F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-RxLibrary.xcconfig + sourceTree + <group> + + 074C7BFE33E5A8B65490CD74 + + fileRef + 6C69DB42AABCB52A9652A925 + isa + PBXBuildFile + + 0D88B5DF071D95A30D664FF6 + + fileRef + 00061C3922BA01C61542886C + isa + PBXBuildFile + + 0E76C0DE38838984ADBE9793 + + isa + PBXTargetDependency + name + Pods-Sample-RxLibrary + target + 5D62B0B091242C70E6F86CAF + targetProxy + 6CE91202B3CB22AD98A8D8DD + + 0E77891D6F14157CEFE7E0AB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-Sample-RxLibrary-Private.xcconfig + path + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig + sourceTree + <group> + + 0EF90C125A8C853D6900067E + + buildActionMask + 2147483647 + files + + A9657244C4119ECE09EE0780 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 0F54B7DB9C41BEA754222626 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-SampleTests-acknowledgements.plist + sourceTree + <group> + + 10420B1B517C0F7BFC1629D6 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + Pods-SampleTests-RxLibrary-prefix.pch + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + sourceTree + <group> + + 17882F47BB3F8879EADC6877 + + children + + ED20D5EB599CC4E0E8E6F6F4 + B960F8B548AAFF747493F848 + 6C69DB42AABCB52A9652A925 + C0AFDE847E9A73FB99BE85CA + B3E633C4D93071411657B4CC + BA6147A19780CE00E1877F27 + E025FBABACF462C5EDEB8F04 + + isa + PBXGroup + name + Pods + path + Target Support Files/Pods + sourceTree + <group> + + 17B62DC84258EA204EC14FC6 + + isa + PBXTargetDependency + name + Pods-SampleTests-RxLibrary + target + 9EED35B98793FD4884D527D7 + targetProxy + AD71151A44A1A6BB85C70D05 + + 1A919D1671FBC2A501B2B80E + + buildConfigurations + + 79FAE9523C4CB0EF1158F9A0 + 3FCF54B65C82686C35E6A695 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 1B96F18B31A3C8F512494663 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriteable.h + sourceTree + <group> + + 1D0CED76BEB5A08AE74DA509 + + fileRef + BD301B295FA10BA71944E6A7 + isa + PBXBuildFile + + 1DD32401F91AA06C7AC30E87 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-Sample.release.xcconfig + sourceTree + <group> + + 1E52CE0A26CA218416895820 + + fileRef + 1B96F18B31A3C8F512494663 + isa + PBXBuildFile + + 1F4EFE5811548D073C9AE7F7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXWriter+Transformations.m + sourceTree + <group> + + 20FAE2C205A83A18304F55D3 + + buildConfigurationList + 3CED27F6BA01528C8C816522 + buildPhases + + 5E942AABDFCC15C6D8A85F77 + EEDF7C277603B79A9BE8324B + + buildRules + + dependencies + + 7E0A207ED9A829B259BAF98E + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + 6F8086848D877F06E765F3B6 + productType + com.apple.product-type.library.static + + 2439530CF70B0AEDF7D20F2F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXImmediateWriter.h + sourceTree + <group> + + 246FBFA8A2E45D74C161F0D4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriter.h + sourceTree + <group> + + 251E2B5CA237FEEC44071A78 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + ONLY_ACTIVE_ARCH + YES + STRIP_INSTALLED_PRODUCT + NO + + isa + XCBuildConfiguration + name + Debug + + 2536F48732661916E7F98AF4 + + fileRef + 246FBFA8A2E45D74C161F0D4 + isa + PBXBuildFile + + 25515F1B6F5C5FC0FC5B2023 + + baseConfigurationReference + BA6147A19780CE00E1877F27 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 26766544901BC361ADA15529 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-Sample.debug.xcconfig + sourceTree + <group> + + 281E734DE47EFFBE3BF9EB6D + + fileRef + 2439530CF70B0AEDF7D20F2F + isa + PBXBuildFile + + 2BBE3F72E34FB1C4FCE57F41 + + buildConfigurations + + BD0C47F343CA107135A8B9F2 + 636DF1F4C61C5AA7645709FA + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 2D16B1B846727EA61BFB6D3F + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + 2D6F8181094C5DE060DD3540 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + name + Podfile + path + ../Podfile + sourceTree + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + 2D9FCC93E8EC668156F428D9 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXImmediateWriter.m + sourceTree + <group> + + 2E1D14017CD6D1DF2F25DA2E + + fileRef + 816CFE69CF10239B3EFBCBF1 + isa + PBXBuildFile + + 34547F4C6AC4B31274C6887D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-SampleTests-environment.h + sourceTree + <group> + + 34C114FAF0ED12406E0FFB5F + + fileRef + 1F4EFE5811548D073C9AE7F7 + isa + PBXBuildFile + + 3538730220221D8890A16973 + + fileRef + EBD4E0AE1D9C793A8420AA8F + isa + PBXBuildFile + + 359EFFFF445825D09A49A284 + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + 388A0A86C10335BD8BA6069B + + baseConfigurationReference + 26766544901BC361ADA15529 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 3BE0763D6A2984A3588C51F3 + + buildActionMask + 2147483647 + files + + A6364C40CAC538ABF3DDE60C + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 3C53511285FA3AEF9ACE450F + + buildActionMask + 2147483647 + files + + FD4FDDAA137AAC4ECC193E65 + 1E52CE0A26CA218416895820 + 033F82759B99EF3786C6C3AB + CA58438D9F3E61D68DE07BB0 + A8484F554272234EC1DA0229 + A5F3698797D4DA1AFBCA61F0 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 3CED27F6BA01528C8C816522 + + buildConfigurations + + 25515F1B6F5C5FC0FC5B2023 + 6C8561D023F024FB9671765B + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 3E250631C4B54FA19123352E + + fileRef + 2D9FCC93E8EC668156F428D9 + isa + PBXBuildFile + + 3FCF54B65C82686C35E6A695 + + baseConfigurationReference + 0E77891D6F14157CEFE7E0AB + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 402AEA377C3925F10F39E9CB + + fileRef + 816CFE69CF10239B3EFBCBF1 + isa + PBXBuildFile + + 446E4587689AB45B32C6B76A + + fileRef + 00061C3922BA01C61542886C + isa + PBXBuildFile + + 44B1E75D8EFE8AED04C78FB7 + + fileRef + D44C1815FF998CE19AF260F7 + isa + PBXBuildFile + + 44EAD826ACB27F88B80500A1 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-Sample.a + sourceTree + BUILT_PRODUCTS_DIR + + 4545C1984951202819F52915 + + fileRef + 246FBFA8A2E45D74C161F0D4 + isa + PBXBuildFile + + 46C034308E68A95A172FD281 + + fileRef + 2D9FCC93E8EC668156F428D9 + isa + PBXBuildFile + + 46E75B83BEFA486A489F2FB5 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-SampleTests-RxLibrary.xcconfig + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig + sourceTree + <group> + + 477CC2FC7C249C2918424B8D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-SampleTests.release.xcconfig + sourceTree + <group> + + 4BB07CE9F73F22C44B89EC9F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXWriter.m + sourceTree + <group> + + 502BB8D05700DD95603B152D + + fileRef + 816CFE69CF10239B3EFBCBF1 + isa + PBXBuildFile + + 53DFD2191AC1853EC39421DF + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + Pods-Sample-RxLibrary-prefix.pch + path + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch + sourceTree + <group> + + 548BF298DFD0AB1E85BFD224 + + buildActionMask + 2147483647 + files + + 359EFFFF445825D09A49A284 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 55F613C8D46B4C3EE36596A4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-Sample-environment.h + sourceTree + <group> + + 569EE7C2B5DC944C87116DDD + + buildActionMask + 2147483647 + files + + BCF96ACB49A4C581F6C4FB72 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 5C1A6CAF7D4B0AADC6E86AB5 + + baseConfigurationReference + 70699B620DD649C9FC80B596 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 5D485A8180289AB7135979D4 + + children + + 2439530CF70B0AEDF7D20F2F + 2D9FCC93E8EC668156F428D9 + 1B96F18B31A3C8F512494663 + 816CFE69CF10239B3EFBCBF1 + 246FBFA8A2E45D74C161F0D4 + 4BB07CE9F73F22C44B89EC9F + EBD4E0AE1D9C793A8420AA8F + 00061C3922BA01C61542886C + D13801CD3BED29EB3EB28C87 + 1F4EFE5811548D073C9AE7F7 + BD301B295FA10BA71944E6A7 + D44C1815FF998CE19AF260F7 + D2B713C74AFBCA4A9C709F44 + + isa + PBXGroup + name + RxLibrary + path + ../../../RxLibrary + sourceTree + <group> + + 5D62B0B091242C70E6F86CAF + + buildConfigurationList + 1A919D1671FBC2A501B2B80E + buildPhases + + 80BFFCFE10F415F6D4AA05BD + 3BE0763D6A2984A3588C51F3 + C099EA9920009567F1CC8E6F + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-Sample-RxLibrary + productName + Pods-Sample-RxLibrary + productReference + B5E5D1402D71983EBFCAC80A + productType + com.apple.product-type.library.static + + 5E942AABDFCC15C6D8A85F77 + + buildActionMask + 2147483647 + files + + 074C7BFE33E5A8B65490CD74 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6269A76A3AFAD59C7AE98E1E + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-SampleTests.a + sourceTree + BUILT_PRODUCTS_DIR + + 62CA148DC83850E7AD0BBC72 + + fileRef + 6721F6605F810F0E3E99A008 + isa + PBXBuildFile + + 636DF1F4C61C5AA7645709FA + + baseConfigurationReference + D4FB4028CE077DDD8A803F26 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 6721F6605F810F0E3E99A008 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-SampleTests-dummy.m + sourceTree + <group> + + 68BB1D7B3AA00144450F5F1C + + fileRef + ACD86D4B746F1151268E7F57 + isa + PBXBuildFile + + 6A7ADEEB77C72E01BBCBF89C + + buildActionMask + 2147483647 + files + + EE32FC2DAC0BD2116BB4F552 + 9CFC94D08F567982ED81D0AC + 3538730220221D8890A16973 + C30D693B18D43C87B0A38159 + 4545C1984951202819F52915 + 1D0CED76BEB5A08AE74DA509 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6C69DB42AABCB52A9652A925 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-dummy.m + sourceTree + <group> + + 6C8561D023F024FB9671765B + + baseConfigurationReference + E025FBABACF462C5EDEB8F04 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 6CE91202B3CB22AD98A8D8DD + + containerPortal + E72217186F5258779AB341C4 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 5D62B0B091242C70E6F86CAF + remoteInfo + Pods-Sample-RxLibrary + + 6E0139A4BF1CBFDAB998D762 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-RxLibrary.a + sourceTree + BUILT_PRODUCTS_DIR + + 6F8086848D877F06E765F3B6 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + 70699B620DD649C9FC80B596 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-SampleTests.debug.xcconfig + sourceTree + <group> + + 708D5526684493C21D4B351D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-RxLibrary-dummy.m + sourceTree + <group> + + 71EAA6DC03A9DA40C184D310 + + fileRef + 4BB07CE9F73F22C44B89EC9F + isa + PBXBuildFile + + 73BE487FD7206FA1037433A9 + + buildConfigurations + + C7522ABF8E5F673B2B51B846 + 9DAF30B69F82D25455209E07 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 77B5A8963EF74F9CE1CDEBEF + + containerPortal + E72217186F5258779AB341C4 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + CA2EA15026724E5FE7863617 + remoteInfo + Pods-RxLibrary + + 78C1945CE480BC3E085811D5 + + fileRef + 9CA52DBDD25FD65977423056 + isa + PBXBuildFile + + 79FAE9523C4CB0EF1158F9A0 + + baseConfigurationReference + 0E77891D6F14157CEFE7E0AB + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 7E0A207ED9A829B259BAF98E + + isa + PBXTargetDependency + name + Pods-RxLibrary + target + CA2EA15026724E5FE7863617 + targetProxy + 77B5A8963EF74F9CE1CDEBEF + + 7F305BF2D2399198431240B2 + + fileRef + D44C1815FF998CE19AF260F7 + isa + PBXBuildFile + + 80BFFCFE10F415F6D4AA05BD + + buildActionMask + 2147483647 + files + + 8B988DE4EEF45D03E1FE4011 + 502BB8D05700DD95603B152D + 0D88B5DF071D95A30D664FF6 + CC015D517558717A179F07EB + CA7A5D5A911B21E060A7C9A8 + DF707F9ADA38C19530138855 + 68BB1D7B3AA00144450F5F1C + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 80ED48A94404B285C3BAD2A2 + + buildActionMask + 2147483647 + files + + 2D16B1B846727EA61BFB6D3F + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 816CFE69CF10239B3EFBCBF1 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXWriteable.m + sourceTree + <group> + + 8258E01A573DC26563C24CD3 + + children + + 8E115C0A94168699797FD383 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + 8454D1F76F981D7967AFEB64 + + buildConfigurations + + 251E2B5CA237FEEC44071A78 + E429BB9EF652206D69B38B4B + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 8998DF528EA3268FD2F3312F + + buildConfigurationList + AAD81C09A25B9BF7DA0C1C86 + buildPhases + + BA1F7D67EB7832C536803BEB + 548BF298DFD0AB1E85BFD224 + + buildRules + + dependencies + + 17B62DC84258EA204EC14FC6 + + isa + PBXNativeTarget + name + Pods-SampleTests + productName + Pods-SampleTests + productReference + 6269A76A3AFAD59C7AE98E1E + productType + com.apple.product-type.library.static + + 8AF2FEBF81B82548A9CD7D5E + + buildConfigurations + + 388A0A86C10335BD8BA6069B + 972E288F65487B1145B953C3 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 8B988DE4EEF45D03E1FE4011 + + fileRef + 2D9FCC93E8EC668156F428D9 + isa + PBXBuildFile + + 8CDD9B1A9971F8E45E6ECCFE + + children + + 6F8086848D877F06E765F3B6 + 6E0139A4BF1CBFDAB998D762 + 44EAD826ACB27F88B80500A1 + B5E5D1402D71983EBFCAC80A + 6269A76A3AFAD59C7AE98E1E + F8FA1EE55435B1DD5386F9B7 + + isa + PBXGroup + name + Products + sourceTree + <group> + + 8D0ECACB7BF0FD50C8BA90EF + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-Sample-dummy.m + sourceTree + <group> + + 8D141FF420B8F70654BEB651 + + buildActionMask + 2147483647 + files + + 46C034308E68A95A172FD281 + 2E1D14017CD6D1DF2F25DA2E + 446E4587689AB45B32C6B76A + 34C114FAF0ED12406E0FFB5F + 71EAA6DC03A9DA40C184D310 + 44B1E75D8EFE8AED04C78FB7 + C7F1D04BA7ECEB89811F5AE8 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 8E115C0A94168699797FD383 + + children + + C4DD5ACCFDD651DB710A7AC6 + + isa + PBXGroup + name + iOS + sourceTree + <group> + + 8FDD88F3116CD60BDFADE08D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-SampleTests-acknowledgements.markdown + sourceTree + <group> + + 9147D56A68B32B154574B4B1 + + children + + 2D6F8181094C5DE060DD3540 + DA385F717CB8DC97197F9779 + 8258E01A573DC26563C24CD3 + 8CDD9B1A9971F8E45E6ECCFE + BC215B3ADAA2B59CC8E1E0D2 + + isa + PBXGroup + sourceTree + <group> + + 93706FFF29E959C0D0FB35B8 + + fileRef + BD301B295FA10BA71944E6A7 + isa + PBXBuildFile + + 972E288F65487B1145B953C3 + + baseConfigurationReference + 1DD32401F91AA06C7AC30E87 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 9CA52DBDD25FD65977423056 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + Pods-SampleTests-RxLibrary-dummy.m + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m + sourceTree + <group> + + 9CFC94D08F567982ED81D0AC + + fileRef + 1B96F18B31A3C8F512494663 + isa + PBXBuildFile + + 9DAF30B69F82D25455209E07 + + baseConfigurationReference + B16330C6E1974F73301EFA15 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 9E294E4639886DA2A66D2F45 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-Sample-acknowledgements.markdown + sourceTree + <group> + + 9EED35B98793FD4884D527D7 + + buildConfigurationList + 2BBE3F72E34FB1C4FCE57F41 + buildPhases + + A5F1BCFC715A1FB9A5E05F54 + 0EF90C125A8C853D6900067E + 3C53511285FA3AEF9ACE450F + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-SampleTests-RxLibrary + productName + Pods-SampleTests-RxLibrary + productReference + F8FA1EE55435B1DD5386F9B7 + productType + com.apple.product-type.library.static + + A3B182A29677AE41F3DDF60E + + children + + 9E294E4639886DA2A66D2F45 + BDDB48DF5321836E03134B73 + 8D0ECACB7BF0FD50C8BA90EF + 55F613C8D46B4C3EE36596A4 + F2055AA27575926EE57B8546 + 26766544901BC361ADA15529 + 1DD32401F91AA06C7AC30E87 + + isa + PBXGroup + name + Pods-Sample + path + Target Support Files/Pods-Sample + sourceTree + <group> + + A5F1BCFC715A1FB9A5E05F54 + + buildActionMask + 2147483647 + files + + 3E250631C4B54FA19123352E + 402AEA377C3925F10F39E9CB + 0014294E408866C876275712 + E21F75C9C5AE553D1525B15D + FFFC86AF33D17D398F42C549 + 7F305BF2D2399198431240B2 + 78C1945CE480BC3E085811D5 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + A5F3698797D4DA1AFBCA61F0 + + fileRef + BD301B295FA10BA71944E6A7 + isa + PBXBuildFile + + A6364C40CAC538ABF3DDE60C + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + A8484F554272234EC1DA0229 + + fileRef + 246FBFA8A2E45D74C161F0D4 + isa + PBXBuildFile + + A9657244C4119ECE09EE0780 + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + AAD81C09A25B9BF7DA0C1C86 + + buildConfigurations + + 5C1A6CAF7D4B0AADC6E86AB5 + C11B686FDA34820988E0EA76 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + AB030C334AF0049970BC6F69 + + fileRef + D13801CD3BED29EB3EB28C87 + isa + PBXBuildFile + + AB49EB008360ACF61F868E97 + + fileRef + 1B96F18B31A3C8F512494663 + isa + PBXBuildFile + + ACD86D4B746F1151268E7F57 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + name + Pods-Sample-RxLibrary-dummy.m + path + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m + sourceTree + <group> + + AD71151A44A1A6BB85C70D05 + + containerPortal + E72217186F5258779AB341C4 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 9EED35B98793FD4884D527D7 + remoteInfo + Pods-SampleTests-RxLibrary + + B032E0762906905546DBF8B3 + + fileRef + EBD4E0AE1D9C793A8420AA8F + isa + PBXBuildFile + + B16330C6E1974F73301EFA15 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-RxLibrary-Private.xcconfig + sourceTree + <group> + + B3E633C4D93071411657B4CC + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-resources.sh + sourceTree + <group> + + B5E5D1402D71983EBFCAC80A + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-Sample-RxLibrary.a + sourceTree + BUILT_PRODUCTS_DIR + + B960F8B548AAFF747493F848 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-acknowledgements.plist + sourceTree + <group> + + BA1F7D67EB7832C536803BEB + + buildActionMask + 2147483647 + files + + 62CA148DC83850E7AD0BBC72 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + BA6147A19780CE00E1877F27 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.debug.xcconfig + sourceTree + <group> + + BC215B3ADAA2B59CC8E1E0D2 + + children + + 17882F47BB3F8879EADC6877 + A3B182A29677AE41F3DDF60E + EE39E3EB35643DA11DB4107A + + isa + PBXGroup + name + Targets Support Files + sourceTree + <group> + + BCF96ACB49A4C581F6C4FB72 + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + BD0C47F343CA107135A8B9F2 + + baseConfigurationReference + D4FB4028CE077DDD8A803F26 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + BD301B295FA10BA71944E6A7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + NSEnumerator+GRXUtil.h + sourceTree + <group> + + BDDB48DF5321836E03134B73 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-Sample-acknowledgements.plist + sourceTree + <group> + + C099EA9920009567F1CC8E6F + + buildActionMask + 2147483647 + files + + 281E734DE47EFFBE3BF9EB6D + AB49EB008360ACF61F868E97 + B032E0762906905546DBF8B3 + AB030C334AF0049970BC6F69 + 2536F48732661916E7F98AF4 + 93706FFF29E959C0D0FB35B8 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C0AFDE847E9A73FB99BE85CA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-environment.h + sourceTree + <group> + + C11B686FDA34820988E0EA76 + + baseConfigurationReference + 477CC2FC7C249C2918424B8D + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + C30D693B18D43C87B0A38159 + + fileRef + D13801CD3BED29EB3EB28C87 + isa + PBXBuildFile + + C4DD5ACCFDD651DB710A7AC6 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR + + C7522ABF8E5F673B2B51B846 + + baseConfigurationReference + B16330C6E1974F73301EFA15 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + C7F1D04BA7ECEB89811F5AE8 + + fileRef + 708D5526684493C21D4B351D + isa + PBXBuildFile + + CA2EA15026724E5FE7863617 + + buildConfigurationList + 73BE487FD7206FA1037433A9 + buildPhases + + 8D141FF420B8F70654BEB651 + 569EE7C2B5DC944C87116DDD + 6A7ADEEB77C72E01BBCBF89C + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-RxLibrary + productName + Pods-RxLibrary + productReference + 6E0139A4BF1CBFDAB998D762 + productType + com.apple.product-type.library.static + + CA58438D9F3E61D68DE07BB0 + + fileRef + D13801CD3BED29EB3EB28C87 + isa + PBXBuildFile + + CA7A5D5A911B21E060A7C9A8 + + fileRef + 4BB07CE9F73F22C44B89EC9F + isa + PBXBuildFile + + CC015D517558717A179F07EB + + fileRef + 1F4EFE5811548D073C9AE7F7 + isa + PBXBuildFile + + CD55EA3FDCE78270B7AD57C1 + + buildActionMask + 2147483647 + files + + F2258DDD414D3E7F794A8D57 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CE7EA2A3E87B73883477BA0E + + fileRef + C4DD5ACCFDD651DB710A7AC6 + isa + PBXBuildFile + + D0574DAAAAAA7164F6C504B0 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-RxLibrary-prefix.pch + sourceTree + <group> + + D13801CD3BED29EB3EB28C87 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriter+Transformations.h + sourceTree + <group> + + D2B713C74AFBCA4A9C709F44 + + children + + 073184615871F8C7E53BF14F + B16330C6E1974F73301EFA15 + 708D5526684493C21D4B351D + D0574DAAAAAA7164F6C504B0 + DE7537ED152395F49840CBC4 + 0E77891D6F14157CEFE7E0AB + ACD86D4B746F1151268E7F57 + 53DFD2191AC1853EC39421DF + 46E75B83BEFA486A489F2FB5 + D4FB4028CE077DDD8A803F26 + 9CA52DBDD25FD65977423056 + 10420B1B517C0F7BFC1629D6 + + isa + PBXGroup + name + Support Files + path + ../examples/Sample/Pods/Target Support Files/Pods-RxLibrary + sourceTree + <group> + + D44C1815FF998CE19AF260F7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + NSEnumerator+GRXUtil.m + sourceTree + <group> + + D4FB4028CE077DDD8A803F26 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-SampleTests-RxLibrary-Private.xcconfig + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig + sourceTree + <group> + + DA385F717CB8DC97197F9779 + + children + + 5D485A8180289AB7135979D4 + + isa + PBXGroup + name + Development Pods + sourceTree + <group> + + DE7537ED152395F49840CBC4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-Sample-RxLibrary.xcconfig + path + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig + sourceTree + <group> + + DF707F9ADA38C19530138855 + + fileRef + D44C1815FF998CE19AF260F7 + isa + PBXBuildFile + + E025FBABACF462C5EDEB8F04 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.release.xcconfig + sourceTree + <group> + + E21F75C9C5AE553D1525B15D + + fileRef + 1F4EFE5811548D073C9AE7F7 + isa + PBXBuildFile + + E429BB9EF652206D69B38B4B + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + NO + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PREPROCESSOR_DEFINITIONS + + RELEASE=1 + + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + STRIP_INSTALLED_PRODUCT + NO + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + E72217186F5258779AB341C4 + + attributes + + LastUpgradeCheck + 0510 + + buildConfigurationList + 8454D1F76F981D7967AFEB64 + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + 9147D56A68B32B154574B4B1 + productRefGroup + 8CDD9B1A9971F8E45E6ECCFE + projectDirPath + + projectReferences + + projectRoot + + targets + + 20FAE2C205A83A18304F55D3 + CA2EA15026724E5FE7863617 + F88FB4C4D5E45ABA4FE79557 + 5D62B0B091242C70E6F86CAF + 8998DF528EA3268FD2F3312F + 9EED35B98793FD4884D527D7 + + + E8EEC1310BE1A1C26A6CC94F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-SampleTests-resources.sh + sourceTree + <group> + + EBD4E0AE1D9C793A8420AA8F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriter+Immediate.h + sourceTree + <group> + + ED20D5EB599CC4E0E8E6F6F4 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-acknowledgements.markdown + sourceTree + <group> + + EE32FC2DAC0BD2116BB4F552 + + fileRef + 2439530CF70B0AEDF7D20F2F + isa + PBXBuildFile + + EE39E3EB35643DA11DB4107A + + children + + 8FDD88F3116CD60BDFADE08D + 0F54B7DB9C41BEA754222626 + 6721F6605F810F0E3E99A008 + 34547F4C6AC4B31274C6887D + E8EEC1310BE1A1C26A6CC94F + 70699B620DD649C9FC80B596 + 477CC2FC7C249C2918424B8D + + isa + PBXGroup + name + Pods-SampleTests + path + Target Support Files/Pods-SampleTests + sourceTree + <group> + + EEDF7C277603B79A9BE8324B + + buildActionMask + 2147483647 + files + + CE7EA2A3E87B73883477BA0E + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + F2055AA27575926EE57B8546 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-Sample-resources.sh + sourceTree + <group> + + F2258DDD414D3E7F794A8D57 + + fileRef + 8D0ECACB7BF0FD50C8BA90EF + isa + PBXBuildFile + + F88FB4C4D5E45ABA4FE79557 + + buildConfigurationList + 8AF2FEBF81B82548A9CD7D5E + buildPhases + + CD55EA3FDCE78270B7AD57C1 + 80ED48A94404B285C3BAD2A2 + + buildRules + + dependencies + + 0E76C0DE38838984ADBE9793 + + isa + PBXNativeTarget + name + Pods-Sample + productName + Pods-Sample + productReference + 44EAD826ACB27F88B80500A1 + productType + com.apple.product-type.library.static + + F8FA1EE55435B1DD5386F9B7 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-SampleTests-RxLibrary.a + sourceTree + BUILT_PRODUCTS_DIR + + FD4FDDAA137AAC4ECC193E65 + + fileRef + 2439530CF70B0AEDF7D20F2F + isa + PBXBuildFile + + FFFC86AF33D17D398F42C549 + + fileRef + 4BB07CE9F73F22C44B89EC9F + isa + PBXBuildFile + + + rootObject + E72217186F5258779AB341C4 + + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-Private.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-Private.xcconfig new file mode 100644 index 00000000000..5c1a7097bed --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-RxLibrary.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RxLibrary" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-dummy.m new file mode 100644 index 00000000000..79e14602570 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_RxLibrary : NSObject +@end +@implementation PodsDummy_Pods_RxLibrary +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch new file mode 100644 index 00000000000..95cf11d9fb0 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-RxLibrary/Pods-RxLibrary.xcconfig new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig new file mode 100644 index 00000000000..2cc81f729dc --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-Sample-RxLibrary.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RxLibrary" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m new file mode 100644 index 00000000000..c81b57bbe88 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Sample_RxLibrary : NSObject +@end +@implementation PodsDummy_Pods_Sample_RxLibrary +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch new file mode 100644 index 00000000000..0e807f67a35 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-Sample-environment.h" diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.markdown b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.markdown new file mode 100644 index 00000000000..255149a8286 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - http://cocoapods.org diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.plist b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.plist new file mode 100644 index 00000000000..e4edebe92da --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-dummy.m new file mode 100644 index 00000000000..b5ca68a1c55 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Sample : NSObject +@end +@implementation PodsDummy_Pods_Sample +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-environment.h b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-environment.h new file mode 100644 index 00000000000..b4fd16b369b --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// RxLibrary +#define COCOAPODS_POD_AVAILABLE_RxLibrary +#define COCOAPODS_VERSION_MAJOR_RxLibrary 0 +#define COCOAPODS_VERSION_MINOR_RxLibrary 0 +#define COCOAPODS_VERSION_PATCH_RxLibrary 1 + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh new file mode 100755 index 00000000000..e149064a090 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample-resources.sh @@ -0,0 +1,74 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig new file mode 100644 index 00000000000..776727154c1 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-Sample-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig new file mode 100644 index 00000000000..776727154c1 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-Sample/Pods-Sample.release.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-Sample-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig new file mode 100644 index 00000000000..a3cd7924345 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-SampleTests-RxLibrary.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Build" "${PODS_ROOT}/Headers/Build/RxLibrary" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m new file mode 100644 index 00000000000..d57aef11d68 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_SampleTests_RxLibrary : NSObject +@end +@implementation PodsDummy_Pods_SampleTests_RxLibrary +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch new file mode 100644 index 00000000000..abd56515872 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-SampleTests-environment.h" diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.markdown b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.markdown new file mode 100644 index 00000000000..255149a8286 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - http://cocoapods.org diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.plist b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.plist new file mode 100644 index 00000000000..e4edebe92da --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-dummy.m new file mode 100644 index 00000000000..01b4ad73ba6 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_SampleTests : NSObject +@end +@implementation PodsDummy_Pods_SampleTests +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-environment.h b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-environment.h new file mode 100644 index 00000000000..b4fd16b369b --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// RxLibrary +#define COCOAPODS_POD_AVAILABLE_RxLibrary +#define COCOAPODS_VERSION_MAJOR_RxLibrary 0 +#define COCOAPODS_VERSION_MINOR_RxLibrary 0 +#define COCOAPODS_VERSION_PATCH_RxLibrary 1 + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-resources.sh b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-resources.sh new file mode 100755 index 00000000000..e149064a090 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests-resources.sh @@ -0,0 +1,74 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.debug.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.debug.xcconfig new file mode 100644 index 00000000000..92a3b7d2bd5 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.debug.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-SampleTests-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.release.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.release.xcconfig new file mode 100644 index 00000000000..92a3b7d2bd5 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods-SampleTests/Pods-SampleTests.release.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-SampleTests-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown new file mode 100644 index 00000000000..255149a8286 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,3 @@ +# Acknowledgements +This application makes use of the following third party libraries: +Generated by CocoaPods - http://cocoapods.org diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist new file mode 100644 index 00000000000..e4edebe92da --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-acknowledgements.plist @@ -0,0 +1,29 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-dummy.m b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-dummy.m new file mode 100644 index 00000000000..ade64bd1a9b --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-environment.h b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-environment.h new file mode 100644 index 00000000000..b4fd16b369b --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// RxLibrary +#define COCOAPODS_POD_AVAILABLE_RxLibrary +#define COCOAPODS_VERSION_MAJOR_RxLibrary 0 +#define COCOAPODS_VERSION_MINOR_RxLibrary 0 +#define COCOAPODS_VERSION_PATCH_RxLibrary 1 + diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-resources.sh b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-resources.sh new file mode 100755 index 00000000000..e149064a090 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods-resources.sh @@ -0,0 +1,74 @@ +#!/bin/sh +set -e + +mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" + xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.debug.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.debug.xcconfig new file mode 100644 index 00000000000..3c7fe4aa007 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.debug.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.release.xcconfig b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.release.xcconfig new file mode 100644 index 00000000000..3c7fe4aa007 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Target Support Files/Pods/Pods.release.xcconfig @@ -0,0 +1,6 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/RxLibrary" +OTHER_LDFLAGS = -ObjC -l"Pods-RxLibrary" +OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/src/objective-c/examples/Sample/README.md b/src/objective-c/examples/Sample/README.md new file mode 100644 index 00000000000..45ba544a34a --- /dev/null +++ b/src/objective-c/examples/Sample/README.md @@ -0,0 +1,2 @@ +When contributing changes to this sample, use Cocoapods to manage the workspace +file and everything under the Pods directory. \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..142e60e2b25 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj @@ -0,0 +1,955 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 04554623324BE4A838846086 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Copy Pods Resources + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh" + + showEnvVarsInLog + 0 + + 2DC7B7C4C0410F43B9621631 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + 41F7486D8F66994B0BFB84AF + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Check Pods Manifest.lock + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null +if [[ $? != 0 ]] ; then + cat << EOM +error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. +EOM + exit 1 +fi + + showEnvVarsInLog + 0 + + 6369A2611A9322E20015FC5C + + children + + 6369A26C1A9322E20015FC5C + 6369A2861A9322E20015FC5C + 6369A26B1A9322E20015FC5C + AB3331C9AE6488E61B2B094E + C4C2C5219053E079C9EFB930 + + isa + PBXGroup + sourceTree + <group> + + 6369A2621A9322E20015FC5C + + attributes + + LastUpgradeCheck + 0610 + ORGANIZATIONNAME + gRPC + TargetAttributes + + 6369A2691A9322E20015FC5C + + CreatedOnToolsVersion + 6.1.1 + + 6369A2821A9322E20015FC5C + + CreatedOnToolsVersion + 6.1.1 + TestTargetID + 6369A2691A9322E20015FC5C + + + + buildConfigurationList + 6369A2651A9322E20015FC5C + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + Base + + mainGroup + 6369A2611A9322E20015FC5C + productRefGroup + 6369A26B1A9322E20015FC5C + projectDirPath + + projectReferences + + projectRoot + + targets + + 6369A2691A9322E20015FC5C + 6369A2821A9322E20015FC5C + + + 6369A2651A9322E20015FC5C + + buildConfigurations + + 6369A28B1A9322E20015FC5C + 6369A28C1A9322E20015FC5C + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 6369A2661A9322E20015FC5C + + buildActionMask + 2147483647 + files + + 6369A2761A9322E20015FC5C + 6369A2731A9322E20015FC5C + 6369A2701A9322E20015FC5C + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2671A9322E20015FC5C + + buildActionMask + 2147483647 + files + + FC81FE63CA655031F3524EC0 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2681A9322E20015FC5C + + buildActionMask + 2147483647 + files + + 6369A2791A9322E20015FC5C + 6369A27E1A9322E20015FC5C + 6369A27B1A9322E20015FC5C + + isa + PBXResourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2691A9322E20015FC5C + + buildConfigurationList + 6369A28D1A9322E20015FC5C + buildPhases + + 41F7486D8F66994B0BFB84AF + 6369A2661A9322E20015FC5C + 6369A2671A9322E20015FC5C + 6369A2681A9322E20015FC5C + 04554623324BE4A838846086 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Sample + productName + Sample + productReference + 6369A26A1A9322E20015FC5C + productType + com.apple.product-type.application + + 6369A26A1A9322E20015FC5C + + explicitFileType + wrapper.application + includeInIndex + 0 + isa + PBXFileReference + path + Sample.app + sourceTree + BUILT_PRODUCTS_DIR + + 6369A26B1A9322E20015FC5C + + children + + 6369A26A1A9322E20015FC5C + 6369A2831A9322E20015FC5C + + isa + PBXGroup + name + Products + sourceTree + <group> + + 6369A26C1A9322E20015FC5C + + children + + 6369A2711A9322E20015FC5C + 6369A2721A9322E20015FC5C + 6369A2741A9322E20015FC5C + 6369A2751A9322E20015FC5C + 6369A2771A9322E20015FC5C + 6369A27A1A9322E20015FC5C + 6369A27C1A9322E20015FC5C + 6369A26D1A9322E20015FC5C + + isa + PBXGroup + path + Sample + sourceTree + <group> + + 6369A26D1A9322E20015FC5C + + children + + 6369A26E1A9322E20015FC5C + 6369A26F1A9322E20015FC5C + + isa + PBXGroup + name + Supporting Files + sourceTree + <group> + + 6369A26E1A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + 6369A26F1A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + main.m + sourceTree + <group> + + 6369A2701A9322E20015FC5C + + fileRef + 6369A26F1A9322E20015FC5C + isa + PBXBuildFile + + 6369A2711A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + AppDelegate.h + sourceTree + <group> + + 6369A2721A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + AppDelegate.m + sourceTree + <group> + + 6369A2731A9322E20015FC5C + + fileRef + 6369A2721A9322E20015FC5C + isa + PBXBuildFile + + 6369A2741A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + ViewController.h + sourceTree + <group> + + 6369A2751A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + ViewController.m + sourceTree + <group> + + 6369A2761A9322E20015FC5C + + fileRef + 6369A2751A9322E20015FC5C + isa + PBXBuildFile + + 6369A2771A9322E20015FC5C + + children + + 6369A2781A9322E20015FC5C + + isa + PBXVariantGroup + name + Main.storyboard + sourceTree + <group> + + 6369A2781A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + file.storyboard + name + Base + path + Base.lproj/Main.storyboard + sourceTree + <group> + + 6369A2791A9322E20015FC5C + + fileRef + 6369A2771A9322E20015FC5C + isa + PBXBuildFile + + 6369A27A1A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + folder.assetcatalog + path + Images.xcassets + sourceTree + <group> + + 6369A27B1A9322E20015FC5C + + fileRef + 6369A27A1A9322E20015FC5C + isa + PBXBuildFile + + 6369A27C1A9322E20015FC5C + + children + + 6369A27D1A9322E20015FC5C + + isa + PBXVariantGroup + name + LaunchScreen.xib + sourceTree + <group> + + 6369A27D1A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + file.xib + name + Base + path + Base.lproj/LaunchScreen.xib + sourceTree + <group> + + 6369A27E1A9322E20015FC5C + + fileRef + 6369A27C1A9322E20015FC5C + isa + PBXBuildFile + + 6369A27F1A9322E20015FC5C + + buildActionMask + 2147483647 + files + + 6369A28A1A9322E20015FC5C + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2801A9322E20015FC5C + + buildActionMask + 2147483647 + files + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2811A9322E20015FC5C + + buildActionMask + 2147483647 + files + + isa + PBXResourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 6369A2821A9322E20015FC5C + + buildConfigurationList + 6369A2901A9322E20015FC5C + buildPhases + + 6369A27F1A9322E20015FC5C + 6369A2801A9322E20015FC5C + 6369A2811A9322E20015FC5C + + buildRules + + dependencies + + 6369A2851A9322E20015FC5C + + isa + PBXNativeTarget + name + SampleTests + productName + SampleTests + productReference + 6369A2831A9322E20015FC5C + productType + com.apple.product-type.bundle.unit-test + + 6369A2831A9322E20015FC5C + + explicitFileType + wrapper.cfbundle + includeInIndex + 0 + isa + PBXFileReference + path + SampleTests.xctest + sourceTree + BUILT_PRODUCTS_DIR + + 6369A2841A9322E20015FC5C + + containerPortal + 6369A2621A9322E20015FC5C + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 6369A2691A9322E20015FC5C + remoteInfo + Sample + + 6369A2851A9322E20015FC5C + + isa + PBXTargetDependency + target + 6369A2691A9322E20015FC5C + targetProxy + 6369A2841A9322E20015FC5C + + 6369A2861A9322E20015FC5C + + children + + 6369A2891A9322E20015FC5C + 6369A2871A9322E20015FC5C + + isa + PBXGroup + path + SampleTests + sourceTree + <group> + + 6369A2871A9322E20015FC5C + + children + + 6369A2881A9322E20015FC5C + + isa + PBXGroup + name + Supporting Files + sourceTree + <group> + + 6369A2881A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Info.plist + sourceTree + <group> + + 6369A2891A9322E20015FC5C + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + SampleTests.m + sourceTree + <group> + + 6369A28A1A9322E20015FC5C + + fileRef + 6369A2891A9322E20015FC5C + isa + PBXBuildFile + + 6369A28B1A9322E20015FC5C + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + NO + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES_AGGRESSIVE + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.1 + MTL_ENABLE_DEBUG_INFO + YES + ONLY_ACTIVE_ARCH + YES + SDKROOT + iphoneos + TARGETED_DEVICE_FAMILY + 1,2 + + isa + XCBuildConfiguration + name + Debug + + 6369A28C1A9322E20015FC5C + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES_ERROR + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES_ERROR + CLANG_WARN_UNREACHABLE_CODE + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + YES + ENABLE_NS_ASSERTIONS + NO + ENABLE_STRICT_OBJC_MSGSEND + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES_ERROR + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES_AGGRESSIVE + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.1 + MTL_ENABLE_DEBUG_INFO + NO + SDKROOT + iphoneos + TARGETED_DEVICE_FAMILY + 1,2 + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 6369A28D1A9322E20015FC5C + + buildConfigurations + + 6369A28E1A9322E20015FC5C + 6369A28F1A9322E20015FC5C + + defaultConfigurationIsVisible + 0 + isa + XCConfigurationList + + 6369A28E1A9322E20015FC5C + + baseConfigurationReference + AC29DD6FCDF962F519FEBB0D + buildSettings + + ASSETCATALOG_COMPILER_APPICON_NAME + AppIcon + INFOPLIST_FILE + Sample/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks + PRODUCT_NAME + $(TARGET_NAME) + + isa + XCBuildConfiguration + name + Debug + + 6369A28F1A9322E20015FC5C + + baseConfigurationReference + C68330F8D451CC6ACEABA09F + buildSettings + + ASSETCATALOG_COMPILER_APPICON_NAME + AppIcon + INFOPLIST_FILE + Sample/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks + PRODUCT_NAME + $(TARGET_NAME) + + isa + XCBuildConfiguration + name + Release + + 6369A2901A9322E20015FC5C + + buildConfigurations + + 6369A2911A9322E20015FC5C + 6369A2921A9322E20015FC5C + + defaultConfigurationIsVisible + 0 + isa + XCConfigurationList + + 6369A2911A9322E20015FC5C + + buildSettings + + BUNDLE_LOADER + $(TEST_HOST) + FRAMEWORK_SEARCH_PATHS + + $(SDKROOT)/Developer/Library/Frameworks + $(inherited) + + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + INFOPLIST_FILE + SampleTests/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks @loader_path/Frameworks + PRODUCT_NAME + $(TARGET_NAME) + TEST_HOST + $(BUILT_PRODUCTS_DIR)/Sample.app/Sample + + isa + XCBuildConfiguration + name + Debug + + 6369A2921A9322E20015FC5C + + buildSettings + + BUNDLE_LOADER + $(TEST_HOST) + FRAMEWORK_SEARCH_PATHS + + $(SDKROOT)/Developer/Library/Frameworks + $(inherited) + + INFOPLIST_FILE + SampleTests/Info.plist + LD_RUNPATH_SEARCH_PATHS + $(inherited) @executable_path/Frameworks @loader_path/Frameworks + PRODUCT_NAME + $(TARGET_NAME) + TEST_HOST + $(BUILT_PRODUCTS_DIR)/Sample.app/Sample + + isa + XCBuildConfiguration + name + Release + + AB3331C9AE6488E61B2B094E + + children + + AC29DD6FCDF962F519FEBB0D + C68330F8D451CC6ACEABA09F + + isa + PBXGroup + name + Pods + sourceTree + <group> + + AC29DD6FCDF962F519FEBB0D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods.debug.xcconfig + path + Pods/Target Support Files/Pods/Pods.debug.xcconfig + sourceTree + <group> + + C4C2C5219053E079C9EFB930 + + children + + 2DC7B7C4C0410F43B9621631 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + C68330F8D451CC6ACEABA09F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods.release.xcconfig + path + Pods/Target Support Files/Pods/Pods.release.xcconfig + sourceTree + <group> + + FC81FE63CA655031F3524EC0 + + fileRef + 2DC7B7C4C0410F43B9621631 + isa + PBXBuildFile + + + rootObject + 6369A2621A9322E20015FC5C + + diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/src/objective-c/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..a80c0382495 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/src/objective-c/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata b/src/objective-c/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..7b5a2f3050a --- /dev/null +++ b/src/objective-c/examples/Sample/Sample.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.h b/src/objective-c/examples/Sample/Sample/AppDelegate.h new file mode 100644 index 00000000000..ff8369337bc --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.h @@ -0,0 +1,17 @@ +// +// AppDelegate.h +// Sample +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.m b/src/objective-c/examples/Sample/Sample/AppDelegate.m new file mode 100644 index 00000000000..7db63e9d7b5 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.m @@ -0,0 +1,45 @@ +// +// AppDelegate.m +// Sample +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/src/objective-c/examples/Sample/Sample/Base.lproj/LaunchScreen.xib b/src/objective-c/examples/Sample/Sample/Base.lproj/LaunchScreen.xib new file mode 100644 index 00000000000..c51a8e199eb --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/Sample/Sample/Base.lproj/Main.storyboard b/src/objective-c/examples/Sample/Sample/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..f56d2f3bb56 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/objective-c/examples/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/examples/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..36d2c80d889 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Sample/Info.plist b/src/objective-c/examples/Sample/Sample/Info.plist new file mode 100644 index 00000000000..ffdc8b30122 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.grpc.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/src/objective-c/examples/Sample/Sample/ViewController.h b/src/objective-c/examples/Sample/Sample/ViewController.h new file mode 100644 index 00000000000..5637635a77c --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// Sample +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m new file mode 100644 index 00000000000..07cefe7289d --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// Sample +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/src/objective-c/examples/Sample/Sample/main.m b/src/objective-c/examples/Sample/Sample/main.m new file mode 100644 index 00000000000..a5deee9cae7 --- /dev/null +++ b/src/objective-c/examples/Sample/Sample/main.m @@ -0,0 +1,16 @@ +// +// main.m +// Sample +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/src/objective-c/examples/Sample/SampleTests/Info.plist b/src/objective-c/examples/Sample/SampleTests/Info.plist new file mode 100644 index 00000000000..f547b0b7072 --- /dev/null +++ b/src/objective-c/examples/Sample/SampleTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + org.grpc.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m new file mode 100644 index 00000000000..5c2bccb5e66 --- /dev/null +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -0,0 +1,40 @@ +// +// SampleTests.m +// SampleTests +// +// Created by Jorge Canizalez Diaz on 2/16/15. +// Copyright (c) 2015 gRPC. All rights reserved. +// + +#import +#import + +@interface SampleTests : XCTestCase + +@end + +@implementation SampleTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end From e8304d5741d31397342c2f279ad8021dd50d2e55 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 17 Feb 2015 19:50:51 -0800 Subject: [PATCH 130/232] Fixes copyright notices --- .../RxLibrary/GRXImmediateWriter.h | 33 ++++++++++++++++ .../RxLibrary/GRXImmediateWriter.m | 33 ++++++++++++++++ src/objective-c/RxLibrary/GRXWriteable.h | 33 ++++++++++++++++ src/objective-c/RxLibrary/GRXWriteable.m | 33 ++++++++++++++++ .../RxLibrary/GRXWriter+Immediate.h | 33 ++++++++++++++++ .../RxLibrary/GRXWriter+Immediate.m | 33 ++++++++++++++++ .../RxLibrary/GRXWriter+Transformations.h | 33 ++++++++++++++++ .../RxLibrary/GRXWriter+Transformations.m | 33 ++++++++++++++++ src/objective-c/RxLibrary/GRXWriter.h | 33 ++++++++++++++++ src/objective-c/RxLibrary/GRXWriter.m | 33 ++++++++++++++++ .../RxLibrary/NSEnumerator+GRXUtil.h | 33 ++++++++++++++++ .../RxLibrary/NSEnumerator+GRXUtil.m | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSBlockEnumerator.h | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSBlockEnumerator.m | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSFastEnumerator.h | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSFastEnumerator.m | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSScalarEnumerator.h | 33 ++++++++++++++++ .../RxLibrary/private/GRXNSScalarEnumerator.m | 33 ++++++++++++++++ .../transformations/GRXMappingWriter.h | 33 ++++++++++++++++ .../transformations/GRXMappingWriter.m | 33 ++++++++++++++++ .../examples/Sample/Sample/AppDelegate.h | 39 +++++++++++++++---- .../examples/Sample/Sample/AppDelegate.m | 39 +++++++++++++++---- .../examples/Sample/Sample/ViewController.h | 39 +++++++++++++++---- .../examples/Sample/Sample/ViewController.m | 39 +++++++++++++++---- src/objective-c/examples/Sample/Sample/main.m | 39 +++++++++++++++---- .../examples/Sample/SampleTests/SampleTests.m | 39 +++++++++++++++---- 26 files changed, 852 insertions(+), 42 deletions(-) diff --git a/src/objective-c/RxLibrary/GRXImmediateWriter.h b/src/objective-c/RxLibrary/GRXImmediateWriter.h index 568dbe65764..74f4dc69f4b 100644 --- a/src/objective-c/RxLibrary/GRXImmediateWriter.h +++ b/src/objective-c/RxLibrary/GRXImmediateWriter.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import #import "GRXWriter.h" diff --git a/src/objective-c/RxLibrary/GRXImmediateWriter.m b/src/objective-c/RxLibrary/GRXImmediateWriter.m index ebeb3f458a3..4417ae8f161 100644 --- a/src/objective-c/RxLibrary/GRXImmediateWriter.m +++ b/src/objective-c/RxLibrary/GRXImmediateWriter.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXImmediateWriter.h" #import "NSEnumerator+GRXUtil.h" diff --git a/src/objective-c/RxLibrary/GRXWriteable.h b/src/objective-c/RxLibrary/GRXWriteable.h index bbcdb6a2ba9..5aa00ba40ec 100644 --- a/src/objective-c/RxLibrary/GRXWriteable.h +++ b/src/objective-c/RxLibrary/GRXWriteable.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // A GRXWriteable is an object to which a sequence of values can be sent. The diff --git a/src/objective-c/RxLibrary/GRXWriteable.m b/src/objective-c/RxLibrary/GRXWriteable.m index 3b4f0811aa7..9567e42b747 100644 --- a/src/objective-c/RxLibrary/GRXWriteable.m +++ b/src/objective-c/RxLibrary/GRXWriteable.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriteable.h" @implementation GRXWriteable { diff --git a/src/objective-c/RxLibrary/GRXWriter+Immediate.h b/src/objective-c/RxLibrary/GRXWriter+Immediate.h index 2d397d76559..101df81e5e6 100644 --- a/src/objective-c/RxLibrary/GRXWriter+Immediate.h +++ b/src/objective-c/RxLibrary/GRXWriter+Immediate.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter.h" @interface GRXWriter (Immediate) diff --git a/src/objective-c/RxLibrary/GRXWriter+Immediate.m b/src/objective-c/RxLibrary/GRXWriter+Immediate.m index 841ea8a30f9..7dab5e2ba57 100644 --- a/src/objective-c/RxLibrary/GRXWriter+Immediate.m +++ b/src/objective-c/RxLibrary/GRXWriter+Immediate.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter+Immediate.h" #import "GRXImmediateWriter.h" diff --git a/src/objective-c/RxLibrary/GRXWriter+Transformations.h b/src/objective-c/RxLibrary/GRXWriter+Transformations.h index 4c9335b6758..cfd644b5208 100644 --- a/src/objective-c/RxLibrary/GRXWriter+Transformations.h +++ b/src/objective-c/RxLibrary/GRXWriter+Transformations.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter.h" @interface GRXWriter (Transformations) diff --git a/src/objective-c/RxLibrary/GRXWriter+Transformations.m b/src/objective-c/RxLibrary/GRXWriter+Transformations.m index 30e5000afdf..67c54a7e809 100644 --- a/src/objective-c/RxLibrary/GRXWriter+Transformations.m +++ b/src/objective-c/RxLibrary/GRXWriter+Transformations.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter+Transformations.h" #import "transformations/GRXMappingWriter.h" diff --git a/src/objective-c/RxLibrary/GRXWriter.h b/src/objective-c/RxLibrary/GRXWriter.h index 03b3ee18cd8..8bda52fcb98 100644 --- a/src/objective-c/RxLibrary/GRXWriter.h +++ b/src/objective-c/RxLibrary/GRXWriter.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import #import "GRXWriteable.h" diff --git a/src/objective-c/RxLibrary/GRXWriter.m b/src/objective-c/RxLibrary/GRXWriter.m index 67d928fed58..7d6c2acd369 100644 --- a/src/objective-c/RxLibrary/GRXWriter.m +++ b/src/objective-c/RxLibrary/GRXWriter.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter.h" @interface GRXWriter () diff --git a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h index ecd8f2de79d..e3f8bbe9c2e 100644 --- a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h +++ b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import @interface NSEnumerator (GRXUtil) diff --git a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m index 7da05d13c49..807a1cd7009 100644 --- a/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m +++ b/src/objective-c/RxLibrary/NSEnumerator+GRXUtil.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "NSEnumerator+GRXUtil.h" #import "private/GRXNSBlockEnumerator.h" diff --git a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h index 0bb1f477648..4253324e95c 100644 --- a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h +++ b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // Concrete subclass of NSEnumerator that delegates the invocations of nextObject to a block passed diff --git a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m index 9a53531b128..53b8bb863d6 100644 --- a/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m +++ b/src/objective-c/RxLibrary/private/GRXNSBlockEnumerator.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXNSBlockEnumerator.h" @implementation GRXNSBlockEnumerator { diff --git a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h index e5f27b1cc70..1c28b158d73 100644 --- a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h +++ b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // This is a bridge to interact through NSEnumerator's interface with objects that only conform to diff --git a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m index 817ff34d95c..2bbefacd69a 100644 --- a/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m +++ b/src/objective-c/RxLibrary/private/GRXNSFastEnumerator.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXNSFastEnumerator.h" @implementation GRXNSFastEnumerator { diff --git a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h index 1130f52897e..5f4026e3a5f 100644 --- a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h +++ b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // Concrete subclass of NSEnumerator whose instances return a single object before finishing. diff --git a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m index b2a1afd00e6..18f6ddfc264 100644 --- a/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m +++ b/src/objective-c/RxLibrary/private/GRXNSScalarEnumerator.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXNSScalarEnumerator.h" @implementation GRXNSScalarEnumerator { diff --git a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h index 13640c5bd6d..72249b486ba 100644 --- a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h +++ b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXWriter.h" // A "proxy" writer that transforms all the values of its input writer by using a mapping function. diff --git a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m index 3aa2a2503ae..8375aefdcd4 100644 --- a/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m +++ b/src/objective-c/RxLibrary/transformations/GRXMappingWriter.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRXMappingWriter.h" static id (^kIdentity)(id value) = ^id(id value) { diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.h b/src/objective-c/examples/Sample/Sample/AppDelegate.h index ff8369337bc..867e62842ae 100644 --- a/src/objective-c/examples/Sample/Sample/AppDelegate.h +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.h @@ -1,10 +1,35 @@ -// -// AppDelegate.h -// Sample -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import diff --git a/src/objective-c/examples/Sample/Sample/AppDelegate.m b/src/objective-c/examples/Sample/Sample/AppDelegate.m index 7db63e9d7b5..66fceffd85c 100644 --- a/src/objective-c/examples/Sample/Sample/AppDelegate.m +++ b/src/objective-c/examples/Sample/Sample/AppDelegate.m @@ -1,10 +1,35 @@ -// -// AppDelegate.m -// Sample -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import "AppDelegate.h" diff --git a/src/objective-c/examples/Sample/Sample/ViewController.h b/src/objective-c/examples/Sample/Sample/ViewController.h index 5637635a77c..38cd7f92b66 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.h +++ b/src/objective-c/examples/Sample/Sample/ViewController.h @@ -1,10 +1,35 @@ -// -// ViewController.h -// Sample -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 07cefe7289d..70b5d458110 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -1,10 +1,35 @@ -// -// ViewController.m -// Sample -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import "ViewController.h" diff --git a/src/objective-c/examples/Sample/Sample/main.m b/src/objective-c/examples/Sample/Sample/main.m index a5deee9cae7..81e9d44e542 100644 --- a/src/objective-c/examples/Sample/Sample/main.m +++ b/src/objective-c/examples/Sample/Sample/main.m @@ -1,10 +1,35 @@ -// -// main.m -// Sample -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import #import "AppDelegate.h" diff --git a/src/objective-c/examples/Sample/SampleTests/SampleTests.m b/src/objective-c/examples/Sample/SampleTests/SampleTests.m index 5c2bccb5e66..9a1d4b14d43 100644 --- a/src/objective-c/examples/Sample/SampleTests/SampleTests.m +++ b/src/objective-c/examples/Sample/SampleTests/SampleTests.m @@ -1,10 +1,35 @@ -// -// SampleTests.m -// SampleTests -// -// Created by Jorge Canizalez Diaz on 2/16/15. -// Copyright (c) 2015 gRPC. All rights reserved. -// +/* + * + * 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. + * + */ #import #import From af2d9977bfd8df7ed3baf09c2c088320cad45218 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 17 Feb 2015 19:56:59 -0800 Subject: [PATCH 131/232] Fixes podspec of the RxLibrary --- src/objective-c/RxLibrary/RxLibrary.podspec | 3 +- src/objective-c/examples/Sample/Podfile.lock | 2 +- .../Public/RxLibrary/GRXMappingWriter.h | 1 + .../Pods/Local Podspecs/RxLibrary.podspec | 3 +- .../examples/Sample/Pods/Manifest.lock | 2 +- .../Pods/Pods.xcodeproj/project.pbxproj | 3110 +++++++++-------- 6 files changed, 1722 insertions(+), 1399 deletions(-) create mode 120000 src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXMappingWriter.h diff --git a/src/objective-c/RxLibrary/RxLibrary.podspec b/src/objective-c/RxLibrary/RxLibrary.podspec index 4e1f64e35f5..605aedaf108 100644 --- a/src/objective-c/RxLibrary/RxLibrary.podspec +++ b/src/objective-c/RxLibrary/RxLibrary.podspec @@ -5,7 +5,8 @@ Pod::Spec.new do |s| s.author = { 'Jorge Canizales' => 'jcanizales@google.com' } - s.source_files = '*.{h,m}' + s.source_files = '*.{h,m}', 'transformations/*.{h,m}', 'private/*.{h,m}' + s.private_header_files = 'private/*.h' s.platform = :ios s.ios.deployment_target = '6.0' s.requires_arc = true diff --git a/src/objective-c/examples/Sample/Podfile.lock b/src/objective-c/examples/Sample/Podfile.lock index 9bc407dafab..fee4b43bec3 100644 --- a/src/objective-c/examples/Sample/Podfile.lock +++ b/src/objective-c/examples/Sample/Podfile.lock @@ -9,6 +9,6 @@ EXTERNAL SOURCES: :path: ../../RxLibrary SPEC CHECKSUMS: - RxLibrary: fc24868ee72616e8c4e58128b439811fdade0da4 + RxLibrary: 70cfcf1573ec16a375b4fe61d976a3188aab9303 COCOAPODS: 0.35.0 diff --git a/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXMappingWriter.h b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXMappingWriter.h new file mode 120000 index 00000000000..4d1073f4511 --- /dev/null +++ b/src/objective-c/examples/Sample/Pods/Headers/Public/RxLibrary/GRXMappingWriter.h @@ -0,0 +1 @@ +../../../../../../RxLibrary/transformations/GRXMappingWriter.h \ No newline at end of file diff --git a/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec b/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec index 4e1f64e35f5..605aedaf108 100644 --- a/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec +++ b/src/objective-c/examples/Sample/Pods/Local Podspecs/RxLibrary.podspec @@ -5,7 +5,8 @@ Pod::Spec.new do |s| s.author = { 'Jorge Canizales' => 'jcanizales@google.com' } - s.source_files = '*.{h,m}' + s.source_files = '*.{h,m}', 'transformations/*.{h,m}', 'private/*.{h,m}' + s.private_header_files = 'private/*.h' s.platform = :ios s.ios.deployment_target = '6.0' s.requires_arc = true diff --git a/src/objective-c/examples/Sample/Pods/Manifest.lock b/src/objective-c/examples/Sample/Pods/Manifest.lock index 9bc407dafab..fee4b43bec3 100644 --- a/src/objective-c/examples/Sample/Pods/Manifest.lock +++ b/src/objective-c/examples/Sample/Pods/Manifest.lock @@ -9,6 +9,6 @@ EXTERNAL SOURCES: :path: ../../RxLibrary SPEC CHECKSUMS: - RxLibrary: fc24868ee72616e8c4e58128b439811fdade0da4 + RxLibrary: 70cfcf1573ec16a375b4fe61d976a3188aab9303 COCOAPODS: 0.35.0 diff --git a/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj index 426cb991de2..68290dd5e8f 100644 --- a/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj +++ b/src/objective-c/examples/Sample/Pods/Pods.xcodeproj/project.pbxproj @@ -10,253 +10,54 @@ 46 objects - 00061C3922BA01C61542886C - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - GRXWriter+Immediate.m - sourceTree - <group> - - 0014294E408866C876275712 - - fileRef - 00061C3922BA01C61542886C - isa - PBXBuildFile - - 033F82759B99EF3786C6C3AB - - fileRef - EBD4E0AE1D9C793A8420AA8F - isa - PBXBuildFile - - 073184615871F8C7E53BF14F - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - path - Pods-RxLibrary.xcconfig - sourceTree - <group> - - 074C7BFE33E5A8B65490CD74 - - fileRef - 6C69DB42AABCB52A9652A925 - isa - PBXBuildFile - - 0D88B5DF071D95A30D664FF6 - - fileRef - 00061C3922BA01C61542886C - isa - PBXBuildFile - - 0E76C0DE38838984ADBE9793 - - isa - PBXTargetDependency - name - Pods-Sample-RxLibrary - target - 5D62B0B091242C70E6F86CAF - targetProxy - 6CE91202B3CB22AD98A8D8DD - - 0E77891D6F14157CEFE7E0AB - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - name - Pods-Sample-RxLibrary-Private.xcconfig - path - ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig - sourceTree - <group> - - 0EF90C125A8C853D6900067E - - buildActionMask - 2147483647 - files - - A9657244C4119ECE09EE0780 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 0F54B7DB9C41BEA754222626 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.plist.xml - path - Pods-SampleTests-acknowledgements.plist - sourceTree - <group> - - 10420B1B517C0F7BFC1629D6 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - name - Pods-SampleTests-RxLibrary-prefix.pch - path - ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch - sourceTree - <group> - - 17882F47BB3F8879EADC6877 - - children - - ED20D5EB599CC4E0E8E6F6F4 - B960F8B548AAFF747493F848 - 6C69DB42AABCB52A9652A925 - C0AFDE847E9A73FB99BE85CA - B3E633C4D93071411657B4CC - BA6147A19780CE00E1877F27 - E025FBABACF462C5EDEB8F04 - - isa - PBXGroup - name - Pods - path - Target Support Files/Pods - sourceTree - <group> - - 17B62DC84258EA204EC14FC6 - - isa - PBXTargetDependency - name - Pods-SampleTests-RxLibrary - target - 9EED35B98793FD4884D527D7 - targetProxy - AD71151A44A1A6BB85C70D05 - - 1A919D1671FBC2A501B2B80E - - buildConfigurations - - 79FAE9523C4CB0EF1158F9A0 - 3FCF54B65C82686C35E6A695 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList - - 1B96F18B31A3C8F512494663 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - GRXWriteable.h - sourceTree - <group> - - 1D0CED76BEB5A08AE74DA509 + 00949E44051CD97851DEFF3B fileRef - BD301B295FA10BA71944E6A7 + 9CFAC09E370EA1C96C8D2880 isa PBXBuildFile - 1DD32401F91AA06C7AC30E87 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - text.xcconfig - path - Pods-Sample.release.xcconfig - sourceTree - <group> - - 1E52CE0A26CA218416895820 + 01F5B724A99ADB3547023C72 fileRef - 1B96F18B31A3C8F512494663 + 1868370C0050315A6B835D42 isa PBXBuildFile - 1F4EFE5811548D073C9AE7F7 - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc - path - GRXWriter+Transformations.m - sourceTree - <group> - - 20FAE2C205A83A18304F55D3 + 0239F1B46D24E21A8042F47F buildConfigurationList - 3CED27F6BA01528C8C816522 + 8919AE774852DD128A7CB510 buildPhases - 5E942AABDFCC15C6D8A85F77 - EEDF7C277603B79A9BE8324B + A71CC1B520D2DFF451839FE2 + 896F697BD1BEAF8A081337EB buildRules dependencies - 7E0A207ED9A829B259BAF98E + 6EB14BC96525C955FBD5CC75 isa PBXNativeTarget name - Pods + Pods-Sample productName - Pods + Pods-Sample productReference - 6F8086848D877F06E765F3B6 + DF94410F5DC0A0AB69336DF4 productType com.apple.product-type.library.static - 2439530CF70B0AEDF7D20F2F + 024F840533A6674922DB7899 + + fileRef + 46513F4AD14CBD2377C1E7A1 + isa + PBXBuildFile + + 0260773D27B4AE159FB0B22D includeInIndex 1 @@ -265,24 +66,31 @@ lastKnownFileType sourcecode.c.h path - GRXImmediateWriter.h + GRXWriter+Immediate.h sourceTree <group> - 246FBFA8A2E45D74C161F0D4 + 026236C3432E9DBC10A40748 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.h + sourcecode.c.objc path - GRXWriter.h + Pods-SampleTests-dummy.m sourceTree <group> - 251E2B5CA237FEEC44071A78 + 0385BCBCA0601E80FAD2A901 + + fileRef + 46513F4AD14CBD2377C1E7A1 + isa + PBXBuildFile + + 0879DBE6FFA1852D106330B4 buildSettings @@ -349,42 +157,95 @@ name Debug - 2536F48732661916E7F98AF4 + 092D0456252ED3F90F66084D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-Sample-environment.h + sourceTree + <group> + + 0BC8818D3A097831FDE0750B + + fileRef + BC50D76123DA4B85E6AD77B4 + isa + PBXBuildFile + + 0C57EED724EBF58759F9F6DF fileRef - 246FBFA8A2E45D74C161F0D4 + 4BB75B0FC7359E8EA8672954 isa PBXBuildFile - 25515F1B6F5C5FC0FC5B2023 + 0D09CEB9308FA5BACEB5F84C + + children + + 30063D2979A72CA1050BD4A6 + DB3528F609E6177E1C5A691C + 026236C3432E9DBC10A40748 + EF8B807C5A2059D6C709450D + 8B503889F903CED9A12E5C87 + 591702CE7D8AF91674F1640F + DB677464758307786D68CCE9 + + isa + PBXGroup + name + Pods-SampleTests + path + Target Support Files/Pods-SampleTests + sourceTree + <group> + + 0D53085043D992DC00E29F0A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriteable.h + sourceTree + <group> + + 0F20828B67FDCB990B1818E9 baseConfigurationReference - BA6147A19780CE00E1877F27 + DB677464758307786D68CCE9 buildSettings ALWAYS_SEARCH_USER_PATHS NO COPY_PHASE_STRIP - NO + YES DSTROOT /tmp/xcodeproj.dst - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 GCC_PRECOMPILE_PREFIX_HEADER YES - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO INSTALL_PATH $(BUILT_PRODUCTS_DIR) IPHONEOS_DEPLOYMENT_TARGET 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + OTHER_LDFLAGS OTHER_LIBTOOLFLAGS @@ -397,38 +258,125 @@ iphoneos SKIP_INSTALL YES + VALIDATE_PRODUCT + YES isa XCBuildConfiguration name - Debug + Release + + 11072993378724E9AF9CAF85 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-SampleTests-RxLibrary.a + sourceTree + BUILT_PRODUCTS_DIR + + 1146D04C598DEBA045C96C2F + + buildActionMask + 2147483647 + files + + 1F3162E71EE5AA2B65DEC06D + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 114F64D42E2AF2F3EBDE9BCB + + buildActionMask + 2147483647 + files + + 1D31B6F63B148D2EA5637823 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 124B93EFC16A2026269840B2 + + isa + PBXTargetDependency + name + Pods-RxLibrary + target + 6BFD156F312F6CAA1E5B00CA + targetProxy + DB007D27F74F8F72C72A1079 + + 14D92BB2ED12213381BD2EB9 + + buildConfigurationList + C4342DDEEF3C3290956C21DF + buildPhases + + 432AE81157886BE484236751 + 87700F015FA41F53D88CA4BC + + buildRules + + dependencies + + F8B4778EF3030EEC2E9927CE + + isa + PBXNativeTarget + name + Pods-SampleTests + productName + Pods-SampleTests + productReference + 42A375125393D0613249D046 + productType + com.apple.product-type.library.static + + 15DC9A153BC412DB41B7F154 + + fileRef + 5AEFA85A5F1AD206D68B0576 + isa + PBXBuildFile - 26766544901BC361ADA15529 + 15F64D3D7D10DB47599A72EB includeInIndex 1 isa PBXFileReference lastKnownFileType - text.xcconfig + sourcecode.c.objc + name + GRXMappingWriter.m path - Pods-Sample.debug.xcconfig + transformations/GRXMappingWriter.m sourceTree <group> - 281E734DE47EFFBE3BF9EB6D + 16E6BBD46D9745611EF313FB fileRef - 2439530CF70B0AEDF7D20F2F + BECFE3DCB323841851972996 isa PBXBuildFile - 2BBE3F72E34FB1C4FCE57F41 + 17F4C2F25813E7A4588FF233 buildConfigurations - BD0C47F343CA107135A8B9F2 - 636DF1F4C61C5AA7645709FA + B153046F0CBA526564A9673C + B960FF1BE77D3F4459EEB1E0 defaultConfigurationIsVisible 0 @@ -437,88 +385,172 @@ isa XCConfigurationList - 2D16B1B846727EA61BFB6D3F + 1868370C0050315A6B835D42 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + GRXNSScalarEnumerator.h + path + private/GRXNSScalarEnumerator.h + sourceTree + <group> + + 19001096C873023095C4F032 fileRef - C4DD5ACCFDD651DB710A7AC6 + EB29FAB1F81F0D17BDAD72D0 isa PBXBuildFile - 2D6F8181094C5DE060DD3540 + 1B8264EEFEF4AD585182D256 includeInIndex 1 isa PBXFileReference lastKnownFileType - text - name - Podfile + text.xcconfig path - ../Podfile + Pods-Sample.debug.xcconfig sourceTree - SOURCE_ROOT - xcLanguageSpecificationIdentifier - xcode.lang.ruby + <group> - 2D9FCC93E8EC668156F428D9 + 1C8DFDF9C457D910DC1FD227 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + sourcecode.c.h path - GRXImmediateWriter.m + Pods-environment.h sourceTree <group> - 2E1D14017CD6D1DF2F25DA2E + 1D31B6F63B148D2EA5637823 + + fileRef + 22DB20D833E7D26AEA6513D6 + isa + PBXBuildFile + + 1E5420835E4862DBA55002A9 + + fileRef + BECFE3DCB323841851972996 + isa + PBXBuildFile + + 1F3162E71EE5AA2B65DEC06D + + fileRef + 56CE61A20C6F88CC0CE888C8 + isa + PBXBuildFile + + 22531AF83592134D3879C3E1 fileRef - 816CFE69CF10239B3EFBCBF1 + 15F64D3D7D10DB47599A72EB isa PBXBuildFile - 34547F4C6AC4B31274C6887D + 22DB20D833E7D26AEA6513D6 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.h + sourcecode.c.objc path - Pods-SampleTests-environment.h + Pods-dummy.m sourceTree <group> - 34C114FAF0ED12406E0FFB5F + 245F9E9690E6E08D291FC94C fileRef - 1F4EFE5811548D073C9AE7F7 + BC52B0661F25B25CE382296C isa PBXBuildFile - 3538730220221D8890A16973 + 266008D38F1E72755C711699 fileRef - EBD4E0AE1D9C793A8420AA8F + 026236C3432E9DBC10A40748 isa PBXBuildFile - 359EFFFF445825D09A49A284 + 2663F4401A9075DAC0B24171 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-RxLibrary-dummy.m + sourceTree + <group> + + 26E6ACBF137DBC325B4E7DA7 + + buildConfigurationList + B05A2B15C8A03AABA163D7D7 + buildPhases + + 114F64D42E2AF2F3EBDE9BCB + DCAB71BD665AF17533987B69 + + buildRules + + dependencies + + 124B93EFC16A2026269840B2 + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + 5C30ABB95D604B483422D72A + productType + com.apple.product-type.library.static + + 27E123435067CC11FE103999 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-Sample.release.xcconfig + sourceTree + <group> + + 288A25371032891C824CF4AA fileRef - C4DD5ACCFDD651DB710A7AC6 + 838341407CEBBFB19D25C45A isa PBXBuildFile - 388A0A86C10335BD8BA6069B + 29B274FDF882AB8B39814FE6 baseConfigurationReference - 26766544901BC361ADA15529 + 687D79F4C2484F58E9796051 buildSettings ALWAYS_SEARCH_USER_PATHS @@ -533,6 +565,8 @@ 0 GCC_PRECOMPILE_PREFIX_HEADER YES + GCC_PREFIX_HEADER + Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch GCC_PREPROCESSOR_DEFINITIONS DEBUG=1 @@ -562,341 +596,172 @@ name Debug - 3BE0763D6A2984A3588C51F3 + 2AADA4C52A284ED5D41C7CF5 - buildActionMask - 2147483647 - files - - A6364C40CAC538ABF3DDE60C - + fileRef + 0D53085043D992DC00E29F0A isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 + PBXBuildFile - 3C53511285FA3AEF9ACE450F + 2B05A4C21D00E8CF0DE88447 - buildActionMask - 2147483647 - files - - FD4FDDAA137AAC4ECC193E65 - 1E52CE0A26CA218416895820 - 033F82759B99EF3786C6C3AB - CA58438D9F3E61D68DE07BB0 - A8484F554272234EC1DA0229 - A5F3698797D4DA1AFBCA61F0 - + includeInIndex + 1 isa - PBXHeadersBuildPhase - runOnlyForDeploymentPostprocessing - 0 + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + Pods-SampleTests-RxLibrary-prefix.pch + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + sourceTree + <group> - 3CED27F6BA01528C8C816522 + 2B341576464148A01DCFB28B - buildConfigurations - - 25515F1B6F5C5FC0FC5B2023 - 6C8561D023F024FB9671765B - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release + fileRef + 3AD75C69A61408EF8BE0F247 isa - XCConfigurationList + PBXBuildFile - 3E250631C4B54FA19123352E + 2B49DCA723ECBC0F2777B960 fileRef - 2D9FCC93E8EC668156F428D9 + BC52B0661F25B25CE382296C isa PBXBuildFile - 3FCF54B65C82686C35E6A695 + 2D6833D4D544AC13450405B1 - baseConfigurationReference - 0E77891D6F14157CEFE7E0AB - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - COPY_PHASE_STRIP - YES - DSTROOT - /tmp/xcodeproj.dst - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREFIX_HEADER - Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch - INSTALL_PATH - $(BUILT_PRODUCTS_DIR) - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - OTHER_CFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_CPLUSPLUSFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_LDFLAGS - - OTHER_LIBTOOLFLAGS - - PRODUCT_NAME - $(TARGET_NAME) - PUBLIC_HEADERS_FOLDER_PATH - $(TARGET_NAME) - SDKROOT - iphoneos - SKIP_INSTALL - YES - VALIDATE_PRODUCT - YES - + fileRef + 2663F4401A9075DAC0B24171 isa - XCBuildConfiguration - name - Release + PBXBuildFile - 402AEA377C3925F10F39E9CB + 2D7732FBE1A5A7FC42D4DC4B fileRef - 816CFE69CF10239B3EFBCBF1 + 56CE61A20C6F88CC0CE888C8 isa PBXBuildFile - 446E4587689AB45B32C6B76A + 2DA405F6E578008991B3F9EA fileRef - 00061C3922BA01C61542886C + BECFE3DCB323841851972996 isa PBXBuildFile - 44B1E75D8EFE8AED04C78FB7 + 2F91A2AD622F87D98C9B0E1E fileRef - D44C1815FF998CE19AF260F7 + 0D53085043D992DC00E29F0A isa PBXBuildFile - 44EAD826ACB27F88B80500A1 + 2FE1D288B8389F925AA3CE0C - explicitFileType - archive.ar includeInIndex - 0 - isa - PBXFileReference - path - libPods-Sample.a - sourceTree - BUILT_PRODUCTS_DIR - - 4545C1984951202819F52915 - - fileRef - 246FBFA8A2E45D74C161F0D4 - isa - PBXBuildFile - - 46C034308E68A95A172FD281 - - fileRef - 2D9FCC93E8EC668156F428D9 - isa - PBXBuildFile - - 46E75B83BEFA486A489F2FB5 - - includeInIndex - 1 + 1 isa PBXFileReference lastKnownFileType text.xcconfig - name - Pods-SampleTests-RxLibrary.xcconfig path - ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig + Pods-RxLibrary-Private.xcconfig sourceTree <group> - 477CC2FC7C249C2918424B8D + 30063D2979A72CA1050BD4A6 includeInIndex 1 isa PBXFileReference lastKnownFileType - text.xcconfig + text path - Pods-SampleTests.release.xcconfig + Pods-SampleTests-acknowledgements.markdown sourceTree <group> - 4BB07CE9F73F22C44B89EC9F + 3133D1CCCF4F1FE3E893509C includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + text.xcconfig path - GRXWriter.m + Pods-RxLibrary.xcconfig sourceTree <group> - 502BB8D05700DD95603B152D + 352B4C7135E3BBBFEBAB7F55 fileRef - 816CFE69CF10239B3EFBCBF1 + BA9F62DDE37FF0D601A4D5EA isa PBXBuildFile - 53DFD2191AC1853EC39421DF + 355670384FC160AB6C32765E - includeInIndex - 1 + children + + 56CE61A20C6F88CC0CE888C8 + isa - PBXFileReference - lastKnownFileType - sourcecode.c.h + PBXGroup name - Pods-Sample-RxLibrary-prefix.pch - path - ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch + iOS sourceTree <group> - 548BF298DFD0AB1E85BFD224 - - buildActionMask - 2147483647 - files - - 359EFFFF445825D09A49A284 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 55F613C8D46B4C3EE36596A4 + 36C139FD3DEDB8CA2A1D3295 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.h + text path - Pods-Sample-environment.h + Pods-acknowledgements.markdown sourceTree <group> - 569EE7C2B5DC944C87116DDD - - buildActionMask - 2147483647 - files - - BCF96ACB49A4C581F6C4FB72 - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - 5C1A6CAF7D4B0AADC6E86AB5 + 36FF37EAC7E918C4CD867776 - baseConfigurationReference - 70699B620DD649C9FC80B596 - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - COPY_PHASE_STRIP - NO - DSTROOT - /tmp/xcodeproj.dst - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO - INSTALL_PATH - $(BUILT_PRODUCTS_DIR) - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - OTHER_LDFLAGS - - OTHER_LIBTOOLFLAGS - - PRODUCT_NAME - $(TARGET_NAME) - PUBLIC_HEADERS_FOLDER_PATH - $(TARGET_NAME) - SDKROOT - iphoneos - SKIP_INSTALL - YES - + fileRef + EB29FAB1F81F0D17BDAD72D0 isa - XCBuildConfiguration - name - Debug + PBXBuildFile - 5D485A8180289AB7135979D4 + 3749A34D3DFA6E2F3539E546 - children + buildConfigurations - 2439530CF70B0AEDF7D20F2F - 2D9FCC93E8EC668156F428D9 - 1B96F18B31A3C8F512494663 - 816CFE69CF10239B3EFBCBF1 - 246FBFA8A2E45D74C161F0D4 - 4BB07CE9F73F22C44B89EC9F - EBD4E0AE1D9C793A8420AA8F - 00061C3922BA01C61542886C - D13801CD3BED29EB3EB28C87 - 1F4EFE5811548D073C9AE7F7 - BD301B295FA10BA71944E6A7 - D44C1815FF998CE19AF260F7 - D2B713C74AFBCA4A9C709F44 + 0879DBE6FFA1852D106330B4 + 6B88B9AB87714A903970EAED + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release isa - PBXGroup - name - RxLibrary - path - ../../../RxLibrary - sourceTree - <group> + XCConfigurationList - 5D62B0B091242C70E6F86CAF + 3800855A656C8D0813062074 buildConfigurationList - 1A919D1671FBC2A501B2B80E + 9508723D4C0D4321A5188108 buildPhases - 80BFFCFE10F415F6D4AA05BD - 3BE0763D6A2984A3588C51F3 - C099EA9920009567F1CC8E6F + F779618174957BE31FCCDE56 + 45FC41033EB61B16BC8151B9 + 8AB7020D9B71B1B4F34249BE buildRules @@ -905,98 +770,84 @@ isa PBXNativeTarget name - Pods-Sample-RxLibrary + Pods-SampleTests-RxLibrary productName - Pods-Sample-RxLibrary + Pods-SampleTests-RxLibrary productReference - B5E5D1402D71983EBFCAC80A + 11072993378724E9AF9CAF85 productType com.apple.product-type.library.static - 5E942AABDFCC15C6D8A85F77 + 397A12919FB4BDD608FE207C - buildActionMask - 2147483647 - files + children - 074C7BFE33E5A8B65490CD74 + B4FB10339A6A2E1AAF255802 + 5840BDD08ED67C12ADB1DF08 + 817F8B2E38A51910E8F8EC7D + 8B05D39455D5B23720961FA4 + F2BB78774BCEFD5DDDF38239 isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 + PBXGroup + sourceTree + <group> - 6269A76A3AFAD59C7AE98E1E + 3A4DE73D0D0274E782C1A564 + + fileRef + 56CE61A20C6F88CC0CE888C8 + isa + PBXBuildFile + + 3AD75C69A61408EF8BE0F247 - explicitFileType - archive.ar includeInIndex - 0 + 1 isa PBXFileReference + lastKnownFileType + sourcecode.c.objc path - libPods-SampleTests.a + GRXWriteable.m sourceTree - BUILT_PRODUCTS_DIR + <group> - 62CA148DC83850E7AD0BBC72 + 3C3F1A188E25219C230FFD4F fileRef - 6721F6605F810F0E3E99A008 + 9DADE0CF857B717294F7F74F isa PBXBuildFile - 636DF1F4C61C5AA7645709FA + 404D4F98249F3383235463A4 - baseConfigurationReference - D4FB4028CE077DDD8A803F26 - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - COPY_PHASE_STRIP - YES - DSTROOT - /tmp/xcodeproj.dst - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREFIX_HEADER - Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch - INSTALL_PATH - $(BUILT_PRODUCTS_DIR) - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - OTHER_CFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_CPLUSPLUSFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_LDFLAGS - - OTHER_LIBTOOLFLAGS - - PRODUCT_NAME - $(TARGET_NAME) - PUBLIC_HEADERS_FOLDER_PATH - $(TARGET_NAME) - SDKROOT - iphoneos - SKIP_INSTALL - YES - VALIDATE_PRODUCT - YES - + fileRef + 56CE61A20C6F88CC0CE888C8 isa - XCBuildConfiguration - name - Release + PBXBuildFile + + 407E794549893DD91A2ED84E + + fileRef + DB0257E62EC33F3F316EF017 + isa + PBXBuildFile + + 42A375125393D0613249D046 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-SampleTests.a + sourceTree + BUILT_PRODUCTS_DIR - 6721F6605F810F0E3E99A008 + 42B461F095E85911637DFD60 includeInIndex 1 @@ -1004,150 +855,176 @@ PBXFileReference lastKnownFileType sourcecode.c.objc + name + Pods-SampleTests-RxLibrary-dummy.m path - Pods-SampleTests-dummy.m + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m sourceTree <group> - 68BB1D7B3AA00144450F5F1C + 432AE81157886BE484236751 + + buildActionMask + 2147483647 + files + + 266008D38F1E72755C711699 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 43CC797FB2A733DF5B7A9F05 + + fileRef + 15F64D3D7D10DB47599A72EB + isa + PBXBuildFile + + 458FF1EEF4EB9646C699F3DD + + fileRef + 57AC9BF19B9635D7476CA5FA + isa + PBXBuildFile + + 45A1913C8F48686C1FC82520 fileRef - ACD86D4B746F1151268E7F57 + 9DADE0CF857B717294F7F74F isa PBXBuildFile - 6A7ADEEB77C72E01BBCBF89C + 45FC41033EB61B16BC8151B9 buildActionMask 2147483647 files - EE32FC2DAC0BD2116BB4F552 - 9CFC94D08F567982ED81D0AC - 3538730220221D8890A16973 - C30D693B18D43C87B0A38159 - 4545C1984951202819F52915 - 1D0CED76BEB5A08AE74DA509 + 2D7732FBE1A5A7FC42D4DC4B isa - PBXHeadersBuildPhase + PBXFrameworksBuildPhase runOnlyForDeploymentPostprocessing 0 - 6C69DB42AABCB52A9652A925 + 46513F4AD14CBD2377C1E7A1 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + sourcecode.c.h + name + GRXNSFastEnumerator.h path - Pods-dummy.m + private/GRXNSFastEnumerator.h sourceTree <group> - 6C8561D023F024FB9671765B + 46A8EFCC59CF17E048EC34ED - baseConfigurationReference - E025FBABACF462C5EDEB8F04 - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - COPY_PHASE_STRIP - YES - DSTROOT - /tmp/xcodeproj.dst - GCC_PRECOMPILE_PREFIX_HEADER - YES - INSTALL_PATH - $(BUILT_PRODUCTS_DIR) - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - OTHER_CFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_CPLUSPLUSFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_LDFLAGS - - OTHER_LIBTOOLFLAGS - - PRODUCT_NAME - $(TARGET_NAME) - PUBLIC_HEADERS_FOLDER_PATH - $(TARGET_NAME) - SDKROOT - iphoneos - SKIP_INSTALL - YES - VALIDATE_PRODUCT - YES - + fileRef + 5AEFA85A5F1AD206D68B0576 isa - XCBuildConfiguration - name - Release + PBXBuildFile - 6CE91202B3CB22AD98A8D8DD + 46FAFA88CA3E774263422EB9 - containerPortal - E72217186F5258779AB341C4 + fileRef + 3AD75C69A61408EF8BE0F247 isa - PBXContainerItemProxy - proxyType - 1 - remoteGlobalIDString - 5D62B0B091242C70E6F86CAF - remoteInfo - Pods-Sample-RxLibrary + PBXBuildFile - 6E0139A4BF1CBFDAB998D762 + 4946B2D315E9BF5CBACD7D52 - explicitFileType - archive.ar includeInIndex - 0 + 1 isa PBXFileReference + lastKnownFileType + text.plist.xml path - libPods-RxLibrary.a + Pods-acknowledgements.plist sourceTree - BUILT_PRODUCTS_DIR + <group> - 6F8086848D877F06E765F3B6 + 4954E8CE730737CD2991E502 - explicitFileType - archive.ar - includeInIndex - 0 + children + + BECFE3DCB323841851972996 + BC52B0661F25B25CE382296C + 9CFAC09E370EA1C96C8D2880 + 15F64D3D7D10DB47599A72EB + 5AEFA85A5F1AD206D68B0576 + 4BB75B0FC7359E8EA8672954 + 46513F4AD14CBD2377C1E7A1 + 636AC1003F2C71FFD74542CD + 1868370C0050315A6B835D42 + 57AC9BF19B9635D7476CA5FA + 0D53085043D992DC00E29F0A + 3AD75C69A61408EF8BE0F247 + DB0257E62EC33F3F316EF017 + BDA58E5E1AE450540A2B0227 + 0260773D27B4AE159FB0B22D + EB29FAB1F81F0D17BDAD72D0 + 838341407CEBBFB19D25C45A + F763F3DF1B47888E75D0ED9C + 9DADE0CF857B717294F7F74F + BA9F62DDE37FF0D601A4D5EA + D49849E96C0C5FFB93C810CD + isa - PBXFileReference + PBXGroup + name + RxLibrary path - libPods.a + ../../../RxLibrary sourceTree - BUILT_PRODUCTS_DIR + <group> - 70699B620DD649C9FC80B596 + 4972C151CE9A8A15BC1AE2C8 includeInIndex 1 isa PBXFileReference lastKnownFileType - text.xcconfig + sourcecode.c.h + name + Pods-Sample-RxLibrary-prefix.pch path - Pods-SampleTests.debug.xcconfig + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch sourceTree <group> - 708D5526684493C21D4B351D + 4BB47C74830C63C90981278E + + buildActionMask + 2147483647 + files + + 245F9E9690E6E08D291FC94C + A96854FB48432263FE68C313 + AA52EF1CD8A3683472BD86FE + BB88043BB37FC0261BA90A30 + 54A02FC8DA14CEC49EA8C8D5 + B7902691B66134F3764663D9 + 19001096C873023095C4F032 + E86A17CE1D79ECDCEBF91109 + 8BB6B6B3653FC309CB8EB3A0 + 7BBF3F432525D33FCB074BD5 + 2D6833D4D544AC13450405B1 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 4BB75B0FC7359E8EA8672954 includeInIndex 1 @@ -1155,364 +1032,452 @@ PBXFileReference lastKnownFileType sourcecode.c.objc + name + GRXNSBlockEnumerator.m path - Pods-RxLibrary-dummy.m + private/GRXNSBlockEnumerator.m sourceTree <group> - 71EAA6DC03A9DA40C184D310 + 50FF607D5DA961C6BEF4ABAC fileRef - 4BB07CE9F73F22C44B89EC9F + 838341407CEBBFB19D25C45A isa PBXBuildFile - 73BE487FD7206FA1037433A9 + 5280A583CA6C6C66698AE67C - buildConfigurations - - C7522ABF8E5F673B2B51B846 - 9DAF30B69F82D25455209E07 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release + fileRef + DB0257E62EC33F3F316EF017 isa - XCConfigurationList + PBXBuildFile - 77B5A8963EF74F9CE1CDEBEF + 54A02FC8DA14CEC49EA8C8D5 - containerPortal - E72217186F5258779AB341C4 + fileRef + 57AC9BF19B9635D7476CA5FA isa - PBXContainerItemProxy - proxyType - 1 - remoteGlobalIDString - CA2EA15026724E5FE7863617 - remoteInfo - Pods-RxLibrary + PBXBuildFile - 78C1945CE480BC3E085811D5 + 56CE61A20C6F88CC0CE888C8 - fileRef - 9CA52DBDD25FD65977423056 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR - 79FAE9523C4CB0EF1158F9A0 + 57AC9BF19B9635D7476CA5FA - baseConfigurationReference - 0E77891D6F14157CEFE7E0AB - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - COPY_PHASE_STRIP - NO - DSTROOT - /tmp/xcodeproj.dst - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 - GCC_PRECOMPILE_PREFIX_HEADER - YES - GCC_PREFIX_HEADER - Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO - INSTALL_PATH - $(BUILT_PRODUCTS_DIR) - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - OTHER_LDFLAGS - - OTHER_LIBTOOLFLAGS - - PRODUCT_NAME - $(TARGET_NAME) - PUBLIC_HEADERS_FOLDER_PATH - $(TARGET_NAME) - SDKROOT - iphoneos - SKIP_INSTALL - YES - + includeInIndex + 1 isa - XCBuildConfiguration + PBXFileReference + lastKnownFileType + sourcecode.c.objc name - Debug + GRXNSScalarEnumerator.m + path + private/GRXNSScalarEnumerator.m + sourceTree + <group> - 7E0A207ED9A829B259BAF98E + 5840BDD08ED67C12ADB1DF08 + children + + 4954E8CE730737CD2991E502 + isa - PBXTargetDependency + PBXGroup name - Pods-RxLibrary - target - CA2EA15026724E5FE7863617 - targetProxy - 77B5A8963EF74F9CE1CDEBEF + Development Pods + sourceTree + <group> + + 591702CE7D8AF91674F1640F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-SampleTests.debug.xcconfig + sourceTree + <group> - 7F305BF2D2399198431240B2 + 594F98D43B96AB5C11E61C10 fileRef - D44C1815FF998CE19AF260F7 + F763F3DF1B47888E75D0ED9C isa PBXBuildFile - 80BFFCFE10F415F6D4AA05BD + 5AEFA85A5F1AD206D68B0576 - buildActionMask - 2147483647 - files - - 8B988DE4EEF45D03E1FE4011 - 502BB8D05700DD95603B152D - 0D88B5DF071D95A30D664FF6 - CC015D517558717A179F07EB - CA7A5D5A911B21E060A7C9A8 - DF707F9ADA38C19530138855 - 68BB1D7B3AA00144450F5F1C - + includeInIndex + 1 isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 + PBXFileReference + lastKnownFileType + sourcecode.c.h + name + GRXNSBlockEnumerator.h + path + private/GRXNSBlockEnumerator.h + sourceTree + <group> - 80ED48A94404B285C3BAD2A2 + 5B8A3BFE016346EF080D52C6 buildActionMask 2147483647 files - 2D16B1B846727EA61BFB6D3F + 3A4DE73D0D0274E782C1A564 isa PBXFrameworksBuildPhase runOnlyForDeploymentPostprocessing 0 - 816CFE69CF10239B3EFBCBF1 + 5C30ABB95D604B483422D72A + explicitFileType + archive.ar includeInIndex - 1 + 0 isa PBXFileReference - lastKnownFileType - sourcecode.c.objc path - GRXWriteable.m + libPods.a sourceTree - <group> + BUILT_PRODUCTS_DIR - 8258E01A573DC26563C24CD3 + 5DE93D7B39D2D1AD7336C4AC - children - - 8E115C0A94168699797FD383 - + fileRef + 838341407CEBBFB19D25C45A isa - PBXGroup - name - Frameworks - sourceTree - <group> + PBXBuildFile - 8454D1F76F981D7967AFEB64 + 621587D6C7759FBE7096D185 - buildConfigurations - - 251E2B5CA237FEEC44071A78 - E429BB9EF652206D69B38B4B - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release + fileRef + 46513F4AD14CBD2377C1E7A1 isa - XCConfigurationList + PBXBuildFile - 8998DF528EA3268FD2F3312F + 636AC1003F2C71FFD74542CD - buildConfigurationList - AAD81C09A25B9BF7DA0C1C86 - buildPhases - - BA1F7D67EB7832C536803BEB - 548BF298DFD0AB1E85BFD224 - - buildRules - - dependencies - - 17B62DC84258EA204EC14FC6 - + includeInIndex + 1 isa - PBXNativeTarget + PBXFileReference + lastKnownFileType + sourcecode.c.objc name - Pods-SampleTests - productName - Pods-SampleTests - productReference - 6269A76A3AFAD59C7AE98E1E - productType - com.apple.product-type.library.static - - 8AF2FEBF81B82548A9CD7D5E - - buildConfigurations - - 388A0A86C10335BD8BA6069B - 972E288F65487B1145B953C3 - - defaultConfigurationIsVisible - 0 - defaultConfigurationName - Release - isa - XCConfigurationList + GRXNSFastEnumerator.m + path + private/GRXNSFastEnumerator.m + sourceTree + <group> - 8B988DE4EEF45D03E1FE4011 + 687D79F4C2484F58E9796051 - fileRef - 2D9FCC93E8EC668156F428D9 + includeInIndex + 1 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-SampleTests-RxLibrary-Private.xcconfig + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig + sourceTree + <group> - 8CDD9B1A9971F8E45E6ECCFE + 69E8FF71552D08D72B9068F1 children - 6F8086848D877F06E765F3B6 - 6E0139A4BF1CBFDAB998D762 - 44EAD826ACB27F88B80500A1 - B5E5D1402D71983EBFCAC80A - 6269A76A3AFAD59C7AE98E1E - F8FA1EE55435B1DD5386F9B7 + 36C139FD3DEDB8CA2A1D3295 + 4946B2D315E9BF5CBACD7D52 + 22DB20D833E7D26AEA6513D6 + 1C8DFDF9C457D910DC1FD227 + E14CB6F332A9E58BB5F76C07 + 6AC13D00A5A61BDA0DE5FAAF + A577CB571492B4F951064FCF isa PBXGroup name - Products + Pods + path + Target Support Files/Pods sourceTree <group> - 8D0ECACB7BF0FD50C8BA90EF + 6AC13D00A5A61BDA0DE5FAAF includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + text.xcconfig path - Pods-Sample-dummy.m + Pods.debug.xcconfig sourceTree <group> - 8D141FF420B8F70654BEB651 + 6B5B56ED61BE76782DF02817 - buildActionMask - 2147483647 - files - - 46C034308E68A95A172FD281 - 2E1D14017CD6D1DF2F25DA2E - 446E4587689AB45B32C6B76A - 34C114FAF0ED12406E0FFB5F - 71EAA6DC03A9DA40C184D310 - 44B1E75D8EFE8AED04C78FB7 - C7F1D04BA7ECEB89811F5AE8 - + baseConfigurationReference + 687D79F4C2484F58E9796051 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 + XCBuildConfiguration + name + Release - 8E115C0A94168699797FD383 + 6B88B9AB87714A903970EAED - children + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + NO + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PREPROCESSOR_DEFINITIONS + + RELEASE=1 + + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + STRIP_INSTALLED_PRODUCT + NO + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + 6BFD156F312F6CAA1E5B00CA + + buildConfigurationList + 962FF5FAC21292530C615D05 + buildPhases - C4DD5ACCFDD651DB710A7AC6 + 4BB47C74830C63C90981278E + 5B8A3BFE016346EF080D52C6 + A4C1C82F355864E7D3E200DD + buildRules + + dependencies + isa - PBXGroup + PBXNativeTarget name - iOS - sourceTree - <group> + Pods-RxLibrary + productName + Pods-RxLibrary + productReference + A579EC5BE7E68C55CA5FECDE + productType + com.apple.product-type.library.static - 8FDD88F3116CD60BDFADE08D + 6D1D41BAE4E325572FAC7B17 - includeInIndex - 1 + fileRef + 9DADE0CF857B717294F7F74F isa - PBXFileReference - lastKnownFileType - text - path - Pods-SampleTests-acknowledgements.markdown - sourceTree - <group> + PBXBuildFile - 9147D56A68B32B154574B4B1 + 6E00FD6D197F0D1332D11199 - children - - 2D6F8181094C5DE060DD3540 - DA385F717CB8DC97197F9779 - 8258E01A573DC26563C24CD3 - 8CDD9B1A9971F8E45E6ECCFE - BC215B3ADAA2B59CC8E1E0D2 - + baseConfigurationReference + 1B8264EEFEF4AD585182D256 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + isa - PBXGroup - sourceTree - <group> + XCBuildConfiguration + name + Debug - 93706FFF29E959C0D0FB35B8 + 6E0669CB3E76E19FC854BA74 fileRef - BD301B295FA10BA71944E6A7 + 4BB75B0FC7359E8EA8672954 isa PBXBuildFile - 972E288F65487B1145B953C3 + 6EB14BC96525C955FBD5CC75 + + isa + PBXTargetDependency + name + Pods-Sample-RxLibrary + target + F6C59E5B4CFE053E9F98000E + targetProxy + A0215878A7EC41E833B5F1D2 + + 74F28D2155D125C3068F96BE baseConfigurationReference - 1DD32401F91AA06C7AC30E87 + 6AC13D00A5A61BDA0DE5FAAF buildSettings ALWAYS_SEARCH_USER_PATHS NO COPY_PHASE_STRIP - YES + NO DSTROOT /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 GCC_PRECOMPILE_PREFIX_HEADER YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO INSTALL_PATH $(BUILT_PRODUCTS_DIR) IPHONEOS_DEPLOYMENT_TARGET 8.0 - OTHER_CFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - - OTHER_CPLUSPLUSFLAGS - - -DNS_BLOCK_ASSERTIONS=1 - $(inherited) - OTHER_LDFLAGS OTHER_LIBTOOLFLAGS @@ -1525,40 +1490,64 @@ iphoneos SKIP_INSTALL YES - VALIDATE_PRODUCT - YES isa XCBuildConfiguration name - Release + Debug - 9CA52DBDD25FD65977423056 + 7A8627E1649F66DEE014EB46 - includeInIndex - 1 + children + + D53A8F2B11E6C2C187AFFF1D + B50ECED4CEC7554ED6077619 + BC50D76123DA4B85E6AD77B4 + 092D0456252ED3F90F66084D + AA99564782B655791B053E58 + 1B8264EEFEF4AD585182D256 + 27E123435067CC11FE103999 + isa - PBXFileReference - lastKnownFileType - sourcecode.c.objc + PBXGroup name - Pods-SampleTests-RxLibrary-dummy.m + Pods-Sample path - ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-dummy.m + Target Support Files/Pods-Sample sourceTree <group> - 9CFC94D08F567982ED81D0AC + 7AC4B3F3D7BB132642153A38 + + fileRef + 0260773D27B4AE159FB0B22D + isa + PBXBuildFile + + 7BBF3F432525D33FCB074BD5 fileRef - 1B96F18B31A3C8F512494663 + BA9F62DDE37FF0D601A4D5EA isa PBXBuildFile - 9DAF30B69F82D25455209E07 + 7DA2A517A18D85B390FB122A + + containerPortal + FBF79DDF04ADEAED54BA2286 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 3800855A656C8D0813062074 + remoteInfo + Pods-SampleTests-RxLibrary + + 7E9B63EFA2466C4456A0695A baseConfigurationReference - B16330C6E1974F73301EFA15 + 2FE1D288B8389F925AA3CE0C buildSettings ALWAYS_SEARCH_USER_PATHS @@ -1605,118 +1594,237 @@ name Release - 9E294E4639886DA2A66D2F45 + 7FACBF2C8AF0403DD1C11015 includeInIndex 1 isa PBXFileReference lastKnownFileType - text + text.xcconfig + name + Pods-Sample-RxLibrary-Private.xcconfig path - Pods-Sample-acknowledgements.markdown + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-Private.xcconfig sourceTree <group> - 9EED35B98793FD4884D527D7 + 801BBA7A538CFAE6746966A7 - buildConfigurationList - 2BBE3F72E34FB1C4FCE57F41 - buildPhases + fileRef + 42B461F095E85911637DFD60 + isa + PBXBuildFile + + 817F8B2E38A51910E8F8EC7D + + children - A5F1BCFC715A1FB9A5E05F54 - 0EF90C125A8C853D6900067E - 3C53511285FA3AEF9ACE450F + 355670384FC160AB6C32765E - buildRules - - dependencies - isa - PBXNativeTarget + PBXGroup name - Pods-SampleTests-RxLibrary - productName - Pods-SampleTests-RxLibrary - productReference - F8FA1EE55435B1DD5386F9B7 - productType - com.apple.product-type.library.static + Frameworks + sourceTree + <group> + + 838341407CEBBFB19D25C45A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXWriter+Transformations.h + sourceTree + <group> + + 85D5565EC08D14A6A60F1DDA + + fileRef + 56CE61A20C6F88CC0CE888C8 + isa + PBXBuildFile + + 86586E0B51D3DC6A97D0A7F3 + + fileRef + 56CE61A20C6F88CC0CE888C8 + isa + PBXBuildFile + + 86D03B997B81819E2F39E48B + + fileRef + BC52B0661F25B25CE382296C + isa + PBXBuildFile + + 87700F015FA41F53D88CA4BC + + buildActionMask + 2147483647 + files + + 404D4F98249F3383235463A4 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 8915073BE8158EF53FE11B95 + + fileRef + EB29FAB1F81F0D17BDAD72D0 + isa + PBXBuildFile + + 8919AE774852DD128A7CB510 + + buildConfigurations + + 6E00FD6D197F0D1332D11199 + B602CFEF970BEA98E40A056C + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 896F697BD1BEAF8A081337EB + + buildActionMask + 2147483647 + files + + 86586E0B51D3DC6A97D0A7F3 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 8A7375A2F98889F35C15E2D7 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods-SampleTests-RxLibrary.xcconfig + path + ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary.xcconfig + sourceTree + <group> + + 8AB7020D9B71B1B4F34249BE + + buildActionMask + 2147483647 + files + + 1E5420835E4862DBA55002A9 + 00949E44051CD97851DEFF3B + 15DC9A153BC412DB41B7F154 + 0385BCBCA0601E80FAD2A901 + 01F5B724A99ADB3547023C72 + F2C6AACFE46FFA8DC383DE43 + 7AC4B3F3D7BB132642153A38 + 5DE93D7B39D2D1AD7336C4AC + 407E794549893DD91A2ED84E + 3C3F1A188E25219C230FFD4F + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 - A3B182A29677AE41F3DDF60E + 8B05D39455D5B23720961FA4 children - 9E294E4639886DA2A66D2F45 - BDDB48DF5321836E03134B73 - 8D0ECACB7BF0FD50C8BA90EF - 55F613C8D46B4C3EE36596A4 - F2055AA27575926EE57B8546 - 26766544901BC361ADA15529 - 1DD32401F91AA06C7AC30E87 + 5C30ABB95D604B483422D72A + A579EC5BE7E68C55CA5FECDE + DF94410F5DC0A0AB69336DF4 + EF2EE4BC906FF9909348DAB5 + 42A375125393D0613249D046 + 11072993378724E9AF9CAF85 isa PBXGroup name - Pods-Sample - path - Target Support Files/Pods-Sample + Products sourceTree <group> - A5F1BCFC715A1FB9A5E05F54 + 8B503889F903CED9A12E5C87 - buildActionMask - 2147483647 - files - - 3E250631C4B54FA19123352E - 402AEA377C3925F10F39E9CB - 0014294E408866C876275712 - E21F75C9C5AE553D1525B15D - FFFC86AF33D17D398F42C549 - 7F305BF2D2399198431240B2 - 78C1945CE480BC3E085811D5 - + includeInIndex + 1 isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-SampleTests-resources.sh + sourceTree + <group> - A5F3698797D4DA1AFBCA61F0 + 8BB6B6B3653FC309CB8EB3A0 fileRef - BD301B295FA10BA71944E6A7 + BDA58E5E1AE450540A2B0227 isa PBXBuildFile - A6364C40CAC538ABF3DDE60C + 8CD061F02F905957F4C1D188 fileRef - C4DD5ACCFDD651DB710A7AC6 + 636AC1003F2C71FFD74542CD isa PBXBuildFile - A8484F554272234EC1DA0229 + 911BEE248BE640294A081862 - fileRef - 246FBFA8A2E45D74C161F0D4 + includeInIndex + 1 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-RxLibrary-prefix.pch + sourceTree + <group> - A9657244C4119ECE09EE0780 + 9508723D4C0D4321A5188108 - fileRef - C4DD5ACCFDD651DB710A7AC6 + buildConfigurations + + 29B274FDF882AB8B39814FE6 + 6B5B56ED61BE76782DF02817 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release isa - PBXBuildFile + XCConfigurationList - AAD81C09A25B9BF7DA0C1C86 + 962FF5FAC21292530C615D05 buildConfigurations - 5C1A6CAF7D4B0AADC6E86AB5 - C11B686FDA34820988E0EA76 + A150782D73BBE95DE629B03C + 7E9B63EFA2466C4456A0695A defaultConfigurationIsVisible 0 @@ -1725,82 +1833,175 @@ isa XCConfigurationList - AB030C334AF0049970BC6F69 + 9BD773E928AD698D23B20123 fileRef - D13801CD3BED29EB3EB28C87 + 1868370C0050315A6B835D42 isa PBXBuildFile - AB49EB008360ACF61F868E97 + 9CCBE9A628C305B3B089B8DD fileRef - 1B96F18B31A3C8F512494663 + BA9F62DDE37FF0D601A4D5EA isa PBXBuildFile - ACD86D4B746F1151268E7F57 + 9CFAC09E370EA1C96C8D2880 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + sourcecode.c.h name - Pods-Sample-RxLibrary-dummy.m + GRXMappingWriter.h path - ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m + transformations/GRXMappingWriter.h + sourceTree + <group> + + 9DADE0CF857B717294F7F74F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + NSEnumerator+GRXUtil.h sourceTree <group> - AD71151A44A1A6BB85C70D05 + 9E8DC61269B141639DA7F859 + + buildActionMask + 2147483647 + files + + 16E6BBD46D9745611EF313FB + CC0A03D531EF0FF199671820 + C382F416EFA39BE2CF216044 + 621587D6C7759FBE7096D185 + C0AC333A6FE8F07600C96890 + 2F91A2AD622F87D98C9B0E1E + FDC6B84EAC9989F0827EA4F3 + 50FF607D5DA961C6BEF4ABAC + 5280A583CA6C6C66698AE67C + 6D1D41BAE4E325572FAC7B17 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + A00077019C113466960E9DAF + + fileRef + 9CFAC09E370EA1C96C8D2880 + isa + PBXBuildFile + + A0215878A7EC41E833B5F1D2 containerPortal - E72217186F5258779AB341C4 + FBF79DDF04ADEAED54BA2286 isa PBXContainerItemProxy proxyType 1 remoteGlobalIDString - 9EED35B98793FD4884D527D7 + F6C59E5B4CFE053E9F98000E remoteInfo - Pods-SampleTests-RxLibrary + Pods-Sample-RxLibrary - B032E0762906905546DBF8B3 + A150782D73BBE95DE629B03C - fileRef - EBD4E0AE1D9C793A8420AA8F + baseConfigurationReference + 2FE1D288B8389F925AA3CE0C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + isa - PBXBuildFile + XCBuildConfiguration + name + Debug - B16330C6E1974F73301EFA15 + A4C1C82F355864E7D3E200DD - includeInIndex - 1 + buildActionMask + 2147483647 + files + + 2DA405F6E578008991B3F9EA + A00077019C113466960E9DAF + 46A8EFCC59CF17E048EC34ED + 024F840533A6674922DB7899 + 9BD773E928AD698D23B20123 + 2AADA4C52A284ED5D41C7CF5 + CC358E38AE146C095C401760 + 288A25371032891C824CF4AA + FDC939796E70DC7D141E29FC + 45A1913C8F48686C1FC82520 + isa - PBXFileReference - lastKnownFileType - text.xcconfig - path - Pods-RxLibrary-Private.xcconfig - sourceTree - <group> + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 - B3E633C4D93071411657B4CC + A577CB571492B4F951064FCF includeInIndex 1 isa PBXFileReference lastKnownFileType - text.script.sh + text.xcconfig path - Pods-resources.sh + Pods.release.xcconfig sourceTree <group> - B5E5D1402D71983EBFCAC80A + A579EC5BE7E68C55CA5FECDE explicitFileType archive.ar @@ -1809,37 +2010,146 @@ isa PBXFileReference path - libPods-Sample-RxLibrary.a + libPods-RxLibrary.a sourceTree BUILT_PRODUCTS_DIR - B960F8B548AAFF747493F848 + A71CC1B520D2DFF451839FE2 + + buildActionMask + 2147483647 + files + + 0BC8818D3A097831FDE0750B + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + A8AFEFDF4700447BBCDF9E10 + + baseConfigurationReference + 591702CE7D8AF91674F1640F + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + A96854FB48432263FE68C313 + + fileRef + 15F64D3D7D10DB47599A72EB + isa + PBXBuildFile + + AA52EF1CD8A3683472BD86FE + + fileRef + 4BB75B0FC7359E8EA8672954 + isa + PBXBuildFile + + AA99564782B655791B053E58 includeInIndex 1 isa PBXFileReference lastKnownFileType - text.plist.xml + text.script.sh path - Pods-acknowledgements.plist + Pods-Sample-resources.sh sourceTree <group> - BA1F7D67EB7832C536803BEB + AF9F0D991C2913F55496D06E - buildActionMask - 2147483647 - files - - 62CA148DC83850E7AD0BBC72 - + baseConfigurationReference + A577CB571492B4F951064FCF + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_PRECOMPILE_PREFIX_HEADER + YES + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + OTHER_LIBTOOLFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + isa - PBXSourcesBuildPhase - runOnlyForDeploymentPostprocessing - 0 + XCBuildConfiguration + name + Release - BA6147A19780CE00E1877F27 + B034EE43C1EF96D1CBD1328A includeInIndex 1 @@ -1847,37 +2157,31 @@ PBXFileReference lastKnownFileType text.xcconfig + name + Pods-Sample-RxLibrary.xcconfig path - Pods.debug.xcconfig + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig sourceTree <group> - BC215B3ADAA2B59CC8E1E0D2 + B05A2B15C8A03AABA163D7D7 - children + buildConfigurations - 17882F47BB3F8879EADC6877 - A3B182A29677AE41F3DDF60E - EE39E3EB35643DA11DB4107A + 74F28D2155D125C3068F96BE + AF9F0D991C2913F55496D06E + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release isa - PBXGroup - name - Targets Support Files - sourceTree - <group> - - BCF96ACB49A4C581F6C4FB72 - - fileRef - C4DD5ACCFDD651DB710A7AC6 - isa - PBXBuildFile + XCConfigurationList - BD0C47F343CA107135A8B9F2 + B153046F0CBA526564A9673C baseConfigurationReference - D4FB4028CE077DDD8A803F26 + 7FACBF2C8AF0403DD1C11015 buildSettings ALWAYS_SEARCH_USER_PATHS @@ -1893,7 +2197,7 @@ GCC_PRECOMPILE_PREFIX_HEADER YES GCC_PREFIX_HEADER - Target Support Files/Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-prefix.pch + Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch GCC_PREPROCESSOR_DEFINITIONS DEBUG=1 @@ -1923,20 +2227,24 @@ name Debug - BD301B295FA10BA71944E6A7 + B4FB10339A6A2E1AAF255802 includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.h + text + name + Podfile path - NSEnumerator+GRXUtil.h + ../Podfile sourceTree - <group> + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby - BDDB48DF5321836E03134B73 + B50ECED4CEC7554ED6077619 includeInIndex 1 @@ -1949,41 +2257,10 @@ sourceTree <group> - C099EA9920009567F1CC8E6F - - buildActionMask - 2147483647 - files - - 281E734DE47EFFBE3BF9EB6D - AB49EB008360ACF61F868E97 - B032E0762906905546DBF8B3 - AB030C334AF0049970BC6F69 - 2536F48732661916E7F98AF4 - 93706FFF29E959C0D0FB35B8 - - isa - PBXHeadersBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - C0AFDE847E9A73FB99BE85CA - - includeInIndex - 1 - isa - PBXFileReference - lastKnownFileType - sourcecode.c.h - path - Pods-environment.h - sourceTree - <group> - - C11B686FDA34820988E0EA76 + B602CFEF970BEA98E40A056C baseConfigurationReference - 477CC2FC7C249C2918424B8D + 27E123435067CC11FE103999 buildSettings ALWAYS_SEARCH_USER_PATHS @@ -2028,57 +2305,57 @@ name Release - C30D693B18D43C87B0A38159 + B78477CA74AEFC96C25B49B4 fileRef - D13801CD3BED29EB3EB28C87 + BDA58E5E1AE450540A2B0227 isa PBXBuildFile - C4DD5ACCFDD651DB710A7AC6 + B7902691B66134F3764663D9 + fileRef + 3AD75C69A61408EF8BE0F247 isa - PBXFileReference - lastKnownFileType - wrapper.framework - name - Foundation.framework - path - Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework - sourceTree - DEVELOPER_DIR + PBXBuildFile + + B90592E4E39AFD1E769F9A95 + + fileRef + F763F3DF1B47888E75D0ED9C + isa + PBXBuildFile - C7522ABF8E5F673B2B51B846 + B960FF1BE77D3F4459EEB1E0 baseConfigurationReference - B16330C6E1974F73301EFA15 + 7FACBF2C8AF0403DD1C11015 buildSettings ALWAYS_SEARCH_USER_PATHS NO COPY_PHASE_STRIP - NO + YES DSTROOT /tmp/xcodeproj.dst - GCC_DYNAMIC_NO_PIC - NO - GCC_OPTIMIZATION_LEVEL - 0 GCC_PRECOMPILE_PREFIX_HEADER YES GCC_PREFIX_HEADER - Target Support Files/Pods-RxLibrary/Pods-RxLibrary-prefix.pch - GCC_PREPROCESSOR_DEFINITIONS - - DEBUG=1 - $(inherited) - - GCC_SYMBOLS_PRIVATE_EXTERN - NO + Target Support Files/Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-prefix.pch INSTALL_PATH $(BUILT_PRODUCTS_DIR) IPHONEOS_DEPLOYMENT_TARGET 8.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + OTHER_LDFLAGS OTHER_LIBTOOLFLAGS @@ -2091,151 +2368,237 @@ iphoneos SKIP_INSTALL YES + VALIDATE_PRODUCT + YES isa XCBuildConfiguration name - Debug + Release - C7F1D04BA7ECEB89811F5AE8 + BA9F62DDE37FF0D601A4D5EA + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + NSEnumerator+GRXUtil.m + sourceTree + <group> + + BB88043BB37FC0261BA90A30 fileRef - 708D5526684493C21D4B351D + 636AC1003F2C71FFD74542CD isa PBXBuildFile - CA2EA15026724E5FE7863617 + BC50D76123DA4B85E6AD77B4 - buildConfigurationList - 73BE487FD7206FA1037433A9 - buildPhases - - 8D141FF420B8F70654BEB651 - 569EE7C2B5DC944C87116DDD - 6A7ADEEB77C72E01BBCBF89C - - buildRules - - dependencies - + includeInIndex + 1 isa - PBXNativeTarget - name - Pods-RxLibrary - productName - Pods-RxLibrary - productReference - 6E0139A4BF1CBFDAB998D762 - productType - com.apple.product-type.library.static + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-Sample-dummy.m + sourceTree + <group> - CA58438D9F3E61D68DE07BB0 + BC52B0661F25B25CE382296C - fileRef - D13801CD3BED29EB3EB28C87 + includeInIndex + 1 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXImmediateWriter.m + sourceTree + <group> - CA7A5D5A911B21E060A7C9A8 + BDA58E5E1AE450540A2B0227 - fileRef - 4BB07CE9F73F22C44B89EC9F + includeInIndex + 1 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + GRXWriter.m + sourceTree + <group> - CC015D517558717A179F07EB + BECFE3DCB323841851972996 - fileRef - 1F4EFE5811548D073C9AE7F7 + includeInIndex + 1 isa - PBXBuildFile + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + GRXImmediateWriter.h + sourceTree + <group> - CD55EA3FDCE78270B7AD57C1 + BFE770FF3C0847AB995A82CA buildActionMask 2147483647 files - F2258DDD414D3E7F794A8D57 + 86D03B997B81819E2F39E48B + 43CC797FB2A733DF5B7A9F05 + 6E0669CB3E76E19FC854BA74 + CBA4FEEF7E642535FB39D878 + FC1BEDED07CA4D91AFEB56BD + 46FAFA88CA3E774263422EB9 + 8915073BE8158EF53FE11B95 + B90592E4E39AFD1E769F9A95 + F6383D21195A5BEFC51F6618 + 352B4C7135E3BBBFEBAB7F55 + E8F0B998CE49FF732F312133 isa PBXSourcesBuildPhase runOnlyForDeploymentPostprocessing 0 - CE7EA2A3E87B73883477BA0E + C0AC333A6FE8F07600C96890 fileRef - C4DD5ACCFDD651DB710A7AC6 + 1868370C0050315A6B835D42 isa PBXBuildFile - D0574DAAAAAA7164F6C504B0 + C382F416EFA39BE2CF216044 - includeInIndex - 1 + fileRef + 5AEFA85A5F1AD206D68B0576 isa - PBXFileReference - lastKnownFileType - sourcecode.c.h + PBXBuildFile + + C4342DDEEF3C3290956C21DF + + buildConfigurations + + A8AFEFDF4700447BBCDF9E10 + 0F20828B67FDCB990B1818E9 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + CBA4FEEF7E642535FB39D878 + + fileRef + 636AC1003F2C71FFD74542CD + isa + PBXBuildFile + + CC0A03D531EF0FF199671820 + + fileRef + 9CFAC09E370EA1C96C8D2880 + isa + PBXBuildFile + + CC358E38AE146C095C401760 + + fileRef + 0260773D27B4AE159FB0B22D + isa + PBXBuildFile + + D49849E96C0C5FFB93C810CD + + children + + 3133D1CCCF4F1FE3E893509C + 2FE1D288B8389F925AA3CE0C + 2663F4401A9075DAC0B24171 + 911BEE248BE640294A081862 + B034EE43C1EF96D1CBD1328A + 7FACBF2C8AF0403DD1C11015 + E232BDE68610C0AC98C0D29F + 4972C151CE9A8A15BC1AE2C8 + 8A7375A2F98889F35C15E2D7 + 687D79F4C2484F58E9796051 + 42B461F095E85911637DFD60 + 2B05A4C21D00E8CF0DE88447 + + isa + PBXGroup + name + Support Files path - Pods-RxLibrary-prefix.pch + ../examples/Sample/Pods/Target Support Files/Pods-RxLibrary sourceTree <group> - D13801CD3BED29EB3EB28C87 + D53A8F2B11E6C2C187AFFF1D includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.h + text path - GRXWriter+Transformations.h + Pods-Sample-acknowledgements.markdown sourceTree <group> - D2B713C74AFBCA4A9C709F44 + DB007D27F74F8F72C72A1079 - children - - 073184615871F8C7E53BF14F - B16330C6E1974F73301EFA15 - 708D5526684493C21D4B351D - D0574DAAAAAA7164F6C504B0 - DE7537ED152395F49840CBC4 - 0E77891D6F14157CEFE7E0AB - ACD86D4B746F1151268E7F57 - 53DFD2191AC1853EC39421DF - 46E75B83BEFA486A489F2FB5 - D4FB4028CE077DDD8A803F26 - 9CA52DBDD25FD65977423056 - 10420B1B517C0F7BFC1629D6 - + containerPortal + FBF79DDF04ADEAED54BA2286 isa - PBXGroup - name - Support Files + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 6BFD156F312F6CAA1E5B00CA + remoteInfo + Pods-RxLibrary + + DB0257E62EC33F3F316EF017 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h path - ../examples/Sample/Pods/Target Support Files/Pods-RxLibrary + GRXWriter.h sourceTree <group> - D44C1815FF998CE19AF260F7 + DB3528F609E6177E1C5A691C includeInIndex 1 isa PBXFileReference lastKnownFileType - sourcecode.c.objc + text.plist.xml path - NSEnumerator+GRXUtil.m + Pods-SampleTests-acknowledgements.plist sourceTree <group> - D4FB4028CE077DDD8A803F26 + DB677464758307786D68CCE9 includeInIndex 1 @@ -2243,326 +2606,283 @@ PBXFileReference lastKnownFileType text.xcconfig - name - Pods-SampleTests-RxLibrary-Private.xcconfig path - ../Pods-SampleTests-RxLibrary/Pods-SampleTests-RxLibrary-Private.xcconfig + Pods-SampleTests.release.xcconfig sourceTree <group> - DA385F717CB8DC97197F9779 + DCAB71BD665AF17533987B69 - children + buildActionMask + 2147483647 + files - 5D485A8180289AB7135979D4 + 85D5565EC08D14A6A60F1DDA isa - PBXGroup - name - Development Pods + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + DF94410F5DC0A0AB69336DF4 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-Sample.a sourceTree - <group> + BUILT_PRODUCTS_DIR - DE7537ED152395F49840CBC4 + E14CB6F332A9E58BB5F76C07 includeInIndex 1 isa PBXFileReference lastKnownFileType - text.xcconfig - name - Pods-Sample-RxLibrary.xcconfig + text.script.sh path - ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary.xcconfig + Pods-resources.sh sourceTree <group> - DF707F9ADA38C19530138855 - - fileRef - D44C1815FF998CE19AF260F7 - isa - PBXBuildFile - - E025FBABACF462C5EDEB8F04 + E232BDE68610C0AC98C0D29F includeInIndex 1 isa PBXFileReference lastKnownFileType - text.xcconfig + sourcecode.c.objc + name + Pods-Sample-RxLibrary-dummy.m path - Pods.release.xcconfig + ../Pods-Sample-RxLibrary/Pods-Sample-RxLibrary-dummy.m sourceTree <group> - E21F75C9C5AE553D1525B15D + E86A17CE1D79ECDCEBF91109 fileRef - 1F4EFE5811548D073C9AE7F7 + F763F3DF1B47888E75D0ED9C isa PBXBuildFile - E429BB9EF652206D69B38B4B - - buildSettings - - ALWAYS_SEARCH_USER_PATHS - NO - CLANG_CXX_LANGUAGE_STANDARD - gnu++0x - CLANG_CXX_LIBRARY - libc++ - CLANG_ENABLE_MODULES - YES - CLANG_ENABLE_OBJC_ARC - YES - CLANG_WARN_BOOL_CONVERSION - YES - CLANG_WARN_CONSTANT_CONVERSION - YES - CLANG_WARN_DIRECT_OBJC_ISA_USAGE - YES - CLANG_WARN_EMPTY_BODY - YES - CLANG_WARN_ENUM_CONVERSION - YES - CLANG_WARN_INT_CONVERSION - YES - CLANG_WARN_OBJC_ROOT_CLASS - YES - COPY_PHASE_STRIP - NO - ENABLE_NS_ASSERTIONS - NO - GCC_C_LANGUAGE_STANDARD - gnu99 - GCC_PREPROCESSOR_DEFINITIONS - - RELEASE=1 - - GCC_WARN_64_TO_32_BIT_CONVERSION - YES - GCC_WARN_ABOUT_RETURN_TYPE - YES - GCC_WARN_UNDECLARED_SELECTOR - YES - GCC_WARN_UNINITIALIZED_AUTOS - YES - GCC_WARN_UNUSED_FUNCTION - YES - GCC_WARN_UNUSED_VARIABLE - YES - IPHONEOS_DEPLOYMENT_TARGET - 8.0 - STRIP_INSTALLED_PRODUCT - NO - VALIDATE_PRODUCT - YES - - isa - XCBuildConfiguration - name - Release - - E72217186F5258779AB341C4 + E8F0B998CE49FF732F312133 - attributes - - LastUpgradeCheck - 0510 - - buildConfigurationList - 8454D1F76F981D7967AFEB64 - compatibilityVersion - Xcode 3.2 - developmentRegion - English - hasScannedForEncodings - 0 + fileRef + E232BDE68610C0AC98C0D29F isa - PBXProject - knownRegions - - en - - mainGroup - 9147D56A68B32B154574B4B1 - productRefGroup - 8CDD9B1A9971F8E45E6ECCFE - projectDirPath - - projectReferences - - projectRoot - - targets - - 20FAE2C205A83A18304F55D3 - CA2EA15026724E5FE7863617 - F88FB4C4D5E45ABA4FE79557 - 5D62B0B091242C70E6F86CAF - 8998DF528EA3268FD2F3312F - 9EED35B98793FD4884D527D7 - + PBXBuildFile - E8EEC1310BE1A1C26A6CC94F + EB29FAB1F81F0D17BDAD72D0 includeInIndex 1 isa PBXFileReference lastKnownFileType - text.script.sh + sourcecode.c.objc path - Pods-SampleTests-resources.sh + GRXWriter+Immediate.m sourceTree <group> - EBD4E0AE1D9C793A8420AA8F + EF2EE4BC906FF9909348DAB5 + explicitFileType + archive.ar includeInIndex - 1 + 0 isa PBXFileReference - lastKnownFileType - sourcecode.c.h path - GRXWriter+Immediate.h + libPods-Sample-RxLibrary.a sourceTree - <group> + BUILT_PRODUCTS_DIR - ED20D5EB599CC4E0E8E6F6F4 + EF8B807C5A2059D6C709450D includeInIndex 1 isa PBXFileReference lastKnownFileType - text + sourcecode.c.h path - Pods-acknowledgements.markdown + Pods-SampleTests-environment.h sourceTree <group> - EE32FC2DAC0BD2116BB4F552 - - fileRef - 2439530CF70B0AEDF7D20F2F - isa - PBXBuildFile - - EE39E3EB35643DA11DB4107A + F2BB78774BCEFD5DDDF38239 children - 8FDD88F3116CD60BDFADE08D - 0F54B7DB9C41BEA754222626 - 6721F6605F810F0E3E99A008 - 34547F4C6AC4B31274C6887D - E8EEC1310BE1A1C26A6CC94F - 70699B620DD649C9FC80B596 - 477CC2FC7C249C2918424B8D + 69E8FF71552D08D72B9068F1 + 7A8627E1649F66DEE014EB46 + 0D09CEB9308FA5BACEB5F84C isa PBXGroup name - Pods-SampleTests - path - Target Support Files/Pods-SampleTests + Targets Support Files sourceTree <group> - EEDF7C277603B79A9BE8324B - - buildActionMask - 2147483647 - files - - CE7EA2A3E87B73883477BA0E - - isa - PBXFrameworksBuildPhase - runOnlyForDeploymentPostprocessing - 0 - - F2055AA27575926EE57B8546 + F2C6AACFE46FFA8DC383DE43 - includeInIndex - 1 + fileRef + 0D53085043D992DC00E29F0A isa - PBXFileReference - lastKnownFileType - text.script.sh - path - Pods-Sample-resources.sh - sourceTree - <group> + PBXBuildFile - F2258DDD414D3E7F794A8D57 + F6383D21195A5BEFC51F6618 fileRef - 8D0ECACB7BF0FD50C8BA90EF + BDA58E5E1AE450540A2B0227 isa PBXBuildFile - F88FB4C4D5E45ABA4FE79557 + F6C59E5B4CFE053E9F98000E buildConfigurationList - 8AF2FEBF81B82548A9CD7D5E + 17F4C2F25813E7A4588FF233 buildPhases - CD55EA3FDCE78270B7AD57C1 - 80ED48A94404B285C3BAD2A2 + BFE770FF3C0847AB995A82CA + 1146D04C598DEBA045C96C2F + 9E8DC61269B141639DA7F859 buildRules dependencies - - 0E76C0DE38838984ADBE9793 - + isa PBXNativeTarget name - Pods-Sample + Pods-Sample-RxLibrary productName - Pods-Sample + Pods-Sample-RxLibrary productReference - 44EAD826ACB27F88B80500A1 + EF2EE4BC906FF9909348DAB5 productType com.apple.product-type.library.static - F8FA1EE55435B1DD5386F9B7 + F763F3DF1B47888E75D0ED9C - explicitFileType - archive.ar includeInIndex - 0 + 1 isa PBXFileReference + lastKnownFileType + sourcecode.c.objc path - libPods-SampleTests-RxLibrary.a + GRXWriter+Transformations.m sourceTree - BUILT_PRODUCTS_DIR + <group> + + F779618174957BE31FCCDE56 + + buildActionMask + 2147483647 + files + + 2B49DCA723ECBC0F2777B960 + 22531AF83592134D3879C3E1 + 0C57EED724EBF58759F9F6DF + 8CD061F02F905957F4C1D188 + 458FF1EEF4EB9646C699F3DD + 2B341576464148A01DCFB28B + 36FF37EAC7E918C4CD867776 + 594F98D43B96AB5C11E61C10 + B78477CA74AEFC96C25B49B4 + 9CCBE9A628C305B3B089B8DD + 801BBA7A538CFAE6746966A7 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + F8B4778EF3030EEC2E9927CE + + isa + PBXTargetDependency + name + Pods-SampleTests-RxLibrary + target + 3800855A656C8D0813062074 + targetProxy + 7DA2A517A18D85B390FB122A + + FBF79DDF04ADEAED54BA2286 + + attributes + + LastUpgradeCheck + 0510 + + buildConfigurationList + 3749A34D3DFA6E2F3539E546 + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + 397A12919FB4BDD608FE207C + productRefGroup + 8B05D39455D5B23720961FA4 + projectDirPath + + projectReferences + + projectRoot + + targets + + 26E6ACBF137DBC325B4E7DA7 + 6BFD156F312F6CAA1E5B00CA + 0239F1B46D24E21A8042F47F + F6C59E5B4CFE053E9F98000E + 14D92BB2ED12213381BD2EB9 + 3800855A656C8D0813062074 + + + FC1BEDED07CA4D91AFEB56BD + + fileRef + 57AC9BF19B9635D7476CA5FA + isa + PBXBuildFile - FD4FDDAA137AAC4ECC193E65 + FDC6B84EAC9989F0827EA4F3 fileRef - 2439530CF70B0AEDF7D20F2F + 0260773D27B4AE159FB0B22D isa PBXBuildFile - FFFC86AF33D17D398F42C549 + FDC939796E70DC7D141E29FC fileRef - 4BB07CE9F73F22C44B89EC9F + DB0257E62EC33F3F316EF017 isa PBXBuildFile rootObject - E72217186F5258779AB341C4 + FBF79DDF04ADEAED54BA2286 From 638a68b21a1936da05d6547570e333c51e33964a Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 20:12:44 -0800 Subject: [PATCH 132/232] Removes the line that sed could not fix --- src/ruby/lib/grpc.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 21253848a7d..3176a158452 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -39,6 +39,3 @@ require 'grpc/generic/active_call' require 'grpc/generic/client_stub' require 'grpc/generic/service' require 'grpc/generic/rpc_server' - -# alias GRPC -GRPC = GRPC From e7163ab6250ea6adc6b85ea36e67bd6c93ccaadc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 20:46:08 -0800 Subject: [PATCH 133/232] Expand comment --- include/grpc/grpc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 077b432e881..358f59238a4 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -554,7 +554,8 @@ grpc_call_error grpc_server_request_call( grpc_completion_queue *completion_queue, void *tag_new); /* Create a server. Additional configuration for each incoming channel can - be specified with args. See grpc_channel_args for more. */ + be specified with args. If no additional configuration is needed, args can + be NULL. See grpc_channel_args for more. */ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args); From a94beff94c26c8940c6c224943c53ffda73025bb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 22:02:06 -0800 Subject: [PATCH 134/232] Add TODO --- src/core/surface/server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 4ae6f5d9559..9b113610d57 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -330,6 +330,7 @@ static void start_new_rpc(grpc_call_element *elem) { gpr_mu_lock(&server->mu); if (chand->registered_methods && calld->path && calld->host) { + /* TODO(ctiller): unify these two searches */ /* check for an exact match with host */ hash = GRPC_MDSTR_KV_HASH(calld->host->hash, calld->path->hash); for (i = 0; i < chand->registered_method_max_probes; i++) { From 8ac56c9607b6953576d1a2e455f52b68e64cea57 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 22:51:36 -0800 Subject: [PATCH 135/232] Clarify completion queue laws --- include/grpc/grpc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 904853d984e..34bfb61f70d 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -370,7 +370,12 @@ grpc_event *grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, void grpc_event_finish(grpc_event *event); /* Begin destruction of a completion queue. Once all possible events are - drained it's safe to call grpc_completion_queue_destroy. */ + drained then grpc_completion_queue_next will start to produce + GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call + grpc_completion_queue_destroy. + + After calling this function applications should ensure that no + NEW work is added to be published on this completion queue. */ void grpc_completion_queue_shutdown(grpc_completion_queue *cq); /* Destroy a completion queue. The caller must ensure that the queue is From 2b7f537546280823ff20fe1020767c3235761418 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 00:45:53 -0800 Subject: [PATCH 136/232] Add metadata test with rpc. Adding/fixing things to make it work --- include/grpc++/client_context.h | 10 -- include/grpc++/impl/call.h | 6 +- include/grpc++/stream.h | 48 +++----- src/cpp/client/client_unary_call.cc | 8 +- src/cpp/common/call.cc | 11 +- src/cpp/server/server_context.cc | 10 ++ test/cpp/end2end/async_end2end_test.cc | 149 +++++++++++++++++++++++++ 7 files changed, 188 insertions(+), 54 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 4594cbaeb6f..7f1069ea5ee 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -119,16 +119,6 @@ class ClientContext { friend class ::grpc::ClientAsyncWriter; template friend class ::grpc::ClientAsyncReaderWriter; - friend Status BlockingUnaryCall(ChannelInterface *channel, - const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result); - friend void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result, Status *status, - CompletionQueue *cq, void *tag); grpc_call *call() { return call_; } void set_call(grpc_call *call) { diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 64f0f890c5f..4ab226339d3 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -65,13 +65,11 @@ class CallOpBuffer : public CompletionQueueTag { void AddSendInitialMetadata( std::multimap *metadata); void AddSendInitialMetadata(ClientContext *ctx); - void AddRecvInitialMetadata( - std::multimap *metadata); + void AddRecvInitialMetadata(ClientContext* ctx); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); - void AddClientRecvStatus(std::multimap *metadata, - Status *status); + void AddClientRecvStatus(ClientContext *ctx, Status *status); void AddServerSendStatus(std::multimap *metadata, const Status &status); void AddServerRecvClose(bool *cancelled); diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index be5b29589fd..20ba3fb7905 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -106,17 +106,15 @@ class ClientReader final : public ClientStreamingInterface, GPR_ASSERT(!context_->initial_metadata_received_); CallOpBuffer buf; - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + buf.AddRecvInitialMetadata(context_); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); - context_->initial_metadata_received_ = true; } virtual bool Read(R* msg) override { CallOpBuffer buf; if (!context_->initial_metadata_received_) { - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + buf.AddRecvInitialMetadata(context_); } buf.AddRecvMessage(msg); call_.PerformOps(&buf); @@ -126,7 +124,7 @@ class ClientReader final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); + buf.AddClientRecvStatus(context_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; @@ -173,7 +171,7 @@ class ClientWriter final : public ClientStreamingInterface, CallOpBuffer buf; Status status; buf.AddRecvMessage(response_); - buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); + buf.AddClientRecvStatus(context_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf) && buf.got_message); return status; @@ -210,17 +208,15 @@ class ClientReaderWriter final : public ClientStreamingInterface, GPR_ASSERT(!context_->initial_metadata_received_); CallOpBuffer buf; - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + buf.AddRecvInitialMetadata(context_); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); - context_->initial_metadata_received_ = true; } virtual bool Read(R* msg) override { CallOpBuffer buf; if (!context_->initial_metadata_received_) { - buf.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + buf.AddRecvInitialMetadata(context_); } buf.AddRecvMessage(msg); call_.PerformOps(&buf); @@ -244,7 +240,7 @@ class ClientReaderWriter final : public ClientStreamingInterface, virtual Status Finish() override { CallOpBuffer buf; Status status; - buf.AddClientRecvStatus(&context_->trailing_metadata_, &status); + buf.AddClientRecvStatus(context_, &status); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); return status; @@ -403,16 +399,14 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); - meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + meta_buf_.AddRecvInitialMetadata(context_); call_.PerformOps(&meta_buf_); - context_->initial_metadata_received_ = true; } void Read(R* msg, void* tag) override { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { - read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + read_buf_.AddRecvInitialMetadata(context_); } read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); @@ -421,10 +415,9 @@ class ClientAsyncReader final : public ClientAsyncStreamingInterface, void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { - finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + finish_buf_.AddRecvInitialMetadata(context_); } - finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); + finish_buf_.AddClientRecvStatus(context_, status); call_.PerformOps(&finish_buf_); } @@ -456,9 +449,8 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); - meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + meta_buf_.AddRecvInitialMetadata(context_); call_.PerformOps(&meta_buf_); - context_->initial_metadata_received_ = true; } void Write(const W& msg, void* tag) override { @@ -476,11 +468,10 @@ class ClientAsyncWriter final : public ClientAsyncStreamingInterface, void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { - finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + finish_buf_.AddRecvInitialMetadata(context_); } finish_buf_.AddRecvMessage(response_); - finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); + finish_buf_.AddClientRecvStatus(context_, status); call_.PerformOps(&finish_buf_); } @@ -514,16 +505,14 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, GPR_ASSERT(!context_->initial_metadata_received_); meta_buf_.Reset(tag); - meta_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); + meta_buf_.AddRecvInitialMetadata(context_); call_.PerformOps(&meta_buf_); - context_->initial_metadata_received_ = true; } void Read(R* msg, void* tag) override { read_buf_.Reset(tag); if (!context_->initial_metadata_received_) { - read_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + read_buf_.AddRecvInitialMetadata(context_); } read_buf_.AddRecvMessage(msg); call_.PerformOps(&read_buf_); @@ -544,10 +533,9 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, void Finish(Status* status, void* tag) override { finish_buf_.Reset(tag); if (!context_->initial_metadata_received_) { - finish_buf_.AddRecvInitialMetadata(&context_->recv_initial_metadata_); - context_->initial_metadata_received_ = true; + finish_buf_.AddRecvInitialMetadata(context_); } - finish_buf_.AddClientRecvStatus(&context_->trailing_metadata_, status); + finish_buf_.AddClientRecvStatus(context_, status); call_.PerformOps(&finish_buf_); } diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 284af33b435..03a03261285 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -52,10 +52,10 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, Status status; buf.AddSendInitialMetadata(context); buf.AddSendMessage(request); - buf.AddRecvInitialMetadata(&context->recv_initial_metadata_); + buf.AddRecvInitialMetadata(context); buf.AddRecvMessage(result); buf.AddClientSendClose(); - buf.AddClientRecvStatus(&context->trailing_metadata_, &status); + buf.AddClientRecvStatus(context, &status); call.PerformOps(&buf); GPR_ASSERT((cq.Pluck(&buf) && buf.got_message) || !status.IsOk()); return status; @@ -79,10 +79,10 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, Call call(channel->CreateCall(method, context, cq)); buf->AddSendInitialMetadata(context); buf->AddSendMessage(request); - buf->AddRecvInitialMetadata(&context->recv_initial_metadata_); + buf->AddRecvInitialMetadata(context); buf->AddRecvMessage(result); buf->AddClientSendClose(); - buf->AddClientRecvStatus(&context->trailing_metadata_, status); + buf->AddClientRecvStatus(context, status); call.PerformOps(buf); } diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index f1142cf8e56..04af36f312f 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -130,9 +130,9 @@ void CallOpBuffer::AddSendInitialMetadata( initial_metadata_ = FillMetadataArray(metadata); } -void CallOpBuffer::AddRecvInitialMetadata( - std::multimap* metadata) { - recv_initial_metadata_ = metadata; +void CallOpBuffer::AddRecvInitialMetadata(ClientContext* ctx) { + ctx->initial_metadata_received_ = true; + recv_initial_metadata_ = &ctx->recv_initial_metadata_; } void CallOpBuffer::AddSendInitialMetadata(ClientContext* ctx) { @@ -154,9 +154,8 @@ void CallOpBuffer::AddServerRecvClose(bool* cancelled) { recv_closed_ = cancelled; } -void CallOpBuffer::AddClientRecvStatus( - std::multimap* metadata, Status* status) { - recv_trailing_metadata_ = metadata; +void CallOpBuffer::AddClientRecvStatus(ClientContext* context, Status* status) { + recv_trailing_metadata_ = &context->trailing_metadata_; recv_status_ = status; } diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 21a61af3a04..df4c4dc3146 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -57,4 +57,14 @@ ServerContext::~ServerContext() { } } +void ServerContext::AddInitialMetadata(const grpc::string& key, + const grpc::string& value) { + initial_metadata_.insert(std::make_pair(key, value)); +} + +void ServerContext::AddTrailingMetadata(const grpc::string& key, + const grpc::string& value) { + trailing_metadata_.insert(std::make_pair(key, value)); +} + } // namespace grpc diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index fbf9bcb1179..3cd0ef5f128 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -364,6 +364,155 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { EXPECT_TRUE(recv_status.IsOk()); } +TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + std::pair meta1("key1", "val1"); + std::pair meta2("key2", "val2"); + + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); + server_ok(2); + EXPECT_EQ(send_request.message(), recv_request.message()); + srv_ctx.AddInitialMetadata(meta1.first, meta1.second); + srv_ctx.AddInitialMetadata(meta2.first, meta2.second); + response_writer.SendInitialMetadata(tag(3)); + server_ok(3); + + send_response.set_message(recv_request.message()); + response_writer.Finish(send_response, Status::OK, tag(4)); + + server_ok(4); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); + auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); + EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); + EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(2, server_initial_metadata.size()); +} + +TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + std::pair meta1("key1", "val1"); + std::pair meta2("key2", "val2"); + + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); + server_ok(2); + EXPECT_EQ(send_request.message(), recv_request.message()); + response_writer.SendInitialMetadata(tag(3)); + server_ok(3); + + send_response.set_message(recv_request.message()); + srv_ctx.AddTrailingMetadata(meta1.first, meta1.second); + srv_ctx.AddTrailingMetadata(meta2.first, meta2.second); + response_writer.Finish(send_response, Status::OK, tag(4)); + + server_ok(4); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); + auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); + EXPECT_EQ(meta1.second, server_trailing_metadata.find(meta1.first)->second); + EXPECT_EQ(meta2.second, server_trailing_metadata.find(meta2.first)->second); + EXPECT_EQ(2, server_trailing_metadata.size()); +} + +TEST_F(AsyncEnd2endTest, MetadataRpc) { + ResetStub(); + + EchoRequest send_request; + EchoRequest recv_request; + EchoResponse send_response; + EchoResponse recv_response; + Status recv_status; + + ClientContext cli_ctx; + ServerContext srv_ctx; + grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); + + send_request.set_message("Hello"); + std::pair meta1("key1", "val1"); + std::pair meta2("key2-bin", {"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13}); + std::pair meta3("key3", "val3"); + std::pair meta6("key4-bin", {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14}); + std::pair meta5("key5", "val5"); + std::pair meta4("key6-bin", {"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15}); + + cli_ctx.AddMetadata(meta1.first, meta1.second); + cli_ctx.AddMetadata(meta2.first, meta2.second); + + stub_->Echo( + &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + + service_.RequestEcho( + &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); + server_ok(2); + EXPECT_EQ(send_request.message(), recv_request.message()); + auto client_initial_metadata = srv_ctx.client_metadata(); + EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); + EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(2, client_initial_metadata.size()); + + srv_ctx.AddInitialMetadata(meta3.first, meta3.second); + srv_ctx.AddInitialMetadata(meta4.first, meta4.second); + response_writer.SendInitialMetadata(tag(3)); + server_ok(3); + + send_response.set_message(recv_request.message()); + srv_ctx.AddTrailingMetadata(meta5.first, meta5.second); + srv_ctx.AddTrailingMetadata(meta6.first, meta6.second); + response_writer.Finish(send_response, Status::OK, tag(4)); + + server_ok(4); + + client_ok(1); + + EXPECT_EQ(send_response.message(), recv_response.message()); + EXPECT_TRUE(recv_status.IsOk()); + auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); + EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); + EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); + EXPECT_EQ(2, server_initial_metadata.size()); + auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); + EXPECT_EQ(meta5.second, server_trailing_metadata.find(meta5.first)->second); + EXPECT_EQ(meta6.second, server_trailing_metadata.find(meta6.first)->second); + EXPECT_EQ(2, server_trailing_metadata.size()); +} } // namespace } // namespace testing } // namespace grpc From da699b8bc101772bcf89d8c4fee8d9dd490444f5 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 01:10:22 -0800 Subject: [PATCH 137/232] do not leak reader or writer --- test/cpp/end2end/async_end2end_test.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 3cd0ef5f128..7e827cb0e57 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -32,7 +32,7 @@ */ #include -#include +#include #include "test/core/util/test_config.h" #include "test/cpp/util/echo_duplicate.pb.h" @@ -177,8 +177,8 @@ TEST_F(AsyncEnd2endTest, SimpleClientStreaming) { ServerAsyncReader srv_stream(&srv_ctx); send_request.set_message("Hello"); - ClientAsyncWriter* cli_stream = - stub_->RequestStream(&cli_ctx, &recv_response, &cli_cq_, tag(1)); + std::unique_ptr > cli_stream( + stub_->RequestStream(&cli_ctx, &recv_response, &cli_cq_, tag(1))); service_.RequestRequestStream( &srv_ctx, &srv_stream, &srv_cq_, tag(2)); @@ -231,8 +231,8 @@ TEST_F(AsyncEnd2endTest, SimpleServerStreaming) { ServerAsyncWriter srv_stream(&srv_ctx); send_request.set_message("Hello"); - ClientAsyncReader* cli_stream = - stub_->ResponseStream(&cli_ctx, send_request, &cli_cq_, tag(1)); + std::unique_ptr > cli_stream( + stub_->ResponseStream(&cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestResponseStream( &srv_ctx, &recv_request, &srv_stream, &srv_cq_, tag(2)); @@ -282,8 +282,8 @@ TEST_F(AsyncEnd2endTest, SimpleBidiStreaming) { ServerAsyncReaderWriter srv_stream(&srv_ctx); send_request.set_message("Hello"); - ClientAsyncReaderWriter* cli_stream = - stub_->BidiStream(&cli_ctx, &cli_cq_, tag(1)); + std::unique_ptr > + cli_stream(stub_->BidiStream(&cli_ctx, &cli_cq_, tag(1))); service_.RequestBidiStream( &srv_ctx, &srv_stream, &srv_cq_, tag(2)); From 6d5f42e79a110f3ed13248f89102dc01ae7780ae Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 08:31:24 -0800 Subject: [PATCH 138/232] Fix copyright notice --- include/grpc++/impl/client_unary_call.h | 62 ++++++++++++------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 22a8a04c823..ff03f7c9369 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -1,35 +1,35 @@ /* -* -* Copyright 2014, 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. -* -*/ + * + * Copyright 2014, 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. + * + */ #ifndef __GRPCPP_CLIENT_UNARY_CALL_H__ #define __GRPCPP_CLIENT_UNARY_CALL_H__ From 0605995e55a2030c5a2a82092a253e7188b8d2fb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 08:34:56 -0800 Subject: [PATCH 139/232] Update copyright to 2015 --- examples/pubsub/main.cc | 4 ++-- examples/pubsub/publisher.cc | 4 ++-- examples/pubsub/publisher.h | 4 ++-- examples/pubsub/publisher_test.cc | 4 ++-- examples/pubsub/subscriber.cc | 4 ++-- examples/pubsub/subscriber.h | 4 ++-- examples/pubsub/subscriber_test.cc | 4 ++-- include/grpc++/channel_arguments.h | 4 ++-- include/grpc++/channel_interface.h | 4 ++-- include/grpc++/client_context.h | 4 ++-- include/grpc++/completion_queue.h | 4 ++-- include/grpc++/config.h | 4 ++-- include/grpc++/create_channel.h | 4 ++-- include/grpc++/credentials.h | 4 ++-- include/grpc++/impl/call.h | 4 ++-- include/grpc++/impl/client_unary_call.h | 4 ++-- include/grpc++/impl/internal_stub.h | 4 ++-- include/grpc++/impl/rpc_method.h | 4 ++-- include/grpc++/impl/rpc_service_method.h | 4 ++-- include/grpc++/impl/service_type.h | 4 ++-- include/grpc++/server.h | 4 ++-- include/grpc++/server_builder.h | 4 ++-- include/grpc++/server_context.h | 4 ++-- include/grpc++/server_credentials.h | 4 ++-- include/grpc++/status.h | 4 ++-- include/grpc++/status_code_enum.h | 4 ++-- include/grpc++/stream.h | 4 ++-- include/grpc++/thread_pool_interface.h | 4 ++-- include/grpc/byte_buffer.h | 4 ++-- include/grpc/byte_buffer_reader.h | 4 ++-- include/grpc/grpc.h | 10 +++++----- include/grpc/grpc_http.h | 4 ++-- include/grpc/grpc_security.h | 4 ++-- include/grpc/status.h | 4 ++-- include/grpc/support/alloc.h | 4 ++-- include/grpc/support/atm.h | 4 ++-- include/grpc/support/atm_gcc_atomic.h | 4 ++-- include/grpc/support/atm_gcc_sync.h | 4 ++-- include/grpc/support/atm_win32.h | 4 ++-- include/grpc/support/cancellable_platform.h | 4 ++-- include/grpc/support/cmdline.h | 4 ++-- include/grpc/support/cpu.h | 4 ++-- include/grpc/support/histogram.h | 4 ++-- include/grpc/support/host_port.h | 4 ++-- include/grpc/support/log.h | 4 ++-- include/grpc/support/log_win32.h | 4 ++-- include/grpc/support/port_platform.h | 4 ++-- include/grpc/support/slice.h | 4 ++-- include/grpc/support/slice_buffer.h | 4 ++-- include/grpc/support/sync.h | 4 ++-- include/grpc/support/sync_generic.h | 4 ++-- include/grpc/support/sync_posix.h | 4 ++-- include/grpc/support/sync_win32.h | 4 ++-- include/grpc/support/thd.h | 4 ++-- include/grpc/support/time.h | 4 ++-- include/grpc/support/useful.h | 4 ++-- src/compiler/cpp_generator.cc | 4 ++-- src/compiler/cpp_generator.h | 4 ++-- src/compiler/cpp_generator_helpers.h | 4 ++-- src/compiler/cpp_plugin.cc | 4 ++-- src/compiler/ruby_generator.cc | 4 ++-- src/compiler/ruby_generator.h | 4 ++-- src/compiler/ruby_generator_helpers-inl.h | 4 ++-- src/compiler/ruby_generator_map-inl.h | 4 ++-- src/compiler/ruby_generator_string-inl.h | 4 ++-- src/compiler/ruby_plugin.cc | 4 ++-- src/core/channel/call_op_string.c | 4 ++-- src/core/channel/census_filter.c | 4 ++-- src/core/channel/census_filter.h | 4 ++-- src/core/channel/channel_args.c | 4 ++-- src/core/channel/channel_args.h | 4 ++-- src/core/channel/channel_stack.c | 4 ++-- src/core/channel/channel_stack.h | 4 ++-- src/core/channel/child_channel.c | 4 ++-- src/core/channel/child_channel.h | 4 ++-- src/core/channel/client_channel.c | 4 ++-- src/core/channel/client_channel.h | 4 ++-- src/core/channel/client_setup.c | 4 ++-- src/core/channel/client_setup.h | 4 ++-- src/core/channel/connected_channel.c | 4 ++-- src/core/channel/connected_channel.h | 4 ++-- src/core/channel/http_client_filter.c | 4 ++-- src/core/channel/http_client_filter.h | 4 ++-- src/core/channel/http_filter.c | 4 ++-- src/core/channel/http_filter.h | 4 ++-- src/core/channel/http_server_filter.c | 4 ++-- src/core/channel/http_server_filter.h | 4 ++-- src/core/channel/metadata_buffer.c | 4 ++-- src/core/channel/metadata_buffer.h | 4 ++-- src/core/channel/noop_filter.c | 4 ++-- src/core/channel/noop_filter.h | 4 ++-- src/core/compression/algorithm.c | 4 ++-- src/core/compression/algorithm.h | 4 ++-- src/core/compression/message_compress.c | 4 ++-- src/core/compression/message_compress.h | 4 ++-- src/core/httpcli/format_request.c | 4 ++-- src/core/httpcli/format_request.h | 4 ++-- src/core/httpcli/httpcli.c | 4 ++-- src/core/httpcli/httpcli.h | 4 ++-- src/core/httpcli/httpcli_security_context.c | 4 ++-- src/core/httpcli/httpcli_security_context.h | 4 ++-- src/core/httpcli/parser.c | 4 ++-- src/core/httpcli/parser.h | 4 ++-- src/core/iomgr/alarm.c | 4 ++-- src/core/iomgr/alarm.h | 4 ++-- src/core/iomgr/alarm_heap.c | 4 ++-- src/core/iomgr/alarm_heap.h | 4 ++-- src/core/iomgr/alarm_internal.h | 6 +++--- src/core/iomgr/endpoint.c | 4 ++-- src/core/iomgr/endpoint.h | 4 ++-- src/core/iomgr/endpoint_pair.h | 4 ++-- src/core/iomgr/endpoint_pair_posix.c | 4 ++-- src/core/iomgr/fd_posix.c | 4 ++-- src/core/iomgr/fd_posix.h | 4 ++-- src/core/iomgr/iocp_windows.c | 4 ++-- src/core/iomgr/iocp_windows.h | 4 ++-- src/core/iomgr/iomgr.c | 4 ++-- src/core/iomgr/iomgr.h | 4 ++-- src/core/iomgr/iomgr_internal.h | 4 ++-- src/core/iomgr/iomgr_posix.c | 4 ++-- src/core/iomgr/iomgr_posix.h | 4 ++-- src/core/iomgr/iomgr_windows.c | 4 ++-- src/core/iomgr/pollset.h | 4 ++-- .../pollset_multipoller_with_poll_posix.c | 4 ++-- src/core/iomgr/pollset_posix.c | 4 ++-- src/core/iomgr/pollset_posix.h | 4 ++-- src/core/iomgr/pollset_windows.c | 4 ++-- src/core/iomgr/pollset_windows.h | 4 ++-- src/core/iomgr/resolve_address.c | 4 ++-- src/core/iomgr/resolve_address.h | 4 ++-- src/core/iomgr/sockaddr.h | 4 ++-- src/core/iomgr/sockaddr_posix.h | 4 ++-- src/core/iomgr/sockaddr_utils.c | 4 ++-- src/core/iomgr/sockaddr_utils.h | 4 ++-- src/core/iomgr/sockaddr_win32.h | 4 ++-- src/core/iomgr/socket_utils_common_posix.c | 4 ++-- src/core/iomgr/socket_utils_linux.c | 4 ++-- src/core/iomgr/socket_utils_posix.c | 4 ++-- src/core/iomgr/socket_utils_posix.h | 4 ++-- src/core/iomgr/socket_windows.c | 4 ++-- src/core/iomgr/socket_windows.h | 4 ++-- src/core/iomgr/tcp_client.h | 4 ++-- src/core/iomgr/tcp_client_posix.c | 4 ++-- src/core/iomgr/tcp_client_windows.c | 4 ++-- src/core/iomgr/tcp_posix.c | 4 ++-- src/core/iomgr/tcp_posix.h | 4 ++-- src/core/iomgr/tcp_server.h | 4 ++-- src/core/iomgr/tcp_server_posix.c | 4 ++-- src/core/iomgr/tcp_server_windows.c | 4 ++-- src/core/iomgr/tcp_windows.c | 4 ++-- src/core/iomgr/tcp_windows.h | 4 ++-- src/core/iomgr/time_averaged_stats.c | 4 ++-- src/core/iomgr/time_averaged_stats.h | 4 ++-- src/core/json/json.c | 4 ++-- src/core/json/json.h | 4 ++-- src/core/json/json_common.h | 4 ++-- src/core/json/json_reader.c | 4 ++-- src/core/json/json_reader.h | 4 ++-- src/core/json/json_string.c | 4 ++-- src/core/json/json_writer.c | 4 ++-- src/core/json/json_writer.h | 4 ++-- src/core/security/auth.c | 4 ++-- src/core/security/auth.h | 4 ++-- src/core/security/base64.c | 4 ++-- src/core/security/base64.h | 4 ++-- src/core/security/credentials.c | 4 ++-- src/core/security/credentials.h | 4 ++-- src/core/security/factories.c | 4 ++-- src/core/security/google_root_certs.c | 4 ++-- src/core/security/google_root_certs.h | 4 ++-- src/core/security/json_token.c | 4 ++-- src/core/security/json_token.h | 4 ++-- src/core/security/secure_endpoint.c | 4 ++-- src/core/security/secure_endpoint.h | 4 ++-- src/core/security/secure_transport_setup.c | 4 ++-- src/core/security/secure_transport_setup.h | 4 ++-- src/core/security/security_context.c | 4 ++-- src/core/security/security_context.h | 4 ++-- src/core/security/server_secure_chttp2.c | 4 ++-- src/core/statistics/census_init.c | 4 ++-- src/core/statistics/census_interface.h | 4 ++-- src/core/statistics/census_log.c | 4 ++-- src/core/statistics/census_log.h | 4 ++-- src/core/statistics/census_rpc_stats.c | 4 ++-- src/core/statistics/census_rpc_stats.h | 4 ++-- src/core/statistics/census_tracing.c | 4 ++-- src/core/statistics/census_tracing.h | 4 ++-- src/core/statistics/hash_table.c | 4 ++-- src/core/statistics/hash_table.h | 4 ++-- src/core/statistics/window_stats.c | 4 ++-- src/core/statistics/window_stats.h | 4 ++-- src/core/support/alloc.c | 4 ++-- src/core/support/cancellable.c | 4 ++-- src/core/support/cmdline.c | 4 ++-- src/core/support/cpu_linux.c | 4 ++-- src/core/support/cpu_posix.c | 4 ++-- src/core/support/env.h | 4 ++-- src/core/support/env_linux.c | 4 ++-- src/core/support/env_posix.c | 4 ++-- src/core/support/env_win32.c | 4 ++-- src/core/support/file.c | 4 ++-- src/core/support/file.h | 4 ++-- src/core/support/file_posix.c | 4 ++-- src/core/support/file_win32.c | 4 ++-- src/core/support/histogram.c | 4 ++-- src/core/support/host_port.c | 4 ++-- src/core/support/log.c | 4 ++-- src/core/support/log_android.c | 4 ++-- src/core/support/log_linux.c | 4 ++-- src/core/support/log_posix.c | 4 ++-- src/core/support/log_win32.c | 4 ++-- src/core/support/murmur_hash.c | 4 ++-- src/core/support/murmur_hash.h | 4 ++-- src/core/support/slice.c | 4 ++-- src/core/support/slice_buffer.c | 4 ++-- src/core/support/string.c | 6 +++--- src/core/support/string.h | 4 ++-- src/core/support/string_posix.c | 4 ++-- src/core/support/string_win32.c | 4 ++-- src/core/support/string_win32.h | 4 ++-- src/core/support/sync.c | 4 ++-- src/core/support/sync_posix.c | 4 ++-- src/core/support/sync_win32.c | 4 ++-- src/core/support/thd_internal.h | 4 ++-- src/core/support/thd_posix.c | 4 ++-- src/core/support/thd_win32.c | 4 ++-- src/core/support/time.c | 4 ++-- src/core/support/time_posix.c | 4 ++-- src/core/support/time_win32.c | 4 ++-- src/core/surface/byte_buffer.c | 4 ++-- src/core/surface/byte_buffer_queue.c | 4 ++-- src/core/surface/byte_buffer_queue.h | 4 ++-- src/core/surface/byte_buffer_reader.c | 4 ++-- src/core/surface/call.c | 4 ++-- src/core/surface/call.h | 4 ++-- src/core/surface/channel.c | 4 ++-- src/core/surface/channel.h | 4 ++-- src/core/surface/channel_create.c | 4 ++-- src/core/surface/client.c | 4 ++-- src/core/surface/client.h | 4 ++-- src/core/surface/completion_queue.c | 4 ++-- src/core/surface/completion_queue.h | 4 ++-- src/core/surface/event_string.c | 4 ++-- src/core/surface/event_string.h | 4 ++-- src/core/surface/init.c | 3 +-- src/core/surface/lame_client.c | 4 ++-- src/core/surface/lame_client.h | 4 ++-- src/core/surface/secure_channel_create.c | 4 ++-- src/core/surface/secure_server_create.c | 4 ++-- src/core/surface/server.c | 4 ++-- src/core/surface/server.h | 4 ++-- src/core/surface/server_chttp2.c | 4 ++-- src/core/surface/server_create.c | 4 ++-- src/core/surface/surface_trace.h | 4 ++-- src/core/transport/chttp2/alpn.c | 4 ++-- src/core/transport/chttp2/alpn.h | 4 ++-- src/core/transport/chttp2/bin_encoder.c | 4 ++-- src/core/transport/chttp2/bin_encoder.h | 4 ++-- src/core/transport/chttp2/frame.h | 4 ++-- src/core/transport/chttp2/frame_data.c | 4 ++-- src/core/transport/chttp2/frame_data.h | 4 ++-- src/core/transport/chttp2/frame_goaway.c | 4 ++-- src/core/transport/chttp2/frame_goaway.h | 4 ++-- src/core/transport/chttp2/frame_ping.c | 4 ++-- src/core/transport/chttp2/frame_ping.h | 4 ++-- src/core/transport/chttp2/frame_rst_stream.c | 4 ++-- src/core/transport/chttp2/frame_rst_stream.h | 4 ++-- src/core/transport/chttp2/frame_settings.c | 4 ++-- src/core/transport/chttp2/frame_settings.h | 4 ++-- .../transport/chttp2/frame_window_update.c | 4 ++-- .../transport/chttp2/frame_window_update.h | 4 ++-- src/core/transport/chttp2/gen_hpack_tables.c | 4 ++-- src/core/transport/chttp2/hpack_parser.c | 4 ++-- src/core/transport/chttp2/hpack_parser.h | 4 ++-- src/core/transport/chttp2/hpack_table.c | 4 ++-- src/core/transport/chttp2/hpack_table.h | 4 ++-- src/core/transport/chttp2/http2_errors.h | 4 ++-- src/core/transport/chttp2/huffsyms.c | 4 ++-- src/core/transport/chttp2/huffsyms.h | 4 ++-- src/core/transport/chttp2/status_conversion.c | 4 ++-- src/core/transport/chttp2/status_conversion.h | 4 ++-- src/core/transport/chttp2/stream_encoder.c | 4 ++-- src/core/transport/chttp2/stream_encoder.h | 4 ++-- src/core/transport/chttp2/stream_map.c | 4 ++-- src/core/transport/chttp2/stream_map.h | 4 ++-- src/core/transport/chttp2/timeout_encoding.c | 4 ++-- src/core/transport/chttp2/timeout_encoding.h | 4 ++-- src/core/transport/chttp2/varint.c | 4 ++-- src/core/transport/chttp2/varint.h | 4 ++-- src/core/transport/chttp2_transport.c | 6 +++--- src/core/transport/chttp2_transport.h | 4 ++-- src/core/transport/metadata.c | 4 ++-- src/core/transport/metadata.h | 4 ++-- src/core/transport/stream_op.c | 4 ++-- src/core/transport/stream_op.h | 4 ++-- src/core/transport/transport.c | 4 ++-- src/core/transport/transport.h | 4 ++-- src/core/transport/transport_impl.h | 4 ++-- src/core/tsi/fake_transport_security.c | 4 ++-- src/core/tsi/fake_transport_security.h | 4 ++-- src/core/tsi/ssl_transport_security.c | 4 ++-- src/core/tsi/ssl_transport_security.h | 4 ++-- src/core/tsi/transport_security.c | 4 ++-- src/core/tsi/transport_security.h | 4 ++-- src/core/tsi/transport_security_interface.h | 4 ++-- src/cpp/client/channel.cc | 4 ++-- src/cpp/client/channel.h | 4 ++-- src/cpp/client/channel_arguments.cc | 4 ++-- src/cpp/client/client_context.cc | 4 ++-- src/cpp/client/client_unary_call.cc | 4 ++-- src/cpp/client/create_channel.cc | 4 ++-- src/cpp/client/credentials.cc | 4 ++-- src/cpp/client/internal_stub.cc | 4 ++-- src/cpp/common/call.cc | 4 ++-- src/cpp/common/completion_queue.cc | 4 ++-- src/cpp/common/rpc_method.cc | 4 ++-- src/cpp/proto/proto_utils.cc | 4 ++-- src/cpp/proto/proto_utils.h | 4 ++-- src/cpp/server/async_server_context.cc | 4 ++-- src/cpp/server/server.cc | 4 ++-- src/cpp/server/server_builder.cc | 4 ++-- src/cpp/server/server_context.cc | 4 ++-- src/cpp/server/server_credentials.cc | 4 ++-- src/cpp/server/thread_pool.cc | 4 ++-- src/cpp/server/thread_pool.h | 4 ++-- src/cpp/util/status.cc | 4 ++-- src/cpp/util/time.cc | 4 ++-- src/cpp/util/time.h | 4 ++-- src/node/examples/math_server.js | 4 ++-- src/node/ext/byte_buffer.cc | 4 ++-- src/node/ext/byte_buffer.h | 4 ++-- src/node/ext/call.h | 4 ++-- src/node/ext/channel.cc | 4 ++-- src/node/ext/channel.h | 4 ++-- src/node/ext/completion_queue_async_worker.cc | 4 ++-- src/node/ext/completion_queue_async_worker.h | 4 ++-- src/node/ext/credentials.cc | 4 ++-- src/node/ext/credentials.h | 4 ++-- src/node/ext/node_grpc.cc | 4 ++-- src/node/ext/server.cc | 4 ++-- src/node/ext/server.h | 4 ++-- src/node/ext/server_credentials.cc | 4 ++-- src/node/ext/server_credentials.h | 4 ++-- src/node/ext/timeval.cc | 4 ++-- src/node/ext/timeval.h | 4 ++-- src/node/index.js | 4 ++-- src/node/interop/interop_client.js | 4 ++-- src/node/interop/interop_server.js | 4 ++-- src/node/src/common.js | 4 ++-- src/node/test/channel_test.js | 4 ++-- src/node/test/constant_test.js | 4 ++-- src/node/test/end_to_end_test.js | 4 ++-- src/node/test/interop_sanity_test.js | 4 ++-- src/node/test/math_client_test.js | 4 ++-- src/node/test/surface_test.js | 4 ++-- src/php/bin/interop_client.sh | 4 ++-- src/php/bin/run_gen_code_test.sh | 4 ++-- src/php/bin/run_tests.sh | 4 ++-- src/python/src/grpc/_adapter/_call.c | 4 ++-- src/ruby/bin/apis/google/protobuf/empty.rb | 4 ++-- src/ruby/bin/apis/pubsub_demo.rb | 4 ++-- src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb | 4 ++-- .../apis/tech/pubsub/proto/pubsub_services.rb | 4 ++-- src/ruby/bin/interop/interop_client.rb | 4 ++-- src/ruby/bin/interop/interop_server.rb | 4 ++-- .../bin/interop/test/cpp/interop/empty.rb | 4 ++-- .../bin/interop/test/cpp/interop/messages.rb | 4 ++-- src/ruby/bin/interop/test/cpp/interop/test.rb | 4 ++-- .../interop/test/cpp/interop/test_services.rb | 4 ++-- src/ruby/bin/math.rb | 4 ++-- src/ruby/bin/math_client.rb | 4 ++-- src/ruby/bin/math_server.rb | 4 ++-- src/ruby/bin/math_services.rb | 4 ++-- src/ruby/bin/noproto_client.rb | 4 ++-- src/ruby/bin/noproto_server.rb | 4 ++-- src/ruby/ext/grpc/extconf.rb | 4 ++-- src/ruby/ext/grpc/rb_byte_buffer.c | 4 ++-- src/ruby/ext/grpc/rb_byte_buffer.h | 4 ++-- src/ruby/ext/grpc/rb_call.c | 4 ++-- src/ruby/ext/grpc/rb_call.h | 4 ++-- src/ruby/ext/grpc/rb_channel.c | 4 ++-- src/ruby/ext/grpc/rb_channel.h | 4 ++-- src/ruby/ext/grpc/rb_channel_args.c | 4 ++-- src/ruby/ext/grpc/rb_channel_args.h | 4 ++-- src/ruby/ext/grpc/rb_completion_queue.c | 4 ++-- src/ruby/ext/grpc/rb_completion_queue.h | 4 ++-- src/ruby/ext/grpc/rb_credentials.c | 4 ++-- src/ruby/ext/grpc/rb_credentials.h | 4 ++-- src/ruby/ext/grpc/rb_event.c | 4 ++-- src/ruby/ext/grpc/rb_event.h | 4 ++-- src/ruby/ext/grpc/rb_grpc.c | 4 ++-- src/ruby/ext/grpc/rb_grpc.h | 4 ++-- src/ruby/ext/grpc/rb_metadata.c | 4 ++-- src/ruby/ext/grpc/rb_metadata.h | 4 ++-- src/ruby/ext/grpc/rb_server.c | 4 ++-- src/ruby/ext/grpc/rb_server.h | 4 ++-- src/ruby/ext/grpc/rb_server_credentials.c | 4 ++-- src/ruby/ext/grpc/rb_server_credentials.h | 4 ++-- src/ruby/lib/grpc.rb | 4 ++-- src/ruby/lib/grpc/core/event.rb | 4 ++-- src/ruby/lib/grpc/core/time_consts.rb | 4 ++-- src/ruby/lib/grpc/errors.rb | 4 ++-- src/ruby/lib/grpc/generic/active_call.rb | 4 ++-- src/ruby/lib/grpc/generic/bidi_call.rb | 4 ++-- src/ruby/lib/grpc/generic/client_stub.rb | 4 ++-- src/ruby/lib/grpc/generic/rpc_desc.rb | 4 ++-- src/ruby/lib/grpc/generic/rpc_server.rb | 4 ++-- src/ruby/lib/grpc/generic/service.rb | 4 ++-- src/ruby/lib/grpc/logconfig.rb | 4 ++-- src/ruby/lib/grpc/version.rb | 4 ++-- src/ruby/spec/alloc_spec.rb | 4 ++-- src/ruby/spec/byte_buffer_spec.rb | 4 ++-- src/ruby/spec/call_spec.rb | 4 ++-- src/ruby/spec/channel_spec.rb | 4 ++-- src/ruby/spec/client_server_spec.rb | 4 ++-- src/ruby/spec/completion_queue_spec.rb | 4 ++-- src/ruby/spec/credentials_spec.rb | 4 ++-- src/ruby/spec/event_spec.rb | 4 ++-- src/ruby/spec/generic/active_call_spec.rb | 4 ++-- src/ruby/spec/generic/client_stub_spec.rb | 4 ++-- src/ruby/spec/generic/rpc_desc_spec.rb | 4 ++-- src/ruby/spec/generic/rpc_server_pool_spec.rb | 4 ++-- src/ruby/spec/generic/rpc_server_spec.rb | 4 ++-- src/ruby/spec/generic/service_spec.rb | 4 ++-- src/ruby/spec/metadata_spec.rb | 4 ++-- src/ruby/spec/server_credentials_spec.rb | 4 ++-- src/ruby/spec/server_spec.rb | 4 ++-- src/ruby/spec/spec_helper.rb | 4 ++-- src/ruby/spec/time_consts_spec.rb | 4 ++-- test/core/channel/channel_stack_test.c | 4 ++-- test/core/channel/metadata_buffer_test.c | 4 ++-- test/core/compression/message_compress_test.c | 4 ++-- test/core/echo/client.c | 4 ++-- test/core/echo/echo_test.c | 4 ++-- test/core/echo/server.c | 4 ++-- test/core/end2end/cq_verifier.c | 4 ++-- test/core/end2end/cq_verifier.h | 4 ++-- test/core/end2end/data/prod_roots_certs.c | 4 ++-- test/core/end2end/data/server1_cert.c | 4 ++-- test/core/end2end/data/server1_key.c | 4 ++-- test/core/end2end/data/ssl_test_data.h | 4 ++-- test/core/end2end/data/test_root_cert.c | 4 ++-- test/core/end2end/dualstack_socket_test.c | 4 ++-- test/core/end2end/end2end_tests.h | 4 ++-- .../end2end/fixtures/chttp2_fake_security.c | 4 ++-- test/core/end2end/fixtures/chttp2_fullstack.c | 4 ++-- .../end2end/fixtures/chttp2_fullstack_uds.c | 4 ++-- .../fixtures/chttp2_simple_ssl_fullstack.c | 4 ++-- .../chttp2_simple_ssl_with_oauth2_fullstack.c | 4 ++-- .../end2end/fixtures/chttp2_socket_pair.c | 4 ++-- .../chttp2_socket_pair_one_byte_at_a_time.c | 4 ++-- test/core/end2end/no_server_test.c | 4 ++-- test/core/end2end/tests/cancel_after_accept.c | 4 ++-- .../cancel_after_accept_and_writes_closed.c | 4 ++-- ...el_after_accept_and_writes_closed_legacy.c | 4 ++-- .../tests/cancel_after_accept_legacy.c | 4 ++-- test/core/end2end/tests/cancel_after_invoke.c | 4 ++-- .../tests/cancel_after_invoke_legacy.c | 4 ++-- .../core/end2end/tests/cancel_before_invoke.c | 4 ++-- .../tests/cancel_before_invoke_legacy.c | 4 ++-- test/core/end2end/tests/cancel_in_a_vacuum.c | 4 ++-- .../end2end/tests/cancel_in_a_vacuum_legacy.c | 4 ++-- test/core/end2end/tests/cancel_test_helpers.h | 4 ++-- .../end2end/tests/census_simple_request.c | 4 ++-- .../tests/census_simple_request_legacy.c | 4 ++-- test/core/end2end/tests/disappearing_server.c | 4 ++-- .../tests/disappearing_server_legacy.c | 4 ++-- ..._server_shutdown_finishes_inflight_calls.c | 4 ++-- ..._shutdown_finishes_inflight_calls_legacy.c | 4 ++-- .../early_server_shutdown_finishes_tags.c | 4 ++-- ...rly_server_shutdown_finishes_tags_legacy.c | 4 ++-- .../end2end/tests/graceful_server_shutdown.c | 4 ++-- .../tests/graceful_server_shutdown_legacy.c | 4 ++-- .../core/end2end/tests/invoke_large_request.c | 4 ++-- .../tests/invoke_large_request_legacy.c | 4 ++-- .../end2end/tests/max_concurrent_streams.c | 4 ++-- .../tests/max_concurrent_streams_legacy.c | 4 ++-- test/core/end2end/tests/no_op.c | 4 ++-- test/core/end2end/tests/no_op_legacy.c | 4 ++-- test/core/end2end/tests/ping_pong_streaming.c | 4 ++-- .../tests/ping_pong_streaming_legacy.c | 4 ++-- ...esponse_with_binary_metadata_and_payload.c | 6 +++--- ..._with_binary_metadata_and_payload_legacy.c | 4 ++-- ...quest_response_with_metadata_and_payload.c | 4 ++-- ...esponse_with_metadata_and_payload_legacy.c | 4 ++-- .../tests/request_response_with_payload.c | 4 ++-- .../request_response_with_payload_legacy.c | 4 ++-- ...ponse_with_trailing_metadata_and_payload.c | 4 ++-- ...ith_trailing_metadata_and_payload_legacy.c | 4 ++-- .../tests/request_with_large_metadata.c | 4 ++-- .../request_with_large_metadata_legacy.c | 4 ++-- .../core/end2end/tests/request_with_payload.c | 4 ++-- .../tests/request_with_payload_legacy.c | 4 ++-- .../end2end/tests/simple_delayed_request.c | 4 ++-- .../tests/simple_delayed_request_legacy.c | 4 ++-- test/core/end2end/tests/simple_request.c | 4 ++-- .../end2end/tests/simple_request_legacy.c | 4 ++-- test/core/end2end/tests/thread_stress.c | 4 ++-- .../core/end2end/tests/thread_stress_legacy.c | 4 ++-- .../writes_done_hangs_with_pending_read.c | 4 ++-- ...ites_done_hangs_with_pending_read_legacy.c | 4 ++-- test/core/fling/client.c | 4 ++-- test/core/fling/fling_stream_test.c | 4 ++-- test/core/fling/fling_test.c | 4 ++-- test/core/fling/server.c | 4 ++-- test/core/httpcli/format_request_test.c | 4 ++-- test/core/httpcli/httpcli_test.c | 4 ++-- test/core/httpcli/parser_test.c | 4 ++-- test/core/iomgr/alarm_heap_test.c | 4 ++-- test/core/iomgr/alarm_list_test.c | 4 ++-- test/core/iomgr/alarm_test.c | 4 ++-- test/core/iomgr/endpoint_tests.c | 4 ++-- test/core/iomgr/endpoint_tests.h | 4 ++-- test/core/iomgr/fd_posix_test.c | 4 ++-- test/core/iomgr/resolve_address_test.c | 4 ++-- test/core/iomgr/sockaddr_utils_test.c | 4 ++-- test/core/iomgr/tcp_client_posix_test.c | 4 ++-- test/core/iomgr/tcp_posix_test.c | 4 ++-- test/core/iomgr/tcp_server_posix_test.c | 4 ++-- test/core/iomgr/time_averaged_stats_test.c | 4 ++-- test/core/json/json_rewrite.c | 4 ++-- test/core/json/json_rewrite_test.c | 4 ++-- test/core/json/json_test.c | 4 ++-- .../network_benchmarks/low_level_ping_pong.c | 4 ++-- test/core/security/base64_test.c | 4 ++-- test/core/security/credentials_test.c | 4 ++-- test/core/security/fetch_oauth2.c | 4 ++-- test/core/security/json_token_test.c | 4 ++-- test/core/security/secure_endpoint_test.c | 4 ++-- test/core/statistics/census_log_tests.c | 4 ++-- test/core/statistics/census_log_tests.h | 4 ++-- test/core/statistics/census_stub_test.c | 4 ++-- test/core/statistics/hash_table_test.c | 4 ++-- .../multiple_writers_circular_buffer_test.c | 4 ++-- test/core/statistics/multiple_writers_test.c | 4 ++-- test/core/statistics/performance_test.c | 4 ++-- test/core/statistics/quick_test.c | 4 ++-- test/core/statistics/rpc_stats_test.c | 4 ++-- test/core/statistics/small_log_test.c | 4 ++-- test/core/statistics/trace_test.c | 4 ++-- test/core/statistics/window_stats_test.c | 4 ++-- test/core/support/cancellable_test.c | 4 ++-- test/core/support/cmdline_test.c | 4 ++-- test/core/support/env_test.c | 4 ++-- test/core/support/file_test.c | 4 ++-- test/core/support/histogram_test.c | 4 ++-- test/core/support/host_port_test.c | 4 ++-- test/core/support/log_test.c | 4 ++-- test/core/support/murmur_hash_test.c | 4 ++-- test/core/support/slice_buffer_test.c | 4 ++-- test/core/support/slice_test.c | 4 ++-- test/core/support/string_test.c | 4 ++-- test/core/support/sync_test.c | 4 ++-- test/core/support/thd_test.c | 4 ++-- test/core/support/time_test.c | 4 ++-- test/core/support/useful_test.c | 4 ++-- test/core/surface/byte_buffer_reader_test.c | 4 ++-- .../core/surface/completion_queue_benchmark.c | 4 ++-- test/core/surface/completion_queue_test.c | 4 ++-- test/core/surface/lame_client_test.c | 4 ++-- test/core/surface/multi_init_test.c | 4 ++-- test/core/transport/chttp2/alpn_test.c | 4 ++-- test/core/transport/chttp2/bin_encoder_test.c | 4 ++-- .../core/transport/chttp2/hpack_parser_test.c | 4 ++-- test/core/transport/chttp2/hpack_table_test.c | 4 ++-- .../transport/chttp2/status_conversion_test.c | 4 ++-- .../transport/chttp2/stream_encoder_test.c | 4 ++-- test/core/transport/chttp2/stream_map_test.c | 4 ++-- .../transport/chttp2/timeout_encoding_test.c | 4 ++-- .../transport/chttp2_transport_end2end_test.c | 4 ++-- test/core/transport/metadata_test.c | 4 ++-- test/core/transport/stream_op_test.c | 4 ++-- test/core/transport/transport_end2end_tests.c | 4 ++-- test/core/transport/transport_end2end_tests.h | 4 ++-- test/core/util/grpc_profiler.c | 4 ++-- test/core/util/grpc_profiler.h | 4 ++-- test/core/util/parse_hexstring.c | 4 ++-- test/core/util/parse_hexstring.h | 4 ++-- test/core/util/port.h | 4 ++-- test/core/util/port_posix.c | 4 ++-- test/core/util/slice_splitter.c | 4 ++-- test/core/util/slice_splitter.h | 4 ++-- test/core/util/test_config.c | 4 ++-- test/core/util/test_config.h | 4 ++-- test/cpp/client/channel_arguments_test.cc | 4 ++-- test/cpp/client/credentials_test.cc | 4 ++-- test/cpp/end2end/async_end2end_test.cc | 4 ++-- test/cpp/end2end/end2end_test.cc | 4 ++-- test/cpp/interop/client.cc | 4 ++-- test/cpp/interop/server.cc | 4 ++-- test/cpp/qps/client.cc | 4 ++-- test/cpp/qps/server.cc | 5 ++--- test/cpp/server/thread_pool_test.cc | 4 ++-- test/cpp/util/create_test_channel.cc | 4 ++-- test/cpp/util/create_test_channel.h | 4 ++-- test/cpp/util/status_test.cc | 4 ++-- test/cpp/util/time_test.cc | 4 ++-- tools/buildgen/generate_projects.sh | 3 +-- tools/distrib/check_copyright.py | 19 +++++++++++++------ tools/gce_setup/builder.sh | 6 +++--- tools/gce_setup/cloud_prod_runner.sh | 4 ++-- tools/gce_setup/compute_extras.sh | 4 ++-- tools/gce_setup/grpc_docker.sh | 8 ++++---- tools/gce_setup/interop_test_runner.sh | 4 ++-- tools/gce_setup/new_grpc_docker_builder.sh | 4 ++-- .../new_grpc_docker_builder_on_startup.sh | 4 ++-- tools/gce_setup/shared_startup_funcs.sh | 4 ++-- tools/run_tests/build_node.sh | 4 ++-- tools/run_tests/build_php.sh | 4 ++-- tools/run_tests/build_python.sh | 4 ++-- tools/run_tests/run_lcov.sh | 3 +-- tools/run_tests/run_node.sh | 4 ++-- tools/run_tests/run_python.sh | 4 ++-- vsprojects/third_party/openssl/buildinf.h | 4 ++-- vsprojects/third_party/openssl/opensslconf.h | 4 ++-- 615 files changed, 1248 insertions(+), 1245 deletions(-) diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index 18c81c426dc..2844d713207 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ int main(int argc, char** argv) { channel.reset(); grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/examples/pubsub/publisher.cc b/examples/pubsub/publisher.cc index cdefd08662e..f4afbc771ca 100644 --- a/examples/pubsub/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,4 +121,4 @@ Status Publisher::Publish(const grpc::string& topic, const grpc::string& data) { } // namespace pubsub } // namespace examples -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index 8eb666aea54..55944b22f63 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ class Publisher { } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ +#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ \ No newline at end of file diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 6f4bc6ba709..e4e71ad9223 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,4 +154,4 @@ int main(int argc, char** argv) { int result = RUN_ALL_TESTS(); grpc_shutdown(); return result; -} +} \ No newline at end of file diff --git a/examples/pubsub/subscriber.cc b/examples/pubsub/subscriber.cc index 18ce0721f67..e450e6cafa6 100644 --- a/examples/pubsub/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -115,4 +115,4 @@ Status Subscriber::Pull(const grpc::string& name, grpc::string* data) { } // namespace pubsub } // namespace examples -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index e5f036f89f9..cf846f11903 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,4 +65,4 @@ class Subscriber { } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ +#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ \ No newline at end of file diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index a436c5d4e21..55eb7be6d71 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,4 +156,4 @@ int main(int argc, char** argv) { int result = RUN_ALL_TESTS(); grpc_shutdown(); return result; -} +} \ No newline at end of file diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h index e4881b78287..ebdb2ffd6e1 100644 --- a/include/grpc++/channel_arguments.h +++ b/include/grpc++/channel_arguments.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,4 +82,4 @@ class ChannelArguments { } // namespace grpc -#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ +#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ \ No newline at end of file diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index b0366faabb9..24fc595dbd4 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,4 @@ class ChannelInterface : public CallHook { } // namespace grpc -#endif // __GRPCPP_CHANNEL_INTERFACE_H__ +#endif // __GRPCPP_CHANNEL_INTERFACE_H__ \ No newline at end of file diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 7f1069ea5ee..cc0d46cede9 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -147,4 +147,4 @@ class ClientContext { } // namespace grpc -#endif // __GRPCPP_CLIENT_CONTEXT_H__ +#endif // __GRPCPP_CLIENT_CONTEXT_H__ \ No newline at end of file diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index c5267f8563c..3a5820bf833 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,4 +114,4 @@ class CompletionQueue { } // namespace grpc -#endif // __GRPCPP_COMPLETION_QUEUE_H__ +#endif // __GRPCPP_COMPLETION_QUEUE_H__ \ No newline at end of file diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 663e40247d8..55e4318010e 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,4 +42,4 @@ typedef std::string string; } // namespace grpc -#endif // __GRPCPP_CONFIG_H__ +#endif // __GRPCPP_CONFIG_H__ \ No newline at end of file diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index a8ce8b8ec84..e8427bf4f86 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ std::shared_ptr CreateChannel( } // namespace grpc -#endif // __GRPCPP_CREATE_CHANNEL_H__ +#endif // __GRPCPP_CREATE_CHANNEL_H__ \ No newline at end of file diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 52304d7f369..6f6523dedcd 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,4 +119,4 @@ class CredentialsFactory { } // namespace grpc -#endif // __GRPCPP_CREDENTIALS_H_ +#endif // __GRPCPP_CREDENTIALS_H_ \ No newline at end of file diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 4ab226339d3..82eb457ae61 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -142,4 +142,4 @@ class Call final { } // namespace grpc -#endif // __GRPCPP_CALL_INTERFACE_H__ +#endif // __GRPCPP_CALL_INTERFACE_H__ \ No newline at end of file diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index ff03f7c9369..81adc274c8c 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,4 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, } // namespace grpc -#endif +#endif \ No newline at end of file diff --git a/include/grpc++/impl/internal_stub.h b/include/grpc++/impl/internal_stub.h index b32fb3a27c0..4c33fde9ca6 100644 --- a/include/grpc++/impl/internal_stub.h +++ b/include/grpc++/impl/internal_stub.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ class InternalStub { } // namespace grpc -#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ +#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ \ No newline at end of file diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index bb16e64c969..0bb53f7abe9 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,4 +66,4 @@ class RpcMethod { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_METHOD_H__ +#endif // __GRPCPP_IMPL_RPC_METHOD_H__ \ No newline at end of file diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index bf62871b7d1..104ff8597a8 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -203,4 +203,4 @@ class RpcService { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ +#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ \ No newline at end of file diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index 221664befe2..a89d9cd89ce 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,4 +124,4 @@ class AsynchronousService { } // namespace grpc -#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ +#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 410c762375c..68d9ab17849 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,4 +125,4 @@ class Server final : private CallHook, } // namespace grpc -#endif // __GRPCPP_SERVER_H__ +#endif // __GRPCPP_SERVER_H__ \ No newline at end of file diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index a550a53afb5..750b4369fb1 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,4 +88,4 @@ class ServerBuilder { } // namespace grpc -#endif // __GRPCPP_SERVER_BUILDER_H__ +#endif // __GRPCPP_SERVER_BUILDER_H__ \ No newline at end of file diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 853f91f4671..0b7f0594f78 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,4 +110,4 @@ class ServerContext final { } // namespace grpc -#endif // __GRPCPP_SERVER_CONTEXT_H_ +#endif // __GRPCPP_SERVER_CONTEXT_H_ \ No newline at end of file diff --git a/include/grpc++/server_credentials.h b/include/grpc++/server_credentials.h index b12d1390451..8e1cd9dd753 100644 --- a/include/grpc++/server_credentials.h +++ b/include/grpc++/server_credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,4 +79,4 @@ class ServerCredentialsFactory { } // namespace grpc -#endif // __GRPCPP_SERVER_CREDENTIALS_H_ +#endif // __GRPCPP_SERVER_CREDENTIALS_H_ \ No newline at end of file diff --git a/include/grpc++/status.h b/include/grpc++/status.h index 432158a989a..cd1ff6c533e 100644 --- a/include/grpc++/status.h +++ b/include/grpc++/status.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,4 +62,4 @@ class Status { } // namespace grpc -#endif // __GRPCPP_STATUS_H__ +#endif // __GRPCPP_STATUS_H__ \ No newline at end of file diff --git a/include/grpc++/status_code_enum.h b/include/grpc++/status_code_enum.h index 4e0fda13db6..5c6ea7d0f71 100644 --- a/include/grpc++/status_code_enum.h +++ b/include/grpc++/status_code_enum.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -195,4 +195,4 @@ enum StatusCode { } // namespace grpc -#endif // __GRPCPP_STATUS_CODE_ENUM_H_ +#endif // __GRPCPP_STATUS_CODE_ENUM_H_ \ No newline at end of file diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 20ba3fb7905..c36488f9632 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -772,4 +772,4 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, } // namespace grpc -#endif // __GRPCPP_STREAM_H__ +#endif // __GRPCPP_STREAM_H__ \ No newline at end of file diff --git a/include/grpc++/thread_pool_interface.h b/include/grpc++/thread_pool_interface.h index a8eacb037fd..9927d293721 100644 --- a/include/grpc++/thread_pool_interface.h +++ b/include/grpc++/thread_pool_interface.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ class ThreadPoolInterface { } // namespace grpc -#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ +#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ \ No newline at end of file diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h index 094d3016e1e..ef874883780 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ struct grpc_byte_buffer { } data; }; -#endif /* __GRPC_BYTE_BUFFER_H__ */ +#endif /* __GRPC_BYTE_BUFFER_H__ */ \ No newline at end of file diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index a9cbb7752be..e60dab51c8a 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader { } current; }; -#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ +#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ \ No newline at end of file diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 12949d569bc..68a1382a4f5 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -563,18 +563,18 @@ grpc_call_error grpc_server_request_call_old(grpc_server *server, grpc_call_error grpc_server_request_call( grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, - grpc_completion_queue *cq_bound_to_call, + grpc_completion_queue *cq_bound_to_call, void *tag_new); /* Registers a method in the server. Methods to this (host, method) pair will not be reported by - grpc_server_request_call, but instead be reported by + grpc_server_request_call, but instead be reported by grpc_server_request_registered_call when passed the appropriate registered_method (as returned by this function). Must be called before grpc_server_start. Returns NULL on failure. */ void *grpc_server_register_method(grpc_server *server, const char *method, - const char *host, + const char *host, grpc_completion_queue *new_call_cq); /* Request notification of a new pre-registered call */ @@ -619,4 +619,4 @@ void grpc_server_destroy(grpc_server *server); } #endif -#endif /* __GRPC_GRPC_H__ */ +#endif /* __GRPC_GRPC_H__ */ \ No newline at end of file diff --git a/include/grpc/grpc_http.h b/include/grpc/grpc_http.h index b2ae5340a56..a20b93bc86d 100644 --- a/include/grpc/grpc_http.h +++ b/include/grpc/grpc_http.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ typedef struct { } #endif -#endif /* __GRPC_GRPC_HTTP_H__ */ +#endif /* __GRPC_GRPC_HTTP_H__ */ \ No newline at end of file diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index a43d998d029..c7d3daf221f 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,4 +173,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr); } #endif -#endif /* GRPC_SECURITY_H_ */ +#endif /* GRPC_SECURITY_H_ */ \ No newline at end of file diff --git a/include/grpc/status.h b/include/grpc/status.h index 630b7769fd5..3096ac4c01d 100644 --- a/include/grpc/status.h +++ b/include/grpc/status.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -199,4 +199,4 @@ typedef enum { } #endif -#endif /* __GRPC_STATUS_H__ */ +#endif /* __GRPC_STATUS_H__ */ \ No newline at end of file diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index fa9cc4bf7c7..739fec25b35 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr); } #endif -#endif /* __GRPC_SUPPORT_ALLOC_H__ */ +#endif /* __GRPC_SUPPORT_ALLOC_H__ */ \ No newline at end of file diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index 5e613f1ba98..7c0ead0447f 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,4 +89,4 @@ #error could not determine platform for atm #endif -#endif /* __GRPC_SUPPORT_ATM_H__ */ +#endif /* __GRPC_SUPPORT_ATM_H__ */ \ No newline at end of file diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index 896dd842ec2..40bcc12d660 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { __ATOMIC_RELAXED); } -#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ +#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ \ No newline at end of file diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index 1a3a10c911b..02da69add51 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) { #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) -#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ +#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ \ No newline at end of file diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 19881e83ad8..87d54259504 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,4 +103,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) { return old; } -#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ +#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ \ No newline at end of file diff --git a/include/grpc/support/cancellable_platform.h b/include/grpc/support/cancellable_platform.h index db099b83818..d732b1f0adc 100644 --- a/include/grpc/support/cancellable_platform.h +++ b/include/grpc/support/cancellable_platform.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ typedef struct { struct gpr_cancellable_list_ waiters; } gpr_cancellable; -#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ +#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ \ No newline at end of file diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index ba3ffe42cc0..ca6d58ca430 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl); } #endif -#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ +#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ \ No newline at end of file diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index 9025f7c21f8..afb3eba2d21 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void); } // extern "C" #endif -#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ +#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ \ No newline at end of file diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index e67323d5d3d..03886556c2c 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram); } #endif -#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ +#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ \ No newline at end of file diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 9495bfea40a..92630af8269 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ int gpr_join_host_port(char **out, const char *host, int port); } #endif -#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ +#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ \ No newline at end of file diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index 1c2857dad38..d88ba7b2d72 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ +#endif /* __GRPC_SUPPORT_LOG_H__ */ \ No newline at end of file diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h index 0350056d26e..49c0ecf2b9b 100644 --- a/include/grpc/support/log_win32.h +++ b/include/grpc/support/log_win32.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ char *gpr_format_message(DWORD messageid); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ +#endif /* __GRPC_SUPPORT_LOG_H__ */ \ No newline at end of file diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 5b9b3c47a6b..e98a9327127 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -204,4 +204,4 @@ typedef uintptr_t gpr_uintptr; power of two */ #define GPR_MAX_ALIGNMENT 16 -#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ +#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ \ No newline at end of file diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h index 7828ccdd13c..fa7995f3f75 100644 --- a/include/grpc/support/slice.h +++ b/include/grpc/support/slice.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,4 +173,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b); } #endif -#endif /* __GRPC_SUPPORT_SLICE_H__ */ +#endif /* __GRPC_SUPPORT_SLICE_H__ */ \ No newline at end of file diff --git a/include/grpc/support/slice_buffer.h b/include/grpc/support/slice_buffer.h index 80c13e064a9..f537472d81a 100644 --- a/include/grpc/support/slice_buffer.h +++ b/include/grpc/support/slice_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb); } #endif -#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ +#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ \ No newline at end of file diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 6f0f684ae7a..9899cccb311 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c); } #endif -#endif /* __GRPC_SUPPORT_SYNC_H__ */ +#endif /* __GRPC_SUPPORT_SYNC_H__ */ \ No newline at end of file diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index 9ad56f7b64e..e8a4ced3015 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ typedef struct { #define GPR_STATS_INIT \ { 0 } -#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ +#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ \ No newline at end of file diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index d51c268dc98..e3e0baeb282 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ typedef pthread_once_t gpr_once; #define GPR_ONCE_INIT PTHREAD_ONCE_INIT -#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ +#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ \ No newline at end of file diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h index 6e256663501..79bb7bdd196 100644 --- a/include/grpc/support/sync_win32.h +++ b/include/grpc/support/sync_win32.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ typedef CONDITION_VARIABLE gpr_cv; typedef INIT_ONCE gpr_once; #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT -#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ +#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ \ No newline at end of file diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 92d40b44752..4868130f65e 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,4 +73,4 @@ gpr_thd_id gpr_thd_currentid(void); } #endif -#endif /* __GRPC_SUPPORT_THD_H__ */ +#endif /* __GRPC_SUPPORT_THD_H__ */ \ No newline at end of file diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 9fb1d0bc97b..22275c42b66 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,4 +100,4 @@ double gpr_timespec_to_micros(gpr_timespec t); } #endif -#endif /* __GRPC_SUPPORT_TIME_H__ */ +#endif /* __GRPC_SUPPORT_TIME_H__ */ \ No newline at end of file diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index c451e9cc83d..0847d351020 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) -#endif /* __GRPC_SUPPORT_USEFUL_H__ */ +#endif /* __GRPC_SUPPORT_USEFUL_H__ */ \ No newline at end of file diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 60dc02d7af9..167c0a86b86 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -703,4 +703,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file) { return output; } -} // namespace grpc_cpp_generator +} // namespace grpc_cpp_generator \ No newline at end of file diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h index fe84d08b4c8..34f0e20dca3 100644 --- a/src/compiler/cpp_generator.h +++ b/src/compiler/cpp_generator.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file); } // namespace grpc_cpp_generator -#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_ +#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_ \ No newline at end of file diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h index 54c343866fc..5e1b115e897 100644 --- a/src/compiler/cpp_generator_helpers.h +++ b/src/compiler/cpp_generator_helpers.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,4 +103,4 @@ inline std::string ClassName(const google::protobuf::Descriptor *descriptor, } // namespace grpc_cpp_generator -#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ +#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ \ No newline at end of file diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index a7fdb1f093f..662e6ef6ccc 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,4 +94,4 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator { int main(int argc, char *argv[]) { CppGrpcGenerator generator; return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} +} \ No newline at end of file diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index 8196589a5c4..ac9ff8d8479 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -169,4 +169,4 @@ std::string GetServices(const FileDescriptor *file) { return output; } -} // namespace grpc_ruby_generator +} // namespace grpc_ruby_generator \ No newline at end of file diff --git a/src/compiler/ruby_generator.h b/src/compiler/ruby_generator.h index 89d7a0b92a9..1d851f3210f 100644 --- a/src/compiler/ruby_generator.h +++ b/src/compiler/ruby_generator.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ std::string GetServices(const google::protobuf::FileDescriptor *file); } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_ +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_ \ No newline at end of file diff --git a/src/compiler/ruby_generator_helpers-inl.h b/src/compiler/ruby_generator_helpers-inl.h index 0034f5ef569..b3c1d21eb66 100644 --- a/src/compiler/ruby_generator_helpers-inl.h +++ b/src/compiler/ruby_generator_helpers-inl.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ inline std::string MessagesRequireName( } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ \ No newline at end of file diff --git a/src/compiler/ruby_generator_map-inl.h b/src/compiler/ruby_generator_map-inl.h index fea9c2e2fac..0e65d1ed104 100644 --- a/src/compiler/ruby_generator_map-inl.h +++ b/src/compiler/ruby_generator_map-inl.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,4 +68,4 @@ inline std::map ListToDict( } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ \ No newline at end of file diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index d24a61b9f5f..92d3f5d3ded 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -130,4 +130,4 @@ inline std::string RubyTypeOf(const std::string &a_type, } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ \ No newline at end of file diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc index 9397452f55e..81c6be6b2e3 100644 --- a/src/compiler/ruby_plugin.cc +++ b/src/compiler/ruby_plugin.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator { int main(int argc, char *argv[]) { RubyGrpcGenerator generator; return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} +} \ No newline at end of file diff --git a/src/core/channel/call_op_string.c b/src/core/channel/call_op_string.c index 127ea707bf5..e3471a01a1b 100644 --- a/src/core/channel/call_op_string.c +++ b/src/core/channel/call_op_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,4 +131,4 @@ void grpc_call_log_op(char *file, int line, gpr_log_severity severity, char *str = grpc_call_op_string(op); gpr_log(file, line, severity, "OP[%s:%p]: %s", elem->filter->name, elem, str); gpr_free(str); -} +} \ No newline at end of file diff --git a/src/core/channel/census_filter.c b/src/core/channel/census_filter.c index 3447e9dde45..3a2aa47d261 100644 --- a/src/core/channel/census_filter.c +++ b/src/core/channel/census_filter.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -185,4 +185,4 @@ const grpc_channel_filter grpc_client_census_filter = { const grpc_channel_filter grpc_server_census_filter = { server_call_op, channel_op, sizeof(call_data), server_init_call_elem, server_destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "census-server"}; + init_channel_elem, destroy_channel_elem, "census-server"}; \ No newline at end of file diff --git a/src/core/channel/census_filter.h b/src/core/channel/census_filter.h index 5b2c01ca9ba..92f0d226d50 100644 --- a/src/core/channel/census_filter.h +++ b/src/core/channel/census_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_client_census_filter; extern const grpc_channel_filter grpc_server_census_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */ \ No newline at end of file diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c index f48415e6346..885e3ac4383 100644 --- a/src/core/channel/channel_args.c +++ b/src/core/channel/channel_args.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,4 +113,4 @@ int grpc_channel_args_is_census_enabled(const grpc_channel_args *a) { } } return 0; -} +} \ No newline at end of file diff --git a/src/core/channel/channel_args.h b/src/core/channel/channel_args.h index 92280450a14..11762f7e7b0 100644 --- a/src/core/channel/channel_args.h +++ b/src/core/channel/channel_args.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ void grpc_channel_args_destroy(grpc_channel_args *a); is specified in channel args, otherwise returns 0. */ int grpc_channel_args_is_census_enabled(const grpc_channel_args *a); -#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */ \ No newline at end of file diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c index d9e722c4f1e..c637e22822d 100644 --- a/src/core/channel/channel_stack.c +++ b/src/core/channel/channel_stack.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -245,4 +245,4 @@ void grpc_call_element_send_finish(grpc_call_element *cur_elem) { finish_op.user_data = NULL; finish_op.flags = 0; grpc_call_next_op(cur_elem, &finish_op); -} +} \ No newline at end of file diff --git a/src/core/channel/channel_stack.h b/src/core/channel/channel_stack.h index ec9ecf3d15a..8dbe28e9410 100644 --- a/src/core/channel/channel_stack.h +++ b/src/core/channel/channel_stack.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -309,4 +309,4 @@ void grpc_call_element_send_finish(grpc_call_element *cur_elem); } while (0) #endif -#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */ \ No newline at end of file diff --git a/src/core/channel/child_channel.c b/src/core/channel/child_channel.c index a7f06bcdc02..d39ace87e16 100644 --- a/src/core/channel/child_channel.c +++ b/src/core/channel/child_channel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -307,4 +307,4 @@ void grpc_child_call_destroy(grpc_child_call *call) { grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call) { return LINK_BACK_ELEM_FROM_CALL(call); -} +} \ No newline at end of file diff --git a/src/core/channel/child_channel.h b/src/core/channel/child_channel.h index ece0ff99a92..239123f27a9 100644 --- a/src/core/channel/child_channel.h +++ b/src/core/channel/child_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ grpc_child_call *grpc_child_channel_create_call(grpc_child_channel *channel, grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call); void grpc_child_call_destroy(grpc_child_call *call); -#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */ \ No newline at end of file diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index 8e8f95fdb35..170065a5c27 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -562,4 +562,4 @@ void grpc_client_channel_set_transport_setup(grpc_channel_stack *channel_stack, channel_data *chand = elem->channel_data; GPR_ASSERT(!chand->transport_setup); chand->transport_setup = setup; -} +} \ No newline at end of file diff --git a/src/core/channel/client_channel.h b/src/core/channel/client_channel.h index 6b8a7d95a8a..3db8cb6c8e8 100644 --- a/src/core/channel/client_channel.h +++ b/src/core/channel/client_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,4 +59,4 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete( grpc_channel_filter const **channel_filters, size_t num_channel_filters, grpc_mdctx *mdctx); -#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */ \ No newline at end of file diff --git a/src/core/channel/client_setup.c b/src/core/channel/client_setup.c index ebaf816902b..f9b28db0dcb 100644 --- a/src/core/channel/client_setup.c +++ b/src/core/channel/client_setup.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -237,4 +237,4 @@ const grpc_channel_args *grpc_client_setup_get_channel_args( grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r) { return r->setup->mdctx; -} +} \ No newline at end of file diff --git a/src/core/channel/client_setup.h b/src/core/channel/client_setup.h index 155a9a5b1a7..c79dda41210 100644 --- a/src/core/channel/client_setup.h +++ b/src/core/channel/client_setup.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r); grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r); -#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */ \ No newline at end of file diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c index 2d61d389e42..9377cb26d4c 100644 --- a/src/core/channel/connected_channel.c +++ b/src/core/channel/connected_channel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -519,4 +519,4 @@ grpc_transport_setup_result grpc_connected_channel_bind_transport( ret.user_data = elem; ret.callbacks = &connected_channel_transport_callbacks; return ret; -} +} \ No newline at end of file diff --git a/src/core/channel/connected_channel.h b/src/core/channel/connected_channel.h index 9d143fc1359..cfd83bb0277 100644 --- a/src/core/channel/connected_channel.h +++ b/src/core/channel/connected_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ extern const grpc_channel_filter grpc_connected_channel_filter; grpc_transport_setup_result grpc_connected_channel_bind_transport( grpc_channel_stack *channel_stack, grpc_transport *transport); -#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */ \ No newline at end of file diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index a2b5f48f608..2cf0648cc00 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -1,5 +1,5 @@ /* - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -196,4 +196,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_client_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "http-client"}; + init_channel_elem, destroy_channel_elem, "http-client"}; \ No newline at end of file diff --git a/src/core/channel/http_client_filter.h b/src/core/channel/http_client_filter.h index 21cde4877ba..f230ca0f9ed 100644 --- a/src/core/channel/http_client_filter.h +++ b/src/core/channel/http_client_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_http_client_filter; #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */ \ No newline at end of file diff --git a/src/core/channel/http_filter.c b/src/core/channel/http_filter.c index eaa746ef208..5276eb9bc56 100644 --- a/src/core/channel/http_filter.c +++ b/src/core/channel/http_filter.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -134,4 +134,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "http"}; + init_channel_elem, destroy_channel_elem, "http"}; \ No newline at end of file diff --git a/src/core/channel/http_filter.h b/src/core/channel/http_filter.h index 89ad482d358..1598034e031 100644 --- a/src/core/channel/http_filter.h +++ b/src/core/channel/http_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ transports. */ extern const grpc_channel_filter grpc_http_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */ \ No newline at end of file diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index b70af434a79..97c3c88752b 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -362,4 +362,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_server_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, destroy_channel_elem, - "http-server"}; + "http-server"}; \ No newline at end of file diff --git a/src/core/channel/http_server_filter.h b/src/core/channel/http_server_filter.h index 5b475432aa2..1ec1c7c2164 100644 --- a/src/core/channel/http_server_filter.h +++ b/src/core/channel/http_server_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,4 +39,4 @@ /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_server_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */ \ No newline at end of file diff --git a/src/core/channel/metadata_buffer.c b/src/core/channel/metadata_buffer.c index a21a37ea7dc..41f328e0d13 100644 --- a/src/core/channel/metadata_buffer.c +++ b/src/core/channel/metadata_buffer.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,4 +197,4 @@ void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_metadata_buffer_destroy(&hdr->impl, error); gpr_free(hdr); -} +} \ No newline at end of file diff --git a/src/core/channel/metadata_buffer.h b/src/core/channel/metadata_buffer.h index 011dabed1b1..17a2eb7414b 100644 --- a/src/core/channel/metadata_buffer.h +++ b/src/core/channel/metadata_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,4 +67,4 @@ grpc_metadata *grpc_metadata_buffer_extract_elements( grpc_metadata_buffer *buffer); void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error); -#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */ \ No newline at end of file diff --git a/src/core/channel/noop_filter.c b/src/core/channel/noop_filter.c index d5615f7ae68..ea4f86a6164 100644 --- a/src/core/channel/noop_filter.c +++ b/src/core/channel/noop_filter.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,4 +133,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_no_op_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "no-op"}; + init_channel_elem, destroy_channel_elem, "no-op"}; \ No newline at end of file diff --git a/src/core/channel/noop_filter.h b/src/core/channel/noop_filter.h index 269214f893f..ef26ec84e0a 100644 --- a/src/core/channel/noop_filter.h +++ b/src/core/channel/noop_filter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ customize for their own filters */ extern const grpc_channel_filter grpc_no_op_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */ +#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */ \ No newline at end of file diff --git a/src/core/compression/algorithm.c b/src/core/compression/algorithm.c index 0b5576f70a6..df7c3026268 100644 --- a/src/core/compression/algorithm.c +++ b/src/core/compression/algorithm.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ const char *grpc_compression_algorithm_name( return "error"; } return "error"; -} +} \ No newline at end of file diff --git a/src/core/compression/algorithm.h b/src/core/compression/algorithm.h index c5ec6d21b68..2c7c38e1d8b 100644 --- a/src/core/compression/algorithm.h +++ b/src/core/compression/algorithm.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ typedef enum { const char *grpc_compression_algorithm_name( grpc_compression_algorithm algorithm); -#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */ +#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */ \ No newline at end of file diff --git a/src/core/compression/message_compress.c b/src/core/compression/message_compress.c index 1787ccd7d8f..b21b8ff27e1 100644 --- a/src/core/compression/message_compress.c +++ b/src/core/compression/message_compress.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -190,4 +190,4 @@ int grpc_msg_decompress(grpc_compression_algorithm algorithm, } gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm); return 0; -} +} \ No newline at end of file diff --git a/src/core/compression/message_compress.h b/src/core/compression/message_compress.h index 564ca69a877..454d8acd1fa 100644 --- a/src/core/compression/message_compress.h +++ b/src/core/compression/message_compress.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm, int grpc_msg_decompress(grpc_compression_algorithm algorithm, gpr_slice_buffer *input, gpr_slice_buffer *output); -#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */ +#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */ \ No newline at end of file diff --git a/src/core/httpcli/format_request.c b/src/core/httpcli/format_request.c index 5d1a04ef826..7382a29823e 100644 --- a/src/core/httpcli/format_request.c +++ b/src/core/httpcli/format_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,4 +114,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, } return gpr_slice_new(tmp, out_len, gpr_free); -} +} \ No newline at end of file diff --git a/src/core/httpcli/format_request.h b/src/core/httpcli/format_request.h index a82130cb93a..6e62f8a4111 100644 --- a/src/core/httpcli/format_request.h +++ b/src/core/httpcli/format_request.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, const char *body_bytes, size_t body_size); -#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */ +#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */ \ No newline at end of file diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c index acd9fa7b55b..97c10a0134c 100644 --- a/src/core/httpcli/httpcli.c +++ b/src/core/httpcli/httpcli.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -270,4 +270,4 @@ void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post) { g_get_override = get; g_post_override = post; -} +} \ No newline at end of file diff --git a/src/core/httpcli/httpcli.h b/src/core/httpcli/httpcli.h index 90f89a93664..012ac530ed2 100644 --- a/src/core/httpcli/httpcli.h +++ b/src/core/httpcli/httpcli.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -115,4 +115,4 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request, void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post); -#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */ +#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */ \ No newline at end of file diff --git a/src/core/httpcli/httpcli_security_context.c b/src/core/httpcli/httpcli_security_context.c index 53e887ccd14..4ba5890a33d 100644 --- a/src/core/httpcli/httpcli_security_context.c +++ b/src/core/httpcli/httpcli_security_context.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,4 +128,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create( } *ctx = &c->base; return GRPC_SECURITY_OK; -} +} \ No newline at end of file diff --git a/src/core/httpcli/httpcli_security_context.h b/src/core/httpcli/httpcli_security_context.h index a73ecca0b37..d2cec2f9dac 100644 --- a/src/core/httpcli/httpcli_security_context.h +++ b/src/core/httpcli/httpcli_security_context.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create( const unsigned char *pem_root_certs, size_t pem_root_certs_size, const char *secure_peer_name, grpc_channel_security_context **ctx); -#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */ +#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */ \ No newline at end of file diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c index 1f0c5167de7..2d1f3af5f6e 100644 --- a/src/core/httpcli/parser.c +++ b/src/core/httpcli/parser.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -209,4 +209,4 @@ int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice) { int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser) { return parser->state == GRPC_HTTPCLI_BODY; -} +} \ No newline at end of file diff --git a/src/core/httpcli/parser.h b/src/core/httpcli/parser.h index 520b16fd020..7924031e88d 100644 --- a/src/core/httpcli/parser.h +++ b/src/core/httpcli/parser.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser); int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice); int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser); -#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */ +#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index 7884b21a1e2..83b189f95b2 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -362,4 +362,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void) { out = g_shard_queue[0]->min_deadline; gpr_mu_unlock(&g_mu); return out; -} +} \ No newline at end of file diff --git a/src/core/iomgr/alarm.h b/src/core/iomgr/alarm.h index f94dcec6e99..478aa9439d6 100644 --- a/src/core/iomgr/alarm.h +++ b/src/core/iomgr/alarm.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,4 +86,4 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline, Requires: cancel() must happen after add() on a given alarm */ void grpc_alarm_cancel(grpc_alarm *alarm); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/alarm_heap.c b/src/core/iomgr/alarm_heap.c index 2b6198336fe..8a8c9b0bf32 100644 --- a/src/core/iomgr/alarm_heap.c +++ b/src/core/iomgr/alarm_heap.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -145,4 +145,4 @@ grpc_alarm *grpc_alarm_heap_top(grpc_alarm_heap *heap) { void grpc_alarm_heap_pop(grpc_alarm_heap *heap) { grpc_alarm_heap_remove(heap, grpc_alarm_heap_top(heap)); -} +} \ No newline at end of file diff --git a/src/core/iomgr/alarm_heap.h b/src/core/iomgr/alarm_heap.h index e51f96dd440..7cf793fc81b 100644 --- a/src/core/iomgr/alarm_heap.h +++ b/src/core/iomgr/alarm_heap.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ void grpc_alarm_heap_pop(grpc_alarm_heap *heap); int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/alarm_internal.h b/src/core/iomgr/alarm_internal.h index 8503292fd1a..b87d3b57639 100644 --- a/src/core/iomgr/alarm_internal.h +++ b/src/core/iomgr/alarm_internal.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,7 +39,7 @@ /* iomgr internal api for dealing with alarms */ -/* Check for alarms to be run, and run them. +/* Check for alarms to be run, and run them. Return non zero if alarm callbacks were executed. Drops drop_mu if it is non-null before executing callbacks. If next is non-null, TRY to update *next with the next running alarm @@ -59,4 +59,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void); void grpc_kick_poller(void); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/endpoint.c b/src/core/iomgr/endpoint.c index 9e5d56389d2..796d89706e7 100644 --- a/src/core/iomgr/endpoint.c +++ b/src/core/iomgr/endpoint.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,4 +52,4 @@ void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) { void grpc_endpoint_shutdown(grpc_endpoint *ep) { ep->vtable->shutdown(ep); } -void grpc_endpoint_destroy(grpc_endpoint *ep) { ep->vtable->destroy(ep); } +void grpc_endpoint_destroy(grpc_endpoint *ep) { ep->vtable->destroy(ep); } \ No newline at end of file diff --git a/src/core/iomgr/endpoint.h b/src/core/iomgr/endpoint.h index ec86d9a1460..bb9552eac99 100644 --- a/src/core/iomgr/endpoint.h +++ b/src/core/iomgr/endpoint.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,4 +103,4 @@ struct grpc_endpoint { const grpc_endpoint_vtable *vtable; }; -#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/endpoint_pair.h b/src/core/iomgr/endpoint_pair.h index 55678b5ddb1..d4981063a41 100644 --- a/src/core/iomgr/endpoint_pair.h +++ b/src/core/iomgr/endpoint_pair.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ typedef struct { grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size); -#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c index 3f53402cf3c..1ce548f9e68 100644 --- a/src/core/iomgr/endpoint_pair_posix.c +++ b/src/core/iomgr/endpoint_pair_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size) { return p; } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index cc578305513..b31b7b151ad 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -322,4 +322,4 @@ void grpc_fd_become_writable(grpc_fd *fd, int allow_synchronous_callback) { set_ready(fd, &fd->writest, allow_synchronous_callback); } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h index 9a675087e59..1c1def27189 100644 --- a/src/core/iomgr/fd_posix.h +++ b/src/core/iomgr/fd_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -147,4 +147,4 @@ void grpc_fd_unref(grpc_fd *fd); void grpc_fd_global_init(void); void grpc_fd_global_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 729b11b78dc..1ad07c06e6e 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -197,4 +197,4 @@ void grpc_socket_notify_on_read(grpc_winsocket *socket, socket_notify_on_iocp(socket, cb, opaque, &socket->read_info); } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/iocp_windows.h b/src/core/iomgr/iocp_windows.h index bf5b90978ef..11b66446a9b 100644 --- a/src/core/iomgr/iocp_windows.h +++ b/src/core/iomgr/iocp_windows.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success void grpc_socket_notify_on_read(grpc_winsocket *, void(*cb)(void *, int success), void *opaque); -#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c index 3d6114ca18e..41d2d58329b 100644 --- a/src/core/iomgr/iomgr.c +++ b/src/core/iomgr/iomgr.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -205,4 +205,4 @@ int grpc_maybe_call_delayed_callbacks(gpr_mu *drop_mu, int success) { gpr_mu_lock(retake_mu); } return n; -} +} \ No newline at end of file diff --git a/src/core/iomgr/iomgr.h b/src/core/iomgr/iomgr.h index 06dc2e5dbfa..a2e11e580f1 100644 --- a/src/core/iomgr/iomgr.h +++ b/src/core/iomgr/iomgr.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ void grpc_iomgr_shutdown(void); and causes the invocation of a callback at some point in the future */ void grpc_iomgr_add_callback(grpc_iomgr_cb_func cb, void *cb_arg); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/iomgr_internal.h b/src/core/iomgr/iomgr_internal.h index e9962a0f66b..5c980f8af13 100644 --- a/src/core/iomgr/iomgr_internal.h +++ b/src/core/iomgr/iomgr_internal.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ void grpc_iomgr_unref(void); void grpc_iomgr_platform_init(void); void grpc_iomgr_platform_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/iomgr/iomgr_posix.c index bbf8cfc4190..9ed11a603a6 100644 --- a/src/core/iomgr/iomgr_posix.c +++ b/src/core/iomgr/iomgr_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ void grpc_iomgr_platform_shutdown(void) { grpc_fd_global_shutdown(); } -#endif /* GRPC_POSIX_SOCKET */ +#endif /* GRPC_POSIX_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/iomgr_posix.h b/src/core/iomgr/iomgr_posix.h index 86973a050dc..272fc309c3d 100644 --- a/src/core/iomgr/iomgr_posix.h +++ b/src/core/iomgr/iomgr_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,4 +39,4 @@ void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/iomgr/iomgr_windows.c index a3a255eaed2..d807c6fc8a0 100644 --- a/src/core/iomgr/iomgr_windows.c +++ b/src/core/iomgr/iomgr_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ void grpc_iomgr_platform_shutdown(void) { winsock_shutdown(); } -#endif /* GRPC_WINSOCK_SOCKET */ +#endif /* GRPC_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/pollset.h b/src/core/iomgr/pollset.h index b9fcf45ea68..3cd60ba6f6a 100644 --- a/src/core/iomgr/pollset.h +++ b/src/core/iomgr/pollset.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,4 +66,4 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline); Requires GRPC_POLLSET_MU(pollset) locked. */ void grpc_pollset_kick(grpc_pollset *pollset); -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index c136ee0b528..44283750b3e 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -248,4 +248,4 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, } } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 1245d22ddee..1845d749fb9 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -311,4 +311,4 @@ static void become_unary_pollset(grpc_pollset *pollset, grpc_fd *fd) { grpc_fd_ref(fd); } -#endif /* GPR_POSIX_POLLSET */ +#endif /* GPR_POSIX_POLLSET */ \ No newline at end of file diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h index b1a82fccfe7..cc8de96f859 100644 --- a/src/core/iomgr/pollset_posix.h +++ b/src/core/iomgr/pollset_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,4 +100,4 @@ grpc_pollset *grpc_backup_pollset(void); void grpc_platform_become_multipoller(grpc_pollset *pollset, struct grpc_fd **fds, size_t fd_count); -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_POSIX_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_POSIX_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index b81d23e57c2..7dbe5f88da3 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,4 +68,4 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) { void grpc_pollset_kick(grpc_pollset *p) { } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/pollset_windows.h b/src/core/iomgr/pollset_windows.h index 1a5e31f627b..44efca739a5 100644 --- a/src/core/iomgr/pollset_windows.h +++ b/src/core/iomgr/pollset_windows.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ typedef struct grpc_pollset { #define GRPC_POLLSET_MU(pollset) (&(pollset)->mu) #define GRPC_POLLSET_CV(pollset) (&(pollset)->cv) -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/resolve_address.c b/src/core/iomgr/resolve_address.c index e17bcdba0f4..8da7d973c4f 100644 --- a/src/core/iomgr/resolve_address.c +++ b/src/core/iomgr/resolve_address.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -232,4 +232,4 @@ void grpc_resolve_address(const char *name, const char *default_port, r->cb = cb; r->arg = arg; gpr_thd_new(&id, do_request, r, NULL); -} +} \ No newline at end of file diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h index 7b537b17674..ac70744964c 100644 --- a/src/core/iomgr/resolve_address.h +++ b/src/core/iomgr/resolve_address.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,4 +66,4 @@ void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses); grpc_resolved_addresses *grpc_blocking_resolve_address( const char *addr, const char *default_port); -#endif /* __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/sockaddr.h b/src/core/iomgr/sockaddr.h index b980b3029fa..60512aa4227 100644 --- a/src/core/iomgr/sockaddr.h +++ b/src/core/iomgr/sockaddr.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ #include "src/core/iomgr/sockaddr_posix.h" #endif -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/sockaddr_posix.h b/src/core/iomgr/sockaddr_posix.h index 53c80386d43..813c6d462f7 100644 --- a/src/core/iomgr/sockaddr_posix.h +++ b/src/core/iomgr/sockaddr_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ #include #include -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_POSIX_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_POSIX_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/sockaddr_utils.c b/src/core/iomgr/sockaddr_utils.c index f7942417769..5895610fdd2 100644 --- a/src/core/iomgr/sockaddr_utils.c +++ b/src/core/iomgr/sockaddr_utils.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -188,4 +188,4 @@ int grpc_sockaddr_set_port(const struct sockaddr *addr, int port) { __FUNCTION__); return 0; } -} +} \ No newline at end of file diff --git a/src/core/iomgr/sockaddr_utils.h b/src/core/iomgr/sockaddr_utils.h index b49cc50491c..7f885d536bb 100644 --- a/src/core/iomgr/sockaddr_utils.h +++ b/src/core/iomgr/sockaddr_utils.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,4 +84,4 @@ int grpc_sockaddr_set_port(const struct sockaddr *addr, int port); int grpc_sockaddr_to_string(char **out, const struct sockaddr *addr, int normalize); -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_UTILS_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_UTILS_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/iomgr/sockaddr_win32.h index 08be0e54f8e..bed9e84c230 100644 --- a/src/core/iomgr/sockaddr_win32.h +++ b/src/core/iomgr/sockaddr_win32.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ #include #include -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_WIN32_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_WIN32_H_ */ \ No newline at end of file diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c index 1854285b5a4..07ae6b888ca 100644 --- a/src/core/iomgr/socket_utils_common_posix.c +++ b/src/core/iomgr/socket_utils_common_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -192,4 +192,4 @@ int grpc_create_dualstack_socket(const struct sockaddr *addr, int type, return socket(family, type, protocol); } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/socket_utils_linux.c b/src/core/iomgr/socket_utils_linux.c index f3c22187d73..81f3bfc40dc 100644 --- a/src/core/iomgr/socket_utils_linux.c +++ b/src/core/iomgr/socket_utils_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, return accept4(sockfd, addr, addrlen, flags); } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/socket_utils_posix.c b/src/core/iomgr/socket_utils_posix.c index 9184b2a47cf..c68a07758ac 100644 --- a/src/core/iomgr/socket_utils_posix.c +++ b/src/core/iomgr/socket_utils_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,4 +67,4 @@ close_and_error: return -1; } -#endif /* GPR_POSIX_SOCKETUTILS */ +#endif /* GPR_POSIX_SOCKETUTILS */ \ No newline at end of file diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h index a84457f01de..b8d5ca392a9 100644 --- a/src/core/iomgr/socket_utils_posix.h +++ b/src/core/iomgr/socket_utils_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,4 +105,4 @@ extern int grpc_forbid_dualstack_sockets_for_testing; int grpc_create_dualstack_socket(const struct sockaddr *addr, int type, int protocol, grpc_dualstack_mode *dsmode); -#endif /* __GRPC_INTERNAL_IOMGR_SOCKET_UTILS_POSIX_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_SOCKET_UTILS_POSIX_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index 3639798dbcd..8e99f491e2e 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ void grpc_winsocket_orphan(grpc_winsocket *socket) { gpr_free(socket); } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/socket_windows.h b/src/core/iomgr/socket_windows.h index 990b520c6da..282e8122aec 100644 --- a/src/core/iomgr/socket_windows.h +++ b/src/core/iomgr/socket_windows.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,4 +72,4 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket); void grpc_winsocket_shutdown(grpc_winsocket *socket); void grpc_winsocket_orphan(grpc_winsocket *socket); -#endif /* __GRPC_INTERNAL_IOMGR_HANDLE_WINDOWS_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_HANDLE_WINDOWS_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h index ef2c4faf473..7211921ac94 100644 --- a/src/core/iomgr/tcp_client.h +++ b/src/core/iomgr/tcp_client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *tcp), void *arg, const struct sockaddr *addr, int addr_len, gpr_timespec deadline); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index 6dc7997833d..25bb8f1826e 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -234,4 +234,4 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep), grpc_fd_notify_on_write(ac->fd, on_writable, ac); } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index 2ed5f39b390..edbdc744160 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -212,4 +212,4 @@ failure: cb(arg, NULL); } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index a9b59df8854..02227abbf6b 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -544,4 +544,4 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size) { return &tcp->base; } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/tcp_posix.h b/src/core/iomgr/tcp_posix.h index c3eef1b4b73..7cac941f809 100644 --- a/src/core/iomgr/tcp_posix.h +++ b/src/core/iomgr/tcp_posix.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ Takes ownership of fd. */ grpc_endpoint *grpc_tcp_create(grpc_fd *fd, size_t read_slice_size); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_POSIX_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_TCP_POSIX_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 11f9b05663d..2466cafbb00 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,4 +73,4 @@ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index); void grpc_tcp_server_destroy(grpc_tcp_server *server); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index c8df07c9170..659aa1e07b7 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -399,4 +399,4 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollsets, gpr_mu_unlock(&s->mu); } -#endif +#endif \ No newline at end of file diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index e6161eb1e86..cde21bddfe9 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -371,4 +371,4 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset *pollset, gpr_mu_unlock(&s->mu); } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 94d84f92b59..06543cff8d2 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -370,4 +370,4 @@ grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket) { return &tcp->base; } -#endif /* GPR_WINSOCK_SOCKET */ +#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file diff --git a/src/core/iomgr/tcp_windows.h b/src/core/iomgr/tcp_windows.h index cbe60801b49..cb034427858 100644 --- a/src/core/iomgr/tcp_windows.h +++ b/src/core/iomgr/tcp_windows.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket); int grpc_tcp_prepare_socket(SOCKET sock); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_WINDOWS_H__ */ +#endif /* __GRPC_INTERNAL_IOMGR_TCP_WINDOWS_H__ */ \ No newline at end of file diff --git a/src/core/iomgr/time_averaged_stats.c b/src/core/iomgr/time_averaged_stats.c index 7624cd91d3c..b5f8b165a4f 100644 --- a/src/core/iomgr/time_averaged_stats.c +++ b/src/core/iomgr/time_averaged_stats.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ double grpc_time_averaged_stats_update_average( stats->batch_num_samples = 0; stats->batch_total_value = 0; return stats->aggregate_weighted_avg; -} +} \ No newline at end of file diff --git a/src/core/iomgr/time_averaged_stats.h b/src/core/iomgr/time_averaged_stats.h index be75bd14489..423979a06f1 100644 --- a/src/core/iomgr/time_averaged_stats.h +++ b/src/core/iomgr/time_averaged_stats.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,4 +85,4 @@ void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats *stats, value. */ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats *stats); -#endif /* __GRPC_INTERNAL_IOMGR_TIME_AVERAGED_STATS_H_ */ +#endif /* __GRPC_INTERNAL_IOMGR_TIME_AVERAGED_STATS_H_ */ \ No newline at end of file diff --git a/src/core/json/json.c b/src/core/json/json.c index 1cff4fa1951..5b7e02ebde9 100644 --- a/src/core/json/json.c +++ b/src/core/json/json.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ void grpc_json_destroy(grpc_json *json) { } gpr_free(json); -} +} \ No newline at end of file diff --git a/src/core/json/json.h b/src/core/json/json.h index 6676744ff7e..78afa4c48c3 100644 --- a/src/core/json/json.h +++ b/src/core/json/json.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,4 +85,4 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent); grpc_json* grpc_json_create(grpc_json_type type); void grpc_json_destroy(grpc_json* json); -#endif /* __GRPC_SRC_CORE_JSON_JSON_H__ */ +#endif /* __GRPC_SRC_CORE_JSON_JSON_H__ */ \ No newline at end of file diff --git a/src/core/json/json_common.h b/src/core/json/json_common.h index 88a8155a42f..ab7627bdbdc 100644 --- a/src/core/json/json_common.h +++ b/src/core/json/json_common.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ typedef enum { GRPC_JSON_TOP_LEVEL } grpc_json_type; -#endif /* __GRPC_SRC_CORE_JSON_JSON_COMMON_H__ */ +#endif /* __GRPC_SRC_CORE_JSON_JSON_COMMON_H__ */ \ No newline at end of file diff --git a/src/core/json/json_reader.c b/src/core/json/json_reader.c index 75aa87eb03c..0e7a61bf2a5 100644 --- a/src/core/json/json_reader.c +++ b/src/core/json/json_reader.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -650,4 +650,4 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) { } return GRPC_JSON_INTERNAL_ERROR; -} +} \ No newline at end of file diff --git a/src/core/json/json_reader.h b/src/core/json/json_reader.h index 388ee3633fb..9c2b8e5c55e 100644 --- a/src/core/json/json_reader.h +++ b/src/core/json/json_reader.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -157,4 +157,4 @@ void grpc_json_reader_init(grpc_json_reader* reader, */ int grpc_json_reader_is_complete(grpc_json_reader* reader); -#endif /* __GRPC_SRC_CORE_JSON_JSON_READER_H__ */ +#endif /* __GRPC_SRC_CORE_JSON_JSON_READER_H__ */ \ No newline at end of file diff --git a/src/core/json/json_string.c b/src/core/json/json_string.c index d29e9e30e82..91ae99aa478 100644 --- a/src/core/json/json_string.c +++ b/src/core/json/json_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -388,4 +388,4 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent) { json_writer_output_char(&state, 0); return state.output; -} +} \ No newline at end of file diff --git a/src/core/json/json_writer.c b/src/core/json/json_writer.c index 5605694fde5..2e037e2ad3d 100644 --- a/src/core/json/json_writer.c +++ b/src/core/json/json_writer.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -249,4 +249,4 @@ void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string) json_writer_output_indent(writer); json_writer_escape_string(writer, string); writer->got_key = 0; -} +} \ No newline at end of file diff --git a/src/core/json/json_writer.h b/src/core/json/json_writer.h index 05684015901..d63add50199 100644 --- a/src/core/json/json_writer.h +++ b/src/core/json/json_writer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,4 +90,4 @@ void grpc_json_writer_value_raw_with_len(grpc_json_writer* writer, const char* s /* Sets a string value. It'll be escaped, and utf-8 validated. */ void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string); -#endif /* __GRPC_SRC_CORE_JSON_JSON_WRITER_H__ */ +#endif /* __GRPC_SRC_CORE_JSON_JSON_WRITER_H__ */ \ No newline at end of file diff --git a/src/core/security/auth.c b/src/core/security/auth.c index 18c32f90f40..2126a2afee8 100644 --- a/src/core/security/auth.c +++ b/src/core/security/auth.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -251,4 +251,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_client_auth_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "auth"}; + init_channel_elem, destroy_channel_elem, "auth"}; \ No newline at end of file diff --git a/src/core/security/auth.h b/src/core/security/auth.h index 94fa2aba7db..6e2afcbfc31 100644 --- a/src/core/security/auth.h +++ b/src/core/security/auth.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ extern const grpc_channel_filter grpc_client_auth_filter; -#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */ +#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */ \ No newline at end of file diff --git a/src/core/security/base64.c b/src/core/security/base64.c index 63467944dde..f418a2a1678 100644 --- a/src/core/security/base64.c +++ b/src/core/security/base64.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -195,4 +195,4 @@ gpr_slice grpc_base64_decode(const char *b64, int url_safe) { fail: gpr_slice_unref(result); return gpr_empty_slice(); -} +} \ No newline at end of file diff --git a/src/core/security/base64.h b/src/core/security/base64.h index 7bfb89b0715..77c7ecec1c4 100644 --- a/src/core/security/base64.h +++ b/src/core/security/base64.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ char *grpc_base64_encode(const void *data, size_t data_size, int url_safe, slice in case of failure. */ gpr_slice grpc_base64_decode(const char *b64, int url_safe); -#endif /* __GRPC_INTERNAL_SECURITY_BASE64_H_ */ +#endif /* __GRPC_INTERNAL_SECURITY_BASE64_H_ */ \ No newline at end of file diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 6f0d72c0c3d..49ccd070df3 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -943,4 +943,4 @@ grpc_credentials *grpc_iam_credentials_create(const char *token, /* -- Default credentials TODO(jboeuf). -- */ -grpc_credentials *grpc_default_credentials_create(void) { return NULL; } +grpc_credentials *grpc_default_credentials_create(void) { return NULL; } \ No newline at end of file diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h index 3ec874681a7..a0ec11a85b6 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -150,4 +150,4 @@ typedef struct { const grpc_ssl_server_config *grpc_ssl_server_credentials_get_config( const grpc_server_credentials *ssl_creds); -#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */ +#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */ \ No newline at end of file diff --git a/src/core/security/factories.c b/src/core/security/factories.c index d89c692989c..3843aff6fc3 100644 --- a/src/core/security/factories.c +++ b/src/core/security/factories.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ grpc_server *grpc_secure_server_create(grpc_server_credentials *creds, server = grpc_secure_server_create_internal(cq, args, ctx); grpc_security_context_unref(ctx); return server; -} +} \ No newline at end of file diff --git a/src/core/security/google_root_certs.c b/src/core/security/google_root_certs.c index 669d637ddfa..9944e8d891b 100644 --- a/src/core/security/google_root_certs.c +++ b/src/core/security/google_root_certs.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11274,4 +11274,4 @@ unsigned char grpc_google_root_certs[] = { 0x64, 0x64, 0x49, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a}; -unsigned int grpc_google_root_certs_size = 134862; +unsigned int grpc_google_root_certs_size = 134862; \ No newline at end of file diff --git a/src/core/security/google_root_certs.h b/src/core/security/google_root_certs.h index 30ed16c03bc..20353a00c3c 100644 --- a/src/core/security/google_root_certs.h +++ b/src/core/security/google_root_certs.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,4 +37,4 @@ extern unsigned char grpc_google_root_certs[]; extern unsigned int grpc_google_root_certs_size; -#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */ +#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */ \ No newline at end of file diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index 8e48686288f..3bba57b574c 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -321,4 +321,4 @@ char *grpc_jwt_encode_and_sign(const grpc_auth_json_key *json_key, void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func) { g_jwt_encode_and_sign_override = func; -} +} \ No newline at end of file diff --git a/src/core/security/json_token.h b/src/core/security/json_token.h index 3ef9f1bfc0b..9256d028a61 100644 --- a/src/core/security/json_token.h +++ b/src/core/security/json_token.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ typedef char *(*grpc_jwt_encode_and_sign_override)( void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func); -#endif /* __GRPC_INTERNAL_SECURITY_JSON_TOKEN_H_ */ +#endif /* __GRPC_INTERNAL_SECURITY_JSON_TOKEN_H_ */ \ No newline at end of file diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index 31138d694f1..137edf378f7 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -356,4 +356,4 @@ grpc_endpoint *grpc_secure_endpoint_create( gpr_mu_init(&ep->protector_mu); gpr_ref_init(&ep->ref, 1); return &ep->base; -} +} \ No newline at end of file diff --git a/src/core/security/secure_endpoint.h b/src/core/security/secure_endpoint.h index 20143150e07..a98deba8d8f 100644 --- a/src/core/security/secure_endpoint.h +++ b/src/core/security/secure_endpoint.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ grpc_endpoint *grpc_secure_endpoint_create( struct tsi_frame_protector *protector, grpc_endpoint *to_wrap, gpr_slice *leftover_slices, size_t leftover_nslices); -#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */ +#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */ \ No newline at end of file diff --git a/src/core/security/secure_transport_setup.c b/src/core/security/secure_transport_setup.c index 59789a7e4de..d227ace2af9 100644 --- a/src/core/security/secure_transport_setup.c +++ b/src/core/security/secure_transport_setup.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -283,4 +283,4 @@ void grpc_setup_secure_transport(grpc_security_context *ctx, s->cb = cb; gpr_slice_buffer_init(&s->left_overs); send_handshake_bytes_to_peer(s); -} +} \ No newline at end of file diff --git a/src/core/security/secure_transport_setup.h b/src/core/security/secure_transport_setup.h index b13d065fbff..a5882f3e026 100644 --- a/src/core/security/secure_transport_setup.h +++ b/src/core/security/secure_transport_setup.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ void grpc_setup_secure_transport(grpc_security_context *ctx, grpc_secure_transport_setup_done_cb cb, void *user_data); -#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */ +#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */ \ No newline at end of file diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index 1909617614d..37b36c167ec 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -630,4 +630,4 @@ grpc_channel *grpc_default_secure_channel_create( const char *target, const grpc_channel_args *args) { return grpc_secure_channel_create(grpc_default_credentials_create(), target, args); -} +} \ No newline at end of file diff --git a/src/core/security/security_context.h b/src/core/security/security_context.h index 25d467d7171..5e9f943f606 100644 --- a/src/core/security/security_context.h +++ b/src/core/security/security_context.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -204,4 +204,4 @@ grpc_server *grpc_secure_server_create_internal(grpc_completion_queue *cq, const grpc_channel_args *args, grpc_security_context *ctx); -#endif /* __GRPC_INTERNAL_SECURITY_SECURITY_CONTEXT_H__ */ +#endif /* __GRPC_INTERNAL_SECURITY_SECURITY_CONTEXT_H__ */ \ No newline at end of file diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index 19056ba23e8..edad78152e8 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,4 +146,4 @@ error: grpc_tcp_server_destroy(tcp); } return 0; -} +} \ No newline at end of file diff --git a/src/core/statistics/census_init.c b/src/core/statistics/census_init.c index cbf2089f3fa..c81aa1524a0 100644 --- a/src/core/statistics/census_init.c +++ b/src/core/statistics/census_init.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ void census_shutdown(void) { gpr_log(GPR_INFO, "Shutdown census library."); census_stats_store_shutdown(); census_tracing_shutdown(); -} +} \ No newline at end of file diff --git a/src/core/statistics/census_interface.h b/src/core/statistics/census_interface.h index 8e586382f78..756e4727417 100644 --- a/src/core/statistics/census_interface.h +++ b/src/core/statistics/census_interface.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,4 +73,4 @@ census_op_id census_tracing_start_op(void); /* Ends tracing. Calling this function will invalidate the input op_id. */ void census_tracing_end_op(census_op_id op_id); -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */ +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */ \ No newline at end of file diff --git a/src/core/statistics/census_log.c b/src/core/statistics/census_log.c index 1504c027deb..6633b044e0c 100644 --- a/src/core/statistics/census_log.c +++ b/src/core/statistics/census_log.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -601,4 +601,4 @@ size_t census_log_remaining_space(void) { int census_log_out_of_space_count(void) { GPR_ASSERT(g_log.initialized); return gpr_atm_acq_load(&g_log.out_of_space_count); -} +} \ No newline at end of file diff --git a/src/core/statistics/census_log.h b/src/core/statistics/census_log.h index 0d89df79929..e1aaa05f7f1 100644 --- a/src/core/statistics/census_log.h +++ b/src/core/statistics/census_log.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,4 +88,4 @@ size_t census_log_remaining_space(void); out-of-space. */ int census_log_out_of_space_count(void); -#endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */ +#endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */ \ No newline at end of file diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c index fc66cb951fe..957f20d0666 100644 --- a/src/core/statistics/census_rpc_stats.c +++ b/src/core/statistics/census_rpc_stats.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -251,4 +251,4 @@ void census_stats_store_shutdown(void) { gpr_log(GPR_ERROR, "Census client stats store not initialized."); } gpr_mu_unlock(&g_mu); -} +} \ No newline at end of file diff --git a/src/core/statistics/census_rpc_stats.h b/src/core/statistics/census_rpc_stats.h index 81466907fdc..9c7f3219847 100644 --- a/src/core/statistics/census_rpc_stats.h +++ b/src/core/statistics/census_rpc_stats.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,4 +98,4 @@ void census_stats_store_shutdown(void); } #endif -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */ +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */ \ No newline at end of file diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c index 8b98323e64c..8612d2cf7d9 100644 --- a/src/core/statistics/census_tracing.c +++ b/src/core/statistics/census_tracing.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -236,4 +236,4 @@ census_trace_obj** census_get_active_ops(int* num_active_ops) { } gpr_mu_unlock(&g_mu); return ret; -} +} \ No newline at end of file diff --git a/src/core/statistics/census_tracing.h b/src/core/statistics/census_tracing.h index 88a06a4a524..173e82c3c97 100644 --- a/src/core/statistics/census_tracing.h +++ b/src/core/statistics/census_tracing.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,4 +93,4 @@ census_trace_obj** census_get_active_ops(int* num_active_ops); } #endif -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_TRACING_H_ */ +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_TRACING_H_ */ \ No newline at end of file diff --git a/src/core/statistics/hash_table.c b/src/core/statistics/hash_table.c index 1f7c242c72e..0afb12c368c 100644 --- a/src/core/statistics/hash_table.c +++ b/src/core/statistics/hash_table.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -300,4 +300,4 @@ void census_ht_destroy(census_ht* ht) { gpr_free(ht); } -size_t census_ht_get_size(const census_ht* ht) { return ht->size; } +size_t census_ht_get_size(const census_ht* ht) { return ht->size; } \ No newline at end of file diff --git a/src/core/statistics/hash_table.h b/src/core/statistics/hash_table.h index 5c9a3fa0b48..c7f592c813a 100644 --- a/src/core/statistics/hash_table.h +++ b/src/core/statistics/hash_table.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,4 +128,4 @@ typedef void (*census_ht_itr_cb)(census_ht_key key, const void* val_ptr, should not invalidate data entries. */ gpr_uint64 census_ht_for_all(const census_ht* ht, census_ht_itr_cb); -#endif /* __GRPC_INTERNAL_STATISTICS_HASH_TABLE_H_ */ +#endif /* __GRPC_INTERNAL_STATISTICS_HASH_TABLE_H_ */ \ No newline at end of file diff --git a/src/core/statistics/window_stats.c b/src/core/statistics/window_stats.c index 42ff02071ba..f84b9316026 100644 --- a/src/core/statistics/window_stats.c +++ b/src/core/statistics/window_stats.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -314,4 +314,4 @@ void census_window_stats_destroy(window_stats* wstats) { /* Ensure any use-after free triggers assert. */ wstats->interval_stats = NULL; gpr_free(wstats); -} +} \ No newline at end of file diff --git a/src/core/statistics/window_stats.h b/src/core/statistics/window_stats.h index 677f40031ef..1fd711939f0 100644 --- a/src/core/statistics/window_stats.h +++ b/src/core/statistics/window_stats.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -170,4 +170,4 @@ void census_window_stats_get_sums(const struct census_window_stats* wstats, assertion failure). This function is thread-compatible. */ void census_window_stats_destroy(struct census_window_stats* wstats); -#endif /* __GRPC_INTERNAL_STATISTICS_WINDOW_STATS_H_ */ +#endif /* __GRPC_INTERNAL_STATISTICS_WINDOW_STATS_H_ */ \ No newline at end of file diff --git a/src/core/support/alloc.c b/src/core/support/alloc.c index ddf67897732..9ce78c64730 100644 --- a/src/core/support/alloc.c +++ b/src/core/support/alloc.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,4 +62,4 @@ void *gpr_malloc_aligned(size_t size, size_t alignment) { return (void *)ret; } -void gpr_free_aligned(void *ptr) { free(((void **)ptr)[-1]); } +void gpr_free_aligned(void *ptr) { free(((void **)ptr)[-1]); } \ No newline at end of file diff --git a/src/core/support/cancellable.c b/src/core/support/cancellable.c index 5596413fba3..b632a3c2fdb 100644 --- a/src/core/support/cancellable.c +++ b/src/core/support/cancellable.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -153,4 +153,4 @@ int gpr_cv_cancellable_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline, } gpr_mu_unlock(&c->mu); return timeout; -} +} \ No newline at end of file diff --git a/src/core/support/cmdline.c b/src/core/support/cmdline.c index a55da9dd188..d2f8d3810ec 100644 --- a/src/core/support/cmdline.c +++ b/src/core/support/cmdline.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -289,4 +289,4 @@ void gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv) { for (i = 1; i < argc; i++) { cl->state(cl, argv[i]); } -} +} \ No newline at end of file diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c index c8375e65b62..397fd9d68a6 100644 --- a/src/core/support/cpu_linux.c +++ b/src/core/support/cpu_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,4 +70,4 @@ unsigned gpr_cpu_current_cpu(void) { return cpu; } -#endif /* GPR_CPU_LINUX */ +#endif /* GPR_CPU_LINUX */ \ No newline at end of file diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c index 68e8cb9b12f..19c032bdc0e 100644 --- a/src/core/support/cpu_posix.c +++ b/src/core/support/cpu_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,4 +71,4 @@ unsigned gpr_cpu_current_cpu(void) { return shard_ptr(&magic_thread_local); } -#endif /* GPR_CPU_LINUX */ +#endif /* GPR_CPU_LINUX */ \ No newline at end of file diff --git a/src/core/support/env.h b/src/core/support/env.h index 81dda7d838a..35ef565a24b 100644 --- a/src/core/support/env.h +++ b/src/core/support/env.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ void gpr_setenv(const char *name, const char *value); } #endif -#endif /* __GRPC_SUPPORT_ENV_H__ */ +#endif /* __GRPC_SUPPORT_ENV_H__ */ \ No newline at end of file diff --git a/src/core/support/env_linux.c b/src/core/support/env_linux.c index 28e3d1450f9..ffd79280404 100644 --- a/src/core/support/env_linux.c +++ b/src/core/support/env_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_LINUX_ENV */ +#endif /* GPR_LINUX_ENV */ \ No newline at end of file diff --git a/src/core/support/env_posix.c b/src/core/support/env_posix.c index bcbff9a1770..4cc71b31523 100644 --- a/src/core/support/env_posix.c +++ b/src/core/support/env_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_POSIX_ENV */ +#endif /* GPR_POSIX_ENV */ \ No newline at end of file diff --git a/src/core/support/env_win32.c b/src/core/support/env_win32.c index 3159c20f7d7..f35fab25abe 100644 --- a/src/core/support/env_win32.c +++ b/src/core/support/env_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/file.c b/src/core/support/file.c index c0bb1b66a06..dfe31102821 100644 --- a/src/core/support/file.c +++ b/src/core/support/file.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,4 +86,4 @@ end: } if (file != NULL) fclose(file); return result; -} +} \ No newline at end of file diff --git a/src/core/support/file.h b/src/core/support/file.h index 92f420e7ceb..2bb5418c17b 100644 --- a/src/core/support/file.h +++ b/src/core/support/file.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename); } #endif -#endif /* __GRPC_SUPPORT_FILE_H__ */ +#endif /* __GRPC_SUPPORT_FILE_H__ */ \ No newline at end of file diff --git a/src/core/support/file_posix.c b/src/core/support/file_posix.c index e1765666dbe..612a101d3d0 100644 --- a/src/core/support/file_posix.c +++ b/src/core/support/file_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,4 +81,4 @@ end: return result; } -#endif /* GPR_POSIX_FILE */ +#endif /* GPR_POSIX_FILE */ \ No newline at end of file diff --git a/src/core/support/file_win32.c b/src/core/support/file_win32.c index 7749d4553f7..d36a3af203e 100644 --- a/src/core/support/file_win32.c +++ b/src/core/support/file_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,4 +80,4 @@ end: return result; } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/histogram.c b/src/core/support/histogram.c index cd360c5a225..47f763f3866 100644 --- a/src/core/support/histogram.c +++ b/src/core/support/histogram.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,4 +221,4 @@ double gpr_histogram_sum(gpr_histogram *h) { return h->sum; } double gpr_histogram_sum_of_squares(gpr_histogram *h) { return h->sum_of_squares; -} +} \ No newline at end of file diff --git a/src/core/support/host_port.c b/src/core/support/host_port.c index 446c11ebec3..c0e7636518a 100644 --- a/src/core/support/host_port.c +++ b/src/core/support/host_port.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ int gpr_join_host_port(char **out, const char *host, int port) { /* Ordinary non-bracketed host:port. */ return gpr_asprintf(out, "%s:%d", host, port); } -} +} \ No newline at end of file diff --git a/src/core/support/log.c b/src/core/support/log.c index 7f102efea82..d1b14bbfdbc 100644 --- a/src/core/support/log.c +++ b/src/core/support/log.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,4 +62,4 @@ void gpr_log_message(const char *file, int line, gpr_log_severity severity, g_log_func(&lfargs); } -void gpr_set_log_function(gpr_log_func f) { g_log_func = f; } +void gpr_set_log_function(gpr_log_func f) { g_log_func = f; } \ No newline at end of file diff --git a/src/core/support/log_android.c b/src/core/support/log_android.c index 53c8153593a..c2fcd469058 100644 --- a/src/core/support/log_android.c +++ b/src/core/support/log_android.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,4 +84,4 @@ void gpr_default_log(gpr_log_func_args *args) { free(output); } -#endif /* GPR_ANDROID */ +#endif /* GPR_ANDROID */ \ No newline at end of file diff --git a/src/core/support/log_linux.c b/src/core/support/log_linux.c index a64faa98bd9..72086d514d9 100644 --- a/src/core/support/log_linux.c +++ b/src/core/support/log_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,4 +95,4 @@ void gpr_default_log(gpr_log_func_args *args) { args->message); } -#endif +#endif \ No newline at end of file diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c index 36479baeed2..40c75989f10 100644 --- a/src/core/support/log_posix.c +++ b/src/core/support/log_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,4 +97,4 @@ void gpr_default_log(gpr_log_func_args *args) { args->message); } -#endif /* defined(GPR_POSIX_LOG) */ +#endif /* defined(GPR_POSIX_LOG) */ \ No newline at end of file diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c index 840f24f68aa..39ce5c652ab 100644 --- a/src/core/support/log_win32.c +++ b/src/core/support/log_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -110,4 +110,4 @@ char *gpr_format_message(DWORD messageid) { return message; } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/murmur_hash.c b/src/core/support/murmur_hash.c index 892e360968f..ef7ff7a9afc 100644 --- a/src/core/support/murmur_hash.c +++ b/src/core/support/murmur_hash.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,4 +93,4 @@ gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed) { h1 ^= len; FMIX32(h1); return h1; -} +} \ No newline at end of file diff --git a/src/core/support/murmur_hash.h b/src/core/support/murmur_hash.h index 2ebf3e57b1f..2609ccd4e68 100644 --- a/src/core/support/murmur_hash.h +++ b/src/core/support/murmur_hash.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ /* compute the hash of key (length len) */ gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed); -#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */ +#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */ \ No newline at end of file diff --git a/src/core/support/slice.c b/src/core/support/slice.c index 836a5a6c2a7..de26136f854 100644 --- a/src/core/support/slice.c +++ b/src/core/support/slice.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -322,4 +322,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b) { int d = GPR_SLICE_LENGTH(a) - b_length; if (d != 0) return d; return memcmp(GPR_SLICE_START_PTR(a), b, b_length); -} +} \ No newline at end of file diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index 22bda966597..2560c0ffa6e 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,4 +152,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) { sb->count = 0; sb->length = 0; -} +} \ No newline at end of file diff --git a/src/core/support/string.c b/src/core/support/string.c index 97bce60f94c..634c4ddcafa 100644 --- a/src/core/support/string.c +++ b/src/core/support/string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * 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 + * 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 @@ -197,4 +197,4 @@ void gpr_strvec_add(gpr_strvec *sv, char *str) { char *gpr_strvec_flatten(gpr_strvec *sv, size_t *final_length) { return gpr_strjoin((const char**)sv->strs, sv->count, final_length); -} +} \ No newline at end of file diff --git a/src/core/support/string.h b/src/core/support/string.h index 64e06d3b6aa..19cf8a0f6f8 100644 --- a/src/core/support/string.h +++ b/src/core/support/string.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,4 +106,4 @@ char *gpr_strvec_flatten(gpr_strvec *strs, size_t *total_length); } #endif -#endif /* __GRPC_SUPPORT_STRING_H__ */ +#endif /* __GRPC_SUPPORT_STRING_H__ */ \ No newline at end of file diff --git a/src/core/support/string_posix.c b/src/core/support/string_posix.c index b6f0cd4af0c..32f1137dfe4 100644 --- a/src/core/support/string_posix.c +++ b/src/core/support/string_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,4 +83,4 @@ int gpr_asprintf(char **strp, const char *format, ...) { return -1; } -#endif /* GPR_POSIX_STRING */ +#endif /* GPR_POSIX_STRING */ \ No newline at end of file diff --git a/src/core/support/string_win32.c b/src/core/support/string_win32.c index 02e1c74d9ce..b853f25880d 100644 --- a/src/core/support/string_win32.c +++ b/src/core/support/string_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,4 +107,4 @@ char *gpr_char_to_tchar(LPTSTR input) { } #endif -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/string_win32.h b/src/core/support/string_win32.h index 9102d982569..ab3fe87fb4f 100644 --- a/src/core/support/string_win32.h +++ b/src/core/support/string_win32.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ LPSTR gpr_tchar_to_char(LPCTSTR input); #endif /* GPR_WIN32 */ -#endif /* __GRPC_SUPPORT_STRING_WIN32_H__ */ +#endif /* __GRPC_SUPPORT_STRING_WIN32_H__ */ \ No newline at end of file diff --git a/src/core/support/sync.c b/src/core/support/sync.c index 40e5465e5db..6d8119769de 100644 --- a/src/core/support/sync.c +++ b/src/core/support/sync.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,4 +132,4 @@ void gpr_stats_inc(gpr_stats_counter *c, gpr_intptr inc) { gpr_intptr gpr_stats_read(const gpr_stats_counter *c) { /* don't need acquire-load, but we have no no-barrier load yet */ return gpr_atm_acq_load(&c->value); -} +} \ No newline at end of file diff --git a/src/core/support/sync_posix.c b/src/core/support/sync_posix.c index 94fc1b0bec3..9a9a5ed7d63 100644 --- a/src/core/support/sync_posix.c +++ b/src/core/support/sync_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,4 +87,4 @@ void gpr_once_init(gpr_once *once, void (*init_function)(void)) { GPR_ASSERT(pthread_once(once, init_function) == 0); } -#endif /* GRP_POSIX_SYNC */ +#endif /* GRP_POSIX_SYNC */ \ No newline at end of file diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c index 8df26bccb9b..a00df07b988 100644 --- a/src/core/support/sync_win32.c +++ b/src/core/support/sync_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -126,4 +126,4 @@ void gpr_once_init(gpr_once *once, void (*init_function)(void)) { InitOnceExecuteOnce(once, run_once_func, &arg, &dummy); } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/thd_internal.h b/src/core/support/thd_internal.h index 190d4e36681..4358692a973 100644 --- a/src/core/support/thd_internal.h +++ b/src/core/support/thd_internal.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,4 +36,4 @@ /* Internal interfaces between modules within the gpr support library. */ -#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */ +#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */ \ No newline at end of file diff --git a/src/core/support/thd_posix.c b/src/core/support/thd_posix.c index 74ca9424bbc..ad015a88f9d 100644 --- a/src/core/support/thd_posix.c +++ b/src/core/support/thd_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,4 +88,4 @@ gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)pthread_self(); } -#endif /* GPR_POSIX_SYNC */ +#endif /* GPR_POSIX_SYNC */ \ No newline at end of file diff --git a/src/core/support/thd_win32.c b/src/core/support/thd_win32.c index 2ee14170484..e50086c51ff 100644 --- a/src/core/support/thd_win32.c +++ b/src/core/support/thd_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -83,4 +83,4 @@ gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)GetCurrentThreadId(); } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/support/time.c b/src/core/support/time.c index 268a43c6775..bb67c7e836b 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -251,4 +251,4 @@ gpr_int32 gpr_time_to_millis(gpr_timespec t) { double gpr_timespec_to_micros(gpr_timespec t) { return t.tv_sec * GPR_US_PER_SEC + t.tv_nsec * 1e-3; -} +} \ No newline at end of file diff --git a/src/core/support/time_posix.c b/src/core/support/time_posix.c index 4af537d974b..314daa8ac0e 100644 --- a/src/core/support/time_posix.c +++ b/src/core/support/time_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,4 +96,4 @@ void gpr_sleep_until(gpr_timespec until) { } } -#endif /* GPR_POSIX_TIME */ +#endif /* GPR_POSIX_TIME */ \ No newline at end of file diff --git a/src/core/support/time_win32.c b/src/core/support/time_win32.c index b9fe5123350..5ee69cbb961 100644 --- a/src/core/support/time_win32.c +++ b/src/core/support/time_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ gpr_timespec gpr_now(void) { return now_tv; } -#endif /* GPR_WIN32 */ +#endif /* GPR_WIN32 */ \ No newline at end of file diff --git a/src/core/surface/byte_buffer.c b/src/core/surface/byte_buffer.c index 09e2aa5b872..7466009b8c0 100644 --- a/src/core/surface/byte_buffer.c +++ b/src/core/surface/byte_buffer.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) { } gpr_log(GPR_ERROR, "should never reach here"); abort(); -} +} \ No newline at end of file diff --git a/src/core/surface/byte_buffer_queue.c b/src/core/surface/byte_buffer_queue.c index aab7fd2ffea..1541a4b3b9f 100644 --- a/src/core/surface/byte_buffer_queue.c +++ b/src/core/surface/byte_buffer_queue.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,4 +88,4 @@ grpc_byte_buffer *grpc_bbq_pop(grpc_byte_buffer_queue *q) { } return q->draining.data[q->drain_pos++]; -} +} \ No newline at end of file diff --git a/src/core/surface/byte_buffer_queue.h b/src/core/surface/byte_buffer_queue.h index 3420dc5caba..f3f58b698d8 100644 --- a/src/core/surface/byte_buffer_queue.h +++ b/src/core/surface/byte_buffer_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ void grpc_bbq_flush(grpc_byte_buffer_queue *q); int grpc_bbq_empty(grpc_byte_buffer_queue *q); void grpc_bbq_push(grpc_byte_buffer_queue *q, grpc_byte_buffer *bb); -#endif /* __GRPC_INTERNAL_SURFACE_BYTE_BUFFER_QUEUE_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_BYTE_BUFFER_QUEUE_H__ */ \ No newline at end of file diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 18500b83e8d..7582cb610ef 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,4 +71,4 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) { free(reader); -} +} \ No newline at end of file diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 743ef0c65b2..a08a8b89050 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1401,4 +1401,4 @@ grpc_call_error grpc_call_start_write_status_old(grpc_call *call, unlock(call); return err; -} +} \ No newline at end of file diff --git a/src/core/surface/call.h b/src/core/surface/call.h index 55e434433d3..270b14f486a 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -119,4 +119,4 @@ grpc_call_stack *grpc_call_get_call_stack(grpc_call *call); /* Given the top call_element, get the call object. */ grpc_call *grpc_call_from_top_element(grpc_call_element *surface_element); -#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */ \ No newline at end of file diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index fef1c7d3948..9dc28549691 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -193,4 +193,4 @@ grpc_mdstr *grpc_channel_get_status_string(grpc_channel *channel) { grpc_mdstr *grpc_channel_get_message_string(grpc_channel *channel) { return channel->grpc_message_string; -} +} \ No newline at end of file diff --git a/src/core/surface/channel.h b/src/core/surface/channel.h index ff9bbc237ef..0e6276ab585 100644 --- a/src/core/surface/channel.h +++ b/src/core/surface/channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ void grpc_client_channel_closed(grpc_channel_element *elem); void grpc_channel_internal_ref(grpc_channel *channel); void grpc_channel_internal_unref(grpc_channel *channel); -#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */ \ No newline at end of file diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c index d3faf0c996a..85464d56f99 100644 --- a/src/core/surface/channel_create.c +++ b/src/core/surface/channel_create.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -209,4 +209,4 @@ grpc_channel *grpc_channel_create(const char *target, s); return channel; -} +} \ No newline at end of file diff --git a/src/core/surface/client.c b/src/core/surface/client.c index 64ee9d51e80..7a63b518fa3 100644 --- a/src/core/surface/client.c +++ b/src/core/surface/client.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,4 +116,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) {} const grpc_channel_filter grpc_client_surface_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "client", }; + init_channel_elem, destroy_channel_elem, "client", }; \ No newline at end of file diff --git a/src/core/surface/client.h b/src/core/surface/client.h index cff3d401d92..8763441acd6 100644 --- a/src/core/surface/client.h +++ b/src/core/surface/client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ extern const grpc_channel_filter grpc_client_surface_filter; -#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */ \ No newline at end of file diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index 8b94aa920af..f8538bf44f5 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -421,4 +421,4 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc) { grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { return &cc->pollset; -} +} \ No newline at end of file diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h index 205cb76cee8..d5f24822785 100644 --- a/src/core/surface/completion_queue.h +++ b/src/core/surface/completion_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,4 +114,4 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc); grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc); -#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */ \ No newline at end of file diff --git a/src/core/surface/event_string.c b/src/core/surface/event_string.c index ab9435351e1..8a3be6ced55 100644 --- a/src/core/surface/event_string.c +++ b/src/core/surface/event_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -134,4 +134,4 @@ char *grpc_event_string(grpc_event *ev) { out = gpr_strvec_flatten(&buf, NULL); gpr_strvec_destroy(&buf); return out; -} +} \ No newline at end of file diff --git a/src/core/surface/event_string.h b/src/core/surface/event_string.h index b34e2d152b5..56c32e6037f 100644 --- a/src/core/surface/event_string.h +++ b/src/core/surface/event_string.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,4 +39,4 @@ /* Returns a string describing an event. Must be later freed with gpr_free() */ char *grpc_event_string(grpc_event *ev); -#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */ \ No newline at end of file diff --git a/src/core/surface/init.c b/src/core/surface/init.c index 4d639fcbce2..43c9906a8a4 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,3 @@ void grpc_shutdown(void) { } gpr_mu_unlock(&g_init_mu); } - diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index a8fdeed87f9..c91936fe4a2 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,4 +122,4 @@ grpc_channel *grpc_lame_client_channel_create(void) { static const grpc_channel_filter *filters[] = {&lame_filter}; return grpc_channel_create_from_filters(filters, 1, NULL, grpc_mdctx_create(), 1); -} +} \ No newline at end of file diff --git a/src/core/surface/lame_client.h b/src/core/surface/lame_client.h index 3cfbf7b954f..dae939586da 100644 --- a/src/core/surface/lame_client.h +++ b/src/core/surface/lame_client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,4 +39,4 @@ /* Create a lame client: this client fails every operation attempted on it. */ grpc_channel *grpc_lame_client_channel_create(void); -#endif /* __GRPC_INTERNAL_SURFACE_LAME_CLIENT_H_ */ +#endif /* __GRPC_INTERNAL_SURFACE_LAME_CLIENT_H_ */ \ No newline at end of file diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index 562e27ff6d4..14090883eb5 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -237,4 +237,4 @@ grpc_channel *grpc_secure_channel_create_internal( args, mdctx, initiate_setup, done_setup, s); return channel; -} +} \ No newline at end of file diff --git a/src/core/surface/secure_server_create.c b/src/core/surface/secure_server_create.c index bf0f62367fc..5c402b05969 100644 --- a/src/core/surface/secure_server_create.c +++ b/src/core/surface/secure_server_create.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ grpc_server *grpc_secure_server_create_internal( server = grpc_server_create_from_filters(cq, NULL, 0, args_copy); grpc_channel_args_destroy(args_copy); return server; -} +} \ No newline at end of file diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 7297a2a12dc..c90e27008c6 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1124,4 +1124,4 @@ static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { return server->channel_args; -} +} \ No newline at end of file diff --git a/src/core/surface/server.h b/src/core/surface/server.h index c8861f420d8..fd9761bb396 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,4 +60,4 @@ grpc_transport_setup_result grpc_server_setup_transport( const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server); -#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */ \ No newline at end of file diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index 3b6abb7d032..c18fc90aa14 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,4 +127,4 @@ error: grpc_tcp_server_destroy(tcp); } return 0; -} +} \ No newline at end of file diff --git a/src/core/surface/server_create.c b/src/core/surface/server_create.c index dcc6ce1ccc8..af427ac19d6 100644 --- a/src/core/surface/server_create.c +++ b/src/core/surface/server_create.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args) { return grpc_server_create_from_filters(cq, NULL, 0, args); -} +} \ No newline at end of file diff --git a/src/core/surface/surface_trace.h b/src/core/surface/surface_trace.h index df1aea9669e..e65c05f3965 100644 --- a/src/core/surface/surface_trace.h +++ b/src/core/surface/surface_trace.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ } while (0) #endif -#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */ +#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/alpn.c b/src/core/transport/chttp2/alpn.c index bc4e789f60c..d436b655846 100644 --- a/src/core/transport/chttp2/alpn.c +++ b/src/core/transport/chttp2/alpn.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ size_t grpc_chttp2_num_alpn_versions(void) { const char *grpc_chttp2_get_alpn_version_index(size_t i) { GPR_ASSERT(i < GPR_ARRAY_SIZE(supported_versions)); return supported_versions[i]; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/alpn.h b/src/core/transport/chttp2/alpn.h index cb96f17831f..b7b5f4fe0c4 100644 --- a/src/core/transport/chttp2/alpn.h +++ b/src/core/transport/chttp2/alpn.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ size_t grpc_chttp2_num_alpn_versions(void); * grpc_chttp2_num_alpn_versions()) */ const char *grpc_chttp2_get_alpn_version_index(size_t i); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_ALPN_H_ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_ALPN_H_ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/transport/chttp2/bin_encoder.c index e3b5fe9fcf7..bd0a0ff8a69 100644 --- a/src/core/transport/chttp2/bin_encoder.c +++ b/src/core/transport/chttp2/bin_encoder.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -276,4 +276,4 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input) { int grpc_is_binary_header(const char *key, size_t length) { if (length < 5) return 0; return 0 == memcmp(key + length - 4, "-bin", 4); -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/bin_encoder.h b/src/core/transport/chttp2/bin_encoder.h index 2310f841f8b..221f663e7cf 100644 --- a/src/core/transport/chttp2/bin_encoder.h +++ b/src/core/transport/chttp2/bin_encoder.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input); int grpc_is_binary_header(const char *key, size_t length); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_BIN_ENCODER_H_ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_BIN_ENCODER_H_ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame.h b/src/core/transport/chttp2/frame.h index 6d286383091..c76a8dffb8b 100644 --- a/src/core/transport/chttp2/frame.h +++ b/src/core/transport/chttp2/frame.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ typedef struct { #define GRPC_CHTTP2_DATA_FLAG_PADDED 8 #define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20 -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index c4ad8f11d5c..e6a1b0c30a5 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -160,4 +160,4 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( gpr_log(GPR_ERROR, "should never reach here"); abort(); return GRPC_CHTTP2_CONNECTION_ERROR; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/transport/chttp2/frame_data.h index c260059e8b9..618e2263014 100644 --- a/src/core/transport/chttp2/frame_data.h +++ b/src/core/transport/chttp2/frame_data.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( /* create a slice with an empty data frame and is_last set */ gpr_slice grpc_chttp2_data_frame_create_empty_close(gpr_uint32 id); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/transport/chttp2/frame_goaway.c index 3d6e9431933..b97d6e822e5 100644 --- a/src/core/transport/chttp2/frame_goaway.c +++ b/src/core/transport/chttp2/frame_goaway.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -186,4 +186,4 @@ void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code, GPR_ASSERT(p == GPR_SLICE_END_PTR(header)); gpr_slice_buffer_add(slice_buffer, header); gpr_slice_buffer_add(slice_buffer, debug_data); -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_goaway.h b/src/core/transport/chttp2/frame_goaway.h index 9a3f8e6a7a6..369bac85db0 100644 --- a/src/core/transport/chttp2/frame_goaway.h +++ b/src/core/transport/chttp2/frame_goaway.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,4 +71,4 @@ void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code, gpr_slice debug_data, gpr_slice_buffer *slice_buffer); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_GOAWAY_H_ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_GOAWAY_H_ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_ping.c b/src/core/transport/chttp2/frame_ping.c index 9556c0cae80..915e70b9d00 100644 --- a/src/core/transport/chttp2/frame_ping.c +++ b/src/core/transport/chttp2/frame_ping.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,4 +90,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse( } return GRPC_CHTTP2_PARSE_OK; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_ping.h b/src/core/transport/chttp2/frame_ping.h index fa778c51b2f..5e8945f1e39 100644 --- a/src/core/transport/chttp2/frame_ping.h +++ b/src/core/transport/chttp2/frame_ping.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c index 825e156e46e..742e037c6a9 100644 --- a/src/core/transport/chttp2/frame_rst_stream.c +++ b/src/core/transport/chttp2/frame_rst_stream.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ gpr_slice grpc_chttp2_rst_stream_create(gpr_uint32 id, gpr_uint32 code) { *p++ = code; return slice; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/transport/chttp2/frame_rst_stream.h index dbb262971b3..95f6b3d37db 100644 --- a/src/core/transport/chttp2/frame_rst_stream.h +++ b/src/core/transport/chttp2/frame_rst_stream.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ gpr_slice grpc_chttp2_rst_stream_create(gpr_uint32 stream_id, gpr_uint32 code); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c index 63c21a9b92a..a8fd189f798 100644 --- a/src/core/transport/chttp2/frame_settings.c +++ b/src/core/transport/chttp2/frame_settings.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -225,4 +225,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( break; } } -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_settings.h b/src/core/transport/chttp2/frame_settings.h index fc513913d90..1d4e5e03981 100644 --- a/src/core/transport/chttp2/frame_settings.h +++ b/src/core/transport/chttp2/frame_settings.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,4 +96,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c index 04bc690108b..a0540bba601 100644 --- a/src/core/transport/chttp2/frame_window_update.c +++ b/src/core/transport/chttp2/frame_window_update.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,4 +96,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse( } return GRPC_CHTTP2_PARSE_OK; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/transport/chttp2/frame_window_update.h index 2d9e6c4dcb7..132793b644d 100644 --- a/src/core/transport/chttp2/frame_window_update.h +++ b/src/core/transport/chttp2/frame_window_update.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,4 +52,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/gen_hpack_tables.c b/src/core/transport/chttp2/gen_hpack_tables.c index fefaf159a5c..ff6f948cc39 100644 --- a/src/core/transport/chttp2/gen_hpack_tables.c +++ b/src/core/transport/chttp2/gen_hpack_tables.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -359,4 +359,4 @@ int main(void) { generate_base64_inverse_table(); return 0; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index 1eba4a24315..823245b7e29 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1391,4 +1391,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse( parser->is_eof = 0xde; } return GRPC_CHTTP2_PARSE_OK; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/hpack_parser.h b/src/core/transport/chttp2/hpack_parser.h index b0a0d76713c..d81ffce5356 100644 --- a/src/core/transport/chttp2/hpack_parser.h +++ b/src/core/transport/chttp2/hpack_parser.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -108,4 +108,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse( void *hpack_parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c index f5c10f934bf..5ba9fbff678 100644 --- a/src/core/transport/chttp2/hpack_table.c +++ b/src/core/transport/chttp2/hpack_table.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -220,4 +220,4 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( } return r; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/transport/chttp2/hpack_table.h index 84a8e2d1e08..b105b68db85 100644 --- a/src/core/transport/chttp2/hpack_table.h +++ b/src/core/transport/chttp2/hpack_table.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -94,4 +94,4 @@ typedef struct { grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( const grpc_chttp2_hptbl *tbl, grpc_mdelem *md); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/http2_errors.h b/src/core/transport/chttp2/http2_errors.h index 7791da6d5ad..b957cd8f6eb 100644 --- a/src/core/transport/chttp2/http2_errors.h +++ b/src/core/transport/chttp2/http2_errors.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ typedef enum { GRPC_CHTTP2__ERROR_DO_NOT_USE = -1 } grpc_chttp2_error_code; -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/huffsyms.c b/src/core/transport/chttp2/huffsyms.c index 1014a29b9f9..cfd3fe8ecb6 100644 --- a/src/core/transport/chttp2/huffsyms.c +++ b/src/core/transport/chttp2/huffsyms.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -293,4 +293,4 @@ const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = { {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26}, - {0x3fffffff, 30}, }; + {0x3fffffff, 30}, }; \ No newline at end of file diff --git a/src/core/transport/chttp2/huffsyms.h b/src/core/transport/chttp2/huffsyms.h index 02d0e53fdd5..f221b39b9e9 100644 --- a/src/core/transport/chttp2/huffsyms.h +++ b/src/core/transport/chttp2/huffsyms.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ typedef struct { extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS]; -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HUFFSYMS_H_ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HUFFSYMS_H_ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/status_conversion.c b/src/core/transport/chttp2/status_conversion.c index 7bd85e8b29d..9c815fa1554 100644 --- a/src/core/transport/chttp2/status_conversion.c +++ b/src/core/transport/chttp2/status_conversion.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,4 +106,4 @@ grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status) { int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status) { return 200; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/status_conversion.h b/src/core/transport/chttp2/status_conversion.h index f78d81e0aab..523a50d966b 100644 --- a/src/core/transport/chttp2/status_conversion.h +++ b/src/core/transport/chttp2/status_conversion.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ grpc_status_code grpc_chttp2_http2_error_to_grpc_status( grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status); int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c index 2af18c30358..6f73b4955fd 100644 --- a/src/core/transport/chttp2/stream_encoder.c +++ b/src/core/transport/chttp2/stream_encoder.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -601,4 +601,4 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof, begin_frame(&st, DATA); } finish_frame(&st, 1, eof); -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/stream_encoder.h b/src/core/transport/chttp2/stream_encoder.h index 147b1d31ffe..e5b1cb4cff0 100644 --- a/src/core/transport/chttp2/stream_encoder.h +++ b/src/core/transport/chttp2/stream_encoder.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,4 +90,4 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof, grpc_chttp2_hpack_compressor *compressor, gpr_slice_buffer *output); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_ENCODER_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_ENCODER_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/stream_map.c b/src/core/transport/chttp2/stream_map.c index 9ac3a4750d0..053dbc3ad26 100644 --- a/src/core/transport/chttp2/stream_map.c +++ b/src/core/transport/chttp2/stream_map.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -151,4 +151,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, f(user_data, map->keys[i], map->values[i]); } } -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/stream_map.h b/src/core/transport/chttp2/stream_map.h index 03bf719f376..2d1f4c47a7b 100644 --- a/src/core/transport/chttp2/stream_map.h +++ b/src/core/transport/chttp2/stream_map.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,4 +78,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, void *value), void *user_data); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_MAP_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_MAP_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/transport/chttp2/timeout_encoding.c index 31018c3d27b..d9943503e2b 100644 --- a/src/core/transport/chttp2/timeout_encoding.c +++ b/src/core/transport/chttp2/timeout_encoding.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -181,4 +181,4 @@ int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout) { } p++; return is_all_whitespace(p); -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/timeout_encoding.h b/src/core/transport/chttp2/timeout_encoding.h index d1e47760324..5028d33237b 100644 --- a/src/core/transport/chttp2/timeout_encoding.h +++ b/src/core/transport/chttp2/timeout_encoding.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ void grpc_chttp2_encode_timeout(gpr_timespec timeout, char *buffer); int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_ */ \ No newline at end of file diff --git a/src/core/transport/chttp2/varint.c b/src/core/transport/chttp2/varint.c index 5d551be6422..2efef951ed4 100644 --- a/src/core/transport/chttp2/varint.c +++ b/src/core/transport/chttp2/varint.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,4 +62,4 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value, target[0] = (gpr_uint8)((tail_value) | 0x80); } target[tail_length - 1] &= 0x7f; -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2/varint.h b/src/core/transport/chttp2/varint.h index d75869866a5..60ce84dc412 100644 --- a/src/core/transport/chttp2/varint.h +++ b/src/core/transport/chttp2/varint.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,4 +71,4 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value, } \ } while (0) -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_VARINT_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_VARINT_H__ */ \ No newline at end of file diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index dcd01718a06..9d41671b3c4 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -696,7 +696,7 @@ static void unlock(transport *t) { pending_goaway *goaways = NULL; grpc_endpoint *ep = t->ep; grpc_stream_op_buffer nuke_now; - + grpc_sopb_init(&nuke_now); if (t->nuke_later_sopb.nops) { grpc_sopb_swap(&nuke_now, &t->nuke_later_sopb); @@ -1770,4 +1770,4 @@ void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, transport *t = gpr_malloc(sizeof(transport)); init_transport(t, setup, arg, channel_args, ep, slices, nslices, mdctx, is_client); -} +} \ No newline at end of file diff --git a/src/core/transport/chttp2_transport.h b/src/core/transport/chttp2_transport.h index e12357ff5ef..18edcd2919d 100644 --- a/src/core/transport/chttp2_transport.h +++ b/src/core/transport/chttp2_transport.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, size_t nslices, grpc_mdctx *metadata_context, int is_client); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ */ \ No newline at end of file diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 74bbb02134d..0f999a1d48f 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -544,4 +544,4 @@ gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *gs) { slice = s->base64_and_huffman; unlock(ctx); return slice; -} +} \ No newline at end of file diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index ac845def379..bc6839cd470 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -136,4 +136,4 @@ const char *grpc_mdstr_as_c_string(grpc_mdstr *s); #define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash)) -#endif /* __GRPC_INTERNAL_TRANSPORT_METADATA_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_METADATA_H__ */ \ No newline at end of file diff --git a/src/core/transport/stream_op.c b/src/core/transport/stream_op.c index 03a338bd9be..f494292070d 100644 --- a/src/core/transport/stream_op.c +++ b/src/core/transport/stream_op.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -170,4 +170,4 @@ void grpc_sopb_append(grpc_stream_op_buffer *sopb, grpc_stream_op *ops, memcpy(sopb->ops + orig_nops, ops, sizeof(grpc_stream_op) * nops); sopb->nops = new_nops; -} +} \ No newline at end of file diff --git a/src/core/transport/stream_op.h b/src/core/transport/stream_op.h index d4d7515c4f2..eadbfe0c32d 100644 --- a/src/core/transport/stream_op.h +++ b/src/core/transport/stream_op.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,4 +131,4 @@ void grpc_sopb_add_flow_ctl_cb(grpc_stream_op_buffer *sopb, void grpc_sopb_append(grpc_stream_op_buffer *sopb, grpc_stream_op *ops, size_t nops); -#endif /* __GRPC_INTERNAL_TRANSPORT_STREAM_OP_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_STREAM_OP_H__ */ \ No newline at end of file diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c index 0ca67acb92d..cfd203a1f61 100644 --- a/src/core/transport/transport.c +++ b/src/core/transport/transport.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,4 +92,4 @@ void grpc_transport_setup_cancel(grpc_transport_setup *setup) { void grpc_transport_setup_initiate(grpc_transport_setup *setup) { setup->vtable->initiate(setup); -} +} \ No newline at end of file diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index af12f4e700d..52a91f2ba78 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -254,4 +254,4 @@ void grpc_transport_setup_initiate(grpc_transport_setup *setup); used as a destruction call by setup). */ void grpc_transport_setup_cancel(grpc_transport_setup *setup); -#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_H__ */ \ No newline at end of file diff --git a/src/core/transport/transport_impl.h b/src/core/transport/transport_impl.h index 31e80d36edd..c807c4a19a4 100644 --- a/src/core/transport/transport_impl.h +++ b/src/core/transport/transport_impl.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,4 +84,4 @@ struct grpc_transport { const grpc_transport_vtable *vtable; }; -#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_IMPL_H__ */ +#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_IMPL_H__ */ \ No newline at end of file diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c index a96c7df4a34..dbe5ef5bafa 100644 --- a/src/core/tsi/fake_transport_security.c +++ b/src/core/tsi/fake_transport_security.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -511,4 +511,4 @@ tsi_frame_protector* tsi_create_fake_protector( : *max_protected_frame_size; impl->base.vtable = &frame_protector_vtable; return &impl->base; -} +} \ No newline at end of file diff --git a/src/core/tsi/fake_transport_security.h b/src/core/tsi/fake_transport_security.h index 9e3480adfaa..37076bb8721 100644 --- a/src/core/tsi/fake_transport_security.h +++ b/src/core/tsi/fake_transport_security.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ tsi_frame_protector* tsi_create_fake_protector( } #endif -#endif /* __FAKE_TRANSPORT_SECURITY_H_ */ +#endif /* __FAKE_TRANSPORT_SECURITY_H_ */ \ No newline at end of file diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index e23421fc157..0a3739910f5 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1313,4 +1313,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) { } } return 0; /* Not found. */ -} +} \ No newline at end of file diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 3a33deacac5..4ddff580550 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -165,4 +165,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name); } #endif -#endif /* __SSL_TRANSPORT_SECURITY_H_ */ +#endif /* __SSL_TRANSPORT_SECURITY_H_ */ \ No newline at end of file diff --git a/src/core/tsi/transport_security.c b/src/core/tsi/transport_security.c index fcf03eeb952..da7e13eec89 100644 --- a/src/core/tsi/transport_security.c +++ b/src/core/tsi/transport_security.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -358,4 +358,4 @@ tsi_result tsi_construct_peer(size_t property_count, tsi_peer* peer) { peer->property_count = property_count; } return TSI_OK; -} +} \ No newline at end of file diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index 3a6ed5290b3..28f60aa1a75 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -115,4 +115,4 @@ char* tsi_strdup(const char* src); /* Sadly, no strdup in C89. */ } #endif -#endif /* __TRANSPORT_SECURITY_H_ */ +#endif /* __TRANSPORT_SECURITY_H_ */ \ No newline at end of file diff --git a/src/core/tsi/transport_security_interface.h b/src/core/tsi/transport_security_interface.h index d180e90799a..5dd4a598981 100644 --- a/src/core/tsi/transport_security_interface.h +++ b/src/core/tsi/transport_security_interface.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -361,4 +361,4 @@ void tsi_handshaker_destroy(tsi_handshaker* self); } #endif -#endif /* __TRANSPORT_SECURITY_INTERFACE_H_ */ +#endif /* __TRANSPORT_SECURITY_INTERFACE_H_ */ \ No newline at end of file diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index b2fc0c97ee9..9a8ee15fdd3 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,4 +99,4 @@ void Channel::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { grpc_call_start_batch(call->call(), ops, nops, buf)); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index c31adab7233..46da754d8c2 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,4 +68,4 @@ class Channel final : public ChannelInterface { } // namespace grpc -#endif // __GRPCPP_INTERNAL_CLIENT_CHANNEL_H__ +#endif // __GRPCPP_INTERNAL_CLIENT_CHANNEL_H__ \ No newline at end of file diff --git a/src/cpp/client/channel_arguments.cc b/src/cpp/client/channel_arguments.cc index 70713f015f1..a8c71b61960 100644 --- a/src/cpp/client/channel_arguments.cc +++ b/src/cpp/client/channel_arguments.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,4 +79,4 @@ void ChannelArguments::SetChannelArgs(grpc_channel_args *channel_args) const { } } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 64a829630d1..646c45a9639 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,4 +81,4 @@ void ClientContext::TryCancel() { } } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 03a03261285..4e71492ad00 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -86,4 +86,4 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, call.PerformOps(buf); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 9cc5cff2148..45502b93617 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ std::shared_ptr CreateChannel( const ChannelArguments &args) { return std::shared_ptr(new Channel(target, creds, args)); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/credentials.cc b/src/cpp/client/credentials.cc index 8e3a9884770..90e278157ee 100644 --- a/src/cpp/client/credentials.cc +++ b/src/cpp/client/credentials.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,4 +112,4 @@ std::unique_ptr CredentialsFactory::ComposeCredentials( return cpp_creds; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/client/internal_stub.cc b/src/cpp/client/internal_stub.cc index 51cb99d1b49..53b66b955d3 100644 --- a/src/cpp/client/internal_stub.cc +++ b/src/cpp/client/internal_stub.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,4 +33,4 @@ #include -namespace grpc {} // namespace grpc +namespace grpc {} // namespace grpc \ No newline at end of file diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 04af36f312f..b7a6450d2c9 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -283,4 +283,4 @@ void Call::PerformOps(CallOpBuffer* buffer) { call_hook_->PerformOpsOnCall(buffer, this); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 4419b4b2f14..f2b75b410ab 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -1,5 +1,5 @@ /* - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,4 +82,4 @@ bool CompletionQueue::Pluck(CompletionQueueTag *tag) { return ok; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/common/rpc_method.cc b/src/cpp/common/rpc_method.cc index c8b2ccb10e2..e536a1b1350 100644 --- a/src/cpp/common/rpc_method.cc +++ b/src/cpp/common/rpc_method.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,4 +33,4 @@ #include -namespace grpc {} // namespace grpc +namespace grpc {} // namespace grpc \ No newline at end of file diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 85f859b9eb5..57098b50c42 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,4 +70,4 @@ bool DeserializeProto(grpc_byte_buffer *buffer, return msg->ParseFromString(msg_string); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/proto/proto_utils.h b/src/cpp/proto/proto_utils.h index a611a227fa7..b3b03289903 100644 --- a/src/cpp/proto/proto_utils.h +++ b/src/cpp/proto/proto_utils.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ bool DeserializeProto(grpc_byte_buffer *buffer, google::protobuf::Message *msg); } // namespace grpc -#endif // __GRPCPP_INTERNAL_PROTO_PROTO_UTILS_H__ +#endif // __GRPCPP_INTERNAL_PROTO_PROTO_UTILS_H__ \ No newline at end of file diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc index 096eb7aa0e0..84b083ead64 100644 --- a/src/cpp/server/async_server_context.cc +++ b/src/cpp/server/async_server_context.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,4 +92,4 @@ bool AsyncServerContext::ParseRead(grpc_byte_buffer *read_buffer) { return success; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index ee9a1daa8e9..8c0844a3199 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -386,4 +386,4 @@ void Server::RunRpc() { } } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index dd23e929b15..1ca1acad944 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,4 +100,4 @@ std::unique_ptr ServerBuilder::BuildAndStart() { return server; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index df4c4dc3146..b9c82138f63 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,4 +67,4 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/server_credentials.cc b/src/cpp/server/server_credentials.cc index ce0271b6a0a..fbd606246bc 100644 --- a/src/cpp/server/server_credentials.cc +++ b/src/cpp/server/server_credentials.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,4 +59,4 @@ std::shared_ptr ServerCredentialsFactory::SslCredentials( return std::shared_ptr(new ServerCredentials(c_creds)); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index 20279592cbc..410e51d8b11 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ void ThreadPool::ScheduleCallback(const std::function &callback) { cv_.notify_one(); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 8a28c877040..77b0f33ddc4 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ class ThreadPool final : public ThreadPoolInterface { } // namespace grpc -#endif // __GRPCPP_INTERNAL_SERVER_THREAD_POOL_H__ +#endif // __GRPCPP_INTERNAL_SERVER_THREAD_POOL_H__ \ No newline at end of file diff --git a/src/cpp/util/status.cc b/src/cpp/util/status.cc index 1ca12d0ae90..f29415b5b8a 100644 --- a/src/cpp/util/status.cc +++ b/src/cpp/util/status.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ namespace grpc { const Status &Status::OK = Status(); const Status &Status::Cancelled = Status(StatusCode::CANCELLED); -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index 7ce7a371f56..56ac4765164 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,4 @@ system_clock::time_point Timespec2Timepoint(gpr_timespec t) { return tp; } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/cpp/util/time.h b/src/cpp/util/time.h index 908395c92b9..59c3b9d4064 100644 --- a/src/cpp/util/time.h +++ b/src/cpp/util/time.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); } // namespace grpc -#endif // __GRPCPP_INTERNAL_UTIL_TIME_H__ +#endif // __GRPCPP_INTERNAL_UTIL_TIME_H__ \ No newline at end of file diff --git a/src/node/examples/math_server.js b/src/node/examples/math_server.js index e1bd11b5a6d..42728d0bd94 100644 --- a/src/node/examples/math_server.js +++ b/src/node/examples/math_server.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,4 +135,4 @@ if (require.main === module) { /** * See docs for server */ -module.exports = server; +module.exports = server; \ No newline at end of file diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index 695ecedd344..8180c2735fe 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,4 +92,4 @@ Handle MakeFastBuffer(Handle slowBuffer) { return NanEscapeScope(fastBuffer); } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/byte_buffer.h b/src/node/ext/byte_buffer.h index 5f1903a42eb..52fee70a9db 100644 --- a/src/node/ext/byte_buffer.h +++ b/src/node/ext/byte_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ v8::Handle MakeFastBuffer(v8::Handle slowBuffer); } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_BYTE_BUFFER_H_ +#endif // NET_GRPC_NODE_BYTE_BUFFER_H_ \ No newline at end of file diff --git a/src/node/ext/call.h b/src/node/ext/call.h index dbdb8e2ff65..e93349d65cb 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,4 +128,4 @@ class Call : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CALL_H_ +#endif // NET_GRPC_NODE_CALL_H_ \ No newline at end of file diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index 9087d6f919b..edeebe9702e 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -179,4 +179,4 @@ NAN_METHOD(Channel::Close) { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/channel.h b/src/node/ext/channel.h index 140cbf201a1..3c0597715b2 100644 --- a/src/node/ext/channel.h +++ b/src/node/ext/channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,4 +76,4 @@ class Channel : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CHANNEL_H_ +#endif // NET_GRPC_NODE_CHANNEL_H_ \ No newline at end of file diff --git a/src/node/ext/completion_queue_async_worker.cc b/src/node/ext/completion_queue_async_worker.cc index a1f390f64b6..bc5896b58bd 100644 --- a/src/node/ext/completion_queue_async_worker.cc +++ b/src/node/ext/completion_queue_async_worker.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -101,4 +101,4 @@ void CompletionQueueAsyncWorker::HandleErrorCallback() { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/completion_queue_async_worker.h b/src/node/ext/completion_queue_async_worker.h index c04a303283a..1c02a345929 100644 --- a/src/node/ext/completion_queue_async_worker.h +++ b/src/node/ext/completion_queue_async_worker.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,4 +78,4 @@ class CompletionQueueAsyncWorker : public NanAsyncWorker { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_COMPLETION_QUEUE_ASYNC_WORKER_H_ +#endif // NET_GRPC_NODE_COMPLETION_QUEUE_ASYNC_WORKER_H_ \ No newline at end of file diff --git a/src/node/ext/credentials.cc b/src/node/ext/credentials.cc index b79c3e3019d..cb1e8a79c1f 100644 --- a/src/node/ext/credentials.cc +++ b/src/node/ext/credentials.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,4 +200,4 @@ NAN_METHOD(Credentials::CreateIam) { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/credentials.h b/src/node/ext/credentials.h index 981e5a99bc7..576a5dbd47a 100644 --- a/src/node/ext/credentials.h +++ b/src/node/ext/credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,4 +78,4 @@ class Credentials : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CREDENTIALS_H_ +#endif // NET_GRPC_NODE_CREDENTIALS_H_ \ No newline at end of file diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 9b0fe82976e..4e1553fecd4 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ void init(Handle exports) { grpc::node::ServerCredentials::Init(exports); } -NODE_MODULE(grpc, init) +NODE_MODULE(grpc, init) \ No newline at end of file diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index ee3e1087ce7..c2e85df5b8b 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -286,4 +286,4 @@ NAN_METHOD(Server::Shutdown) { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/server.h b/src/node/ext/server.h index d50f1fb6c5e..e4bb4d889ea 100644 --- a/src/node/ext/server.h +++ b/src/node/ext/server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,4 +76,4 @@ class Server : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_SERVER_H_ +#endif // NET_GRPC_NODE_SERVER_H_ \ No newline at end of file diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc index 3add43c48c9..9c9a1b38a7b 100644 --- a/src/node/ext/server_credentials.cc +++ b/src/node/ext/server_credentials.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -151,4 +151,4 @@ NAN_METHOD(ServerCredentials::CreateFake) { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/server_credentials.h b/src/node/ext/server_credentials.h index 8baae3f185a..7c916e774e3 100644 --- a/src/node/ext/server_credentials.h +++ b/src/node/ext/server_credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ class ServerCredentials : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_SERVER_CREDENTIALS_H_ +#endif // NET_GRPC_NODE_SERVER_CREDENTIALS_H_ \ No newline at end of file diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc index 20d52f0963e..5cece4a97d1 100644 --- a/src/node/ext/timeval.cc +++ b/src/node/ext/timeval.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,4 +62,4 @@ double TimespecToMilliseconds(gpr_timespec timespec) { } } // namespace node -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/src/node/ext/timeval.h b/src/node/ext/timeval.h index 1fb0f2c690f..a85949f2674 100644 --- a/src/node/ext/timeval.h +++ b/src/node/ext/timeval.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ gpr_timespec MillisecondsToTimespec(double millis); } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_TIMEVAL_H_ +#endif // NET_GRPC_NODE_TIMEVAL_H_ \ No newline at end of file diff --git a/src/node/index.js b/src/node/index.js index baef4d03c68..167be3a7d05 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,4 +105,4 @@ exports.Credentials = grpc.Credentials; /** * ServerCredentials factories */ -exports.ServerCredentials = grpc.ServerCredentials; +exports.ServerCredentials = grpc.ServerCredentials; \ No newline at end of file diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 8737af6cde9..4efc9667da4 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -310,4 +310,4 @@ if (require.main === module) { /** * See docs for runTest */ -exports.runTest = runTest; +exports.runTest = runTest; \ No newline at end of file diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js index 54e9715d1e3..2c9cf04cdbc 100644 --- a/src/node/interop/interop_server.js +++ b/src/node/interop/interop_server.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -201,4 +201,4 @@ if (require.main === module) { /** * See docs for getServer */ -exports.getServer = getServer; +exports.getServer = getServer; \ No newline at end of file diff --git a/src/node/src/common.js b/src/node/src/common.js index 7560cf1bddf..c5b836231a4 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,4 +125,4 @@ exports.fullyQualifiedName = fullyQualifiedName; /** * See docs for wrapIgnoreNull */ -exports.wrapIgnoreNull = wrapIgnoreNull; +exports.wrapIgnoreNull = wrapIgnoreNull; \ No newline at end of file diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js index 4d8cfc4d89c..77708d163ed 100644 --- a/src/node/test/channel_test.js +++ b/src/node/test/channel_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,4 +85,4 @@ describe('channel', function() { }); }); }); -}); +}); \ No newline at end of file diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index 4d11e6f5272..0affa403c8d 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,4 +89,4 @@ describe('constants', function() { 'call error missing: ' + callErrorNames[i]); } }); -}); +}); \ No newline at end of file diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js index f8899beae82..4fd6d8d2d0e 100644 --- a/src/node/test/end_to_end_test.js +++ b/src/node/test/end_to_end_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -233,4 +233,4 @@ describe('end-to-end', function() { }); }); }); -}); +}); \ No newline at end of file diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index 81cd9fa5b95..92e87b5d646 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,4 +79,4 @@ describe('Interop tests', function() { interop_client.runTest(port, name_override, 'cancel_after_first_response', true, done); }); -}); +}); \ No newline at end of file diff --git a/src/node/test/math_client_test.js b/src/node/test/math_client_test.js index 61b4a2fa2fe..97b95377fb4 100644 --- a/src/node/test/math_client_test.js +++ b/src/node/test/math_client_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -113,4 +113,4 @@ describe('Math client', function() { done(); }); }); -}); +}); \ No newline at end of file diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 34e4ab4013c..e6a63b1ed72 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -125,4 +125,4 @@ describe('Cancelling surface client', function() { }); call.cancel(); }); -}); +}); \ No newline at end of file diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index 2e2b12fd444..e422e93989a 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -32,4 +32,4 @@ set +e cd $(dirname $0) php -d extension_dir=../ext/grpc/modules/ -d extension=grpc.so \ - ../tests/interop/interop_client.php $@ 1>&2 + ../tests/interop/interop_client.php $@ 1>&2 \ No newline at end of file diff --git a/src/php/bin/run_gen_code_test.sh b/src/php/bin/run_gen_code_test.sh index f035a9ba7f0..a1d760a5b07 100755 --- a/src/php/bin/run_gen_code_test.sh +++ b/src/php/bin/run_gen_code_test.sh @@ -1,5 +1,5 @@ # Runs the generated code test against the ruby server -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,4 +31,4 @@ cd $(dirname $0) GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ - ../tests/generated_code/GeneratedCodeTest.php + ../tests/generated_code/GeneratedCodeTest.php \ No newline at end of file diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index b9946834e93..33bfe289e28 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ done php \ -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so \ - `which phpunit` -v --debug --strict ../tests/unit_tests + `which phpunit` -v --debug --strict ../tests/unit_tests \ No newline at end of file diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c index a2cc590d28b..1587a8c7413 100644 --- a/src/python/src/grpc/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -290,4 +290,4 @@ int pygrpc_add_call(PyObject *module) { PyErr_SetString(PyExc_ImportError, "Couldn't add Call type to module!"); } return 0; -} +} \ No newline at end of file diff --git a/src/ruby/bin/apis/google/protobuf/empty.rb b/src/ruby/bin/apis/google/protobuf/empty.rb index 33e8a9281c7..9aaa19b4743 100644 --- a/src/ruby/bin/apis/google/protobuf/empty.rb +++ b/src/ruby/bin/apis/google/protobuf/empty.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ module Google module Protobuf Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass end -end +end \ No newline at end of file diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/src/ruby/bin/apis/pubsub_demo.rb index 8ebac19d95a..cd31efd9f11 100755 --- a/src/ruby/bin/apis/pubsub_demo.rb +++ b/src/ruby/bin/apis/pubsub_demo.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -275,4 +275,4 @@ def main NamedActions.new(pub, sub, args).method(args.action).call end -main +main \ No newline at end of file diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb index aa7893dbc7b..63db5c3ec84 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +++ b/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -171,4 +171,4 @@ module Tech AcknowledgeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.AcknowledgeRequest").msgclass NackRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.NackRequest").msgclass end -end +end \ No newline at end of file diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb index 0023f4844ee..cb27ce60398 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +++ b/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -100,4 +100,4 @@ module Tech Stub = Service.rpc_stub_class end end -end +end \ No newline at end of file diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb index e29e22b8c15..94d4ad6c3e9 100755 --- a/src/ruby/bin/interop/interop_client.rb +++ b/src/ruby/bin/interop/interop_client.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -348,4 +348,4 @@ def main NamedTests.new(stub, opts).method(opts['test_case']).call end -main +main \ No newline at end of file diff --git a/src/ruby/bin/interop/interop_server.rb b/src/ruby/bin/interop/interop_server.rb index cc4d2608795..0e2b40bdcae 100755 --- a/src/ruby/bin/interop/interop_server.rb +++ b/src/ruby/bin/interop/interop_server.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -189,4 +189,4 @@ def main s.run end -main +main \ No newline at end of file diff --git a/src/ruby/bin/interop/test/cpp/interop/empty.rb b/src/ruby/bin/interop/test/cpp/interop/empty.rb index acd4160d248..0dd4d212933 100644 --- a/src/ruby/bin/interop/test/cpp/interop/empty.rb +++ b/src/ruby/bin/interop/test/cpp/interop/empty.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ module Grpc module Testing Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.Empty").msgclass end -end +end \ No newline at end of file diff --git a/src/ruby/bin/interop/test/cpp/interop/messages.rb b/src/ruby/bin/interop/test/cpp/interop/messages.rb index b86cd396a9f..9e65b42caae 100644 --- a/src/ruby/bin/interop/test/cpp/interop/messages.rb +++ b/src/ruby/bin/interop/test/cpp/interop/messages.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -86,4 +86,4 @@ module Grpc StreamingOutputCallResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.StreamingOutputCallResponse").msgclass PayloadType = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule end -end +end \ No newline at end of file diff --git a/src/ruby/bin/interop/test/cpp/interop/test.rb b/src/ruby/bin/interop/test/cpp/interop/test.rb index 0b391ed6af0..0df3ec1f3a2 100644 --- a/src/ruby/bin/interop/test/cpp/interop/test.rb +++ b/src/ruby/bin/interop/test/cpp/interop/test.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ end module Grpc module Testing end -end +end \ No newline at end of file diff --git a/src/ruby/bin/interop/test/cpp/interop/test_services.rb b/src/ruby/bin/interop/test/cpp/interop/test_services.rb index 17b5461d3e3..d50457f18c6 100644 --- a/src/ruby/bin/interop/test/cpp/interop/test_services.rb +++ b/src/ruby/bin/interop/test/cpp/interop/test_services.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -57,4 +57,4 @@ module Grpc Stub = Service.rpc_stub_class end end -end +end \ No newline at end of file diff --git a/src/ruby/bin/math.rb b/src/ruby/bin/math.rb index 09d1e985864..7dc677b6a3a 100755 --- a/src/ruby/bin/math.rb +++ b/src/ruby/bin/math.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -58,4 +58,4 @@ module Math FibArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibArgs").msgclass Num = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.Num").msgclass FibReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibReply").msgclass -end +end \ No newline at end of file diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb index 7e838e23d17..9a0687f6696 100755 --- a/src/ruby/bin/math_client.rb +++ b/src/ruby/bin/math_client.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -144,4 +144,4 @@ def main do_div_many(stub) end -main +main \ No newline at end of file diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb index 55ee1d33141..ff38b2a2501 100755 --- a/src/ruby/bin/math_server.rb +++ b/src/ruby/bin/math_server.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -187,4 +187,4 @@ def main s.run end -main +main \ No newline at end of file diff --git a/src/ruby/bin/math_services.rb b/src/ruby/bin/math_services.rb index f6ca6fe060c..c559ae0bb8a 100755 --- a/src/ruby/bin/math_services.rb +++ b/src/ruby/bin/math_services.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -53,4 +53,4 @@ module Math Stub = Service.rpc_stub_class end -end +end \ No newline at end of file diff --git a/src/ruby/bin/noproto_client.rb b/src/ruby/bin/noproto_client.rb index 74bdfbb93a7..ec01e740f3e 100755 --- a/src/ruby/bin/noproto_client.rb +++ b/src/ruby/bin/noproto_client.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -105,4 +105,4 @@ def main logger.info("got a response: #{resp}") end -main +main \ No newline at end of file diff --git a/src/ruby/bin/noproto_server.rb b/src/ruby/bin/noproto_server.rb index e34075c1f0c..208a91f734b 100755 --- a/src/ruby/bin/noproto_server.rb +++ b/src/ruby/bin/noproto_server.rb @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -109,4 +109,4 @@ def main s.run end -main +main \ No newline at end of file diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index cbf41eda8b7..c9f7d94165c 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -73,4 +73,4 @@ $LDFLAGS << ' -lgrpc -lgpr -ldl' crash('need grpc lib') unless have_library('grpc', 'grpc_channel_destroy') have_library('grpc', 'grpc_channel_destroy') crash('need gpr lib') unless have_library('gpr', 'gpr_now') -create_makefile('grpc/grpc') +create_makefile('grpc/grpc') \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index f73b12c417f..605703fd53f 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -238,4 +238,4 @@ grpc_byte_buffer *grpc_rb_get_wrapped_byte_buffer(VALUE v) { grpc_rb_byte_buffer *wrapper = NULL; Data_Get_Struct(v, grpc_rb_byte_buffer, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_byte_buffer.h b/src/ruby/ext/grpc/rb_byte_buffer.h index 322c268f377..935f206c619 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.h +++ b/src/ruby/ext/grpc/rb_byte_buffer.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ VALUE grpc_rb_byte_buffer_create_with_mark(VALUE mark, grpc_byte_buffer* bb); /* Gets the wrapped byte_buffer from its ruby object. */ grpc_byte_buffer* grpc_rb_get_wrapped_byte_buffer(VALUE v); -#endif /* GRPC_RB_BYTE_BUFFER_H_ */ +#endif /* GRPC_RB_BYTE_BUFFER_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 5d723076682..9576075ffa1 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -566,4 +566,4 @@ VALUE grpc_rb_wrap_call(grpc_call *c) { UINT2NUM(NUM2UINT(obj) + 1)); } return Data_Wrap_Struct(rb_cCall, GC_NOT_MARKED, grpc_rb_call_destroy, c); -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index 965e9eef409..f2a3f3ed3be 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,4 +56,4 @@ extern VALUE rb_eCallError; /* Initializes the Call class. */ void Init_google_rpc_call(); -#endif /* GRPC_RB_CALL_H_ */ +#endif /* GRPC_RB_CALL_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 7c98e66c33d..116e7740561 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -261,4 +261,4 @@ grpc_channel *grpc_rb_get_wrapped_channel(VALUE v) { grpc_rb_channel *wrapper = NULL; Data_Get_Struct(v, grpc_rb_channel, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index 6c1210e812d..696f77e9418 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,4 +46,4 @@ void Init_google_rpc_channel(); /* Gets the wrapped channel from the ruby wrapper */ grpc_channel* grpc_rb_get_wrapped_channel(VALUE v); -#endif /* GRPC_RB_CHANNEL_H_ */ +#endif /* GRPC_RB_CHANNEL_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c index cf492591284..4249db77689 100644 --- a/src/ruby/ext/grpc/rb_channel_args.c +++ b/src/ruby/ext/grpc/rb_channel_args.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -151,4 +151,4 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, } rb_jump_tag(status); } -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_channel_args.h b/src/ruby/ext/grpc/rb_channel_args.h index 07be6627930..ff12e90806c 100644 --- a/src/ruby/ext/grpc/rb_channel_args.h +++ b/src/ruby/ext/grpc/rb_channel_args.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, grpc_channel_args* dst); -#endif /* GRPC_RB_CHANNEL_ARGS_H_ */ +#endif /* GRPC_RB_CHANNEL_ARGS_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 47776a991a1..7ed586fbb12 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -182,4 +182,4 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v) { grpc_completion_queue *cq = NULL; Data_Get_Struct(v, grpc_completion_queue, cq); return cq; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h index c563662c2d4..61b27ab10f2 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.h +++ b/src/ruby/ext/grpc/rb_completion_queue.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ extern VALUE rb_cCompletionQueue; /* Initializes the CompletionQueue class. */ void Init_google_rpc_completion_queue(); -#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */ +#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c index 87a5d0a299c..9df58e2c69f 100644 --- a/src/ruby/ext/grpc/rb_credentials.c +++ b/src/ruby/ext/grpc/rb_credentials.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -278,4 +278,4 @@ grpc_credentials *grpc_rb_get_wrapped_credentials(VALUE v) { grpc_rb_credentials *wrapper = NULL; Data_Get_Struct(v, grpc_rb_credentials, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h index fada3639d58..838d2abb3d7 100644 --- a/src/ruby/ext/grpc/rb_credentials.h +++ b/src/ruby/ext/grpc/rb_credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ void Init_google_rpc_credentials(); /* Gets the wrapped credentials from the ruby wrapper */ grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v); -#endif /* GRPC_RB_CREDENTIALS_H_ */ +#endif /* GRPC_RB_CREDENTIALS_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c index 72c9dd2ec00..70147349d5c 100644 --- a/src/ruby/ext/grpc/rb_event.c +++ b/src/ruby/ext/grpc/rb_event.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -358,4 +358,4 @@ VALUE grpc_rb_new_event(grpc_event *ev) { wrapper->mark = Qnil; return Data_Wrap_Struct(rb_cEvent, grpc_rb_event_mark, grpc_rb_event_free, wrapper); -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_event.h b/src/ruby/ext/grpc/rb_event.h index a406e9e9f17..ee75231ae72 100644 --- a/src/ruby/ext/grpc/rb_event.h +++ b/src/ruby/ext/grpc/rb_event.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ VALUE grpc_rb_new_event(grpc_event *ev); /* Initializes the Event and EventError classes. */ void Init_google_rpc_event(); -#endif /* GRPC_RB_EVENT_H_ */ +#endif /* GRPC_RB_EVENT_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 8feefb047cc..2ec4ee5aacd 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -273,4 +273,4 @@ void Init_grpc() { Init_google_rpc_server_credentials(); Init_google_status_codes(); Init_google_time_consts(); -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index d5e8930fca6..0cd79eaf854 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self); /* grpc_rb_time_timeval creates a gpr_timespec from a ruby time object. */ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval); -#endif /* GRPC_RB_H_ */ +#endif /* GRPC_RB_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_metadata.c b/src/ruby/ext/grpc/rb_metadata.c index 88eb62ab738..f054ae9e98a 100644 --- a/src/ruby/ext/grpc/rb_metadata.c +++ b/src/ruby/ext/grpc/rb_metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -212,4 +212,4 @@ grpc_metadata *grpc_rb_get_wrapped_metadata(VALUE v) { grpc_rb_metadata *wrapper = NULL; Data_Get_Struct(v, grpc_rb_metadata, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_metadata.h b/src/ruby/ext/grpc/rb_metadata.h index 329ef15c68a..5873ca597ec 100644 --- a/src/ruby/ext/grpc/rb_metadata.h +++ b/src/ruby/ext/grpc/rb_metadata.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v); /* Initializes the Metadata class. */ void Init_google_rpc_metadata(); -#endif /* GRPC_RB_METADATA_H_ */ +#endif /* GRPC_RB_METADATA_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index e68843e12b1..4789f2e8834 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -275,4 +275,4 @@ grpc_server *grpc_rb_get_wrapped_server(VALUE v) { grpc_rb_server *wrapper = NULL; Data_Get_Struct(v, grpc_rb_server, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h index 92047efd187..7226359b2d9 100644 --- a/src/ruby/ext/grpc/rb_server.h +++ b/src/ruby/ext/grpc/rb_server.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ void Init_google_rpc_server(); /* Gets the wrapped server from the ruby wrapper */ grpc_server* grpc_rb_get_wrapped_server(VALUE v); -#endif /* GRPC_RB_SERVER_H_ */ +#endif /* GRPC_RB_SERVER_H_ */ \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index 4f6c67ea5e3..41c0a955a7a 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,4 +207,4 @@ grpc_server_credentials *grpc_rb_get_wrapped_server_credentials(VALUE v) { grpc_rb_server_credentials *wrapper = NULL; Data_Get_Struct(v, grpc_rb_server_credentials, wrapper); return wrapper->wrapped; -} +} \ No newline at end of file diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h index 2a2e1fbc822..a2193cdc4e1 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.h +++ b/src/ruby/ext/grpc/rb_server_credentials.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,4 +47,4 @@ void Init_google_rpc_server_credentials(); /* Gets the wrapped server_credentials from the ruby wrapper */ grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v); -#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */ +#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */ \ No newline at end of file diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 758ac0c2d16..8836afd6dd3 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ require 'grpc/generic/service' require 'grpc/generic/rpc_server' # alias GRPC -GRPC = Google::RPC +GRPC = Google::RPC \ No newline at end of file diff --git a/src/ruby/lib/grpc/core/event.rb b/src/ruby/lib/grpc/core/event.rb index 9a333589c21..bfde5dfe3bf 100644 --- a/src/ruby/lib/grpc/core/event.rb +++ b/src/ruby/lib/grpc/core/event.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/core/time_consts.rb b/src/ruby/lib/grpc/core/time_consts.rb index 6876dcb02eb..0b7c22d20b8 100644 --- a/src/ruby/lib/grpc/core/time_consts.rb +++ b/src/ruby/lib/grpc/core/time_consts.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -69,4 +69,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index 70a92bfed77..d562f0503d9 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -60,4 +60,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index 6c2b6e91c24..22218bd7546 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -535,4 +535,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb index 099d57151c0..2e470346ede 100644 --- a/src/ruby/lib/grpc/generic/bidi_call.rb +++ b/src/ruby/lib/grpc/generic/bidi_call.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -220,4 +220,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index 7e13de19ca5..10405a922ee 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -407,4 +407,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index 876397a6e70..ea6abbc4008 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -148,4 +148,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 40c5ec118e3..1ea9cfbef3a 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -403,4 +403,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index ff37617ccfa..77f0021e958 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -234,4 +234,4 @@ module Google end end end -end +end \ No newline at end of file diff --git a/src/ruby/lib/grpc/logconfig.rb b/src/ruby/lib/grpc/logconfig.rb index 6442f23e895..24c0913640d 100644 --- a/src/ruby/lib/grpc/logconfig.rb +++ b/src/ruby/lib/grpc/logconfig.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,4 +37,4 @@ Logging.logger.root.level = :info # TODO: provide command-line configuration for logging Logging.logger['Google::RPC'].level = :debug Logging.logger['Google::RPC::ActiveCall'].level = :info -Logging.logger['Google::RPC::BidiCall'].level = :info +Logging.logger['Google::RPC::BidiCall'].level = :info \ No newline at end of file diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index dd526e583a6..de7ef5f8880 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -32,4 +32,4 @@ module Google module RPC VERSION = '0.0.1' end -end +end \ No newline at end of file diff --git a/src/ruby/spec/alloc_spec.rb b/src/ruby/spec/alloc_spec.rb index 6dd59ab9fce..1bd0e093bd7 100644 --- a/src/ruby/spec/alloc_spec.rb +++ b/src/ruby/spec/alloc_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -41,4 +41,4 @@ describe 'Wrapped classes where .new cannot create an instance' do expect { GRPC::Core::Event.new }.to raise_error(TypeError) end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/byte_buffer_spec.rb b/src/ruby/spec/byte_buffer_spec.rb index 3a65f45c7ed..76e3fae3582 100644 --- a/src/ruby/spec/byte_buffer_spec.rb +++ b/src/ruby/spec/byte_buffer_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ describe GRPC::Core::ByteBuffer do expect(a_copy.dup.to_s).to eq('#dup') end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb index 8bb5043186b..2a47eac23a3 100644 --- a/src/ruby/spec/call_spec.rb +++ b/src/ruby/spec/call_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -160,4 +160,4 @@ describe GRPC::Core::Call do def deadline Time.now + 2 # in 2 seconds; arbitrary end -end +end \ No newline at end of file diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb index 82c7915debb..8e514411e59 100644 --- a/src/ruby/spec/channel_spec.rb +++ b/src/ruby/spec/channel_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -178,4 +178,4 @@ describe GRPC::Core::Channel do expect(&blk).to_not raise_error end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb index 1321727f5cf..734b6517c8f 100644 --- a/src/ruby/spec/client_server_spec.rb +++ b/src/ruby/spec/client_server_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -369,4 +369,4 @@ describe 'the secure http client/server' do # TODO: uncomment after updating the to the new c api # it_behaves_like 'GRPC metadata delivery works OK' do # end -end +end \ No newline at end of file diff --git a/src/ruby/spec/completion_queue_spec.rb b/src/ruby/spec/completion_queue_spec.rb index 6117e062d64..89b418583ae 100644 --- a/src/ruby/spec/completion_queue_spec.rb +++ b/src/ruby/spec/completion_queue_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -71,4 +71,4 @@ describe GRPC::Core::CompletionQueue do expect { @cq.pluck(tag, a_time) }.not_to raise_error end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/credentials_spec.rb b/src/ruby/spec/credentials_spec.rb index 47b42aed29b..62a58fff434 100644 --- a/src/ruby/spec/credentials_spec.rb +++ b/src/ruby/spec/credentials_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ describe Credentials do expect { Credentials.default }.to raise_error RuntimeError end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/event_spec.rb b/src/ruby/spec/event_spec.rb index 89acd4ba676..e2b76a54a26 100644 --- a/src/ruby/spec/event_spec.rb +++ b/src/ruby/spec/event_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ describe GRPC::Core::CompletionType do blk = proc { Hash[mod.constants.collect { |c| [c, mod.const_get(c)] }] } expect(blk.call).to eq(@known_types) end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 86495d73694..3e54c1fd6f1 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -370,4 +370,4 @@ describe GRPC::ActiveCall do def deadline Time.now + 1 # in 1 second; arbitrary end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index c7218da2cff..1609534f0d4 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -516,4 +516,4 @@ describe 'ClientStub' do INFINITE_FUTURE, finished_tag: finished_tag) end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb index 54ccf7ab8b0..791395b3ace 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -354,4 +354,4 @@ describe GRPC::RpcDesc do def other_error_alt(_call) fail(ArgumentError, 'other error') end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 27fabd9c312..6ffde325f6d 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -136,4 +136,4 @@ describe Pool do p.stop end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb index 0ec79572e7d..f8484d778c2 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -401,4 +401,4 @@ describe GRPC::RpcServer do end end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/generic/service_spec.rb b/src/ruby/spec/generic/service_spec.rb index 29f24126319..21e4bd75f09 100644 --- a/src/ruby/spec/generic/service_spec.rb +++ b/src/ruby/spec/generic/service_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -339,4 +339,4 @@ describe GenericService do expect(c.include?(GenericService)).to be(true) end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/metadata_spec.rb b/src/ruby/spec/metadata_spec.rb index 9cdce6b40d5..3c479147415 100644 --- a/src/ruby/spec/metadata_spec.rb +++ b/src/ruby/spec/metadata_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ describe GRPC::Core::Metadata do expect(md.dup.value).to eq('a value') end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/server_credentials_spec.rb b/src/ruby/spec/server_credentials_spec.rb index faa713d562c..a641a650fba 100644 --- a/src/ruby/spec/server_credentials_spec.rb +++ b/src/ruby/spec/server_credentials_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -66,4 +66,4 @@ describe GRPC::Core::ServerCredentials do expect(&blk).to_not raise_error end end -end +end \ No newline at end of file diff --git a/src/ruby/spec/server_spec.rb b/src/ruby/spec/server_spec.rb index 1550ba65660..123e6455127 100644 --- a/src/ruby/spec/server_spec.rb +++ b/src/ruby/spec/server_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -209,4 +209,4 @@ describe Server do s.start s end -end +end \ No newline at end of file diff --git a/src/ruby/spec/spec_helper.rb b/src/ruby/spec/spec_helper.rb index ea0a2567131..3838181bab3 100644 --- a/src/ruby/spec/spec_helper.rb +++ b/src/ruby/spec/spec_helper.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ Faraday::Adapter.load_middleware(:test) RSpec.configure do |config| include RSpec::LoggingHelper config.capture_log_messages -end +end \ No newline at end of file diff --git a/src/ruby/spec/time_consts_spec.rb b/src/ruby/spec/time_consts_spec.rb index b01027ce267..d090e71db3c 100644 --- a/src/ruby/spec/time_consts_spec.rb +++ b/src/ruby/spec/time_consts_spec.rb @@ -1,4 +1,4 @@ -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -86,4 +86,4 @@ describe '#from_relative_time' do expect(abs.to_f).to be_within(epsilon).of(want.to_f) end end -end +end \ No newline at end of file diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index d53098b5e42..71c4676df40 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,4 +135,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_create_channel_stack(); return 0; -} +} \ No newline at end of file diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c index 60813089868..2b62aa02e17 100644 --- a/test/core/channel/metadata_buffer_test.c +++ b/test/core/channel/metadata_buffer_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -198,4 +198,4 @@ int main(int argc, char **argv) { test_case(100, 100, 2); test_case(100, 100, 10000); return 0; -} +} \ No newline at end of file diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c index 5f55fa68d32..b46658b6dd9 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -190,4 +190,4 @@ int main(int argc, char **argv) { test_bad_data(); return 0; -} +} \ No newline at end of file diff --git a/test/core/echo/client.c b/test/core/echo/client.c index 5652fd9f38b..f6e9d665a5c 100644 --- a/test/core/echo/client.c +++ b/test/core/echo/client.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -136,4 +136,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/echo/echo_test.c b/test/core/echo/echo_test.c index 5450dfbef56..fd531b93146 100644 --- a/test/core/echo/echo_test.c +++ b/test/core/echo/echo_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,4 +132,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} +} \ No newline at end of file diff --git a/test/core/echo/server.c b/test/core/echo/server.c index 6e494d50fff..17b876af8c4 100644 --- a/test/core/echo/server.c +++ b/test/core/echo/server.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -220,4 +220,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 15dc4270d6f..82a0af0632b 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -496,4 +496,4 @@ void cq_expect_finished(cq_verifier *v, void *tag, ...) { void cq_expect_server_shutdown(cq_verifier *v, void *tag) { add(v, GRPC_SERVER_SHUTDOWN, tag); -} +} \ No newline at end of file diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index 8b76bc421df..7357a664376 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,4 +75,4 @@ void cq_expect_server_shutdown(cq_verifier *v, void *tag); int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string); int contains_metadata(grpc_metadata_array *array, const char *key, const char *value); -#endif /* __GRPC_TEST_END2END_CQ_VERIFIER_H__ */ +#endif /* __GRPC_TEST_END2END_CQ_VERIFIER_H__ */ \ No newline at end of file diff --git a/test/core/end2end/data/prod_roots_certs.c b/test/core/end2end/data/prod_roots_certs.c index 3b66d236c36..001c7246e4f 100644 --- a/test/core/end2end/data/prod_roots_certs.c +++ b/test/core/end2end/data/prod_roots_certs.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -11270,4 +11270,4 @@ const char prod_roots_certs[] = { 0x33, 0x50, 0x59, 0x74, 0x6c, 0x4e, 0x58, 0x4c, 0x66, 0x62, 0x51, 0x34, 0x64, 0x64, 0x49, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file diff --git a/test/core/end2end/data/server1_cert.c b/test/core/end2end/data/server1_cert.c index 134b9cb98e4..e2573fb9e11 100644 --- a/test/core/end2end/data/server1_cert.c +++ b/test/core/end2end/data/server1_cert.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,4 +112,4 @@ const char test_server1_cert[] = { 0x32, 0x77, 0x65, 0x2f, 0x4b, 0x44, 0x34, 0x6f, 0x6a, 0x66, 0x39, 0x73, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; + 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file diff --git a/test/core/end2end/data/server1_key.c b/test/core/end2end/data/server1_key.c index 992d3c032a9..2b6fbf3280e 100644 --- a/test/core/end2end/data/server1_key.c +++ b/test/core/end2end/data/server1_key.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,4 +105,4 @@ const char test_server1_key[] = { 0x6e, 0x68, 0x66, 0x66, 0x46, 0x79, 0x65, 0x37, 0x53, 0x42, 0x58, 0x79, 0x61, 0x67, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, - 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; + 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h index 3456ebebd4b..72bce3ed257 100644 --- a/test/core/end2end/data/ssl_test_data.h +++ b/test/core/end2end/data/ssl_test_data.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ extern const char test_server1_key[]; extern const char prod_roots_certs[]; -#endif /* __GRPC_TEST_END2END_DATA_SSL_TEST_DATA_H__ */ +#endif /* __GRPC_TEST_END2END_DATA_SSL_TEST_DATA_H__ */ \ No newline at end of file diff --git a/test/core/end2end/data/test_root_cert.c b/test/core/end2end/data/test_root_cert.c index f358b0b79ac..2b39f6c7eb0 100644 --- a/test/core/end2end/data/test_root_cert.c +++ b/test/core/end2end/data/test_root_cert.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,4 +98,4 @@ const char test_root_cert[] = { 0x31, 0x59, 0x75, 0x58, 0x32, 0x72, 0x6e, 0x65, 0x78, 0x30, 0x4a, 0x68, 0x75, 0x54, 0x51, 0x66, 0x63, 0x49, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, - 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; + 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index a61644f583c..c37b71d1c58 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,4 +221,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index e222ed62bd7..3211fffad8a 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,4 +63,4 @@ struct grpc_end2end_test_config { void grpc_end2end_tests(grpc_end2end_test_config config); -#endif /* __GRPC_TEST_END2END_END2END_TESTS_H__ */ +#endif /* __GRPC_TEST_END2END_END2END_TESTS_H__ */ \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_fake_security.c b/test/core/end2end/fixtures/chttp2_fake_security.c index 38c3b228342..de06f558562 100644 --- a/test/core/end2end/fixtures/chttp2_fake_security.c +++ b/test/core/end2end/fixtures/chttp2_fake_security.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -132,4 +132,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_fullstack.c b/test/core/end2end/fixtures/chttp2_fullstack.c index 82bf267ce50..4775d8ee6d9 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_fullstack.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,4 +114,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds.c b/test/core/end2end/fixtures/chttp2_fullstack_uds.c index 35a23698e4d..a3afe9af2e1 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_uds.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_uds.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -120,4 +120,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c index 149ac8c07bb..bd2f0600f48 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -159,4 +159,4 @@ int main(int argc, char **argv) { gpr_free(roots_filename); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c index fb241cd460c..4af50bdd614 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_socket_pair.c b/test/core/end2end/fixtures/chttp2_socket_pair.c index b5b7cee85f3..98907b901b9 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c index 2de67913d7c..7a7095b588b 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 85d95338ddb..a83c873387c 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,4 +78,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 17f37d6719f..63fbf595b2a 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -224,4 +224,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index 889db541624..99e21f296c1 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -164,4 +164,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c index 24596662422..ecedbfb44dd 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -164,4 +164,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_accept_legacy.c b/test/core/end2end/tests/cancel_after_accept_legacy.c index e87f7d648c2..72d2942e226 100644 --- a/test/core/end2end/tests/cancel_after_accept_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,4 +156,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 7f7c1e6597d..53f3d88964e 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -188,4 +188,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_cancel_after_invoke(config, cancellation_modes[i], j); } } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_after_invoke_legacy.c b/test/core/end2end/tests/cancel_after_invoke_legacy.c index 7a656f1cb0b..bcc2cc6cc6f 100644 --- a/test/core/end2end/tests/cancel_after_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_after_invoke_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -138,4 +138,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 663db5290d1..b62a5635196 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -182,4 +182,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_before_invoke_legacy.c b/test/core/end2end/tests/cancel_before_invoke_legacy.c index cdd4b43447a..3329188717c 100644 --- a/test/core/end2end/tests/cancel_before_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_before_invoke_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,4 +131,4 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_cancel_before_invoke(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index e19d28a41ed..370db8f230b 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,4 +128,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c index c9870896c00..b293489c557 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,4 +128,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index 52ebc9052fc..e88daca014b 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ static const cancellation_mode cancellation_modes[] = { {grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, {wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; -#endif +#endif \ No newline at end of file diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index f144cd17aa1..21f4b491d0d 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ static void test_invoke_request_with_census( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_census(config, "census_simple_request", test_body); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/census_simple_request_legacy.c b/test/core/end2end/tests/census_simple_request_legacy.c index f144cd17aa1..21f4b491d0d 100644 --- a/test/core/end2end/tests/census_simple_request_legacy.c +++ b/test/core/end2end/tests/census_simple_request_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ static void test_invoke_request_with_census( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_census(config, "census_simple_request", test_body); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index 07de01059cc..ac7de77deaf 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -165,4 +165,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { disappearing_server_test(config); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/disappearing_server_legacy.c b/test/core/end2end/tests/disappearing_server_legacy.c index b75b268647c..6412e621017 100644 --- a/test/core/end2end/tests/disappearing_server_legacy.c +++ b/test/core/end2end/tests/disappearing_server_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -165,4 +165,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { disappearing_server_test(config); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index 65de02ac1f0..ec760485d2d 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,4 +156,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c index 6b920bb4ade..f4f19362fdf 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,4 +156,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c index 51486cc1699..ae34e0c3c15 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,4 +124,4 @@ static void test_early_server_shutdown_finishes_tags( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_tags(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c index 123c8bc4153..68c7743b4bb 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -124,4 +124,4 @@ static void test_early_server_shutdown_finishes_tags( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_tags(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index 65972a756e8..bd83efdf38c 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -157,4 +157,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/graceful_server_shutdown_legacy.c b/test/core/end2end/tests/graceful_server_shutdown_legacy.c index 20394965d30..ecc1fb00965 100644 --- a/test/core/end2end/tests/graceful_server_shutdown_legacy.c +++ b/test/core/end2end/tests/graceful_server_shutdown_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -157,4 +157,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 10c1e0befb5..22e0a5a8936 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -180,4 +180,4 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_large_request(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/invoke_large_request_legacy.c b/test/core/end2end/tests/invoke_large_request_legacy.c index 8982d027012..54af896c7c7 100644 --- a/test/core/end2end/tests/invoke_large_request_legacy.c +++ b/test/core/end2end/tests/invoke_large_request_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -180,4 +180,4 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_large_request(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index 2ea8645ea71..d204fbc9d72 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -271,4 +271,4 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_max_concurrent_streams(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/max_concurrent_streams_legacy.c b/test/core/end2end/tests/max_concurrent_streams_legacy.c index d15368182a0..67a03ccfa7d 100644 --- a/test/core/end2end/tests/max_concurrent_streams_legacy.c +++ b/test/core/end2end/tests/max_concurrent_streams_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -271,4 +271,4 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_max_concurrent_streams(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index bd4ff06701e..ed59e0f2a94 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,4 +106,4 @@ static void test_no_op(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } +void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } \ No newline at end of file diff --git a/test/core/end2end/tests/no_op_legacy.c b/test/core/end2end/tests/no_op_legacy.c index bd4ff06701e..ed59e0f2a94 100644 --- a/test/core/end2end/tests/no_op_legacy.c +++ b/test/core/end2end/tests/no_op_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,4 +106,4 @@ static void test_no_op(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } +void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } \ No newline at end of file diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 4e27be16b4a..1cb682b3f00 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,4 +200,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/ping_pong_streaming_legacy.c b/test/core/end2end/tests/ping_pong_streaming_legacy.c index cd1d03e4cd8..8c7dcadf3f8 100644 --- a/test/core/end2end/tests/ping_pong_streaming_legacy.c +++ b/test/core/end2end/tests/ping_pong_streaming_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -200,4 +200,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index a71e3a77368..22a483b21de 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,7 +175,7 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, + f.server_cq, tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); @@ -250,4 +250,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c index b5e4eea6c86..ac18f00cda7 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -219,4 +219,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index f7394a25b03..d4dabf3c63c 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -235,4 +235,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c index a86e1aa7f95..5e1189f3566 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -205,4 +205,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index be4beb537a6..ba20879fa27 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -243,4 +243,4 @@ static void test_invoke_10_request_response_with_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_payload_legacy.c b/test/core/end2end/tests/request_response_with_payload_legacy.c index eaa88eb91ad..b621cd4755b 100644 --- a/test/core/end2end/tests/request_response_with_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_payload_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -205,4 +205,4 @@ static void test_invoke_10_request_response_with_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 637a9ffe1cf..e8213dc8e5e 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -239,4 +239,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c index d6554b27923..31058d3858d 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -210,4 +210,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index fff83dcbf0b..0d4fbd8660b 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -225,4 +225,4 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_with_large_metadata(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_with_large_metadata_legacy.c b/test/core/end2end/tests/request_with_large_metadata_legacy.c index d768f148efe..35397ea93ab 100644 --- a/test/core/end2end/tests/request_with_large_metadata_legacy.c +++ b/test/core/end2end/tests/request_with_large_metadata_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -169,4 +169,4 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_with_large_metadata(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 2b520046bb5..4b75b0057d5 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -213,4 +213,4 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/request_with_payload_legacy.c b/test/core/end2end/tests/request_with_payload_legacy.c index 8d932afb35c..26d91d13ae6 100644 --- a/test/core/end2end/tests/request_with_payload_legacy.c +++ b/test/core/end2end/tests/request_with_payload_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -169,4 +169,4 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_payload(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index ac248f9be0e..6ed48c0221a 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -214,4 +214,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/simple_delayed_request_legacy.c b/test/core/end2end/tests/simple_delayed_request_legacy.c index 6b211ecccf8..3a735f13be7 100644 --- a/test/core/end2end/tests/simple_delayed_request_legacy.c +++ b/test/core/end2end/tests/simple_delayed_request_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -172,4 +172,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); } -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index ab034795868..3fc23493c3c 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -217,4 +217,4 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_simple_request(config); test_invoke_10_simple_requests(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/simple_request_legacy.c b/test/core/end2end/tests/simple_request_legacy.c index eb984cee978..e4b809734f6 100644 --- a/test/core/end2end/tests/simple_request_legacy.c +++ b/test/core/end2end/tests/simple_request_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -229,4 +229,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_simple_request(config, "simple_request_body2", simple_request_body2); test_invoke_10_simple_requests(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/thread_stress.c b/test/core/end2end/tests/thread_stress.c index 8a5cdc7e92b..608a20659e9 100644 --- a/test/core/end2end/tests/thread_stress.c +++ b/test/core/end2end/tests/thread_stress.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -321,4 +321,4 @@ static void run_test(grpc_end2end_test_config config, int requests_in_flight) { void grpc_end2end_tests(grpc_end2end_test_config config) { run_test(config, 1000); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/thread_stress_legacy.c b/test/core/end2end/tests/thread_stress_legacy.c index 8a5cdc7e92b..608a20659e9 100644 --- a/test/core/end2end/tests/thread_stress_legacy.c +++ b/test/core/end2end/tests/thread_stress_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -321,4 +321,4 @@ static void run_test(grpc_end2end_test_config config, int requests_in_flight) { void grpc_end2end_tests(grpc_end2end_test_config config) { run_test(config, 1000); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c index e7b7da17569..58b7492c25b 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -196,4 +196,4 @@ static void test_writes_done_hangs_with_pending_read( void grpc_end2end_tests(grpc_end2end_test_config config) { test_writes_done_hangs_with_pending_read(config); -} +} \ No newline at end of file diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c index e7b7da17569..58b7492c25b 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -196,4 +196,4 @@ static void test_writes_done_hangs_with_pending_read( void grpc_end2end_tests(grpc_end2end_test_config config) { test_writes_done_hangs_with_pending_read(config); -} +} \ No newline at end of file diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 0a113f033f7..28bf967b2f9 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -229,4 +229,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.c index 1db2f1a7916..c05798bbb7b 100644 --- a/test/core/fling/fling_stream_test.c +++ b/test/core/fling/fling_stream_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,4 +109,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} +} \ No newline at end of file diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c index 4f41a21aaaf..5d733d14be5 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,4 +109,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} +} \ No newline at end of file diff --git a/test/core/fling/server.c b/test/core/fling/server.c index ca0683fa679..27a69c83f77 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -316,4 +316,4 @@ int main(int argc, char **argv) { grpc_completion_queue_destroy(cq); grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/httpcli/format_request_test.c b/test/core/httpcli/format_request_test.c index ec66f960042..0cad9ba5151 100644 --- a/test/core/httpcli/format_request_test.c +++ b/test/core/httpcli/format_request_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -162,4 +162,4 @@ int main(int argc, char **argv) { test_format_post_request_content_type_override(); return 0; -} +} \ No newline at end of file diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c index c901e595f63..7d9aa75b778 100644 --- a/test/core/httpcli/httpcli_test.c +++ b/test/core/httpcli/httpcli_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,4 +99,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/httpcli/parser_test.c b/test/core/httpcli/parser_test.c index 455f6a63939..4718107edd1 100644 --- a/test/core/httpcli/parser_test.c +++ b/test/core/httpcli/parser_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,4 +152,4 @@ int main(int argc, char **argv) { } return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/alarm_heap_test.c b/test/core/iomgr/alarm_heap_test.c index abb1086a22d..5defe97885d 100644 --- a/test/core/iomgr/alarm_heap_test.c +++ b/test/core/iomgr/alarm_heap_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -274,4 +274,4 @@ int main(int argc, char **argv) { } return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/alarm_list_test.c b/test/core/iomgr/alarm_list_test.c index a2509512318..a1a56d6132c 100644 --- a/test/core/iomgr/alarm_list_test.c +++ b/test/core/iomgr/alarm_list_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -141,4 +141,4 @@ int main(int argc, char **argv) { add_test(); destruction_test(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/alarm_test.c b/test/core/iomgr/alarm_test.c index aec3a50efc6..537bed47f75 100644 --- a/test/core/iomgr/alarm_test.c +++ b/test/core/iomgr/alarm_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -219,4 +219,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_grpc_alarm(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index 125cde46785..ea350c923ce 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -366,4 +366,4 @@ void grpc_endpoint_tests(grpc_endpoint_test_config config) { read_and_write_test(config, 1000000, 100000, 1, 0); read_and_write_test(config, 100000000, 100000, 1, 1); shutdown_during_write_test(config, 1000); -} +} \ No newline at end of file diff --git a/test/core/iomgr/endpoint_tests.h b/test/core/iomgr/endpoint_tests.h index c76c9483c6a..f555a54203b 100644 --- a/test/core/iomgr/endpoint_tests.h +++ b/test/core/iomgr/endpoint_tests.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,4 +54,4 @@ struct grpc_endpoint_test_config { void grpc_endpoint_tests(grpc_endpoint_test_config config); -#endif /* __GRPC_TEST_IOMGR_ENDPOINT_TESTS_H__ */ +#endif /* __GRPC_TEST_IOMGR_ENDPOINT_TESTS_H__ */ \ No newline at end of file diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 05c91ffdd4d..7f1f7412639 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -479,4 +479,4 @@ int main(int argc, char **argv) { test_grpc_fd_change(); grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 1f97724e607..859aaf4629a 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -129,4 +129,4 @@ int main(int argc, char** argv) { test_unparseable_hostports(); grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.c index 6cbdc4e21c1..110b09998d3 100644 --- a/test/core/iomgr/sockaddr_utils_test.c +++ b/test/core/iomgr/sockaddr_utils_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -230,4 +230,4 @@ int main(int argc, char **argv) { test_sockaddr_to_string(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c index 78709f47fbc..c8f1f53dbb3 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -176,4 +176,4 @@ int main(void) { test_times_out(); grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index f52ae229812..a00b54da885 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -492,4 +492,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index ae6994ef071..8409fb4f628 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -164,4 +164,4 @@ int main(int argc, char **argv) { gpr_mu_destroy(&mu); gpr_cv_destroy(&cv); return 0; -} +} \ No newline at end of file diff --git a/test/core/iomgr/time_averaged_stats_test.c b/test/core/iomgr/time_averaged_stats_test.c index bbfeab56330..4329ee5198c 100644 --- a/test/core/iomgr/time_averaged_stats_test.c +++ b/test/core/iomgr/time_averaged_stats_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -205,4 +205,4 @@ int main(int argc, char **argv) { no_regress_some_persist_test(); some_regress_some_persist_test(); return 0; -} +} \ No newline at end of file diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.c index a761a670f0e..23ea798feac 100644 --- a/test/core/json/json_rewrite.c +++ b/test/core/json/json_rewrite.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -258,4 +258,4 @@ int main(int argc, char** argv) { gpr_cmdline_destroy(cl); return rewrite(stdin, stdout, indent) ? 0 : 1; -} +} \ No newline at end of file diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.c index 4ce406c9909..1b3383653df 100644 --- a/test/core/json/json_rewrite_test.c +++ b/test/core/json/json_rewrite_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -319,4 +319,4 @@ int main(int argc, char** argv) { test_rewrites(); gpr_log(GPR_INFO, "json_rewrite_test success"); return 0; -} +} \ No newline at end of file diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c index 6d0227ad39b..1cfbbc4105a 100644 --- a/test/core/json/json_test.c +++ b/test/core/json/json_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ int main(int argc, char **argv) { test_atypical(); gpr_log(GPR_INFO, "json_test success"); return 0; -} +} \ No newline at end of file diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index 9a6f518399c..6db618409cf 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.c +++ b/test/core/network_benchmarks/low_level_ping_pong.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -678,4 +678,4 @@ int main(int argc, char **argv) { gpr_cmdline_destroy(cmdline); return error; -} +} \ No newline at end of file diff --git a/test/core/security/base64_test.c b/test/core/security/base64_test.c index b3ba491a341..e306ea3cf6d 100644 --- a/test/core/security/base64_test.c +++ b/test/core/security/base64_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -182,4 +182,4 @@ int main(int argc, char **argv) { test_url_safe_unsafe_mismtach_failure(); test_rfc4648_test_vectors(); return 0; -} +} \ No newline at end of file diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index dd90a7edc85..cefe969c229 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -622,4 +622,4 @@ int main(int argc, char **argv) { test_service_accounts_creds_http_failure(); test_service_accounts_creds_signing_failure(); return 0; -} +} \ No newline at end of file diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index c5cc3adfd69..dbd5f312626 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -174,4 +174,4 @@ int main(int argc, char **argv) { gpr_cmdline_destroy(cl); grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c index 2a9c8f88b24..0457f6499af 100644 --- a/test/core/security/json_token_test.c +++ b/test/core/security/json_token_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -374,4 +374,4 @@ int main(int argc, char **argv) { test_parse_json_key_failure_no_private_key(); test_jwt_encode_and_sign(); return 0; -} +} \ No newline at end of file diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index 456515bfd50..1d0e36ddafc 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -201,4 +201,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index e2ad78a6f2b..8d15a9becc7 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -586,4 +586,4 @@ void test_performance(void) { 1000 * write_time_micro / nrecords, (write_size * nrecords) / write_time_micro / 1000); } -} +} \ No newline at end of file diff --git a/test/core/statistics/census_log_tests.h b/test/core/statistics/census_log_tests.h index 764b9fde195..89404c620b0 100644 --- a/test/core/statistics/census_log_tests.h +++ b/test/core/statistics/census_log_tests.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,4 +48,4 @@ void test_multiple_writers(); void test_performance(); void test_small_log(); -#endif /* __GRPC_TEST_STATISTICS_LOG_TESTS_H__ */ +#endif /* __GRPC_TEST_STATISTICS_LOG_TESTS_H__ */ \ No newline at end of file diff --git a/test/core/statistics/census_stub_test.c b/test/core/statistics/census_stub_test.c index c651eaf21ff..595c1f94ff0 100644 --- a/test/core/statistics/census_stub_test.c +++ b/test/core/statistics/census_stub_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); test_census_stubs(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index e8e4d8b6f1d..a5d5fada7d0 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -298,4 +298,4 @@ int main(int argc, char** argv) { test_insertion_with_same_key(); test_insertion_and_deletion_with_high_collision_rate(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/multiple_writers_circular_buffer_test.c b/test/core/statistics/multiple_writers_circular_buffer_test.c index 298900a6612..2db36997b19 100644 --- a/test/core/statistics/multiple_writers_circular_buffer_test.c +++ b/test/core/statistics/multiple_writers_circular_buffer_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_multiple_writers_circular_log(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/multiple_writers_test.c b/test/core/statistics/multiple_writers_test.c index ae6fd956514..d87847c7f92 100644 --- a/test/core/statistics/multiple_writers_test.c +++ b/test/core/statistics/multiple_writers_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_multiple_writers(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/performance_test.c b/test/core/statistics/performance_test.c index 40fe4c59114..81b2ed4553d 100644 --- a/test/core/statistics/performance_test.c +++ b/test/core/statistics/performance_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_performance(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/quick_test.c b/test/core/statistics/quick_test.c index 8df32cf1117..eb025d42e01 100644 --- a/test/core/statistics/quick_test.c +++ b/test/core/statistics/quick_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ int main(int argc, char **argv) { test_fill_log_with_straddling_records(); test_fill_circular_log_with_straddling_records(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/rpc_stats_test.c b/test/core/statistics/rpc_stats_test.c index 1e929d18ef0..1ac4ce92c29 100644 --- a/test/core/statistics/rpc_stats_test.c +++ b/test/core/statistics/rpc_stats_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -194,4 +194,4 @@ int main(int argc, char** argv) { test_record_stats_on_unknown_op_id(); test_record_stats_with_trace_store_uninitialized(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/small_log_test.c b/test/core/statistics/small_log_test.c index ff3aee9eae3..eccae087b7a 100644 --- a/test/core/statistics/small_log_test.c +++ b/test/core/statistics/small_log_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_small_log(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/trace_test.c b/test/core/statistics/trace_test.c index 97e1463ae13..21cc17be516 100644 --- a/test/core/statistics/trace_test.c +++ b/test/core/statistics/trace_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -252,4 +252,4 @@ int main(int argc, char** argv) { test_trace_print(); test_get_active_ops(); return 0; -} +} \ No newline at end of file diff --git a/test/core/statistics/window_stats_test.c b/test/core/statistics/window_stats_test.c index 1fe77477408..c15469c20d5 100644 --- a/test/core/statistics/window_stats_test.c +++ b/test/core/statistics/window_stats_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -314,4 +314,4 @@ int main(int argc, char* argv[]) { rolling_time_test(); infinite_interval_test(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/cancellable_test.c b/test/core/support/cancellable_test.c index e90c999921d..c073597a83f 100644 --- a/test/core/support/cancellable_test.c +++ b/test/core/support/cancellable_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -157,4 +157,4 @@ int main(int argc, char *argv[]) { grpc_test_init(argc, argv); test(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.c index 1d15c662898..677415a6eca 100644 --- a/test/core/support/cmdline_test.c +++ b/test/core/support/cmdline_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -290,4 +290,4 @@ int main(int argc, char **argv) { test_flag_val_false(); test_many(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/env_test.c b/test/core/support/env_test.c index 36d7adf80b5..025caa17c03 100644 --- a/test/core/support/env_test.c +++ b/test/core/support/env_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_setenv_getenv(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/file_test.c b/test/core/support/file_test.c index b089954186c..f111a074482 100644 --- a/test/core/support/file_test.c +++ b/test/core/support/file_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -156,4 +156,4 @@ int main(int argc, char **argv) { test_load_small_file(); test_load_big_file(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.c index 4769ce05998..9fb3319e6fc 100644 --- a/test/core/support/histogram_test.c +++ b/test/core/support/histogram_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,4 +175,4 @@ int main(void) { test_percentile(); test_merge(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.c index 6d14fab8636..22dbb0e81ad 100644 --- a/test/core/support/host_port_test.c +++ b/test/core/support/host_port_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,4 +70,4 @@ int main(int argc, char **argv) { test_join_host_port_garbage(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/log_test.c b/test/core/support/log_test.c index 3ee40b6d76d..dfe30d45640 100644 --- a/test/core/support/log_test.c +++ b/test/core/support/log_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,4 +56,4 @@ int main(int argc, char **argv) { gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3); /* TODO(ctiller): should we add a GPR_ASSERT failure test here */ return 0; -} +} \ No newline at end of file diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.c index 366bcb20bf6..63b938c0104 100644 --- a/test/core/support/murmur_hash_test.c +++ b/test/core/support/murmur_hash_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,4 +84,4 @@ int main(int argc, char **argv) { gpr_murmur_hash3("xyz", 3, 0); verification_test(gpr_murmur_hash3, 0xB0F57EE3); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/slice_buffer_test.c b/test/core/support/slice_buffer_test.c index 030d1d4249a..3788d66c517 100644 --- a/test/core/support/slice_buffer_test.c +++ b/test/core/support/slice_buffer_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,4 +67,4 @@ int main(int argc, char **argv) { gpr_slice_buffer_destroy(&buf); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/slice_test.c b/test/core/support/slice_test.c index 469d7dedc3b..69cb56b4049 100644 --- a/test/core/support/slice_test.c +++ b/test/core/support/slice_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -224,4 +224,4 @@ int main(int argc, char **argv) { } test_slice_from_copied_string_works(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c index a01ec6f87f3..4beabbe262a 100644 --- a/test/core/support/string_test.c +++ b/test/core/support/string_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -151,4 +151,4 @@ int main(int argc, char **argv) { test_parse_uint32(); test_asprintf(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c index 540d9d1c643..827d3d322a2 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -448,4 +448,4 @@ int main(int argc, char *argv[]) { test("refcount", &refinc, &refcheck, 1); test("timedevent", &inc_with_1ms_delay_event, NULL, 1); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index c70e025326f..6e10b23be52 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -87,4 +87,4 @@ int main(int argc, char *argv[]) { grpc_test_init(argc, argv); test(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index 56f927787bc..c9833dd4df8 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -252,4 +252,4 @@ int main(int argc, char *argv[]) { test_sticky_infinities(); test_similar(); return 0; -} +} \ No newline at end of file diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.c index 716861665b5..92f44b331be 100644 --- a/test/core/support/useful_test.c +++ b/test/core/support/useful_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,4 +56,4 @@ int main(int argc, char **argv) { GPR_ASSERT(GPR_ARRAY_SIZE(five) == 5); return 0; -} +} \ No newline at end of file diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index d78dd641ad6..51b1d8b8b15 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -108,4 +108,4 @@ int main(int argc, char **argv) { test_read_one_slice(); test_read_one_slice_malloc(); return 0; -} +} \ No newline at end of file diff --git a/test/core/surface/completion_queue_benchmark.c b/test/core/surface/completion_queue_benchmark.c index e1b9d0d035a..15b99db774d 100644 --- a/test/core/surface/completion_queue_benchmark.c +++ b/test/core/surface/completion_queue_benchmark.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -165,4 +165,4 @@ int main(void) { } return 0; -} +} \ No newline at end of file diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 875cf3e52aa..3374da45b01 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -405,4 +405,4 @@ int main(int argc, char **argv) { test_threading(10, 10); grpc_iomgr_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 0a6edc1630d..497b4f926da 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,4 +77,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/core/surface/multi_init_test.c b/test/core/surface/multi_init_test.c index dced8825746..e5a753766ea 100644 --- a/test/core/surface/multi_init_test.c +++ b/test/core/surface/multi_init_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,4 +60,4 @@ int main(int argc, char **argv) { test(3); test_mixed(); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.c index 7a70b0ca7f0..b65f4dffbec 100644 --- a/test/core/transport/chttp2/alpn_test.c +++ b/test/core/transport/chttp2/alpn_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,4 +52,4 @@ int main(int argc, char **argv) { test_alpn_success(); test_alpn_failure(); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c index 048ed7edd3c..7e248968a71 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -184,4 +184,4 @@ int main(int argc, char **argv) { expect_binary_header("-bin", 0); return all_ok ? 0 : 1; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c index 3be6c366f5c..b4769cb55f0 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -222,4 +222,4 @@ int main(int argc, char **argv) { test_vectors(GRPC_SLICE_SPLIT_MERGE_ALL); test_vectors(GRPC_SLICE_SPLIT_ONE_BYTE); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index d155dee9dc2..45036942337 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -271,4 +271,4 @@ int main(int argc, char **argv) { test_many_additions(); test_find(); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/status_conversion_test.c b/test/core/transport/chttp2/status_conversion_test.c index bb5d7b88608..b39b58d323c 100644 --- a/test/core/transport/chttp2/status_conversion_test.c +++ b/test/core/transport/chttp2/status_conversion_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,4 +135,4 @@ int main(int argc, char **argv) { } return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c index 5e8ec0a1af8..94c1c96050e 100644 --- a/test/core/transport/chttp2/stream_encoder_test.c +++ b/test/core/transport/chttp2/stream_encoder_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -330,4 +330,4 @@ int main(int argc, char **argv) { TEST(test_decode_random_headers_89); TEST(test_decode_random_headers_144); return g_failure; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.c index 9b4446f7f80..24c6b5998e1 100644 --- a/test/core/transport/chttp2/stream_map_test.c +++ b/test/core/transport/chttp2/stream_map_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -225,4 +225,4 @@ int main(int argc, char **argv) { } return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c index 56a1e6ee638..39c993ae595 100644 --- a/test/core/transport/chttp2/timeout_encoding_test.c +++ b/test/core/transport/chttp2/timeout_encoding_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,4 +146,4 @@ int main(int argc, char **argv) { test_decoding(); test_decoding_fails(); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/chttp2_transport_end2end_test.c b/test/core/transport/chttp2_transport_end2end_test.c index 34e3aeba383..4d278d44acf 100644 --- a/test/core/transport/chttp2_transport_end2end_test.c +++ b/test/core/transport/chttp2_transport_end2end_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,4 +117,4 @@ int main(int argc, char **argv) { gpr_log(GPR_INFO, "exiting"); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index a2d190e1c4e..9947a4b4ab8 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -279,4 +279,4 @@ int main(int argc, char **argv) { test_slices_work(); test_base64_and_huffman_works(); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/stream_op_test.c b/test/core/transport/stream_op_test.c index e6649ec97c2..e69c5ec9dfe 100644 --- a/test/core/transport/stream_op_test.c +++ b/test/core/transport/stream_op_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -122,4 +122,4 @@ int main(int argc, char **argv) { gpr_slice_unref(test_slice_4); return 0; -} +} \ No newline at end of file diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c index 2cd033bf3ac..4bb36a1b61f 100644 --- a/test/core/transport/transport_end2end_tests.c +++ b/test/core/transport/transport_end2end_tests.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -930,4 +930,4 @@ void grpc_transport_end2end_tests(grpc_transport_test_config *config) { grpc_mdctx_orphan(g_metadata_context); gpr_log(GPR_INFO, "tests completed ok"); -} +} \ No newline at end of file diff --git a/test/core/transport/transport_end2end_tests.h b/test/core/transport/transport_end2end_tests.h index f1447e2e983..e181b45a6f4 100644 --- a/test/core/transport/transport_end2end_tests.h +++ b/test/core/transport/transport_end2end_tests.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,4 +65,4 @@ typedef struct grpc_transport_test_config { /* Run the test suite on one configuration */ void grpc_transport_end2end_tests(grpc_transport_test_config *config); -#endif /* __GRPC_TEST_TRANSPORT_TRANSPORT_END2END_TESTS_H__ */ +#endif /* __GRPC_TEST_TRANSPORT_TRANSPORT_END2END_TESTS_H__ */ \ No newline at end of file diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.c index 46bfc1f533c..659322e05d3 100644 --- a/test/core/util/grpc_profiler.c +++ b/test/core/util/grpc_profiler.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ void grpc_profiler_start(const char *filename) { } void grpc_profiler_stop(void) {} -#endif +#endif \ No newline at end of file diff --git a/test/core/util/grpc_profiler.h b/test/core/util/grpc_profiler.h index a35472db735..d4b9f6330c3 100644 --- a/test/core/util/grpc_profiler.h +++ b/test/core/util/grpc_profiler.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ void grpc_profiler_stop(); } #endif /* __cplusplus */ -#endif /* __GRPC_TEST_UTIL_GRPC_PROFILER_H__ */ +#endif /* __GRPC_TEST_UTIL_GRPC_PROFILER_H__ */ \ No newline at end of file diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.c index 888d03bc68b..137ce561277 100644 --- a/test/core/util/parse_hexstring.c +++ b/test/core/util/parse_hexstring.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,4 +67,4 @@ gpr_slice parse_hexstring(const char *hexstring) { } return slice; -} +} \ No newline at end of file diff --git a/test/core/util/parse_hexstring.h b/test/core/util/parse_hexstring.h index 7477986d609..4cb1779b5f5 100644 --- a/test/core/util/parse_hexstring.h +++ b/test/core/util/parse_hexstring.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,4 +38,4 @@ gpr_slice parse_hexstring(const char *hexstring); -#endif /* __GRPC_TEST_UTIL_PARSE_HEXSTRING_H_ */ +#endif /* __GRPC_TEST_UTIL_PARSE_HEXSTRING_H_ */ \ No newline at end of file diff --git a/test/core/util/port.h b/test/core/util/port.h index 94cc1d5bd36..bed94c9a0ac 100644 --- a/test/core/util/port.h +++ b/test/core/util/port.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,4 +49,4 @@ int grpc_pick_unused_port_or_die(); } #endif -#endif /* __GRPC_TEST_UTIL_PORT_H__ */ +#endif /* __GRPC_TEST_UTIL_PORT_H__ */ \ No newline at end of file diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index 067ca0fafa5..c4868a16c7b 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,4 +146,4 @@ int grpc_pick_unused_port_or_die(void) { return port; } -#endif /* GPR_POSIX_SOCKET */ +#endif /* GPR_POSIX_SOCKET */ \ No newline at end of file diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.c index 1682ef4fcde..c4d5f12e797 100644 --- a/test/core/util/slice_splitter.c +++ b/test/core/util/slice_splitter.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,4 +135,4 @@ gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices) { } return gpr_slice_new(out, length, gpr_free); -} +} \ No newline at end of file diff --git a/test/core/util/slice_splitter.h b/test/core/util/slice_splitter.h index 7aed9ea9224..9f6f354aefa 100644 --- a/test/core/util/slice_splitter.h +++ b/test/core/util/slice_splitter.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,4 +65,4 @@ gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices); const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode); -#endif /* __GRPC_TEST_UTIL_SLICE_SPLITTER_H__ */ +#endif /* __GRPC_TEST_UTIL_SLICE_SPLITTER_H__ */ \ No newline at end of file diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 5f3b55da75b..41768f2f72d 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,4 +55,4 @@ void grpc_test_init(int argc, char **argv) { /* seed rng with pid, so we don't end up with the same random numbers as a concurrently running test binary */ srand(seed()); -} +} \ No newline at end of file diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index e24501508f6..b827e535446 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ void grpc_test_init(int argc, char **argv); } #endif /* __cplusplus */ -#endif /* __GRPC_TEST_UTIL_TEST_CONFIG_H__ */ +#endif /* __GRPC_TEST_UTIL_TEST_CONFIG_H__ */ \ No newline at end of file diff --git a/test/cpp/client/channel_arguments_test.cc b/test/cpp/client/channel_arguments_test.cc index 3cd6add167b..59b5910e1ec 100644 --- a/test/cpp/client/channel_arguments_test.cc +++ b/test/cpp/client/channel_arguments_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,4 +121,4 @@ TEST_F(ChannelArgumentsTest, SetString) { int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -} +} \ No newline at end of file diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index 174d2187b0b..c26612caf2f 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,4 +61,4 @@ int main(int argc, char **argv) { int ret = RUN_ALL_TESTS(); grpc_shutdown(); return ret; -} +} \ No newline at end of file diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 7e827cb0e57..7057fa07d0c 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -525,4 +525,4 @@ int main(int argc, char** argv) { grpc_shutdown(); google::protobuf::ShutdownProtobufLibrary(); return result; -} +} \ No newline at end of file diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 974717f6e2e..c70930387af 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -447,4 +447,4 @@ int main(int argc, char** argv) { grpc_shutdown(); google::protobuf::ShutdownProtobufLibrary(); return result; -} +} \ No newline at end of file diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 57a503f84f9..76cb05eee41 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -429,4 +429,4 @@ int main(int argc, char** argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index a8399779b96..b08030fce78 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -224,4 +224,4 @@ int main(int argc, char** argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc index d2c83aad3df..1bca2524c2b 100644 --- a/test/cpp/qps/client.cc +++ b/test/cpp/qps/client.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -242,4 +242,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index 718046170f0..6a30d5d8d46 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -152,7 +152,7 @@ int main(int argc, char** argv) { google::ParseCommandLineFlags(&argc, &argv, true); signal(SIGINT, sigint_handler); - + GPR_ASSERT(FLAGS_port != 0); GPR_ASSERT(!FLAGS_enable_ssl); RunServer(); @@ -160,4 +160,3 @@ int main(int argc, char** argv) { grpc_shutdown(); return 0; } - diff --git a/test/cpp/server/thread_pool_test.cc b/test/cpp/server/thread_pool_test.cc index cae1a105c96..bdaf523b2f6 100644 --- a/test/cpp/server/thread_pool_test.cc +++ b/test/cpp/server/thread_pool_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,4 +74,4 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); return result; -} +} \ No newline at end of file diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index 301e9a3c3a3..bd6e62d1514 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,4 +96,4 @@ std::shared_ptr CreateTestChannel(const grpc::string& server, return CreateTestChannel(server, "foo.test.google.com", enable_ssl, false); } -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 4e326559bfd..19a9d2e83bb 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -56,4 +56,4 @@ std::shared_ptr CreateTestChannel( } // namespace grpc -#endif // __GRPCPP_TEST_UTIL_CREATE_TEST_CHANNEL_H_ +#endif // __GRPCPP_TEST_UTIL_CREATE_TEST_CHANNEL_H_ \ No newline at end of file diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc index 0c32311badb..d7dacf03f66 100644 --- a/test/cpp/util/status_test.cc +++ b/test/cpp/util/status_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,4 +73,4 @@ int main(int argc, char **argv) { static_cast(GRPC_STATUS_DATA_LOSS)); return 0; -} +} \ No newline at end of file diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index f5942aa85a1..a258eb02019 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,4 +68,4 @@ TEST_F(TimeTest, InfFuture) { } } // namespace -} // namespace grpc +} // namespace grpc \ No newline at end of file diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh index 9903f0e7835..d37288a078c 100755 --- a/tools/buildgen/generate_projects.sh +++ b/tools/buildgen/generate_projects.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -72,4 +72,3 @@ for dir in . ; do done rm $end2end_test_build - diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index fbe01841d98..68fac49d7d5 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -41,15 +41,19 @@ os.chdir(ROOT) # parse command line argp = argparse.ArgumentParser(description='copyright checker') -argp.add_argument('-o', '--output', - default='details', +argp.add_argument('-o', '--output', + default='details', choices=['list', 'details']) -argp.add_argument('-s', '--skips', +argp.add_argument('-s', '--skips', default=0, action='store_const', const=1) -argp.add_argument('-a', '--ancient', - default=0, +argp.add_argument('-a', '--ancient', + default=0, + action='store_const', + const=1) +argp.add_argument('-f', '--fix', + default=0, action='store_const', const=1) args = argp.parse_args() @@ -94,7 +98,7 @@ def log(cond, why, filename): for filename in subprocess.check_output('git ls-tree -r --name-only -r HEAD', shell=True).splitlines(): ext = os.path.splitext(filename)[1] - if ext not in LICENSE_TEXT: + if ext not in LICENSE_TEXT: log(args.skips, 'skip', filename) continue license = LICENSE_TEXT[ext] @@ -105,6 +109,9 @@ for filename in subprocess.check_output('git ls-tree -r --name-only -r HEAD', pass elif old_license in text: log(args.ancient, 'old', filename) + if args.fix: + with open(filename, 'w') as f: + f.write(text.replace('Copyright 2014, Google Inc.', 'Copyright 2015, Google Inc.')) elif 'DO NOT EDIT' not in text and 'AssemblyInfo.cs' not in filename: log(1, 'missing', filename) diff --git a/tools/gce_setup/builder.sh b/tools/gce_setup/builder.sh index 9fd1e1c61e6..1a175dee9dd 100755 --- a/tools/gce_setup/builder.sh +++ b/tools/gce_setup/builder.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -51,8 +51,8 @@ main() { # launch images for all languages on server grpc_launch_servers grpc-docker-server - + } set -x -main "$@" +main "$@" \ No newline at end of file diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index ffb5b858229..dd076ccf747 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -50,4 +50,4 @@ main() { } set -x -main "$@" +main "$@" \ No newline at end of file diff --git a/tools/gce_setup/compute_extras.sh b/tools/gce_setup/compute_extras.sh index 4dab4c093e9..7b691b064ef 100755 --- a/tools/gce_setup/compute_extras.sh +++ b/tools/gce_setup/compute_extras.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -281,4 +281,4 @@ find_named_ip() { gcloud compute addresses list | sed -e 's/ \+/ /g' \ | grep $name | cut -d' ' -f 3 -} +} \ No newline at end of file diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 37e24949f67..0ffce7cd0c7 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -795,7 +795,7 @@ grpc_interop_test() { echo " $ssh_cmd" echo "on $host" [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & PID=$! sleep 10 echo "pid is $PID" @@ -850,7 +850,7 @@ grpc_cloud_prod_test() { echo " $ssh_cmd" echo "on $host" [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & PID=$! sleep 10 echo "pid is $PID" @@ -1117,4 +1117,4 @@ _grpc_gce_test_flags() { echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" } -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python +# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python \ No newline at end of file diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index a1d7813b201..cebae549dc4 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -64,4 +64,4 @@ main() { } set -x -main "$@" +main "$@" \ No newline at end of file diff --git a/tools/gce_setup/new_grpc_docker_builder.sh b/tools/gce_setup/new_grpc_docker_builder.sh index 70a2f125402..4bef368ebaf 100755 --- a/tools/gce_setup/new_grpc_docker_builder.sh +++ b/tools/gce_setup/new_grpc_docker_builder.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -179,4 +179,4 @@ main() { } set -x -main "$@" +main "$@" \ No newline at end of file diff --git a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh index a084fe08d6a..388803aa3b8 100755 --- a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh +++ b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -167,4 +167,4 @@ main() { } set -x -main "$@" +main "$@" \ No newline at end of file diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index 13bf3124fa3..1d56856c0b5 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -534,4 +534,4 @@ grpc_docker_sync_service_account() { return 1 } gsutil cp $src $gcs_acct_path $local_acct_path -} +} \ No newline at end of file diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh index 85feacfb86c..29a1fa12d03 100755 --- a/tools/run_tests/build_node.sh +++ b/tools/run_tests/build_node.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -45,4 +45,4 @@ export GRPC_NO_INSTALL=yes cd src/node -npm install +npm install \ No newline at end of file diff --git a/tools/run_tests/build_php.sh b/tools/run_tests/build_php.sh index d32969f39ca..bec0ce4553f 100755 --- a/tools/run_tests/build_php.sh +++ b/tools/run_tests/build_php.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -44,4 +44,4 @@ cd src/php cd ext/grpc phpize ./configure --enable-grpc=$root -make +make \ No newline at end of file diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh index 084b3893ab0..d7a58838b43 100755 --- a/tools/run_tests/build_python.sh +++ b/tools/run_tests/build_python.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,4 +40,4 @@ virtualenv python2.7_virtual_environment ln -sf $root/include/grpc python2.7_virtual_environment/include/grpc source python2.7_virtual_environment/bin/activate pip install enum34==1.0.4 futures==2.2.0 protobuf==3.0.0-alpha-1 -CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src +CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src \ No newline at end of file diff --git a/tools/run_tests/run_lcov.sh b/tools/run_tests/run_lcov.sh index 7696536141d..292aec45482 100755 --- a/tools/run_tests/run_lcov.sh +++ b/tools/run_tests/run_lcov.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -43,4 +43,3 @@ if which xdg-open > /dev/null then xdg-open file://$out/index.html fi - diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh index 525b34a7095..699b5f3fa13 100755 --- a/tools/run_tests/run_node.sh +++ b/tools/run_tests/run_node.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -35,4 +35,4 @@ cd $(dirname $0)/../.. root=`pwd` -$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test +$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test \ No newline at end of file diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index fc7e4871182..7ce4b253427 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright 2014, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -51,4 +51,4 @@ python2.7 -B -m grpc.framework.face.future_invocation_asynchronous_event_service python2.7 -B -m grpc.framework.foundation._later_test python2.7 -B -m grpc.framework.foundation._logging_pool_test # TODO(nathaniel): Get tests working under 3.4 (requires 3.X-friendly protobuf) -# python3.4 -B -m unittest discover -s src/python -p '*.py' +# python3.4 -B -m unittest discover -s src/python -p '*.py' \ No newline at end of file diff --git a/vsprojects/third_party/openssl/buildinf.h b/vsprojects/third_party/openssl/buildinf.h index 8249d5e7ff0..f4345e461ec 100644 --- a/vsprojects/third_party/openssl/buildinf.h +++ b/vsprojects/third_party/openssl/buildinf.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,4 +43,4 @@ #define CFLAGS "cl /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE " #define PLATFORM "VC-WIN32" #define DATE "Sat Dec 13 01:17:07 2014" -#endif +#endif \ No newline at end of file diff --git a/vsprojects/third_party/openssl/opensslconf.h b/vsprojects/third_party/openssl/opensslconf.h index f0404453843..398d5eee19f 100644 --- a/vsprojects/third_party/openssl/opensslconf.h +++ b/vsprojects/third_party/openssl/opensslconf.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -290,4 +290,4 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED !!!!! #endif /* HEADER_DES_LOCL_H */ #ifdef __cplusplus } -#endif +#endif \ No newline at end of file From 645466e0899bfe811acc746d23d8eb15f784fdd3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 09:18:33 -0800 Subject: [PATCH 140/232] Initial sketch --- include/grpc++/completion_queue.h | 9 ++++- include/grpc++/impl/call.h | 4 +-- include/grpc++/server_context.h | 20 +++++++++++ src/cpp/client/client_unary_call.cc | 5 +-- src/cpp/common/call.cc | 3 +- src/cpp/common/completion_queue.cc | 51 +++++++++++++++++++---------- src/cpp/server/server.cc | 9 +++-- src/cpp/server/server_context.cc | 18 ++++++++-- 8 files changed, 90 insertions(+), 29 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index c5267f8563c..9a4fa9f2e10 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -55,6 +55,7 @@ class ServerReaderWriter; class CompletionQueue; class Server; +class ServerContext; class CompletionQueueTag { public: @@ -62,7 +63,9 @@ class CompletionQueueTag { // Called prior to returning from Next(), return value // is the status of the operation (return status is the default thing // to do) - virtual void FinalizeResult(void **tag, bool *status) = 0; + // If this function returns false, the tag is dropped and not returned + // from the completion queue + virtual bool FinalizeResult(void **tag, bool *status) = 0; }; // grpc_completion_queue wrapper class @@ -99,6 +102,7 @@ class CompletionQueue { template friend class ::grpc::ServerReaderWriter; friend class ::grpc::Server; + friend class ::grpc::ServerContext; friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, @@ -109,6 +113,9 @@ class CompletionQueue { // Cannot be mixed with calls to Next(). bool Pluck(CompletionQueueTag *tag); + // Does a single polling pluck on tag + void TryPluck(CompletionQueueTag *tag); + grpc_completion_queue *cq_; // owned }; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 4ab226339d3..20c60fc5455 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -65,7 +65,7 @@ class CallOpBuffer : public CompletionQueueTag { void AddSendInitialMetadata( std::multimap *metadata); void AddSendInitialMetadata(ClientContext *ctx); - void AddRecvInitialMetadata(ClientContext* ctx); + void AddRecvInitialMetadata(ClientContext *ctx); void AddSendMessage(const google::protobuf::Message &message); void AddRecvMessage(google::protobuf::Message *message); void AddClientSendClose(); @@ -80,7 +80,7 @@ class CallOpBuffer : public CompletionQueueTag { void FillOps(grpc_op *ops, size_t *nops); // Called by completion queue just prior to returning from Next() or Pluck() - void FinalizeResult(void **tag, bool *status) override; + bool FinalizeResult(void **tag, bool *status) override; bool got_message = false; diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 853f91f4671..e2e14d9ef76 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -34,8 +34,11 @@ #ifndef __GRPCPP_SERVER_CONTEXT_H_ #define __GRPCPP_SERVER_CONTEXT_H_ +#include + #include #include +#include #include "config.h" @@ -76,6 +79,8 @@ class ServerContext final { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); + bool IsCancelled() { return completion_op_.CheckCancelled(cq_); } + std::multimap client_metadata() { return client_metadata_; } @@ -97,11 +102,26 @@ class ServerContext final { template friend class ::grpc::ServerReaderWriter; + class CompletionOp final : public CompletionQueueTag { + public: + bool FinalizeResult(void** tag, bool* status) override; + + bool CheckCancelled(CompletionQueue* cq); + + private: + std::mutex mu_; + bool finalized_ = false; + int cancelled_ = 0; + }; + ServerContext(gpr_timespec deadline, grpc_metadata* metadata, size_t metadata_count); + CompletionOp completion_op_; + std::chrono::system_clock::time_point deadline_; grpc_call* call_ = nullptr; + CompletionQueue* cq_ = nullptr; bool sent_initial_metadata_ = false; std::multimap client_metadata_; std::multimap initial_metadata_; diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 03a03261285..7b904fc0f53 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -63,9 +63,10 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, class ClientAsyncRequest final : public CallOpBuffer { public: - void FinalizeResult(void **tag, bool *status) override { - CallOpBuffer::FinalizeResult(tag, status); + bool FinalizeResult(void **tag, bool *status) override { + bool r = CallOpBuffer::FinalizeResult(tag, status); delete this; + return r; } }; diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index 04af36f312f..49cf9650c76 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -231,7 +231,7 @@ void CallOpBuffer::FillOps(grpc_op* ops, size_t* nops) { } } -void CallOpBuffer::FinalizeResult(void** tag, bool* status) { +bool CallOpBuffer::FinalizeResult(void** tag, bool* status) { // Release send buffers. if (send_message_buf_) { grpc_byte_buffer_destroy(send_message_buf_); @@ -274,6 +274,7 @@ void CallOpBuffer::FinalizeResult(void** tag, bool* status) { if (recv_closed_) { *recv_closed_ = cancelled_buf_ != 0; } + return true; } Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq) diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 4419b4b2f14..c330d21a467 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -43,7 +43,7 @@ namespace grpc { CompletionQueue::CompletionQueue() { cq_ = grpc_completion_queue_create(); } -CompletionQueue::CompletionQueue(grpc_completion_queue *take) : cq_(take) {} +CompletionQueue::CompletionQueue(grpc_completion_queue* take) : cq_(take) {} CompletionQueue::~CompletionQueue() { grpc_completion_queue_destroy(cq_); } @@ -52,34 +52,51 @@ void CompletionQueue::Shutdown() { grpc_completion_queue_shutdown(cq_); } // Helper class so we can declare a unique_ptr with grpc_event class EventDeleter { public: - void operator()(grpc_event *ev) { + void operator()(grpc_event* ev) { if (ev) grpc_event_finish(ev); } }; -bool CompletionQueue::Next(void **tag, bool *ok) { +bool CompletionQueue::Next(void** tag, bool* ok) { std::unique_ptr ev; - ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); - if (ev->type == GRPC_QUEUE_SHUTDOWN) { - return false; + for (;;) { + ev.reset(grpc_completion_queue_next(cq_, gpr_inf_future)); + if (ev->type == GRPC_QUEUE_SHUTDOWN) { + return false; + } + auto cq_tag = static_cast(ev->tag); + *ok = ev->data.op_complete == GRPC_OP_OK; + *tag = cq_tag; + if (cq_tag->FinalizeResult(tag, ok)) { + return true; + } } - auto cq_tag = static_cast(ev->tag); - *ok = ev->data.op_complete == GRPC_OP_OK; - *tag = cq_tag; - cq_tag->FinalizeResult(tag, ok); - return true; } -bool CompletionQueue::Pluck(CompletionQueueTag *tag) { +bool CompletionQueue::Pluck(CompletionQueueTag* tag) { std::unique_ptr ev; - ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future)); + for (;;) { + ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future)); + bool ok = ev->data.op_complete == GRPC_OP_OK; + void* ignored = tag; + if (tag->FinalizeResult(&ignored, &ok)) { + GPR_ASSERT(ignored == tag); + return ok; + } + } +} + +void CompletionQueue::TryPluck(CompletionQueueTag* tag) { + std::unique_ptr ev; + + ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_past)); + if (!ev) return; bool ok = ev->data.op_complete == GRPC_OP_OK; - void *ignored = tag; - tag->FinalizeResult(&ignored, &ok); - GPR_ASSERT(ignored == tag); - return ok; + void* ignored = tag; + // the tag must be swallowed if using TryPluck + GPR_ASSERT(!tag->FinalizeResult(&ignored, &ok)); } } // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index ee9a1daa8e9..8fffea640f7 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -163,10 +163,11 @@ class Server::SyncRequest final : public CompletionQueueTag { this)); } - void FinalizeResult(void** tag, bool* status) override { + bool FinalizeResult(void** tag, bool* status) override { if (!*status) { grpc_completion_queue_destroy(cq_); } + return true; } class CallData final { @@ -310,11 +311,11 @@ class Server::AsyncRequest final : public CompletionQueueTag { grpc_metadata_array_destroy(&array_); } - void FinalizeResult(void** tag, bool* status) override { + bool FinalizeResult(void** tag, bool* status) override { *tag = tag_; if (*status && request_) { if (payload_) { - *status = *status && DeserializeProto(payload_, request_); + *status = DeserializeProto(payload_, request_); } else { *status = false; } @@ -331,8 +332,10 @@ class Server::AsyncRequest final : public CompletionQueueTag { } ctx_->call_ = call_; Call call(call_, server_, cq_); + // just the pointers inside call are copied here stream_->BindCall(&call); delete this; + return true; } private: diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index df4c4dc3146..b9d85b95e93 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -40,7 +40,7 @@ namespace grpc { ServerContext::ServerContext() {} -ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata *metadata, +ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, size_t metadata_count) : deadline_(Timespec2Timepoint(deadline)) { for (size_t i = 0; i < metadata_count; i++) { @@ -58,13 +58,25 @@ ServerContext::~ServerContext() { } void ServerContext::AddInitialMetadata(const grpc::string& key, - const grpc::string& value) { + const grpc::string& value) { initial_metadata_.insert(std::make_pair(key, value)); } void ServerContext::AddTrailingMetadata(const grpc::string& key, - const grpc::string& value) { + const grpc::string& value) { trailing_metadata_.insert(std::make_pair(key, value)); } +bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) { + cq->TryPluck(this); + std::lock_guard g(mu_); + return finalized_ ? cancelled_ != 0 : false; +} + +bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { + std::lock_guard g(mu_); + finalized_ = true; + return false; +} + } // namespace grpc From 190d360defe58eec0540d50cbb5d4a8f4878c4f1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 09:23:38 -0800 Subject: [PATCH 141/232] Add missing new-lines at end of file --- examples/pubsub/main.cc | 2 +- examples/pubsub/publisher.cc | 2 +- examples/pubsub/publisher.h | 2 +- examples/pubsub/publisher_test.cc | 2 +- examples/pubsub/subscriber.cc | 2 +- examples/pubsub/subscriber.h | 2 +- examples/pubsub/subscriber_test.cc | 2 +- include/grpc++/channel_arguments.h | 2 +- include/grpc++/channel_interface.h | 2 +- include/grpc++/client_context.h | 2 +- include/grpc++/completion_queue.h | 2 +- include/grpc++/config.h | 2 +- include/grpc++/create_channel.h | 2 +- include/grpc++/credentials.h | 2 +- include/grpc++/impl/call.h | 2 +- include/grpc++/impl/client_unary_call.h | 2 +- include/grpc++/impl/internal_stub.h | 2 +- include/grpc++/impl/rpc_method.h | 2 +- include/grpc++/impl/rpc_service_method.h | 2 +- include/grpc++/impl/service_type.h | 2 +- include/grpc++/server.h | 2 +- include/grpc++/server_builder.h | 2 +- include/grpc++/server_context.h | 2 +- include/grpc++/server_credentials.h | 2 +- include/grpc++/status.h | 2 +- include/grpc++/status_code_enum.h | 2 +- include/grpc++/stream.h | 2 +- include/grpc++/thread_pool_interface.h | 2 +- include/grpc/byte_buffer.h | 2 +- include/grpc/byte_buffer_reader.h | 2 +- include/grpc/grpc.h | 2 +- include/grpc/grpc_http.h | 2 +- include/grpc/grpc_security.h | 2 +- include/grpc/status.h | 2 +- include/grpc/support/alloc.h | 2 +- include/grpc/support/atm.h | 2 +- include/grpc/support/atm_gcc_atomic.h | 2 +- include/grpc/support/atm_gcc_sync.h | 2 +- include/grpc/support/atm_win32.h | 2 +- include/grpc/support/cancellable_platform.h | 2 +- include/grpc/support/cmdline.h | 2 +- include/grpc/support/cpu.h | 2 +- include/grpc/support/histogram.h | 2 +- include/grpc/support/host_port.h | 2 +- include/grpc/support/log.h | 2 +- include/grpc/support/log_win32.h | 2 +- include/grpc/support/port_platform.h | 2 +- include/grpc/support/slice.h | 2 +- include/grpc/support/slice_buffer.h | 2 +- include/grpc/support/sync.h | 2 +- include/grpc/support/sync_generic.h | 2 +- include/grpc/support/sync_posix.h | 2 +- include/grpc/support/sync_win32.h | 2 +- include/grpc/support/thd.h | 2 +- include/grpc/support/time.h | 2 +- include/grpc/support/useful.h | 2 +- src/compiler/cpp_generator.cc | 2 +- src/compiler/cpp_generator.h | 2 +- src/compiler/cpp_generator_helpers.h | 2 +- src/compiler/cpp_plugin.cc | 2 +- src/compiler/ruby_generator.cc | 2 +- src/compiler/ruby_generator.h | 2 +- src/compiler/ruby_generator_helpers-inl.h | 2 +- src/compiler/ruby_generator_map-inl.h | 2 +- src/compiler/ruby_generator_string-inl.h | 2 +- src/compiler/ruby_plugin.cc | 2 +- src/core/channel/call_op_string.c | 2 +- src/core/channel/census_filter.c | 2 +- src/core/channel/census_filter.h | 2 +- src/core/channel/channel_args.c | 2 +- src/core/channel/channel_args.h | 2 +- src/core/channel/channel_stack.c | 2 +- src/core/channel/channel_stack.h | 2 +- src/core/channel/child_channel.c | 2 +- src/core/channel/child_channel.h | 2 +- src/core/channel/client_channel.c | 2 +- src/core/channel/client_channel.h | 2 +- src/core/channel/client_setup.c | 2 +- src/core/channel/client_setup.h | 2 +- src/core/channel/connected_channel.c | 2 +- src/core/channel/connected_channel.h | 2 +- src/core/channel/http_client_filter.c | 2 +- src/core/channel/http_client_filter.h | 2 +- src/core/channel/http_filter.c | 2 +- src/core/channel/http_filter.h | 2 +- src/core/channel/http_server_filter.c | 2 +- src/core/channel/http_server_filter.h | 2 +- src/core/channel/metadata_buffer.c | 2 +- src/core/channel/metadata_buffer.h | 2 +- src/core/channel/noop_filter.c | 2 +- src/core/channel/noop_filter.h | 2 +- src/core/compression/algorithm.c | 2 +- src/core/compression/algorithm.h | 2 +- src/core/compression/message_compress.c | 2 +- src/core/compression/message_compress.h | 2 +- src/core/httpcli/format_request.c | 2 +- src/core/httpcli/format_request.h | 2 +- src/core/httpcli/httpcli.c | 2 +- src/core/httpcli/httpcli.h | 2 +- src/core/httpcli/httpcli_security_context.c | 2 +- src/core/httpcli/httpcli_security_context.h | 2 +- src/core/httpcli/parser.c | 2 +- src/core/httpcli/parser.h | 2 +- src/core/iomgr/alarm.c | 2 +- src/core/iomgr/alarm.h | 2 +- src/core/iomgr/alarm_heap.c | 2 +- src/core/iomgr/alarm_heap.h | 2 +- src/core/iomgr/alarm_internal.h | 2 +- src/core/iomgr/endpoint.c | 2 +- src/core/iomgr/endpoint.h | 2 +- src/core/iomgr/endpoint_pair.h | 2 +- src/core/iomgr/endpoint_pair_posix.c | 2 +- src/core/iomgr/fd_posix.c | 2 +- src/core/iomgr/fd_posix.h | 2 +- src/core/iomgr/iocp_windows.c | 2 +- src/core/iomgr/iocp_windows.h | 2 +- src/core/iomgr/iomgr.c | 2 +- src/core/iomgr/iomgr.h | 2 +- src/core/iomgr/iomgr_internal.h | 2 +- src/core/iomgr/iomgr_posix.c | 2 +- src/core/iomgr/iomgr_posix.h | 2 +- src/core/iomgr/iomgr_windows.c | 2 +- src/core/iomgr/pollset.h | 2 +- .../pollset_multipoller_with_poll_posix.c | 2 +- src/core/iomgr/pollset_posix.c | 2 +- src/core/iomgr/pollset_posix.h | 2 +- src/core/iomgr/pollset_windows.c | 2 +- src/core/iomgr/pollset_windows.h | 2 +- src/core/iomgr/resolve_address.c | 2 +- src/core/iomgr/resolve_address.h | 2 +- src/core/iomgr/sockaddr.h | 2 +- src/core/iomgr/sockaddr_posix.h | 2 +- src/core/iomgr/sockaddr_utils.c | 2 +- src/core/iomgr/sockaddr_utils.h | 2 +- src/core/iomgr/sockaddr_win32.h | 2 +- src/core/iomgr/socket_utils_common_posix.c | 2 +- src/core/iomgr/socket_utils_linux.c | 2 +- src/core/iomgr/socket_utils_posix.c | 2 +- src/core/iomgr/socket_utils_posix.h | 2 +- src/core/iomgr/socket_windows.c | 2 +- src/core/iomgr/socket_windows.h | 2 +- src/core/iomgr/tcp_client.h | 2 +- src/core/iomgr/tcp_client_posix.c | 2 +- src/core/iomgr/tcp_client_windows.c | 2 +- src/core/iomgr/tcp_posix.c | 2 +- src/core/iomgr/tcp_posix.h | 2 +- src/core/iomgr/tcp_server.h | 2 +- src/core/iomgr/tcp_server_posix.c | 2 +- src/core/iomgr/tcp_server_windows.c | 2 +- src/core/iomgr/tcp_windows.c | 2 +- src/core/iomgr/tcp_windows.h | 2 +- src/core/iomgr/time_averaged_stats.c | 2 +- src/core/iomgr/time_averaged_stats.h | 2 +- src/core/json/json.c | 2 +- src/core/json/json.h | 2 +- src/core/json/json_common.h | 2 +- src/core/json/json_reader.c | 2 +- src/core/json/json_reader.h | 2 +- src/core/json/json_string.c | 2 +- src/core/json/json_writer.c | 2 +- src/core/json/json_writer.h | 2 +- src/core/security/auth.c | 2 +- src/core/security/auth.h | 2 +- src/core/security/base64.c | 2 +- src/core/security/base64.h | 2 +- src/core/security/credentials.c | 2 +- src/core/security/credentials.h | 2 +- src/core/security/factories.c | 2 +- src/core/security/google_root_certs.c | 2 +- src/core/security/google_root_certs.h | 2 +- src/core/security/json_token.c | 2 +- src/core/security/json_token.h | 2 +- src/core/security/secure_endpoint.c | 2 +- src/core/security/secure_endpoint.h | 2 +- src/core/security/secure_transport_setup.c | 2 +- src/core/security/secure_transport_setup.h | 2 +- src/core/security/security_context.c | 2 +- src/core/security/security_context.h | 2 +- src/core/security/server_secure_chttp2.c | 2 +- src/core/statistics/census_init.c | 2 +- src/core/statistics/census_interface.h | 2 +- src/core/statistics/census_log.c | 2 +- src/core/statistics/census_log.h | 2 +- src/core/statistics/census_rpc_stats.c | 2 +- src/core/statistics/census_rpc_stats.h | 2 +- src/core/statistics/census_tracing.c | 2 +- src/core/statistics/census_tracing.h | 2 +- src/core/statistics/hash_table.c | 2 +- src/core/statistics/hash_table.h | 2 +- src/core/statistics/window_stats.c | 2 +- src/core/statistics/window_stats.h | 2 +- src/core/support/alloc.c | 2 +- src/core/support/cancellable.c | 2 +- src/core/support/cmdline.c | 2 +- src/core/support/cpu_linux.c | 2 +- src/core/support/cpu_posix.c | 2 +- src/core/support/env.h | 2 +- src/core/support/env_linux.c | 2 +- src/core/support/env_posix.c | 2 +- src/core/support/env_win32.c | 2 +- src/core/support/file.c | 2 +- src/core/support/file.h | 2 +- src/core/support/file_posix.c | 2 +- src/core/support/file_win32.c | 2 +- src/core/support/histogram.c | 2 +- src/core/support/host_port.c | 2 +- src/core/support/log.c | 2 +- src/core/support/log_android.c | 2 +- src/core/support/log_linux.c | 2 +- src/core/support/log_posix.c | 2 +- src/core/support/log_win32.c | 2 +- src/core/support/murmur_hash.c | 2 +- src/core/support/murmur_hash.h | 2 +- src/core/support/slice.c | 2 +- src/core/support/slice_buffer.c | 2 +- src/core/support/string.c | 2 +- src/core/support/string.h | 2 +- src/core/support/string_posix.c | 2 +- src/core/support/string_win32.c | 2 +- src/core/support/string_win32.h | 2 +- src/core/support/sync.c | 2 +- src/core/support/sync_posix.c | 2 +- src/core/support/sync_win32.c | 2 +- src/core/support/thd_internal.h | 2 +- src/core/support/thd_posix.c | 2 +- src/core/support/thd_win32.c | 2 +- src/core/support/time.c | 2 +- src/core/support/time_posix.c | 2 +- src/core/support/time_win32.c | 2 +- src/core/surface/byte_buffer.c | 2 +- src/core/surface/byte_buffer_queue.c | 2 +- src/core/surface/byte_buffer_queue.h | 2 +- src/core/surface/byte_buffer_reader.c | 2 +- src/core/surface/call.c | 2 +- src/core/surface/call.h | 2 +- src/core/surface/channel.c | 2 +- src/core/surface/channel.h | 2 +- src/core/surface/channel_create.c | 2 +- src/core/surface/client.c | 2 +- src/core/surface/client.h | 2 +- src/core/surface/completion_queue.c | 2 +- src/core/surface/completion_queue.h | 2 +- src/core/surface/event_string.c | 2 +- src/core/surface/event_string.h | 2 +- src/core/surface/lame_client.c | 2 +- src/core/surface/lame_client.h | 2 +- src/core/surface/secure_channel_create.c | 2 +- src/core/surface/secure_server_create.c | 2 +- src/core/surface/server.c | 2 +- src/core/surface/server.h | 2 +- src/core/surface/server_chttp2.c | 2 +- src/core/surface/server_create.c | 2 +- src/core/surface/surface_trace.h | 2 +- src/core/transport/chttp2/alpn.c | 2 +- src/core/transport/chttp2/alpn.h | 2 +- src/core/transport/chttp2/bin_encoder.c | 2 +- src/core/transport/chttp2/bin_encoder.h | 2 +- src/core/transport/chttp2/frame.h | 2 +- src/core/transport/chttp2/frame_data.c | 2 +- src/core/transport/chttp2/frame_data.h | 2 +- src/core/transport/chttp2/frame_goaway.c | 2 +- src/core/transport/chttp2/frame_goaway.h | 2 +- src/core/transport/chttp2/frame_ping.c | 2 +- src/core/transport/chttp2/frame_ping.h | 2 +- src/core/transport/chttp2/frame_rst_stream.c | 2 +- src/core/transport/chttp2/frame_rst_stream.h | 2 +- src/core/transport/chttp2/frame_settings.c | 2 +- src/core/transport/chttp2/frame_settings.h | 2 +- .../transport/chttp2/frame_window_update.c | 2 +- .../transport/chttp2/frame_window_update.h | 2 +- src/core/transport/chttp2/gen_hpack_tables.c | 2 +- src/core/transport/chttp2/hpack_parser.c | 2 +- src/core/transport/chttp2/hpack_parser.h | 2 +- src/core/transport/chttp2/hpack_table.c | 2 +- src/core/transport/chttp2/hpack_table.h | 2 +- src/core/transport/chttp2/http2_errors.h | 2 +- src/core/transport/chttp2/huffsyms.c | 2 +- src/core/transport/chttp2/huffsyms.h | 2 +- src/core/transport/chttp2/status_conversion.c | 2 +- src/core/transport/chttp2/status_conversion.h | 2 +- src/core/transport/chttp2/stream_encoder.c | 2 +- src/core/transport/chttp2/stream_encoder.h | 2 +- src/core/transport/chttp2/stream_map.c | 2 +- src/core/transport/chttp2/stream_map.h | 2 +- src/core/transport/chttp2/timeout_encoding.c | 2 +- src/core/transport/chttp2/timeout_encoding.h | 2 +- src/core/transport/chttp2/varint.c | 2 +- src/core/transport/chttp2/varint.h | 2 +- src/core/transport/chttp2_transport.c | 2 +- src/core/transport/chttp2_transport.h | 2 +- src/core/transport/metadata.c | 2 +- src/core/transport/metadata.h | 2 +- src/core/transport/stream_op.c | 2 +- src/core/transport/stream_op.h | 2 +- src/core/transport/transport.c | 2 +- src/core/transport/transport.h | 2 +- src/core/transport/transport_impl.h | 2 +- src/core/tsi/fake_transport_security.c | 2 +- src/core/tsi/fake_transport_security.h | 2 +- src/core/tsi/ssl_transport_security.c | 2 +- src/core/tsi/ssl_transport_security.h | 2 +- src/core/tsi/transport_security.c | 2 +- src/core/tsi/transport_security.h | 2 +- src/core/tsi/transport_security_interface.h | 2 +- src/cpp/client/channel.cc | 2 +- src/cpp/client/channel.h | 2 +- src/cpp/client/channel_arguments.cc | 2 +- src/cpp/client/client_context.cc | 2 +- src/cpp/client/client_unary_call.cc | 2 +- src/cpp/client/create_channel.cc | 2 +- src/cpp/client/credentials.cc | 2 +- src/cpp/client/internal_stub.cc | 2 +- src/cpp/common/call.cc | 2 +- src/cpp/common/completion_queue.cc | 2 +- src/cpp/common/rpc_method.cc | 2 +- src/cpp/proto/proto_utils.cc | 2 +- src/cpp/proto/proto_utils.h | 2 +- src/cpp/server/async_server_context.cc | 2 +- src/cpp/server/server.cc | 2 +- src/cpp/server/server_builder.cc | 2 +- src/cpp/server/server_context.cc | 2 +- src/cpp/server/server_credentials.cc | 2 +- src/cpp/server/thread_pool.cc | 2 +- src/cpp/server/thread_pool.h | 2 +- src/cpp/util/status.cc | 2 +- src/cpp/util/time.cc | 2 +- src/cpp/util/time.h | 2 +- src/csharp/GrpcApi/Empty.cs | 68 +-- src/csharp/GrpcApi/Math.cs | 336 +++++----- src/csharp/GrpcApi/MathExamples.cs | 16 +- src/csharp/GrpcApi/MathGrpc.cs | 8 +- src/csharp/GrpcApi/MathServiceImpl.cs | 12 +- src/csharp/GrpcApi/Messages.cs | 572 +++++++++--------- src/csharp/GrpcApi/Properties/AssemblyInfo.cs | 4 +- src/csharp/GrpcApi/TestServiceGrpc.cs | 6 +- .../GrpcApiTests/MathClientServerTests.cs | 8 +- .../GrpcApiTests/Properties/AssemblyInfo.cs | 4 +- src/csharp/GrpcCore/Call.cs | 8 +- src/csharp/GrpcCore/Calls.cs | 6 +- src/csharp/GrpcCore/Channel.cs | 8 +- .../GrpcCore/ClientStreamingAsyncResult.cs | 6 +- src/csharp/GrpcCore/GrpcEnvironment.cs | 10 +- src/csharp/GrpcCore/Internal/AsyncCall.cs | 20 +- .../GrpcCore/Internal/CallSafeHandle.cs | 16 +- .../GrpcCore/Internal/ChannelSafeHandle.cs | 8 +- .../Internal/CompletionQueueSafeHandle.cs | 6 +- src/csharp/GrpcCore/Internal/Enums.cs | 10 +- src/csharp/GrpcCore/Internal/Event.cs | 10 +- .../GrpcCore/Internal/GrpcThreadPool.cs | 6 +- .../Internal/SafeHandleZeroIsInvalid.cs | 6 +- .../GrpcCore/Internal/ServerSafeHandle.cs | 8 +- .../Internal/ServerWritingObserver.cs | 6 +- .../Internal/StreamingInputObserver.cs | 6 +- src/csharp/GrpcCore/Internal/Timespec.cs | 8 +- src/csharp/GrpcCore/Marshaller.cs | 8 +- src/csharp/GrpcCore/Method.cs | 6 +- .../GrpcCore/Properties/AssemblyInfo.cs | 4 +- src/csharp/GrpcCore/RpcException.cs | 6 +- src/csharp/GrpcCore/Server.cs | 14 +- src/csharp/GrpcCore/ServerCallHandler.cs | 8 +- src/csharp/GrpcCore/ServerCalls.cs | 6 +- .../GrpcCore/ServerServiceDefinition.cs | 10 +- src/csharp/GrpcCore/Status.cs | 8 +- src/csharp/GrpcCore/StatusCode.cs | 6 +- .../GrpcCore/Utils/RecordingObserver.cs | 6 +- src/csharp/GrpcCore/Utils/RecordingQueue.cs | 8 +- src/csharp/GrpcCoreTests/ClientServerTest.cs | 8 +- .../GrpcCoreTests/GrpcEnvironmentTest.cs | 6 +- .../GrpcCoreTests/Properties/AssemblyInfo.cs | 4 +- src/csharp/GrpcCoreTests/ServerTest.cs | 6 +- src/csharp/GrpcCoreTests/TimespecTest.cs | 6 +- src/csharp/InteropClient/Client.cs | 20 +- .../InteropClient/Properties/AssemblyInfo.cs | 4 +- src/csharp/MathClient/MathClient.cs | 8 +- .../MathClient/Properties/AssemblyInfo.cs | 4 +- src/node/ext/byte_buffer.cc | 2 +- src/node/ext/byte_buffer.h | 2 +- src/node/ext/call.h | 2 +- src/node/ext/channel.cc | 2 +- src/node/ext/channel.h | 2 +- src/node/ext/completion_queue_async_worker.cc | 2 +- src/node/ext/completion_queue_async_worker.h | 2 +- src/node/ext/credentials.cc | 2 +- src/node/ext/credentials.h | 2 +- src/node/ext/node_grpc.cc | 2 +- src/node/ext/server.cc | 2 +- src/node/ext/server.h | 2 +- src/node/ext/server_credentials.cc | 2 +- src/node/ext/server_credentials.h | 2 +- src/node/ext/timeval.cc | 2 +- src/node/ext/timeval.h | 2 +- src/python/src/grpc/_adapter/_call.c | 2 +- src/ruby/bin/apis/google/protobuf/empty.rb | 2 +- src/ruby/bin/apis/pubsub_demo.rb | 2 +- src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb | 2 +- .../apis/tech/pubsub/proto/pubsub_services.rb | 2 +- src/ruby/bin/interop/interop_client.rb | 2 +- src/ruby/bin/interop/interop_server.rb | 2 +- .../bin/interop/test/cpp/interop/empty.rb | 2 +- .../bin/interop/test/cpp/interop/messages.rb | 2 +- src/ruby/bin/interop/test/cpp/interop/test.rb | 2 +- .../interop/test/cpp/interop/test_services.rb | 2 +- src/ruby/bin/math.rb | 2 +- src/ruby/bin/math_client.rb | 2 +- src/ruby/bin/math_server.rb | 2 +- src/ruby/bin/math_services.rb | 2 +- src/ruby/bin/noproto_client.rb | 2 +- src/ruby/bin/noproto_server.rb | 2 +- src/ruby/ext/grpc/extconf.rb | 2 +- src/ruby/ext/grpc/rb_byte_buffer.c | 2 +- src/ruby/ext/grpc/rb_byte_buffer.h | 2 +- src/ruby/ext/grpc/rb_call.c | 2 +- src/ruby/ext/grpc/rb_call.h | 2 +- src/ruby/ext/grpc/rb_channel.c | 2 +- src/ruby/ext/grpc/rb_channel.h | 2 +- src/ruby/ext/grpc/rb_channel_args.c | 2 +- src/ruby/ext/grpc/rb_channel_args.h | 2 +- src/ruby/ext/grpc/rb_completion_queue.c | 2 +- src/ruby/ext/grpc/rb_completion_queue.h | 2 +- src/ruby/ext/grpc/rb_credentials.c | 2 +- src/ruby/ext/grpc/rb_credentials.h | 2 +- src/ruby/ext/grpc/rb_event.c | 2 +- src/ruby/ext/grpc/rb_event.h | 2 +- src/ruby/ext/grpc/rb_grpc.c | 2 +- src/ruby/ext/grpc/rb_grpc.h | 2 +- src/ruby/ext/grpc/rb_metadata.c | 2 +- src/ruby/ext/grpc/rb_metadata.h | 2 +- src/ruby/ext/grpc/rb_server.c | 2 +- src/ruby/ext/grpc/rb_server.h | 2 +- src/ruby/ext/grpc/rb_server_credentials.c | 2 +- src/ruby/ext/grpc/rb_server_credentials.h | 2 +- src/ruby/lib/grpc.rb | 2 +- src/ruby/lib/grpc/core/event.rb | 2 +- src/ruby/lib/grpc/core/time_consts.rb | 2 +- src/ruby/lib/grpc/errors.rb | 2 +- src/ruby/lib/grpc/generic/active_call.rb | 2 +- src/ruby/lib/grpc/generic/bidi_call.rb | 2 +- src/ruby/lib/grpc/generic/client_stub.rb | 2 +- src/ruby/lib/grpc/generic/rpc_desc.rb | 2 +- src/ruby/lib/grpc/generic/rpc_server.rb | 2 +- src/ruby/lib/grpc/generic/service.rb | 2 +- src/ruby/lib/grpc/logconfig.rb | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/spec/alloc_spec.rb | 2 +- src/ruby/spec/byte_buffer_spec.rb | 2 +- src/ruby/spec/call_spec.rb | 2 +- src/ruby/spec/channel_spec.rb | 2 +- src/ruby/spec/client_server_spec.rb | 2 +- src/ruby/spec/completion_queue_spec.rb | 2 +- src/ruby/spec/credentials_spec.rb | 2 +- src/ruby/spec/event_spec.rb | 2 +- src/ruby/spec/generic/active_call_spec.rb | 2 +- src/ruby/spec/generic/client_stub_spec.rb | 2 +- src/ruby/spec/generic/rpc_desc_spec.rb | 2 +- src/ruby/spec/generic/rpc_server_pool_spec.rb | 2 +- src/ruby/spec/generic/rpc_server_spec.rb | 2 +- src/ruby/spec/generic/service_spec.rb | 2 +- src/ruby/spec/metadata_spec.rb | 2 +- src/ruby/spec/server_credentials_spec.rb | 2 +- src/ruby/spec/server_spec.rb | 2 +- src/ruby/spec/spec_helper.rb | 2 +- src/ruby/spec/time_consts_spec.rb | 2 +- test/core/channel/channel_stack_test.c | 2 +- test/core/channel/metadata_buffer_test.c | 2 +- test/core/compression/message_compress_test.c | 2 +- test/core/echo/client.c | 2 +- test/core/echo/echo_test.c | 2 +- test/core/echo/server.c | 2 +- test/core/end2end/cq_verifier.c | 2 +- test/core/end2end/cq_verifier.h | 2 +- test/core/end2end/data/prod_roots_certs.c | 2 +- test/core/end2end/data/server1_cert.c | 2 +- test/core/end2end/data/server1_key.c | 2 +- test/core/end2end/data/ssl_test_data.h | 2 +- test/core/end2end/data/test_root_cert.c | 2 +- test/core/end2end/dualstack_socket_test.c | 2 +- test/core/end2end/end2end_tests.h | 2 +- .../end2end/fixtures/chttp2_fake_security.c | 2 +- test/core/end2end/fixtures/chttp2_fullstack.c | 2 +- .../end2end/fixtures/chttp2_fullstack_uds.c | 2 +- .../fixtures/chttp2_simple_ssl_fullstack.c | 2 +- .../chttp2_simple_ssl_with_oauth2_fullstack.c | 2 +- .../end2end/fixtures/chttp2_socket_pair.c | 2 +- .../chttp2_socket_pair_one_byte_at_a_time.c | 2 +- test/core/end2end/no_server_test.c | 2 +- test/core/end2end/tests/cancel_after_accept.c | 2 +- .../cancel_after_accept_and_writes_closed.c | 2 +- ...el_after_accept_and_writes_closed_legacy.c | 2 +- .../tests/cancel_after_accept_legacy.c | 2 +- test/core/end2end/tests/cancel_after_invoke.c | 2 +- .../tests/cancel_after_invoke_legacy.c | 2 +- .../core/end2end/tests/cancel_before_invoke.c | 2 +- .../tests/cancel_before_invoke_legacy.c | 2 +- test/core/end2end/tests/cancel_in_a_vacuum.c | 2 +- .../end2end/tests/cancel_in_a_vacuum_legacy.c | 2 +- test/core/end2end/tests/cancel_test_helpers.h | 2 +- .../end2end/tests/census_simple_request.c | 2 +- .../tests/census_simple_request_legacy.c | 2 +- test/core/end2end/tests/disappearing_server.c | 2 +- .../tests/disappearing_server_legacy.c | 2 +- ..._server_shutdown_finishes_inflight_calls.c | 2 +- ..._shutdown_finishes_inflight_calls_legacy.c | 2 +- .../early_server_shutdown_finishes_tags.c | 2 +- ...rly_server_shutdown_finishes_tags_legacy.c | 2 +- .../end2end/tests/graceful_server_shutdown.c | 2 +- .../tests/graceful_server_shutdown_legacy.c | 2 +- .../core/end2end/tests/invoke_large_request.c | 2 +- .../tests/invoke_large_request_legacy.c | 2 +- .../end2end/tests/max_concurrent_streams.c | 2 +- .../tests/max_concurrent_streams_legacy.c | 2 +- test/core/end2end/tests/no_op.c | 2 +- test/core/end2end/tests/no_op_legacy.c | 2 +- test/core/end2end/tests/ping_pong_streaming.c | 2 +- .../tests/ping_pong_streaming_legacy.c | 2 +- ...esponse_with_binary_metadata_and_payload.c | 2 +- ..._with_binary_metadata_and_payload_legacy.c | 2 +- ...quest_response_with_metadata_and_payload.c | 2 +- ...esponse_with_metadata_and_payload_legacy.c | 2 +- .../tests/request_response_with_payload.c | 2 +- .../request_response_with_payload_legacy.c | 2 +- ...ponse_with_trailing_metadata_and_payload.c | 2 +- ...ith_trailing_metadata_and_payload_legacy.c | 2 +- .../tests/request_with_large_metadata.c | 2 +- .../request_with_large_metadata_legacy.c | 2 +- .../core/end2end/tests/request_with_payload.c | 2 +- .../tests/request_with_payload_legacy.c | 2 +- .../end2end/tests/simple_delayed_request.c | 2 +- .../tests/simple_delayed_request_legacy.c | 2 +- test/core/end2end/tests/simple_request.c | 2 +- .../end2end/tests/simple_request_legacy.c | 2 +- test/core/end2end/tests/thread_stress.c | 2 +- .../core/end2end/tests/thread_stress_legacy.c | 2 +- .../writes_done_hangs_with_pending_read.c | 2 +- ...ites_done_hangs_with_pending_read_legacy.c | 2 +- test/core/fling/client.c | 2 +- test/core/fling/fling_stream_test.c | 2 +- test/core/fling/fling_test.c | 2 +- test/core/fling/server.c | 2 +- test/core/httpcli/format_request_test.c | 2 +- test/core/httpcli/httpcli_test.c | 2 +- test/core/httpcli/parser_test.c | 2 +- test/core/iomgr/alarm_heap_test.c | 2 +- test/core/iomgr/alarm_list_test.c | 2 +- test/core/iomgr/alarm_test.c | 2 +- test/core/iomgr/endpoint_tests.c | 2 +- test/core/iomgr/endpoint_tests.h | 2 +- test/core/iomgr/fd_posix_test.c | 2 +- test/core/iomgr/resolve_address_test.c | 2 +- test/core/iomgr/sockaddr_utils_test.c | 2 +- test/core/iomgr/tcp_client_posix_test.c | 2 +- test/core/iomgr/tcp_posix_test.c | 2 +- test/core/iomgr/tcp_server_posix_test.c | 2 +- test/core/iomgr/time_averaged_stats_test.c | 2 +- test/core/json/json_rewrite.c | 2 +- test/core/json/json_rewrite_test.c | 2 +- test/core/json/json_test.c | 2 +- .../network_benchmarks/low_level_ping_pong.c | 2 +- test/core/security/base64_test.c | 2 +- test/core/security/credentials_test.c | 2 +- test/core/security/fetch_oauth2.c | 2 +- test/core/security/json_token_test.c | 2 +- test/core/security/secure_endpoint_test.c | 2 +- test/core/statistics/census_log_tests.c | 2 +- test/core/statistics/census_log_tests.h | 2 +- test/core/statistics/census_stub_test.c | 2 +- test/core/statistics/hash_table_test.c | 2 +- .../multiple_writers_circular_buffer_test.c | 2 +- test/core/statistics/multiple_writers_test.c | 2 +- test/core/statistics/performance_test.c | 2 +- test/core/statistics/quick_test.c | 2 +- test/core/statistics/rpc_stats_test.c | 2 +- test/core/statistics/small_log_test.c | 2 +- test/core/statistics/trace_test.c | 2 +- test/core/statistics/window_stats_test.c | 2 +- test/core/support/cancellable_test.c | 2 +- test/core/support/cmdline_test.c | 2 +- test/core/support/env_test.c | 2 +- test/core/support/file_test.c | 2 +- test/core/support/histogram_test.c | 2 +- test/core/support/host_port_test.c | 2 +- test/core/support/log_test.c | 2 +- test/core/support/murmur_hash_test.c | 2 +- test/core/support/slice_buffer_test.c | 2 +- test/core/support/slice_test.c | 2 +- test/core/support/string_test.c | 2 +- test/core/support/sync_test.c | 2 +- test/core/support/thd_test.c | 2 +- test/core/support/time_test.c | 2 +- test/core/support/useful_test.c | 2 +- test/core/surface/byte_buffer_reader_test.c | 2 +- .../core/surface/completion_queue_benchmark.c | 2 +- test/core/surface/completion_queue_test.c | 2 +- test/core/surface/lame_client_test.c | 2 +- test/core/surface/multi_init_test.c | 2 +- test/core/transport/chttp2/alpn_test.c | 2 +- test/core/transport/chttp2/bin_encoder_test.c | 2 +- .../core/transport/chttp2/hpack_parser_test.c | 2 +- test/core/transport/chttp2/hpack_table_test.c | 2 +- .../transport/chttp2/status_conversion_test.c | 2 +- .../transport/chttp2/stream_encoder_test.c | 2 +- test/core/transport/chttp2/stream_map_test.c | 2 +- .../transport/chttp2/timeout_encoding_test.c | 2 +- .../transport/chttp2_transport_end2end_test.c | 2 +- test/core/transport/metadata_test.c | 2 +- test/core/transport/stream_op_test.c | 2 +- test/core/transport/transport_end2end_tests.c | 2 +- test/core/transport/transport_end2end_tests.h | 2 +- test/core/util/grpc_profiler.c | 2 +- test/core/util/grpc_profiler.h | 2 +- test/core/util/parse_hexstring.c | 2 +- test/core/util/parse_hexstring.h | 2 +- test/core/util/port.h | 2 +- test/core/util/port_posix.c | 2 +- test/core/util/slice_splitter.c | 2 +- test/core/util/slice_splitter.h | 2 +- test/core/util/test_config.c | 2 +- test/core/util/test_config.h | 2 +- test/cpp/client/channel_arguments_test.cc | 2 +- test/cpp/client/credentials_test.cc | 2 +- test/cpp/end2end/async_end2end_test.cc | 2 +- test/cpp/end2end/end2end_test.cc | 2 +- test/cpp/interop/client.cc | 2 +- test/cpp/interop/server.cc | 2 +- test/cpp/qps/client.cc | 2 +- test/cpp/server/thread_pool_test.cc | 2 +- test/cpp/util/create_test_channel.cc | 2 +- test/cpp/util/create_test_channel.h | 2 +- test/cpp/util/status_test.cc | 2 +- test/cpp/util/time_test.cc | 2 +- vsprojects/third_party/openssl/buildinf.h | 2 +- vsprojects/third_party/openssl/opensslconf.h | 2 +- 631 files changed, 1252 insertions(+), 1252 deletions(-) diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index 2844d713207..d7526855459 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -175,4 +175,4 @@ int main(int argc, char** argv) { channel.reset(); grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/examples/pubsub/publisher.cc b/examples/pubsub/publisher.cc index f4afbc771ca..308f9a77e57 100644 --- a/examples/pubsub/publisher.cc +++ b/examples/pubsub/publisher.cc @@ -121,4 +121,4 @@ Status Publisher::Publish(const grpc::string& topic, const grpc::string& data) { } // namespace pubsub } // namespace examples -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/examples/pubsub/publisher.h b/examples/pubsub/publisher.h index 55944b22f63..2d64a2abfa3 100644 --- a/examples/pubsub/publisher.h +++ b/examples/pubsub/publisher.h @@ -64,4 +64,4 @@ class Publisher { } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ \ No newline at end of file +#endif // __GRPCPP_EXAMPLES_PUBSUB_PUBLISHER_H_ diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index e4e71ad9223..40b122bc746 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -154,4 +154,4 @@ int main(int argc, char** argv) { int result = RUN_ALL_TESTS(); grpc_shutdown(); return result; -} \ No newline at end of file +} diff --git a/examples/pubsub/subscriber.cc b/examples/pubsub/subscriber.cc index e450e6cafa6..29f6635b7c9 100644 --- a/examples/pubsub/subscriber.cc +++ b/examples/pubsub/subscriber.cc @@ -115,4 +115,4 @@ Status Subscriber::Pull(const grpc::string& name, grpc::string* data) { } // namespace pubsub } // namespace examples -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/examples/pubsub/subscriber.h b/examples/pubsub/subscriber.h index cf846f11903..a973cd755c7 100644 --- a/examples/pubsub/subscriber.h +++ b/examples/pubsub/subscriber.h @@ -65,4 +65,4 @@ class Subscriber { } // namespace examples } // namespace grpc -#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ \ No newline at end of file +#endif // __GRPCPP_EXAMPLES_PUBSUB_SUBSCRIBER_H_ diff --git a/examples/pubsub/subscriber_test.cc b/examples/pubsub/subscriber_test.cc index 55eb7be6d71..1fdcc8f755f 100644 --- a/examples/pubsub/subscriber_test.cc +++ b/examples/pubsub/subscriber_test.cc @@ -156,4 +156,4 @@ int main(int argc, char** argv) { int result = RUN_ALL_TESTS(); grpc_shutdown(); return result; -} \ No newline at end of file +} diff --git a/include/grpc++/channel_arguments.h b/include/grpc++/channel_arguments.h index ebdb2ffd6e1..75c3cf45b49 100644 --- a/include/grpc++/channel_arguments.h +++ b/include/grpc++/channel_arguments.h @@ -82,4 +82,4 @@ class ChannelArguments { } // namespace grpc -#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ \ No newline at end of file +#endif // __GRPCPP_CHANNEL_ARGUMENTS_H_ diff --git a/include/grpc++/channel_interface.h b/include/grpc++/channel_interface.h index 24fc595dbd4..890fd04d824 100644 --- a/include/grpc++/channel_interface.h +++ b/include/grpc++/channel_interface.h @@ -63,4 +63,4 @@ class ChannelInterface : public CallHook { } // namespace grpc -#endif // __GRPCPP_CHANNEL_INTERFACE_H__ \ No newline at end of file +#endif // __GRPCPP_CHANNEL_INTERFACE_H__ diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index cc0d46cede9..24e67c9ee1f 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -147,4 +147,4 @@ class ClientContext { } // namespace grpc -#endif // __GRPCPP_CLIENT_CONTEXT_H__ \ No newline at end of file +#endif // __GRPCPP_CLIENT_CONTEXT_H__ diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 3a5820bf833..f1b4962d1b7 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -114,4 +114,4 @@ class CompletionQueue { } // namespace grpc -#endif // __GRPCPP_COMPLETION_QUEUE_H__ \ No newline at end of file +#endif // __GRPCPP_COMPLETION_QUEUE_H__ diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 55e4318010e..2dced12e379 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -42,4 +42,4 @@ typedef std::string string; } // namespace grpc -#endif // __GRPCPP_CONFIG_H__ \ No newline at end of file +#endif // __GRPCPP_CONFIG_H__ diff --git a/include/grpc++/create_channel.h b/include/grpc++/create_channel.h index e8427bf4f86..eadabda3596 100644 --- a/include/grpc++/create_channel.h +++ b/include/grpc++/create_channel.h @@ -53,4 +53,4 @@ std::shared_ptr CreateChannel( } // namespace grpc -#endif // __GRPCPP_CREATE_CHANNEL_H__ \ No newline at end of file +#endif // __GRPCPP_CREATE_CHANNEL_H__ diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 6f6523dedcd..ac6f394847d 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -119,4 +119,4 @@ class CredentialsFactory { } // namespace grpc -#endif // __GRPCPP_CREDENTIALS_H_ \ No newline at end of file +#endif // __GRPCPP_CREDENTIALS_H_ diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index 82eb457ae61..7ba5d16bf31 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -142,4 +142,4 @@ class Call final { } // namespace grpc -#endif // __GRPCPP_CALL_INTERFACE_H__ \ No newline at end of file +#endif // __GRPCPP_CALL_INTERFACE_H__ diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 81adc274c8c..a29621edb3b 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -63,4 +63,4 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, } // namespace grpc -#endif \ No newline at end of file +#endif diff --git a/include/grpc++/impl/internal_stub.h b/include/grpc++/impl/internal_stub.h index 4c33fde9ca6..25290121cdf 100644 --- a/include/grpc++/impl/internal_stub.h +++ b/include/grpc++/impl/internal_stub.h @@ -57,4 +57,4 @@ class InternalStub { } // namespace grpc -#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_INTERNAL_STUB_H__ diff --git a/include/grpc++/impl/rpc_method.h b/include/grpc++/impl/rpc_method.h index 0bb53f7abe9..0236b1182a0 100644 --- a/include/grpc++/impl/rpc_method.h +++ b/include/grpc++/impl/rpc_method.h @@ -66,4 +66,4 @@ class RpcMethod { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_METHOD_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_RPC_METHOD_H__ diff --git a/include/grpc++/impl/rpc_service_method.h b/include/grpc++/impl/rpc_service_method.h index 104ff8597a8..ffd5c34ef6d 100644 --- a/include/grpc++/impl/rpc_service_method.h +++ b/include/grpc++/impl/rpc_service_method.h @@ -203,4 +203,4 @@ class RpcService { } // namespace grpc -#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_RPC_SERVICE_METHOD_H__ diff --git a/include/grpc++/impl/service_type.h b/include/grpc++/impl/service_type.h index a89d9cd89ce..cafa2696ab2 100644 --- a/include/grpc++/impl/service_type.h +++ b/include/grpc++/impl/service_type.h @@ -124,4 +124,4 @@ class AsynchronousService { } // namespace grpc -#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ \ No newline at end of file +#endif // __GRPCPP_IMPL_SERVICE_TYPE_H__ diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 68d9ab17849..26d18d1bbe4 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -125,4 +125,4 @@ class Server final : private CallHook, } // namespace grpc -#endif // __GRPCPP_SERVER_H__ \ No newline at end of file +#endif // __GRPCPP_SERVER_H__ diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 750b4369fb1..4545c413d25 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -88,4 +88,4 @@ class ServerBuilder { } // namespace grpc -#endif // __GRPCPP_SERVER_BUILDER_H__ \ No newline at end of file +#endif // __GRPCPP_SERVER_BUILDER_H__ diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 0b7f0594f78..06744f8f4fd 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -110,4 +110,4 @@ class ServerContext final { } // namespace grpc -#endif // __GRPCPP_SERVER_CONTEXT_H_ \ No newline at end of file +#endif // __GRPCPP_SERVER_CONTEXT_H_ diff --git a/include/grpc++/server_credentials.h b/include/grpc++/server_credentials.h index 8e1cd9dd753..5c6787a0770 100644 --- a/include/grpc++/server_credentials.h +++ b/include/grpc++/server_credentials.h @@ -79,4 +79,4 @@ class ServerCredentialsFactory { } // namespace grpc -#endif // __GRPCPP_SERVER_CREDENTIALS_H_ \ No newline at end of file +#endif // __GRPCPP_SERVER_CREDENTIALS_H_ diff --git a/include/grpc++/status.h b/include/grpc++/status.h index cd1ff6c533e..1dfb0c997ca 100644 --- a/include/grpc++/status.h +++ b/include/grpc++/status.h @@ -62,4 +62,4 @@ class Status { } // namespace grpc -#endif // __GRPCPP_STATUS_H__ \ No newline at end of file +#endif // __GRPCPP_STATUS_H__ diff --git a/include/grpc++/status_code_enum.h b/include/grpc++/status_code_enum.h index 5c6ea7d0f71..0ec0a976d22 100644 --- a/include/grpc++/status_code_enum.h +++ b/include/grpc++/status_code_enum.h @@ -195,4 +195,4 @@ enum StatusCode { } // namespace grpc -#endif // __GRPCPP_STATUS_CODE_ENUM_H_ \ No newline at end of file +#endif // __GRPCPP_STATUS_CODE_ENUM_H_ diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index c36488f9632..491dfc81361 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -772,4 +772,4 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, } // namespace grpc -#endif // __GRPCPP_STREAM_H__ \ No newline at end of file +#endif // __GRPCPP_STREAM_H__ diff --git a/include/grpc++/thread_pool_interface.h b/include/grpc++/thread_pool_interface.h index 9927d293721..c8392493241 100644 --- a/include/grpc++/thread_pool_interface.h +++ b/include/grpc++/thread_pool_interface.h @@ -49,4 +49,4 @@ class ThreadPoolInterface { } // namespace grpc -#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ \ No newline at end of file +#endif // __GRPCPP_THREAD_POOL_INTERFACE_H__ diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h index ef874883780..89d8557edff 100644 --- a/include/grpc/byte_buffer.h +++ b/include/grpc/byte_buffer.h @@ -47,4 +47,4 @@ struct grpc_byte_buffer { } data; }; -#endif /* __GRPC_BYTE_BUFFER_H__ */ \ No newline at end of file +#endif /* __GRPC_BYTE_BUFFER_H__ */ diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index e60dab51c8a..4446e0c6b39 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -46,4 +46,4 @@ struct grpc_byte_buffer_reader { } current; }; -#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ \ No newline at end of file +#endif /* __GRPC_BYTE_BUFFER_READER_H__ */ diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 68a1382a4f5..b33cc3da874 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -619,4 +619,4 @@ void grpc_server_destroy(grpc_server *server); } #endif -#endif /* __GRPC_GRPC_H__ */ \ No newline at end of file +#endif /* __GRPC_GRPC_H__ */ diff --git a/include/grpc/grpc_http.h b/include/grpc/grpc_http.h index a20b93bc86d..757f53f9df1 100644 --- a/include/grpc/grpc_http.h +++ b/include/grpc/grpc_http.h @@ -64,4 +64,4 @@ typedef struct { } #endif -#endif /* __GRPC_GRPC_HTTP_H__ */ \ No newline at end of file +#endif /* __GRPC_GRPC_HTTP_H__ */ diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index c7d3daf221f..f03ac8004da 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -173,4 +173,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr); } #endif -#endif /* GRPC_SECURITY_H_ */ \ No newline at end of file +#endif /* GRPC_SECURITY_H_ */ diff --git a/include/grpc/status.h b/include/grpc/status.h index 3096ac4c01d..76a71ed26fc 100644 --- a/include/grpc/status.h +++ b/include/grpc/status.h @@ -199,4 +199,4 @@ typedef enum { } #endif -#endif /* __GRPC_STATUS_H__ */ \ No newline at end of file +#endif /* __GRPC_STATUS_H__ */ diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index 739fec25b35..c7580655761 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr); } #endif -#endif /* __GRPC_SUPPORT_ALLOC_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ALLOC_H__ */ diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index 7c0ead0447f..0cac9bf5865 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -89,4 +89,4 @@ #error could not determine platform for atm #endif -#endif /* __GRPC_SUPPORT_ATM_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ATM_H__ */ diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index 40bcc12d660..2ae24aec06d 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -66,4 +66,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { __ATOMIC_RELAXED); } -#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ATM_GCC_ATOMIC_H__ */ diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index 02da69add51..cec62e1a20d 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -70,4 +70,4 @@ static __inline void gpr_atm_rel_store(gpr_atm *p, gpr_atm value) { #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) -#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ATM_GCC_SYNC_H__ */ diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 87d54259504..acacf12013c 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -103,4 +103,4 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) { return old; } -#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ATM_WIN32_H__ */ diff --git a/include/grpc/support/cancellable_platform.h b/include/grpc/support/cancellable_platform.h index d732b1f0adc..e77f9f15777 100644 --- a/include/grpc/support/cancellable_platform.h +++ b/include/grpc/support/cancellable_platform.h @@ -53,4 +53,4 @@ typedef struct { struct gpr_cancellable_list_ waiters; } gpr_cancellable; -#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_CANCELLABLE_PLATFORM_H__ */ diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index ca6d58ca430..20de12242c7 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -92,4 +92,4 @@ void gpr_cmdline_destroy(gpr_cmdline *cl); } #endif -#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_CMDLINE_H__ */ diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index afb3eba2d21..580f12dad72 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void); } // extern "C" #endif -#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SUPPORT_CPU_H__ */ diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index 03886556c2c..fb9d3d1691e 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -63,4 +63,4 @@ double gpr_histogram_sum_of_squares(gpr_histogram *histogram); } #endif -#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_HISTOGRAM_H__ */ diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 92630af8269..362046cb95d 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -54,4 +54,4 @@ int gpr_join_host_port(char **out, const char *host, int port); } #endif -#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_HOST_PORT_H__ */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index d88ba7b2d72..c142949f770 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_LOG_H__ */ diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h index 49c0ecf2b9b..52d6a703189 100644 --- a/include/grpc/support/log_win32.h +++ b/include/grpc/support/log_win32.h @@ -50,4 +50,4 @@ char *gpr_format_message(DWORD messageid); } #endif -#endif /* __GRPC_SUPPORT_LOG_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_LOG_H__ */ diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index e98a9327127..27efa294485 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -204,4 +204,4 @@ typedef uintptr_t gpr_uintptr; power of two */ #define GPR_MAX_ALIGNMENT 16 -#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_PORT_PLATFORM_H__ */ diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h index fa7995f3f75..261e3baabee 100644 --- a/include/grpc/support/slice.h +++ b/include/grpc/support/slice.h @@ -173,4 +173,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b); } #endif -#endif /* __GRPC_SUPPORT_SLICE_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SLICE_H__ */ diff --git a/include/grpc/support/slice_buffer.h b/include/grpc/support/slice_buffer.h index f537472d81a..8b57f9f0b92 100644 --- a/include/grpc/support/slice_buffer.h +++ b/include/grpc/support/slice_buffer.h @@ -81,4 +81,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb); } #endif -#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SLICE_BUFFER_H__ */ diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 9899cccb311..4437375db72 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -345,4 +345,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c); } #endif -#endif /* __GRPC_SUPPORT_SYNC_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SYNC_H__ */ diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index e8a4ced3015..3bae222cb00 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -58,4 +58,4 @@ typedef struct { #define GPR_STATS_INIT \ { 0 } -#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SYNC_GENERIC_H__ */ diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index e3e0baeb282..413226a9e8f 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -45,4 +45,4 @@ typedef pthread_once_t gpr_once; #define GPR_ONCE_INIT PTHREAD_ONCE_INIT -#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SYNC_POSIX_H__ */ diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h index 79bb7bdd196..5a48b52a2dc 100644 --- a/include/grpc/support/sync_win32.h +++ b/include/grpc/support/sync_win32.h @@ -49,4 +49,4 @@ typedef CONDITION_VARIABLE gpr_cv; typedef INIT_ONCE gpr_once; #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT -#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_SYNC_WIN32_H__ */ diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 4868130f65e..a81e6cd3ba9 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -73,4 +73,4 @@ gpr_thd_id gpr_thd_currentid(void); } #endif -#endif /* __GRPC_SUPPORT_THD_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_THD_H__ */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index 22275c42b66..ebc18c91e94 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -100,4 +100,4 @@ double gpr_timespec_to_micros(gpr_timespec t); } #endif -#endif /* __GRPC_SUPPORT_TIME_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_TIME_H__ */ diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index 0847d351020..8d756c37c31 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -45,4 +45,4 @@ #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) -#endif /* __GRPC_SUPPORT_USEFUL_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_USEFUL_H__ */ diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 167c0a86b86..aa764cbb33d 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -703,4 +703,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file) { return output; } -} // namespace grpc_cpp_generator \ No newline at end of file +} // namespace grpc_cpp_generator diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h index 34f0e20dca3..f5b1ad23eee 100644 --- a/src/compiler/cpp_generator.h +++ b/src/compiler/cpp_generator.h @@ -58,4 +58,4 @@ std::string GetSourceServices(const google::protobuf::FileDescriptor *file); } // namespace grpc_cpp_generator -#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_ \ No newline at end of file +#endif // NET_GRPC_COMPILER_CPP_GENERATOR_H_ diff --git a/src/compiler/cpp_generator_helpers.h b/src/compiler/cpp_generator_helpers.h index 5e1b115e897..e3c76e02912 100644 --- a/src/compiler/cpp_generator_helpers.h +++ b/src/compiler/cpp_generator_helpers.h @@ -103,4 +103,4 @@ inline std::string ClassName(const google::protobuf::Descriptor *descriptor, } // namespace grpc_cpp_generator -#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ \ No newline at end of file +#endif // NET_GRPC_COMPILER_CPP_GENERATOR_HELPERS_H__ diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc index 662e6ef6ccc..a421e51b78d 100644 --- a/src/compiler/cpp_plugin.cc +++ b/src/compiler/cpp_plugin.cc @@ -94,4 +94,4 @@ class CppGrpcGenerator : public google::protobuf::compiler::CodeGenerator { int main(int argc, char *argv[]) { CppGrpcGenerator generator; return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} \ No newline at end of file +} diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index ac9ff8d8479..32b6a8d8e4a 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -169,4 +169,4 @@ std::string GetServices(const FileDescriptor *file) { return output; } -} // namespace grpc_ruby_generator \ No newline at end of file +} // namespace grpc_ruby_generator diff --git a/src/compiler/ruby_generator.h b/src/compiler/ruby_generator.h index 1d851f3210f..d0c568fad0f 100644 --- a/src/compiler/ruby_generator.h +++ b/src/compiler/ruby_generator.h @@ -48,4 +48,4 @@ std::string GetServices(const google::protobuf::FileDescriptor *file); } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_ \ No newline at end of file +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_H_ diff --git a/src/compiler/ruby_generator_helpers-inl.h b/src/compiler/ruby_generator_helpers-inl.h index b3c1d21eb66..61d887b41cd 100644 --- a/src/compiler/ruby_generator_helpers-inl.h +++ b/src/compiler/ruby_generator_helpers-inl.h @@ -64,4 +64,4 @@ inline std::string MessagesRequireName( } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ \ No newline at end of file +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_HELPERS_INL_H_ diff --git a/src/compiler/ruby_generator_map-inl.h b/src/compiler/ruby_generator_map-inl.h index 0e65d1ed104..345e4c13706 100644 --- a/src/compiler/ruby_generator_map-inl.h +++ b/src/compiler/ruby_generator_map-inl.h @@ -68,4 +68,4 @@ inline std::map ListToDict( } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ \ No newline at end of file +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_MAP_INL_H_ diff --git a/src/compiler/ruby_generator_string-inl.h b/src/compiler/ruby_generator_string-inl.h index 92d3f5d3ded..7c2e4e5d9d4 100644 --- a/src/compiler/ruby_generator_string-inl.h +++ b/src/compiler/ruby_generator_string-inl.h @@ -130,4 +130,4 @@ inline std::string RubyTypeOf(const std::string &a_type, } // namespace grpc_ruby_generator -#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ \ No newline at end of file +#endif // NET_GRPC_COMPILER_RUBY_GENERATOR_STRING_INL_H_ diff --git a/src/compiler/ruby_plugin.cc b/src/compiler/ruby_plugin.cc index 81c6be6b2e3..6580e5ab5be 100644 --- a/src/compiler/ruby_plugin.cc +++ b/src/compiler/ruby_plugin.cc @@ -77,4 +77,4 @@ class RubyGrpcGenerator : public google::protobuf::compiler::CodeGenerator { int main(int argc, char *argv[]) { RubyGrpcGenerator generator; return google::protobuf::compiler::PluginMain(argc, argv, &generator); -} \ No newline at end of file +} diff --git a/src/core/channel/call_op_string.c b/src/core/channel/call_op_string.c index e3471a01a1b..08f2e95deb6 100644 --- a/src/core/channel/call_op_string.c +++ b/src/core/channel/call_op_string.c @@ -131,4 +131,4 @@ void grpc_call_log_op(char *file, int line, gpr_log_severity severity, char *str = grpc_call_op_string(op); gpr_log(file, line, severity, "OP[%s:%p]: %s", elem->filter->name, elem, str); gpr_free(str); -} \ No newline at end of file +} diff --git a/src/core/channel/census_filter.c b/src/core/channel/census_filter.c index 3a2aa47d261..ba7b7ba59ca 100644 --- a/src/core/channel/census_filter.c +++ b/src/core/channel/census_filter.c @@ -185,4 +185,4 @@ const grpc_channel_filter grpc_client_census_filter = { const grpc_channel_filter grpc_server_census_filter = { server_call_op, channel_op, sizeof(call_data), server_init_call_elem, server_destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "census-server"}; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "census-server"}; diff --git a/src/core/channel/census_filter.h b/src/core/channel/census_filter.h index 92f0d226d50..6acf9695f47 100644 --- a/src/core/channel/census_filter.h +++ b/src/core/channel/census_filter.h @@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_client_census_filter; extern const grpc_channel_filter grpc_server_census_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CENSUS_FILTER_H__ */ diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c index 885e3ac4383..509ae0df896 100644 --- a/src/core/channel/channel_args.c +++ b/src/core/channel/channel_args.c @@ -113,4 +113,4 @@ int grpc_channel_args_is_census_enabled(const grpc_channel_args *a) { } } return 0; -} \ No newline at end of file +} diff --git a/src/core/channel/channel_args.h b/src/core/channel/channel_args.h index 11762f7e7b0..640bbd85a5f 100644 --- a/src/core/channel/channel_args.h +++ b/src/core/channel/channel_args.h @@ -51,4 +51,4 @@ void grpc_channel_args_destroy(grpc_channel_args *a); is specified in channel args, otherwise returns 0. */ int grpc_channel_args_is_census_enabled(const grpc_channel_args *a); -#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_ARGS_H__ */ diff --git a/src/core/channel/channel_stack.c b/src/core/channel/channel_stack.c index c637e22822d..0382a7a2f30 100644 --- a/src/core/channel/channel_stack.c +++ b/src/core/channel/channel_stack.c @@ -245,4 +245,4 @@ void grpc_call_element_send_finish(grpc_call_element *cur_elem) { finish_op.user_data = NULL; finish_op.flags = 0; grpc_call_next_op(cur_elem, &finish_op); -} \ No newline at end of file +} diff --git a/src/core/channel/channel_stack.h b/src/core/channel/channel_stack.h index 8dbe28e9410..98d095fccf1 100644 --- a/src/core/channel/channel_stack.h +++ b/src/core/channel/channel_stack.h @@ -309,4 +309,4 @@ void grpc_call_element_send_finish(grpc_call_element *cur_elem); } while (0) #endif -#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CHANNEL_STACK_H__ */ diff --git a/src/core/channel/child_channel.c b/src/core/channel/child_channel.c index d39ace87e16..2cb03829c79 100644 --- a/src/core/channel/child_channel.c +++ b/src/core/channel/child_channel.c @@ -307,4 +307,4 @@ void grpc_child_call_destroy(grpc_child_call *call) { grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call) { return LINK_BACK_ELEM_FROM_CALL(call); -} \ No newline at end of file +} diff --git a/src/core/channel/child_channel.h b/src/core/channel/child_channel.h index 239123f27a9..84a11062cbe 100644 --- a/src/core/channel/child_channel.h +++ b/src/core/channel/child_channel.h @@ -61,4 +61,4 @@ grpc_child_call *grpc_child_channel_create_call(grpc_child_channel *channel, grpc_call_element *grpc_child_call_get_top_element(grpc_child_call *call); void grpc_child_call_destroy(grpc_child_call *call); -#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CHILD_CHANNEL_H_ */ diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index 170065a5c27..9791f98be88 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -562,4 +562,4 @@ void grpc_client_channel_set_transport_setup(grpc_channel_stack *channel_stack, channel_data *chand = elem->channel_data; GPR_ASSERT(!chand->transport_setup); chand->transport_setup = setup; -} \ No newline at end of file +} diff --git a/src/core/channel/client_channel.h b/src/core/channel/client_channel.h index 3db8cb6c8e8..7da4fc92580 100644 --- a/src/core/channel/client_channel.h +++ b/src/core/channel/client_channel.h @@ -59,4 +59,4 @@ grpc_transport_setup_result grpc_client_channel_transport_setup_complete( grpc_channel_filter const **channel_filters, size_t num_channel_filters, grpc_mdctx *mdctx); -#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_CHANNEL_H__ */ diff --git a/src/core/channel/client_setup.c b/src/core/channel/client_setup.c index f9b28db0dcb..bb6d3638074 100644 --- a/src/core/channel/client_setup.c +++ b/src/core/channel/client_setup.c @@ -237,4 +237,4 @@ const grpc_channel_args *grpc_client_setup_get_channel_args( grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r) { return r->setup->mdctx; -} \ No newline at end of file +} diff --git a/src/core/channel/client_setup.h b/src/core/channel/client_setup.h index c79dda41210..6ac3fe62f19 100644 --- a/src/core/channel/client_setup.h +++ b/src/core/channel/client_setup.h @@ -64,4 +64,4 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r); grpc_mdctx *grpc_client_setup_get_mdctx(grpc_client_setup_request *r); -#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CLIENT_SETUP_H__ */ diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c index 9377cb26d4c..fa186551648 100644 --- a/src/core/channel/connected_channel.c +++ b/src/core/channel/connected_channel.c @@ -519,4 +519,4 @@ grpc_transport_setup_result grpc_connected_channel_bind_transport( ret.user_data = elem; ret.callbacks = &connected_channel_transport_callbacks; return ret; -} \ No newline at end of file +} diff --git a/src/core/channel/connected_channel.h b/src/core/channel/connected_channel.h index cfd83bb0277..e19de62ca94 100644 --- a/src/core/channel/connected_channel.h +++ b/src/core/channel/connected_channel.h @@ -46,4 +46,4 @@ extern const grpc_channel_filter grpc_connected_channel_filter; grpc_transport_setup_result grpc_connected_channel_bind_transport( grpc_channel_stack *channel_stack, grpc_transport *transport); -#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_CONNECTED_CHANNEL_H__ */ diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 2cf0648cc00..3ccc39b717f 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -196,4 +196,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_client_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "http-client"}; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "http-client"}; diff --git a/src/core/channel/http_client_filter.h b/src/core/channel/http_client_filter.h index f230ca0f9ed..5882f8fe057 100644 --- a/src/core/channel/http_client_filter.h +++ b/src/core/channel/http_client_filter.h @@ -41,4 +41,4 @@ extern const grpc_channel_filter grpc_http_client_filter; #define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme" -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_CLIENT_FILTER_H__ */ diff --git a/src/core/channel/http_filter.c b/src/core/channel/http_filter.c index 5276eb9bc56..453a0422d85 100644 --- a/src/core/channel/http_filter.c +++ b/src/core/channel/http_filter.c @@ -134,4 +134,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "http"}; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "http"}; diff --git a/src/core/channel/http_filter.h b/src/core/channel/http_filter.h index 1598034e031..b85cd3956eb 100644 --- a/src/core/channel/http_filter.h +++ b/src/core/channel/http_filter.h @@ -40,4 +40,4 @@ transports. */ extern const grpc_channel_filter grpc_http_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_FILTER_H__ */ diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 97c3c88752b..d1616a3450d 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -362,4 +362,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_http_server_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem, destroy_channel_elem, - "http-server"}; \ No newline at end of file + "http-server"}; diff --git a/src/core/channel/http_server_filter.h b/src/core/channel/http_server_filter.h index 1ec1c7c2164..0643c7be83c 100644 --- a/src/core/channel/http_server_filter.h +++ b/src/core/channel/http_server_filter.h @@ -39,4 +39,4 @@ /* Processes metadata on the client side for HTTP2 transports */ extern const grpc_channel_filter grpc_http_server_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_HTTP_SERVER_FILTER_H__ */ diff --git a/src/core/channel/metadata_buffer.c b/src/core/channel/metadata_buffer.c index 41f328e0d13..da66a028c4d 100644 --- a/src/core/channel/metadata_buffer.c +++ b/src/core/channel/metadata_buffer.c @@ -197,4 +197,4 @@ void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_metadata_buffer_destroy(&hdr->impl, error); gpr_free(hdr); -} \ No newline at end of file +} diff --git a/src/core/channel/metadata_buffer.h b/src/core/channel/metadata_buffer.h index 17a2eb7414b..701d69df7c5 100644 --- a/src/core/channel/metadata_buffer.h +++ b/src/core/channel/metadata_buffer.h @@ -67,4 +67,4 @@ grpc_metadata *grpc_metadata_buffer_extract_elements( grpc_metadata_buffer *buffer); void grpc_metadata_buffer_cleanup_elements(void *elements, grpc_op_error error); -#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_METADATA_BUFFER_H__ */ diff --git a/src/core/channel/noop_filter.c b/src/core/channel/noop_filter.c index ea4f86a6164..d987fa2bc10 100644 --- a/src/core/channel/noop_filter.c +++ b/src/core/channel/noop_filter.c @@ -133,4 +133,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_no_op_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "no-op"}; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "no-op"}; diff --git a/src/core/channel/noop_filter.h b/src/core/channel/noop_filter.h index ef26ec84e0a..93c2bff9b02 100644 --- a/src/core/channel/noop_filter.h +++ b/src/core/channel/noop_filter.h @@ -41,4 +41,4 @@ customize for their own filters */ extern const grpc_channel_filter grpc_no_op_filter; -#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_CHANNEL_NOOP_FILTER_H__ */ diff --git a/src/core/compression/algorithm.c b/src/core/compression/algorithm.c index df7c3026268..ca07002ff94 100644 --- a/src/core/compression/algorithm.c +++ b/src/core/compression/algorithm.c @@ -46,4 +46,4 @@ const char *grpc_compression_algorithm_name( return "error"; } return "error"; -} \ No newline at end of file +} diff --git a/src/core/compression/algorithm.h b/src/core/compression/algorithm.h index 2c7c38e1d8b..e398ae34b4c 100644 --- a/src/core/compression/algorithm.h +++ b/src/core/compression/algorithm.h @@ -46,4 +46,4 @@ typedef enum { const char *grpc_compression_algorithm_name( grpc_compression_algorithm algorithm); -#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_COMPRESSION_ALGORITHM_H__ */ diff --git a/src/core/compression/message_compress.c b/src/core/compression/message_compress.c index b21b8ff27e1..9b8100a3d6c 100644 --- a/src/core/compression/message_compress.c +++ b/src/core/compression/message_compress.c @@ -190,4 +190,4 @@ int grpc_msg_decompress(grpc_compression_algorithm algorithm, } gpr_log(GPR_ERROR, "invalid compression algorithm %d", algorithm); return 0; -} \ No newline at end of file +} diff --git a/src/core/compression/message_compress.h b/src/core/compression/message_compress.h index 454d8acd1fa..666da2ed0d6 100644 --- a/src/core/compression/message_compress.h +++ b/src/core/compression/message_compress.h @@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm, int grpc_msg_decompress(grpc_compression_algorithm algorithm, gpr_slice_buffer *input, gpr_slice_buffer *output); -#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_COMPRESSION_MESSAGE_COMPRESS_H__ */ diff --git a/src/core/httpcli/format_request.c b/src/core/httpcli/format_request.c index 7382a29823e..af252190847 100644 --- a/src/core/httpcli/format_request.c +++ b/src/core/httpcli/format_request.c @@ -114,4 +114,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, } return gpr_slice_new(tmp, out_len, gpr_free); -} \ No newline at end of file +} diff --git a/src/core/httpcli/format_request.h b/src/core/httpcli/format_request.h index 6e62f8a4111..e06b6329903 100644 --- a/src/core/httpcli/format_request.h +++ b/src/core/httpcli/format_request.h @@ -42,4 +42,4 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, const char *body_bytes, size_t body_size); -#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_HTTPCLI_FORMAT_REQUEST_H__ */ diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c index 97c10a0134c..8a1c04b631e 100644 --- a/src/core/httpcli/httpcli.c +++ b/src/core/httpcli/httpcli.c @@ -270,4 +270,4 @@ void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post) { g_get_override = get; g_post_override = post; -} \ No newline at end of file +} diff --git a/src/core/httpcli/httpcli.h b/src/core/httpcli/httpcli.h index 012ac530ed2..f6209877680 100644 --- a/src/core/httpcli/httpcli.h +++ b/src/core/httpcli/httpcli.h @@ -115,4 +115,4 @@ typedef int (*grpc_httpcli_post_override)(const grpc_httpcli_request *request, void grpc_httpcli_set_override(grpc_httpcli_get_override get, grpc_httpcli_post_override post); -#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_H__ */ diff --git a/src/core/httpcli/httpcli_security_context.c b/src/core/httpcli/httpcli_security_context.c index 4ba5890a33d..e97752bbe19 100644 --- a/src/core/httpcli/httpcli_security_context.c +++ b/src/core/httpcli/httpcli_security_context.c @@ -128,4 +128,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create( } *ctx = &c->base; return GRPC_SECURITY_OK; -} \ No newline at end of file +} diff --git a/src/core/httpcli/httpcli_security_context.h b/src/core/httpcli/httpcli_security_context.h index d2cec2f9dac..5a1311e7a41 100644 --- a/src/core/httpcli/httpcli_security_context.h +++ b/src/core/httpcli/httpcli_security_context.h @@ -40,4 +40,4 @@ grpc_security_status grpc_httpcli_ssl_channel_security_context_create( const unsigned char *pem_root_certs, size_t pem_root_certs_size, const char *secure_peer_name, grpc_channel_security_context **ctx); -#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_HTTPCLI_HTTPCLI_SECURITY_CONTEXT_H__ */ diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c index 2d1f3af5f6e..f4decda98a9 100644 --- a/src/core/httpcli/parser.c +++ b/src/core/httpcli/parser.c @@ -209,4 +209,4 @@ int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice) { int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser) { return parser->state == GRPC_HTTPCLI_BODY; -} \ No newline at end of file +} diff --git a/src/core/httpcli/parser.h b/src/core/httpcli/parser.h index 7924031e88d..db1fa0a33c8 100644 --- a/src/core/httpcli/parser.h +++ b/src/core/httpcli/parser.h @@ -61,4 +61,4 @@ void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser); int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice); int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser); -#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_HTTPCLI_PARSER_H__ */ diff --git a/src/core/iomgr/alarm.c b/src/core/iomgr/alarm.c index 83b189f95b2..5860834de3f 100644 --- a/src/core/iomgr/alarm.c +++ b/src/core/iomgr/alarm.c @@ -362,4 +362,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void) { out = g_shard_queue[0]->min_deadline; gpr_mu_unlock(&g_mu); return out; -} \ No newline at end of file +} diff --git a/src/core/iomgr/alarm.h b/src/core/iomgr/alarm.h index 478aa9439d6..6dcc63a6d58 100644 --- a/src/core/iomgr/alarm.h +++ b/src/core/iomgr/alarm.h @@ -86,4 +86,4 @@ void grpc_alarm_init(grpc_alarm *alarm, gpr_timespec deadline, Requires: cancel() must happen after add() on a given alarm */ void grpc_alarm_cancel(grpc_alarm *alarm); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_H__ */ diff --git a/src/core/iomgr/alarm_heap.c b/src/core/iomgr/alarm_heap.c index 8a8c9b0bf32..d912178fda3 100644 --- a/src/core/iomgr/alarm_heap.c +++ b/src/core/iomgr/alarm_heap.c @@ -145,4 +145,4 @@ grpc_alarm *grpc_alarm_heap_top(grpc_alarm_heap *heap) { void grpc_alarm_heap_pop(grpc_alarm_heap *heap) { grpc_alarm_heap_remove(heap, grpc_alarm_heap_top(heap)); -} \ No newline at end of file +} diff --git a/src/core/iomgr/alarm_heap.h b/src/core/iomgr/alarm_heap.h index 7cf793fc81b..bb6e5e3a899 100644 --- a/src/core/iomgr/alarm_heap.h +++ b/src/core/iomgr/alarm_heap.h @@ -54,4 +54,4 @@ void grpc_alarm_heap_pop(grpc_alarm_heap *heap); int grpc_alarm_heap_is_empty(grpc_alarm_heap *heap); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_HEAP_H_ */ diff --git a/src/core/iomgr/alarm_internal.h b/src/core/iomgr/alarm_internal.h index b87d3b57639..cbd8fa9421f 100644 --- a/src/core/iomgr/alarm_internal.h +++ b/src/core/iomgr/alarm_internal.h @@ -59,4 +59,4 @@ gpr_timespec grpc_alarm_list_next_timeout(void); void grpc_kick_poller(void); -#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_ALARM_INTERNAL_H_ */ diff --git a/src/core/iomgr/endpoint.c b/src/core/iomgr/endpoint.c index 796d89706e7..96487958a71 100644 --- a/src/core/iomgr/endpoint.c +++ b/src/core/iomgr/endpoint.c @@ -52,4 +52,4 @@ void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset) { void grpc_endpoint_shutdown(grpc_endpoint *ep) { ep->vtable->shutdown(ep); } -void grpc_endpoint_destroy(grpc_endpoint *ep) { ep->vtable->destroy(ep); } \ No newline at end of file +void grpc_endpoint_destroy(grpc_endpoint *ep) { ep->vtable->destroy(ep); } diff --git a/src/core/iomgr/endpoint.h b/src/core/iomgr/endpoint.h index bb9552eac99..e89cf6691c0 100644 --- a/src/core/iomgr/endpoint.h +++ b/src/core/iomgr/endpoint.h @@ -103,4 +103,4 @@ struct grpc_endpoint { const grpc_endpoint_vtable *vtable; }; -#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_H__ */ diff --git a/src/core/iomgr/endpoint_pair.h b/src/core/iomgr/endpoint_pair.h index d4981063a41..2e46aab2283 100644 --- a/src/core/iomgr/endpoint_pair.h +++ b/src/core/iomgr/endpoint_pair.h @@ -43,4 +43,4 @@ typedef struct { grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size); -#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ */ diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c index 1ce548f9e68..ac511b97b26 100644 --- a/src/core/iomgr/endpoint_pair_posix.c +++ b/src/core/iomgr/endpoint_pair_posix.c @@ -64,4 +64,4 @@ grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(size_t read_slice_size) { return p; } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index b31b7b151ad..e3571e8e280 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -322,4 +322,4 @@ void grpc_fd_become_writable(grpc_fd *fd, int allow_synchronous_callback) { set_ready(fd, &fd->writest, allow_synchronous_callback); } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h index 1c1def27189..370ab1345a0 100644 --- a/src/core/iomgr/fd_posix.h +++ b/src/core/iomgr/fd_posix.h @@ -147,4 +147,4 @@ void grpc_fd_unref(grpc_fd *fd); void grpc_fd_global_init(void); void grpc_fd_global_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_FD_POSIX_H_ */ diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index 1ad07c06e6e..8b019e80496 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -197,4 +197,4 @@ void grpc_socket_notify_on_read(grpc_winsocket *socket, socket_notify_on_iocp(socket, cb, opaque, &socket->read_info); } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/iocp_windows.h b/src/core/iomgr/iocp_windows.h index 11b66446a9b..d0231702a16 100644 --- a/src/core/iomgr/iocp_windows.h +++ b/src/core/iomgr/iocp_windows.h @@ -49,4 +49,4 @@ void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success void grpc_socket_notify_on_read(grpc_winsocket *, void(*cb)(void *, int success), void *opaque); -#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_IOCP_WINDOWS_H_ */ diff --git a/src/core/iomgr/iomgr.c b/src/core/iomgr/iomgr.c index 41d2d58329b..058685b295d 100644 --- a/src/core/iomgr/iomgr.c +++ b/src/core/iomgr/iomgr.c @@ -205,4 +205,4 @@ int grpc_maybe_call_delayed_callbacks(gpr_mu *drop_mu, int success) { gpr_mu_lock(retake_mu); } return n; -} \ No newline at end of file +} diff --git a/src/core/iomgr/iomgr.h b/src/core/iomgr/iomgr.h index a2e11e580f1..18a7d151fc7 100644 --- a/src/core/iomgr/iomgr.h +++ b/src/core/iomgr/iomgr.h @@ -44,4 +44,4 @@ void grpc_iomgr_shutdown(void); and causes the invocation of a callback at some point in the future */ void grpc_iomgr_add_callback(grpc_iomgr_cb_func cb, void *cb_arg); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_H__ */ diff --git a/src/core/iomgr/iomgr_internal.h b/src/core/iomgr/iomgr_internal.h index 5c980f8af13..7f29f44f7f9 100644 --- a/src/core/iomgr/iomgr_internal.h +++ b/src/core/iomgr/iomgr_internal.h @@ -48,4 +48,4 @@ void grpc_iomgr_unref(void); void grpc_iomgr_platform_init(void); void grpc_iomgr_platform_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_INTERNAL_H_ */ diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/iomgr/iomgr_posix.c index 9ed11a603a6..14e3d182f66 100644 --- a/src/core/iomgr/iomgr_posix.c +++ b/src/core/iomgr/iomgr_posix.c @@ -48,4 +48,4 @@ void grpc_iomgr_platform_shutdown(void) { grpc_fd_global_shutdown(); } -#endif /* GRPC_POSIX_SOCKET */ \ No newline at end of file +#endif /* GRPC_POSIX_SOCKET */ diff --git a/src/core/iomgr/iomgr_posix.h b/src/core/iomgr/iomgr_posix.h index 272fc309c3d..f9e9b3d6ee4 100644 --- a/src/core/iomgr/iomgr_posix.h +++ b/src/core/iomgr/iomgr_posix.h @@ -39,4 +39,4 @@ void grpc_pollset_global_init(void); void grpc_pollset_global_shutdown(void); -#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_IOMGR_POSIX_H_ */ diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/iomgr/iomgr_windows.c index d807c6fc8a0..f130ab9a078 100644 --- a/src/core/iomgr/iomgr_windows.c +++ b/src/core/iomgr/iomgr_windows.c @@ -64,4 +64,4 @@ void grpc_iomgr_platform_shutdown(void) { winsock_shutdown(); } -#endif /* GRPC_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GRPC_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/pollset.h b/src/core/iomgr/pollset.h index 3cd60ba6f6a..9d04b014ba7 100644 --- a/src/core/iomgr/pollset.h +++ b/src/core/iomgr/pollset.h @@ -66,4 +66,4 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline); Requires GRPC_POLLSET_MU(pollset) locked. */ void grpc_pollset_kick(grpc_pollset *pollset); -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_H_ */ diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/iomgr/pollset_multipoller_with_poll_posix.c index 44283750b3e..fbacad1e998 100644 --- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c +++ b/src/core/iomgr/pollset_multipoller_with_poll_posix.c @@ -248,4 +248,4 @@ void grpc_platform_become_multipoller(grpc_pollset *pollset, grpc_fd **fds, } } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/pollset_posix.c b/src/core/iomgr/pollset_posix.c index 1845d749fb9..05b78adeb61 100644 --- a/src/core/iomgr/pollset_posix.c +++ b/src/core/iomgr/pollset_posix.c @@ -311,4 +311,4 @@ static void become_unary_pollset(grpc_pollset *pollset, grpc_fd *fd) { grpc_fd_ref(fd); } -#endif /* GPR_POSIX_POLLSET */ \ No newline at end of file +#endif /* GPR_POSIX_POLLSET */ diff --git a/src/core/iomgr/pollset_posix.h b/src/core/iomgr/pollset_posix.h index cc8de96f859..03b4c775b7f 100644 --- a/src/core/iomgr/pollset_posix.h +++ b/src/core/iomgr/pollset_posix.h @@ -100,4 +100,4 @@ grpc_pollset *grpc_backup_pollset(void); void grpc_platform_become_multipoller(grpc_pollset *pollset, struct grpc_fd **fds, size_t fd_count); -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_POSIX_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_POSIX_H_ */ diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index 7dbe5f88da3..d21072b2832 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -68,4 +68,4 @@ int grpc_pollset_work(grpc_pollset *pollset, gpr_timespec deadline) { void grpc_pollset_kick(grpc_pollset *p) { } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/pollset_windows.h b/src/core/iomgr/pollset_windows.h index 44efca739a5..41c193fcad0 100644 --- a/src/core/iomgr/pollset_windows.h +++ b/src/core/iomgr/pollset_windows.h @@ -53,4 +53,4 @@ typedef struct grpc_pollset { #define GRPC_POLLSET_MU(pollset) (&(pollset)->mu) #define GRPC_POLLSET_CV(pollset) (&(pollset)->cv) -#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_POLLSET_WINDOWS_H_ */ diff --git a/src/core/iomgr/resolve_address.c b/src/core/iomgr/resolve_address.c index 8da7d973c4f..6d748c86981 100644 --- a/src/core/iomgr/resolve_address.c +++ b/src/core/iomgr/resolve_address.c @@ -232,4 +232,4 @@ void grpc_resolve_address(const char *name, const char *default_port, r->cb = cb; r->arg = arg; gpr_thd_new(&id, do_request, r, NULL); -} \ No newline at end of file +} diff --git a/src/core/iomgr/resolve_address.h b/src/core/iomgr/resolve_address.h index ac70744964c..65432ec61aa 100644 --- a/src/core/iomgr/resolve_address.h +++ b/src/core/iomgr/resolve_address.h @@ -66,4 +66,4 @@ void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses); grpc_resolved_addresses *grpc_blocking_resolve_address( const char *addr, const char *default_port); -#endif /* __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_RESOLVE_ADDRESS_H__ */ diff --git a/src/core/iomgr/sockaddr.h b/src/core/iomgr/sockaddr.h index 60512aa4227..a5f7c546ecf 100644 --- a/src/core/iomgr/sockaddr.h +++ b/src/core/iomgr/sockaddr.h @@ -44,4 +44,4 @@ #include "src/core/iomgr/sockaddr_posix.h" #endif -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_H_ */ diff --git a/src/core/iomgr/sockaddr_posix.h b/src/core/iomgr/sockaddr_posix.h index 813c6d462f7..00115e25368 100644 --- a/src/core/iomgr/sockaddr_posix.h +++ b/src/core/iomgr/sockaddr_posix.h @@ -41,4 +41,4 @@ #include #include -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_POSIX_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_POSIX_H_ */ diff --git a/src/core/iomgr/sockaddr_utils.c b/src/core/iomgr/sockaddr_utils.c index 5895610fdd2..740bbe716ec 100644 --- a/src/core/iomgr/sockaddr_utils.c +++ b/src/core/iomgr/sockaddr_utils.c @@ -188,4 +188,4 @@ int grpc_sockaddr_set_port(const struct sockaddr *addr, int port) { __FUNCTION__); return 0; } -} \ No newline at end of file +} diff --git a/src/core/iomgr/sockaddr_utils.h b/src/core/iomgr/sockaddr_utils.h index 7f885d536bb..d3a25ad373b 100644 --- a/src/core/iomgr/sockaddr_utils.h +++ b/src/core/iomgr/sockaddr_utils.h @@ -84,4 +84,4 @@ int grpc_sockaddr_set_port(const struct sockaddr *addr, int port); int grpc_sockaddr_to_string(char **out, const struct sockaddr *addr, int normalize); -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_UTILS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_UTILS_H__ */ diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/iomgr/sockaddr_win32.h index bed9e84c230..6ed164ced1d 100644 --- a/src/core/iomgr/sockaddr_win32.h +++ b/src/core/iomgr/sockaddr_win32.h @@ -38,4 +38,4 @@ #include #include -#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_WIN32_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_SOCKADDR_WIN32_H_ */ diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c index 07ae6b888ca..3c8cafa3152 100644 --- a/src/core/iomgr/socket_utils_common_posix.c +++ b/src/core/iomgr/socket_utils_common_posix.c @@ -192,4 +192,4 @@ int grpc_create_dualstack_socket(const struct sockaddr *addr, int type, return socket(family, type, protocol); } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/socket_utils_linux.c b/src/core/iomgr/socket_utils_linux.c index 81f3bfc40dc..a87625262b2 100644 --- a/src/core/iomgr/socket_utils_linux.c +++ b/src/core/iomgr/socket_utils_linux.c @@ -48,4 +48,4 @@ int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, return accept4(sockfd, addr, addrlen, flags); } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/socket_utils_posix.c b/src/core/iomgr/socket_utils_posix.c index c68a07758ac..3c56b467443 100644 --- a/src/core/iomgr/socket_utils_posix.c +++ b/src/core/iomgr/socket_utils_posix.c @@ -67,4 +67,4 @@ close_and_error: return -1; } -#endif /* GPR_POSIX_SOCKETUTILS */ \ No newline at end of file +#endif /* GPR_POSIX_SOCKETUTILS */ diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h index b8d5ca392a9..b35fe785f1a 100644 --- a/src/core/iomgr/socket_utils_posix.h +++ b/src/core/iomgr/socket_utils_posix.h @@ -105,4 +105,4 @@ extern int grpc_forbid_dualstack_sockets_for_testing; int grpc_create_dualstack_socket(const struct sockaddr *addr, int type, int protocol, grpc_dualstack_mode *dsmode); -#endif /* __GRPC_INTERNAL_IOMGR_SOCKET_UTILS_POSIX_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_SOCKET_UTILS_POSIX_H__ */ diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index 8e99f491e2e..99f38b0e032 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -74,4 +74,4 @@ void grpc_winsocket_orphan(grpc_winsocket *socket) { gpr_free(socket); } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/socket_windows.h b/src/core/iomgr/socket_windows.h index 282e8122aec..de80e97e7f6 100644 --- a/src/core/iomgr/socket_windows.h +++ b/src/core/iomgr/socket_windows.h @@ -72,4 +72,4 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket); void grpc_winsocket_shutdown(grpc_winsocket *socket); void grpc_winsocket_orphan(grpc_winsocket *socket); -#endif /* __GRPC_INTERNAL_IOMGR_HANDLE_WINDOWS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_HANDLE_WINDOWS_H__ */ diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h index 7211921ac94..c919c02440f 100644 --- a/src/core/iomgr/tcp_client.h +++ b/src/core/iomgr/tcp_client.h @@ -45,4 +45,4 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *tcp), void *arg, const struct sockaddr *addr, int addr_len, gpr_timespec deadline); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ */ diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index 25bb8f1826e..137aa99c7b1 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -234,4 +234,4 @@ void grpc_tcp_client_connect(void (*cb)(void *arg, grpc_endpoint *ep), grpc_fd_notify_on_write(ac->fd, on_writable, ac); } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index edbdc744160..2bd93c6af2c 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -212,4 +212,4 @@ failure: cb(arg, NULL); } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index 02227abbf6b..150a907cb10 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -544,4 +544,4 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size) { return &tcp->base; } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/tcp_posix.h b/src/core/iomgr/tcp_posix.h index 7cac941f809..6ff87704efb 100644 --- a/src/core/iomgr/tcp_posix.h +++ b/src/core/iomgr/tcp_posix.h @@ -53,4 +53,4 @@ Takes ownership of fd. */ grpc_endpoint *grpc_tcp_create(grpc_fd *fd, size_t read_slice_size); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_POSIX_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_TCP_POSIX_H__ */ diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index 2466cafbb00..c1e5f45208d 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -73,4 +73,4 @@ int grpc_tcp_server_get_fd(grpc_tcp_server *s, unsigned index); void grpc_tcp_server_destroy(grpc_tcp_server *server); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_TCP_SERVER_H__ */ diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 659aa1e07b7..b7a06259497 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -399,4 +399,4 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset **pollsets, gpr_mu_unlock(&s->mu); } -#endif \ No newline at end of file +#endif diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/iomgr/tcp_server_windows.c index cde21bddfe9..c6864efdc53 100644 --- a/src/core/iomgr/tcp_server_windows.c +++ b/src/core/iomgr/tcp_server_windows.c @@ -371,4 +371,4 @@ void grpc_tcp_server_start(grpc_tcp_server *s, grpc_pollset *pollset, gpr_mu_unlock(&s->mu); } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 06543cff8d2..3efd69a71b9 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -370,4 +370,4 @@ grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket) { return &tcp->base; } -#endif /* GPR_WINSOCK_SOCKET */ \ No newline at end of file +#endif /* GPR_WINSOCK_SOCKET */ diff --git a/src/core/iomgr/tcp_windows.h b/src/core/iomgr/tcp_windows.h index cb034427858..565d42e5b29 100644 --- a/src/core/iomgr/tcp_windows.h +++ b/src/core/iomgr/tcp_windows.h @@ -54,4 +54,4 @@ grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket); int grpc_tcp_prepare_socket(SOCKET sock); -#endif /* __GRPC_INTERNAL_IOMGR_TCP_WINDOWS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_TCP_WINDOWS_H__ */ diff --git a/src/core/iomgr/time_averaged_stats.c b/src/core/iomgr/time_averaged_stats.c index b5f8b165a4f..f881dde9fc2 100644 --- a/src/core/iomgr/time_averaged_stats.c +++ b/src/core/iomgr/time_averaged_stats.c @@ -74,4 +74,4 @@ double grpc_time_averaged_stats_update_average( stats->batch_num_samples = 0; stats->batch_total_value = 0; return stats->aggregate_weighted_avg; -} \ No newline at end of file +} diff --git a/src/core/iomgr/time_averaged_stats.h b/src/core/iomgr/time_averaged_stats.h index 423979a06f1..e901f3c33b3 100644 --- a/src/core/iomgr/time_averaged_stats.h +++ b/src/core/iomgr/time_averaged_stats.h @@ -85,4 +85,4 @@ void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats *stats, value. */ double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats *stats); -#endif /* __GRPC_INTERNAL_IOMGR_TIME_AVERAGED_STATS_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_IOMGR_TIME_AVERAGED_STATS_H_ */ diff --git a/src/core/json/json.c b/src/core/json/json.c index 5b7e02ebde9..df7108a94de 100644 --- a/src/core/json/json.c +++ b/src/core/json/json.c @@ -61,4 +61,4 @@ void grpc_json_destroy(grpc_json *json) { } gpr_free(json); -} \ No newline at end of file +} diff --git a/src/core/json/json.h b/src/core/json/json.h index 78afa4c48c3..dc519e9d5ec 100644 --- a/src/core/json/json.h +++ b/src/core/json/json.h @@ -85,4 +85,4 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent); grpc_json* grpc_json_create(grpc_json_type type); void grpc_json_destroy(grpc_json* json); -#endif /* __GRPC_SRC_CORE_JSON_JSON_H__ */ \ No newline at end of file +#endif /* __GRPC_SRC_CORE_JSON_JSON_H__ */ diff --git a/src/core/json/json_common.h b/src/core/json/json_common.h index ab7627bdbdc..60763cc72ea 100644 --- a/src/core/json/json_common.h +++ b/src/core/json/json_common.h @@ -46,4 +46,4 @@ typedef enum { GRPC_JSON_TOP_LEVEL } grpc_json_type; -#endif /* __GRPC_SRC_CORE_JSON_JSON_COMMON_H__ */ \ No newline at end of file +#endif /* __GRPC_SRC_CORE_JSON_JSON_COMMON_H__ */ diff --git a/src/core/json/json_reader.c b/src/core/json/json_reader.c index 0e7a61bf2a5..774faa5f239 100644 --- a/src/core/json/json_reader.c +++ b/src/core/json/json_reader.c @@ -650,4 +650,4 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) { } return GRPC_JSON_INTERNAL_ERROR; -} \ No newline at end of file +} diff --git a/src/core/json/json_reader.h b/src/core/json/json_reader.h index 9c2b8e5c55e..f7f59127f93 100644 --- a/src/core/json/json_reader.h +++ b/src/core/json/json_reader.h @@ -157,4 +157,4 @@ void grpc_json_reader_init(grpc_json_reader* reader, */ int grpc_json_reader_is_complete(grpc_json_reader* reader); -#endif /* __GRPC_SRC_CORE_JSON_JSON_READER_H__ */ \ No newline at end of file +#endif /* __GRPC_SRC_CORE_JSON_JSON_READER_H__ */ diff --git a/src/core/json/json_string.c b/src/core/json/json_string.c index 91ae99aa478..13f816995b2 100644 --- a/src/core/json/json_string.c +++ b/src/core/json/json_string.c @@ -388,4 +388,4 @@ char* grpc_json_dump_to_string(grpc_json* json, int indent) { json_writer_output_char(&state, 0); return state.output; -} \ No newline at end of file +} diff --git a/src/core/json/json_writer.c b/src/core/json/json_writer.c index 2e037e2ad3d..4c0bf30780d 100644 --- a/src/core/json/json_writer.c +++ b/src/core/json/json_writer.c @@ -249,4 +249,4 @@ void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string) json_writer_output_indent(writer); json_writer_escape_string(writer, string); writer->got_key = 0; -} \ No newline at end of file +} diff --git a/src/core/json/json_writer.h b/src/core/json/json_writer.h index d63add50199..5d5d0891a3c 100644 --- a/src/core/json/json_writer.h +++ b/src/core/json/json_writer.h @@ -90,4 +90,4 @@ void grpc_json_writer_value_raw_with_len(grpc_json_writer* writer, const char* s /* Sets a string value. It'll be escaped, and utf-8 validated. */ void grpc_json_writer_value_string(grpc_json_writer* writer, const char* string); -#endif /* __GRPC_SRC_CORE_JSON_JSON_WRITER_H__ */ \ No newline at end of file +#endif /* __GRPC_SRC_CORE_JSON_JSON_WRITER_H__ */ diff --git a/src/core/security/auth.c b/src/core/security/auth.c index 2126a2afee8..58679a87aa5 100644 --- a/src/core/security/auth.c +++ b/src/core/security/auth.c @@ -251,4 +251,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) { const grpc_channel_filter grpc_client_auth_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "auth"}; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "auth"}; diff --git a/src/core/security/auth.h b/src/core/security/auth.h index 6e2afcbfc31..fee75c40e1c 100644 --- a/src/core/security/auth.h +++ b/src/core/security/auth.h @@ -38,4 +38,4 @@ extern const grpc_channel_filter grpc_client_auth_filter; -#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_AUTH_H__ */ diff --git a/src/core/security/base64.c b/src/core/security/base64.c index f418a2a1678..3b8fea8f737 100644 --- a/src/core/security/base64.c +++ b/src/core/security/base64.c @@ -195,4 +195,4 @@ gpr_slice grpc_base64_decode(const char *b64, int url_safe) { fail: gpr_slice_unref(result); return gpr_empty_slice(); -} \ No newline at end of file +} diff --git a/src/core/security/base64.h b/src/core/security/base64.h index 77c7ecec1c4..0eb69d0ccb3 100644 --- a/src/core/security/base64.h +++ b/src/core/security/base64.h @@ -45,4 +45,4 @@ char *grpc_base64_encode(const void *data, size_t data_size, int url_safe, slice in case of failure. */ gpr_slice grpc_base64_decode(const char *b64, int url_safe); -#endif /* __GRPC_INTERNAL_SECURITY_BASE64_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_BASE64_H_ */ diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 49ccd070df3..b2e0fd215a9 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -943,4 +943,4 @@ grpc_credentials *grpc_iam_credentials_create(const char *token, /* -- Default credentials TODO(jboeuf). -- */ -grpc_credentials *grpc_default_credentials_create(void) { return NULL; } \ No newline at end of file +grpc_credentials *grpc_default_credentials_create(void) { return NULL; } diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h index a0ec11a85b6..614db96ad7a 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -150,4 +150,4 @@ typedef struct { const grpc_ssl_server_config *grpc_ssl_server_credentials_get_config( const grpc_server_credentials *ssl_creds); -#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_CREDENTIALS_H__ */ diff --git a/src/core/security/factories.c b/src/core/security/factories.c index 3843aff6fc3..c9701b9080d 100644 --- a/src/core/security/factories.c +++ b/src/core/security/factories.c @@ -77,4 +77,4 @@ grpc_server *grpc_secure_server_create(grpc_server_credentials *creds, server = grpc_secure_server_create_internal(cq, args, ctx); grpc_security_context_unref(ctx); return server; -} \ No newline at end of file +} diff --git a/src/core/security/google_root_certs.c b/src/core/security/google_root_certs.c index 9944e8d891b..1a44058a29e 100644 --- a/src/core/security/google_root_certs.c +++ b/src/core/security/google_root_certs.c @@ -11274,4 +11274,4 @@ unsigned char grpc_google_root_certs[] = { 0x64, 0x64, 0x49, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a}; -unsigned int grpc_google_root_certs_size = 134862; \ No newline at end of file +unsigned int grpc_google_root_certs_size = 134862; diff --git a/src/core/security/google_root_certs.h b/src/core/security/google_root_certs.h index 20353a00c3c..914e7561718 100644 --- a/src/core/security/google_root_certs.h +++ b/src/core/security/google_root_certs.h @@ -37,4 +37,4 @@ extern unsigned char grpc_google_root_certs[]; extern unsigned int grpc_google_root_certs_size; -#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_GOOGLE_ROOT_CERTS_H__ */ diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index 3bba57b574c..c85b0cd8475 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -321,4 +321,4 @@ char *grpc_jwt_encode_and_sign(const grpc_auth_json_key *json_key, void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func) { g_jwt_encode_and_sign_override = func; -} \ No newline at end of file +} diff --git a/src/core/security/json_token.h b/src/core/security/json_token.h index 9256d028a61..5a9b2dab4b3 100644 --- a/src/core/security/json_token.h +++ b/src/core/security/json_token.h @@ -74,4 +74,4 @@ typedef char *(*grpc_jwt_encode_and_sign_override)( void grpc_jwt_encode_and_sign_set_override( grpc_jwt_encode_and_sign_override func); -#endif /* __GRPC_INTERNAL_SECURITY_JSON_TOKEN_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_JSON_TOKEN_H_ */ diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index 137edf378f7..031f23dc79d 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -356,4 +356,4 @@ grpc_endpoint *grpc_secure_endpoint_create( gpr_mu_init(&ep->protector_mu); gpr_ref_init(&ep->ref, 1); return &ep->base; -} \ No newline at end of file +} diff --git a/src/core/security/secure_endpoint.h b/src/core/security/secure_endpoint.h index a98deba8d8f..82ba4082e32 100644 --- a/src/core/security/secure_endpoint.h +++ b/src/core/security/secure_endpoint.h @@ -44,4 +44,4 @@ grpc_endpoint *grpc_secure_endpoint_create( struct tsi_frame_protector *protector, grpc_endpoint *to_wrap, gpr_slice *leftover_slices, size_t leftover_nslices); -#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ */ diff --git a/src/core/security/secure_transport_setup.c b/src/core/security/secure_transport_setup.c index d227ace2af9..f57d22109ce 100644 --- a/src/core/security/secure_transport_setup.c +++ b/src/core/security/secure_transport_setup.c @@ -283,4 +283,4 @@ void grpc_setup_secure_transport(grpc_security_context *ctx, s->cb = cb; gpr_slice_buffer_init(&s->left_overs); send_handshake_bytes_to_peer(s); -} \ No newline at end of file +} diff --git a/src/core/security/secure_transport_setup.h b/src/core/security/secure_transport_setup.h index a5882f3e026..21f41fd6822 100644 --- a/src/core/security/secure_transport_setup.h +++ b/src/core/security/secure_transport_setup.h @@ -50,4 +50,4 @@ void grpc_setup_secure_transport(grpc_security_context *ctx, grpc_secure_transport_setup_done_cb cb, void *user_data); -#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ */ diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index 37b36c167ec..f9fb2407cf9 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -630,4 +630,4 @@ grpc_channel *grpc_default_secure_channel_create( const char *target, const grpc_channel_args *args) { return grpc_secure_channel_create(grpc_default_credentials_create(), target, args); -} \ No newline at end of file +} diff --git a/src/core/security/security_context.h b/src/core/security/security_context.h index 5e9f943f606..e3d91139678 100644 --- a/src/core/security/security_context.h +++ b/src/core/security/security_context.h @@ -204,4 +204,4 @@ grpc_server *grpc_secure_server_create_internal(grpc_completion_queue *cq, const grpc_channel_args *args, grpc_security_context *ctx); -#endif /* __GRPC_INTERNAL_SECURITY_SECURITY_CONTEXT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SECURITY_SECURITY_CONTEXT_H__ */ diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index edad78152e8..c88f0726bb7 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -146,4 +146,4 @@ error: grpc_tcp_server_destroy(tcp); } return 0; -} \ No newline at end of file +} diff --git a/src/core/statistics/census_init.c b/src/core/statistics/census_init.c index c81aa1524a0..820d75f795e 100644 --- a/src/core/statistics/census_init.c +++ b/src/core/statistics/census_init.c @@ -47,4 +47,4 @@ void census_shutdown(void) { gpr_log(GPR_INFO, "Shutdown census library."); census_stats_store_shutdown(); census_tracing_shutdown(); -} \ No newline at end of file +} diff --git a/src/core/statistics/census_interface.h b/src/core/statistics/census_interface.h index 756e4727417..0bb0a9f328d 100644 --- a/src/core/statistics/census_interface.h +++ b/src/core/statistics/census_interface.h @@ -73,4 +73,4 @@ census_op_id census_tracing_start_op(void); /* Ends tracing. Calling this function will invalidate the input op_id. */ void census_tracing_end_op(census_op_id op_id); -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_INTERFACE_H__ */ diff --git a/src/core/statistics/census_log.c b/src/core/statistics/census_log.c index 6633b044e0c..24e46876d25 100644 --- a/src/core/statistics/census_log.c +++ b/src/core/statistics/census_log.c @@ -601,4 +601,4 @@ size_t census_log_remaining_space(void) { int census_log_out_of_space_count(void) { GPR_ASSERT(g_log.initialized); return gpr_atm_acq_load(&g_log.out_of_space_count); -} \ No newline at end of file +} diff --git a/src/core/statistics/census_log.h b/src/core/statistics/census_log.h index e1aaa05f7f1..01fd63aca39 100644 --- a/src/core/statistics/census_log.h +++ b/src/core/statistics/census_log.h @@ -88,4 +88,4 @@ size_t census_log_remaining_space(void); out-of-space. */ int census_log_out_of_space_count(void); -#endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_LOG_H__ */ diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c index 957f20d0666..388ce4fe2c8 100644 --- a/src/core/statistics/census_rpc_stats.c +++ b/src/core/statistics/census_rpc_stats.c @@ -251,4 +251,4 @@ void census_stats_store_shutdown(void) { gpr_log(GPR_ERROR, "Census client stats store not initialized."); } gpr_mu_unlock(&g_mu); -} \ No newline at end of file +} diff --git a/src/core/statistics/census_rpc_stats.h b/src/core/statistics/census_rpc_stats.h index 9c7f3219847..942de81b888 100644 --- a/src/core/statistics/census_rpc_stats.h +++ b/src/core/statistics/census_rpc_stats.h @@ -98,4 +98,4 @@ void census_stats_store_shutdown(void); } #endif -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_RPC_STATS_H__ */ diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c index 8612d2cf7d9..adfcbecb4c8 100644 --- a/src/core/statistics/census_tracing.c +++ b/src/core/statistics/census_tracing.c @@ -236,4 +236,4 @@ census_trace_obj** census_get_active_ops(int* num_active_ops) { } gpr_mu_unlock(&g_mu); return ret; -} \ No newline at end of file +} diff --git a/src/core/statistics/census_tracing.h b/src/core/statistics/census_tracing.h index 173e82c3c97..51aa578c0c1 100644 --- a/src/core/statistics/census_tracing.h +++ b/src/core/statistics/census_tracing.h @@ -93,4 +93,4 @@ census_trace_obj** census_get_active_ops(int* num_active_ops); } #endif -#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_TRACING_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_CENSUS_TRACING_H_ */ diff --git a/src/core/statistics/hash_table.c b/src/core/statistics/hash_table.c index 0afb12c368c..56bdcc2ffff 100644 --- a/src/core/statistics/hash_table.c +++ b/src/core/statistics/hash_table.c @@ -300,4 +300,4 @@ void census_ht_destroy(census_ht* ht) { gpr_free(ht); } -size_t census_ht_get_size(const census_ht* ht) { return ht->size; } \ No newline at end of file +size_t census_ht_get_size(const census_ht* ht) { return ht->size; } diff --git a/src/core/statistics/hash_table.h b/src/core/statistics/hash_table.h index c7f592c813a..2c2386d1ab1 100644 --- a/src/core/statistics/hash_table.h +++ b/src/core/statistics/hash_table.h @@ -128,4 +128,4 @@ typedef void (*census_ht_itr_cb)(census_ht_key key, const void* val_ptr, should not invalidate data entries. */ gpr_uint64 census_ht_for_all(const census_ht* ht, census_ht_itr_cb); -#endif /* __GRPC_INTERNAL_STATISTICS_HASH_TABLE_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_HASH_TABLE_H_ */ diff --git a/src/core/statistics/window_stats.c b/src/core/statistics/window_stats.c index f84b9316026..a64e0805652 100644 --- a/src/core/statistics/window_stats.c +++ b/src/core/statistics/window_stats.c @@ -314,4 +314,4 @@ void census_window_stats_destroy(window_stats* wstats) { /* Ensure any use-after free triggers assert. */ wstats->interval_stats = NULL; gpr_free(wstats); -} \ No newline at end of file +} diff --git a/src/core/statistics/window_stats.h b/src/core/statistics/window_stats.h index 1fd711939f0..98f8dac5595 100644 --- a/src/core/statistics/window_stats.h +++ b/src/core/statistics/window_stats.h @@ -170,4 +170,4 @@ void census_window_stats_get_sums(const struct census_window_stats* wstats, assertion failure). This function is thread-compatible. */ void census_window_stats_destroy(struct census_window_stats* wstats); -#endif /* __GRPC_INTERNAL_STATISTICS_WINDOW_STATS_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_STATISTICS_WINDOW_STATS_H_ */ diff --git a/src/core/support/alloc.c b/src/core/support/alloc.c index 9ce78c64730..44f343b4f40 100644 --- a/src/core/support/alloc.c +++ b/src/core/support/alloc.c @@ -62,4 +62,4 @@ void *gpr_malloc_aligned(size_t size, size_t alignment) { return (void *)ret; } -void gpr_free_aligned(void *ptr) { free(((void **)ptr)[-1]); } \ No newline at end of file +void gpr_free_aligned(void *ptr) { free(((void **)ptr)[-1]); } diff --git a/src/core/support/cancellable.c b/src/core/support/cancellable.c index b632a3c2fdb..5a4d488dd3c 100644 --- a/src/core/support/cancellable.c +++ b/src/core/support/cancellable.c @@ -153,4 +153,4 @@ int gpr_cv_cancellable_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline, } gpr_mu_unlock(&c->mu); return timeout; -} \ No newline at end of file +} diff --git a/src/core/support/cmdline.c b/src/core/support/cmdline.c index d2f8d3810ec..72f46c1bd72 100644 --- a/src/core/support/cmdline.c +++ b/src/core/support/cmdline.c @@ -289,4 +289,4 @@ void gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv) { for (i = 1; i < argc; i++) { cl->state(cl, argv[i]); } -} \ No newline at end of file +} diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c index 397fd9d68a6..ef6bf9ca096 100644 --- a/src/core/support/cpu_linux.c +++ b/src/core/support/cpu_linux.c @@ -70,4 +70,4 @@ unsigned gpr_cpu_current_cpu(void) { return cpu; } -#endif /* GPR_CPU_LINUX */ \ No newline at end of file +#endif /* GPR_CPU_LINUX */ diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c index 19c032bdc0e..91f722530ca 100644 --- a/src/core/support/cpu_posix.c +++ b/src/core/support/cpu_posix.c @@ -71,4 +71,4 @@ unsigned gpr_cpu_current_cpu(void) { return shard_ptr(&magic_thread_local); } -#endif /* GPR_CPU_LINUX */ \ No newline at end of file +#endif /* GPR_CPU_LINUX */ diff --git a/src/core/support/env.h b/src/core/support/env.h index 35ef565a24b..0c6091b84b8 100644 --- a/src/core/support/env.h +++ b/src/core/support/env.h @@ -57,4 +57,4 @@ void gpr_setenv(const char *name, const char *value); } #endif -#endif /* __GRPC_SUPPORT_ENV_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_ENV_H__ */ diff --git a/src/core/support/env_linux.c b/src/core/support/env_linux.c index ffd79280404..bdadfb6ca4c 100644 --- a/src/core/support/env_linux.c +++ b/src/core/support/env_linux.c @@ -58,4 +58,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_LINUX_ENV */ \ No newline at end of file +#endif /* GPR_LINUX_ENV */ diff --git a/src/core/support/env_posix.c b/src/core/support/env_posix.c index 4cc71b31523..45f89b67379 100644 --- a/src/core/support/env_posix.c +++ b/src/core/support/env_posix.c @@ -53,4 +53,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_POSIX_ENV */ \ No newline at end of file +#endif /* GPR_POSIX_ENV */ diff --git a/src/core/support/env_win32.c b/src/core/support/env_win32.c index f35fab25abe..177cc36a30a 100644 --- a/src/core/support/env_win32.c +++ b/src/core/support/env_win32.c @@ -58,4 +58,4 @@ void gpr_setenv(const char *name, const char *value) { GPR_ASSERT(res == 0); } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/file.c b/src/core/support/file.c index dfe31102821..70100b7e9b5 100644 --- a/src/core/support/file.c +++ b/src/core/support/file.c @@ -86,4 +86,4 @@ end: } if (file != NULL) fclose(file); return result; -} \ No newline at end of file +} diff --git a/src/core/support/file.h b/src/core/support/file.h index 2bb5418c17b..600850e03d4 100644 --- a/src/core/support/file.h +++ b/src/core/support/file.h @@ -58,4 +58,4 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename); } #endif -#endif /* __GRPC_SUPPORT_FILE_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_FILE_H__ */ diff --git a/src/core/support/file_posix.c b/src/core/support/file_posix.c index 612a101d3d0..11a459ad364 100644 --- a/src/core/support/file_posix.c +++ b/src/core/support/file_posix.c @@ -81,4 +81,4 @@ end: return result; } -#endif /* GPR_POSIX_FILE */ \ No newline at end of file +#endif /* GPR_POSIX_FILE */ diff --git a/src/core/support/file_win32.c b/src/core/support/file_win32.c index d36a3af203e..fe209af9b2d 100644 --- a/src/core/support/file_win32.c +++ b/src/core/support/file_win32.c @@ -80,4 +80,4 @@ end: return result; } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/histogram.c b/src/core/support/histogram.c index 47f763f3866..eacb77082f9 100644 --- a/src/core/support/histogram.c +++ b/src/core/support/histogram.c @@ -221,4 +221,4 @@ double gpr_histogram_sum(gpr_histogram *h) { return h->sum; } double gpr_histogram_sum_of_squares(gpr_histogram *h) { return h->sum_of_squares; -} \ No newline at end of file +} diff --git a/src/core/support/host_port.c b/src/core/support/host_port.c index c0e7636518a..379d30b0456 100644 --- a/src/core/support/host_port.c +++ b/src/core/support/host_port.c @@ -46,4 +46,4 @@ int gpr_join_host_port(char **out, const char *host, int port) { /* Ordinary non-bracketed host:port. */ return gpr_asprintf(out, "%s:%d", host, port); } -} \ No newline at end of file +} diff --git a/src/core/support/log.c b/src/core/support/log.c index d1b14bbfdbc..f52c2035b9c 100644 --- a/src/core/support/log.c +++ b/src/core/support/log.c @@ -62,4 +62,4 @@ void gpr_log_message(const char *file, int line, gpr_log_severity severity, g_log_func(&lfargs); } -void gpr_set_log_function(gpr_log_func f) { g_log_func = f; } \ No newline at end of file +void gpr_set_log_function(gpr_log_func f) { g_log_func = f; } diff --git a/src/core/support/log_android.c b/src/core/support/log_android.c index c2fcd469058..5d0c7d820d8 100644 --- a/src/core/support/log_android.c +++ b/src/core/support/log_android.c @@ -84,4 +84,4 @@ void gpr_default_log(gpr_log_func_args *args) { free(output); } -#endif /* GPR_ANDROID */ \ No newline at end of file +#endif /* GPR_ANDROID */ diff --git a/src/core/support/log_linux.c b/src/core/support/log_linux.c index 72086d514d9..48349d2c831 100644 --- a/src/core/support/log_linux.c +++ b/src/core/support/log_linux.c @@ -95,4 +95,4 @@ void gpr_default_log(gpr_log_func_args *args) { args->message); } -#endif \ No newline at end of file +#endif diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c index 40c75989f10..8f85791466d 100644 --- a/src/core/support/log_posix.c +++ b/src/core/support/log_posix.c @@ -97,4 +97,4 @@ void gpr_default_log(gpr_log_func_args *args) { args->message); } -#endif /* defined(GPR_POSIX_LOG) */ \ No newline at end of file +#endif /* defined(GPR_POSIX_LOG) */ diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c index 39ce5c652ab..cff130ae18d 100644 --- a/src/core/support/log_win32.c +++ b/src/core/support/log_win32.c @@ -110,4 +110,4 @@ char *gpr_format_message(DWORD messageid) { return message; } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/murmur_hash.c b/src/core/support/murmur_hash.c index ef7ff7a9afc..cc84691508f 100644 --- a/src/core/support/murmur_hash.c +++ b/src/core/support/murmur_hash.c @@ -93,4 +93,4 @@ gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed) { h1 ^= len; FMIX32(h1); return h1; -} \ No newline at end of file +} diff --git a/src/core/support/murmur_hash.h b/src/core/support/murmur_hash.h index 2609ccd4e68..06c0c560797 100644 --- a/src/core/support/murmur_hash.h +++ b/src/core/support/murmur_hash.h @@ -41,4 +41,4 @@ /* compute the hash of key (length len) */ gpr_uint32 gpr_murmur_hash3(const void *key, size_t len, gpr_uint32 seed); -#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SUPPORT_MURMUR_HASH_H__ */ diff --git a/src/core/support/slice.c b/src/core/support/slice.c index de26136f854..4cff029286c 100644 --- a/src/core/support/slice.c +++ b/src/core/support/slice.c @@ -322,4 +322,4 @@ int gpr_slice_str_cmp(gpr_slice a, const char *b) { int d = GPR_SLICE_LENGTH(a) - b_length; if (d != 0) return d; return memcmp(GPR_SLICE_START_PTR(a), b, b_length); -} \ No newline at end of file +} diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index 2560c0ffa6e..6cd51f925c3 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -152,4 +152,4 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) { sb->count = 0; sb->length = 0; -} \ No newline at end of file +} diff --git a/src/core/support/string.c b/src/core/support/string.c index 634c4ddcafa..f3d26b45acf 100644 --- a/src/core/support/string.c +++ b/src/core/support/string.c @@ -197,4 +197,4 @@ void gpr_strvec_add(gpr_strvec *sv, char *str) { char *gpr_strvec_flatten(gpr_strvec *sv, size_t *final_length) { return gpr_strjoin((const char**)sv->strs, sv->count, final_length); -} \ No newline at end of file +} diff --git a/src/core/support/string.h b/src/core/support/string.h index 19cf8a0f6f8..eaa18264392 100644 --- a/src/core/support/string.h +++ b/src/core/support/string.h @@ -106,4 +106,4 @@ char *gpr_strvec_flatten(gpr_strvec *strs, size_t *total_length); } #endif -#endif /* __GRPC_SUPPORT_STRING_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_STRING_H__ */ diff --git a/src/core/support/string_posix.c b/src/core/support/string_posix.c index 32f1137dfe4..8a678b3103d 100644 --- a/src/core/support/string_posix.c +++ b/src/core/support/string_posix.c @@ -83,4 +83,4 @@ int gpr_asprintf(char **strp, const char *format, ...) { return -1; } -#endif /* GPR_POSIX_STRING */ \ No newline at end of file +#endif /* GPR_POSIX_STRING */ diff --git a/src/core/support/string_win32.c b/src/core/support/string_win32.c index b853f25880d..583abd27d82 100644 --- a/src/core/support/string_win32.c +++ b/src/core/support/string_win32.c @@ -107,4 +107,4 @@ char *gpr_char_to_tchar(LPTSTR input) { } #endif -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/string_win32.h b/src/core/support/string_win32.h index ab3fe87fb4f..5dbb40dbc3b 100644 --- a/src/core/support/string_win32.h +++ b/src/core/support/string_win32.h @@ -46,4 +46,4 @@ LPSTR gpr_tchar_to_char(LPCTSTR input); #endif /* GPR_WIN32 */ -#endif /* __GRPC_SUPPORT_STRING_WIN32_H__ */ \ No newline at end of file +#endif /* __GRPC_SUPPORT_STRING_WIN32_H__ */ diff --git a/src/core/support/sync.c b/src/core/support/sync.c index 6d8119769de..1a5cf57c4f2 100644 --- a/src/core/support/sync.c +++ b/src/core/support/sync.c @@ -132,4 +132,4 @@ void gpr_stats_inc(gpr_stats_counter *c, gpr_intptr inc) { gpr_intptr gpr_stats_read(const gpr_stats_counter *c) { /* don't need acquire-load, but we have no no-barrier load yet */ return gpr_atm_acq_load(&c->value); -} \ No newline at end of file +} diff --git a/src/core/support/sync_posix.c b/src/core/support/sync_posix.c index 9a9a5ed7d63..0ccbd4923f8 100644 --- a/src/core/support/sync_posix.c +++ b/src/core/support/sync_posix.c @@ -87,4 +87,4 @@ void gpr_once_init(gpr_once *once, void (*init_function)(void)) { GPR_ASSERT(pthread_once(once, init_function) == 0); } -#endif /* GRP_POSIX_SYNC */ \ No newline at end of file +#endif /* GRP_POSIX_SYNC */ diff --git a/src/core/support/sync_win32.c b/src/core/support/sync_win32.c index a00df07b988..c9a977cc80e 100644 --- a/src/core/support/sync_win32.c +++ b/src/core/support/sync_win32.c @@ -126,4 +126,4 @@ void gpr_once_init(gpr_once *once, void (*init_function)(void)) { InitOnceExecuteOnce(once, run_once_func, &arg, &dummy); } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/thd_internal.h b/src/core/support/thd_internal.h index 4358692a973..0fb1447e488 100644 --- a/src/core/support/thd_internal.h +++ b/src/core/support/thd_internal.h @@ -36,4 +36,4 @@ /* Internal interfaces between modules within the gpr support library. */ -#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SUPPORT_THD_INTERNAL_H__ */ diff --git a/src/core/support/thd_posix.c b/src/core/support/thd_posix.c index ad015a88f9d..f50ea583357 100644 --- a/src/core/support/thd_posix.c +++ b/src/core/support/thd_posix.c @@ -88,4 +88,4 @@ gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)pthread_self(); } -#endif /* GPR_POSIX_SYNC */ \ No newline at end of file +#endif /* GPR_POSIX_SYNC */ diff --git a/src/core/support/thd_win32.c b/src/core/support/thd_win32.c index e50086c51ff..347cad57e3a 100644 --- a/src/core/support/thd_win32.c +++ b/src/core/support/thd_win32.c @@ -83,4 +83,4 @@ gpr_thd_id gpr_thd_currentid(void) { return (gpr_thd_id)GetCurrentThreadId(); } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/support/time.c b/src/core/support/time.c index bb67c7e836b..67f76656502 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -251,4 +251,4 @@ gpr_int32 gpr_time_to_millis(gpr_timespec t) { double gpr_timespec_to_micros(gpr_timespec t) { return t.tv_sec * GPR_US_PER_SEC + t.tv_nsec * 1e-3; -} \ No newline at end of file +} diff --git a/src/core/support/time_posix.c b/src/core/support/time_posix.c index 314daa8ac0e..3675f1eb229 100644 --- a/src/core/support/time_posix.c +++ b/src/core/support/time_posix.c @@ -96,4 +96,4 @@ void gpr_sleep_until(gpr_timespec until) { } } -#endif /* GPR_POSIX_TIME */ \ No newline at end of file +#endif /* GPR_POSIX_TIME */ diff --git a/src/core/support/time_win32.c b/src/core/support/time_win32.c index 5ee69cbb961..82568496558 100644 --- a/src/core/support/time_win32.c +++ b/src/core/support/time_win32.c @@ -49,4 +49,4 @@ gpr_timespec gpr_now(void) { return now_tv; } -#endif /* GPR_WIN32 */ \ No newline at end of file +#endif /* GPR_WIN32 */ diff --git a/src/core/surface/byte_buffer.c b/src/core/surface/byte_buffer.c index 7466009b8c0..12244f6644e 100644 --- a/src/core/surface/byte_buffer.c +++ b/src/core/surface/byte_buffer.c @@ -77,4 +77,4 @@ size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) { } gpr_log(GPR_ERROR, "should never reach here"); abort(); -} \ No newline at end of file +} diff --git a/src/core/surface/byte_buffer_queue.c b/src/core/surface/byte_buffer_queue.c index 1541a4b3b9f..7c31bfe5da2 100644 --- a/src/core/surface/byte_buffer_queue.c +++ b/src/core/surface/byte_buffer_queue.c @@ -88,4 +88,4 @@ grpc_byte_buffer *grpc_bbq_pop(grpc_byte_buffer_queue *q) { } return q->draining.data[q->drain_pos++]; -} \ No newline at end of file +} diff --git a/src/core/surface/byte_buffer_queue.h b/src/core/surface/byte_buffer_queue.h index f3f58b698d8..9d3b5257a7a 100644 --- a/src/core/surface/byte_buffer_queue.h +++ b/src/core/surface/byte_buffer_queue.h @@ -57,4 +57,4 @@ void grpc_bbq_flush(grpc_byte_buffer_queue *q); int grpc_bbq_empty(grpc_byte_buffer_queue *q); void grpc_bbq_push(grpc_byte_buffer_queue *q, grpc_byte_buffer *bb); -#endif /* __GRPC_INTERNAL_SURFACE_BYTE_BUFFER_QUEUE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_BYTE_BUFFER_QUEUE_H__ */ diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 7582cb610ef..fd5289bac38 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -71,4 +71,4 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) { free(reader); -} \ No newline at end of file +} diff --git a/src/core/surface/call.c b/src/core/surface/call.c index a08a8b89050..89a6ba63b27 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1401,4 +1401,4 @@ grpc_call_error grpc_call_start_write_status_old(grpc_call *call, unlock(call); return err; -} \ No newline at end of file +} diff --git a/src/core/surface/call.h b/src/core/surface/call.h index 270b14f486a..dd3ad124e6d 100644 --- a/src/core/surface/call.h +++ b/src/core/surface/call.h @@ -119,4 +119,4 @@ grpc_call_stack *grpc_call_get_call_stack(grpc_call *call); /* Given the top call_element, get the call object. */ grpc_call *grpc_call_from_top_element(grpc_call_element *surface_element); -#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_CALL_H__ */ diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index 9dc28549691..e308c60410f 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -193,4 +193,4 @@ grpc_mdstr *grpc_channel_get_status_string(grpc_channel *channel) { grpc_mdstr *grpc_channel_get_message_string(grpc_channel *channel) { return channel->grpc_message_string; -} \ No newline at end of file +} diff --git a/src/core/surface/channel.h b/src/core/surface/channel.h index 0e6276ab585..6bdfd474d2e 100644 --- a/src/core/surface/channel.h +++ b/src/core/surface/channel.h @@ -50,4 +50,4 @@ void grpc_client_channel_closed(grpc_channel_element *elem); void grpc_channel_internal_ref(grpc_channel *channel); void grpc_channel_internal_unref(grpc_channel *channel); -#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_CHANNEL_H__ */ diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c index 85464d56f99..7a5f62ed53e 100644 --- a/src/core/surface/channel_create.c +++ b/src/core/surface/channel_create.c @@ -209,4 +209,4 @@ grpc_channel *grpc_channel_create(const char *target, s); return channel; -} \ No newline at end of file +} diff --git a/src/core/surface/client.c b/src/core/surface/client.c index 7a63b518fa3..4d54865d167 100644 --- a/src/core/surface/client.c +++ b/src/core/surface/client.c @@ -116,4 +116,4 @@ static void destroy_channel_elem(grpc_channel_element *elem) {} const grpc_channel_filter grpc_client_surface_filter = { call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, "client", }; \ No newline at end of file + init_channel_elem, destroy_channel_elem, "client", }; diff --git a/src/core/surface/client.h b/src/core/surface/client.h index 8763441acd6..06ce8f66567 100644 --- a/src/core/surface/client.h +++ b/src/core/surface/client.h @@ -38,4 +38,4 @@ extern const grpc_channel_filter grpc_client_surface_filter; -#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_CLIENT_H__ */ diff --git a/src/core/surface/completion_queue.c b/src/core/surface/completion_queue.c index f8538bf44f5..2efc084d7b3 100644 --- a/src/core/surface/completion_queue.c +++ b/src/core/surface/completion_queue.c @@ -421,4 +421,4 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc) { grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc) { return &cc->pollset; -} \ No newline at end of file +} diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h index d5f24822785..a7688b844c6 100644 --- a/src/core/surface/completion_queue.h +++ b/src/core/surface/completion_queue.h @@ -114,4 +114,4 @@ void grpc_cq_dump_pending_ops(grpc_completion_queue *cc); grpc_pollset *grpc_cq_pollset(grpc_completion_queue *cc); -#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_COMPLETION_QUEUE_H__ */ diff --git a/src/core/surface/event_string.c b/src/core/surface/event_string.c index 8a3be6ced55..0fa3f166e2c 100644 --- a/src/core/surface/event_string.c +++ b/src/core/surface/event_string.c @@ -134,4 +134,4 @@ char *grpc_event_string(grpc_event *ev) { out = gpr_strvec_flatten(&buf, NULL); gpr_strvec_destroy(&buf); return out; -} \ No newline at end of file +} diff --git a/src/core/surface/event_string.h b/src/core/surface/event_string.h index 56c32e6037f..d9b1e4e0747 100644 --- a/src/core/surface/event_string.h +++ b/src/core/surface/event_string.h @@ -39,4 +39,4 @@ /* Returns a string describing an event. Must be later freed with gpr_free() */ char *grpc_event_string(grpc_event *ev); -#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_EVENT_STRING_H__ */ diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index c91936fe4a2..57f6ddf0f7f 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -122,4 +122,4 @@ grpc_channel *grpc_lame_client_channel_create(void) { static const grpc_channel_filter *filters[] = {&lame_filter}; return grpc_channel_create_from_filters(filters, 1, NULL, grpc_mdctx_create(), 1); -} \ No newline at end of file +} diff --git a/src/core/surface/lame_client.h b/src/core/surface/lame_client.h index dae939586da..2bd97b95eb1 100644 --- a/src/core/surface/lame_client.h +++ b/src/core/surface/lame_client.h @@ -39,4 +39,4 @@ /* Create a lame client: this client fails every operation attempted on it. */ grpc_channel *grpc_lame_client_channel_create(void); -#endif /* __GRPC_INTERNAL_SURFACE_LAME_CLIENT_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_LAME_CLIENT_H_ */ diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index 14090883eb5..c6968f4b24b 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -237,4 +237,4 @@ grpc_channel *grpc_secure_channel_create_internal( args, mdctx, initiate_setup, done_setup, s); return channel; -} \ No newline at end of file +} diff --git a/src/core/surface/secure_server_create.c b/src/core/surface/secure_server_create.c index 5c402b05969..1d5b9279977 100644 --- a/src/core/surface/secure_server_create.c +++ b/src/core/surface/secure_server_create.c @@ -54,4 +54,4 @@ grpc_server *grpc_secure_server_create_internal( server = grpc_server_create_from_filters(cq, NULL, 0, args_copy); grpc_channel_args_destroy(args_copy); return server; -} \ No newline at end of file +} diff --git a/src/core/surface/server.c b/src/core/surface/server.c index c90e27008c6..a95215c5de9 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -1124,4 +1124,4 @@ static void publish_registered_or_batch(grpc_call *call, grpc_op_error status, const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server) { return server->channel_args; -} \ No newline at end of file +} diff --git a/src/core/surface/server.h b/src/core/surface/server.h index fd9761bb396..5ae59b22554 100644 --- a/src/core/surface/server.h +++ b/src/core/surface/server.h @@ -60,4 +60,4 @@ grpc_transport_setup_result grpc_server_setup_transport( const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server); -#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_SERVER_H__ */ diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index c18fc90aa14..fd702593b89 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -127,4 +127,4 @@ error: grpc_tcp_server_destroy(tcp); } return 0; -} \ No newline at end of file +} diff --git a/src/core/surface/server_create.c b/src/core/surface/server_create.c index af427ac19d6..f629c7c72de 100644 --- a/src/core/surface/server_create.c +++ b/src/core/surface/server_create.c @@ -38,4 +38,4 @@ grpc_server *grpc_server_create(grpc_completion_queue *cq, const grpc_channel_args *args) { return grpc_server_create_from_filters(cq, NULL, 0, args); -} \ No newline at end of file +} diff --git a/src/core/surface/surface_trace.h b/src/core/surface/surface_trace.h index e65c05f3965..f998de1ad6a 100644 --- a/src/core/surface/surface_trace.h +++ b/src/core/surface/surface_trace.h @@ -51,4 +51,4 @@ } while (0) #endif -#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_SURFACE_SURFACE_TRACE_H__ */ diff --git a/src/core/transport/chttp2/alpn.c b/src/core/transport/chttp2/alpn.c index d436b655846..11901a58a06 100644 --- a/src/core/transport/chttp2/alpn.c +++ b/src/core/transport/chttp2/alpn.c @@ -53,4 +53,4 @@ size_t grpc_chttp2_num_alpn_versions(void) { const char *grpc_chttp2_get_alpn_version_index(size_t i) { GPR_ASSERT(i < GPR_ARRAY_SIZE(supported_versions)); return supported_versions[i]; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/alpn.h b/src/core/transport/chttp2/alpn.h index b7b5f4fe0c4..796f514f19e 100644 --- a/src/core/transport/chttp2/alpn.h +++ b/src/core/transport/chttp2/alpn.h @@ -46,4 +46,4 @@ size_t grpc_chttp2_num_alpn_versions(void); * grpc_chttp2_num_alpn_versions()) */ const char *grpc_chttp2_get_alpn_version_index(size_t i); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_ALPN_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_ALPN_H_ */ diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/transport/chttp2/bin_encoder.c index bd0a0ff8a69..f5ca6c4e506 100644 --- a/src/core/transport/chttp2/bin_encoder.c +++ b/src/core/transport/chttp2/bin_encoder.c @@ -276,4 +276,4 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input) { int grpc_is_binary_header(const char *key, size_t length) { if (length < 5) return 0; return 0 == memcmp(key + length - 4, "-bin", 4); -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/bin_encoder.h b/src/core/transport/chttp2/bin_encoder.h index 221f663e7cf..2368fdd738c 100644 --- a/src/core/transport/chttp2/bin_encoder.h +++ b/src/core/transport/chttp2/bin_encoder.h @@ -53,4 +53,4 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input); int grpc_is_binary_header(const char *key, size_t length); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_BIN_ENCODER_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_BIN_ENCODER_H_ */ diff --git a/src/core/transport/chttp2/frame.h b/src/core/transport/chttp2/frame.h index c76a8dffb8b..733dd5eec48 100644 --- a/src/core/transport/chttp2/frame.h +++ b/src/core/transport/chttp2/frame.h @@ -77,4 +77,4 @@ typedef struct { #define GRPC_CHTTP2_DATA_FLAG_PADDED 8 #define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20 -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_H__ */ diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index e6a1b0c30a5..95c27ad286a 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -160,4 +160,4 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( gpr_log(GPR_ERROR, "should never reach here"); abort(); return GRPC_CHTTP2_CONNECTION_ERROR; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/transport/chttp2/frame_data.h index 618e2263014..4d05a5f4529 100644 --- a/src/core/transport/chttp2/frame_data.h +++ b/src/core/transport/chttp2/frame_data.h @@ -77,4 +77,4 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( /* create a slice with an empty data frame and is_last set */ gpr_slice grpc_chttp2_data_frame_create_empty_close(gpr_uint32 id); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_DATA_H__ */ diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/transport/chttp2/frame_goaway.c index b97d6e822e5..95b75d4fded 100644 --- a/src/core/transport/chttp2/frame_goaway.c +++ b/src/core/transport/chttp2/frame_goaway.c @@ -186,4 +186,4 @@ void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code, GPR_ASSERT(p == GPR_SLICE_END_PTR(header)); gpr_slice_buffer_add(slice_buffer, header); gpr_slice_buffer_add(slice_buffer, debug_data); -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_goaway.h b/src/core/transport/chttp2/frame_goaway.h index 369bac85db0..9ccef276346 100644 --- a/src/core/transport/chttp2/frame_goaway.h +++ b/src/core/transport/chttp2/frame_goaway.h @@ -71,4 +71,4 @@ void grpc_chttp2_goaway_append(gpr_uint32 last_stream_id, gpr_uint32 error_code, gpr_slice debug_data, gpr_slice_buffer *slice_buffer); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_GOAWAY_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_GOAWAY_H_ */ diff --git a/src/core/transport/chttp2/frame_ping.c b/src/core/transport/chttp2/frame_ping.c index 915e70b9d00..26004b3b7c6 100644 --- a/src/core/transport/chttp2/frame_ping.c +++ b/src/core/transport/chttp2/frame_ping.c @@ -90,4 +90,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse( } return GRPC_CHTTP2_PARSE_OK; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_ping.h b/src/core/transport/chttp2/frame_ping.h index 5e8945f1e39..d9d6f7ef15e 100644 --- a/src/core/transport/chttp2/frame_ping.h +++ b/src/core/transport/chttp2/frame_ping.h @@ -50,4 +50,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_PING_H__ */ diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c index 742e037c6a9..368ca864816 100644 --- a/src/core/transport/chttp2/frame_rst_stream.c +++ b/src/core/transport/chttp2/frame_rst_stream.c @@ -53,4 +53,4 @@ gpr_slice grpc_chttp2_rst_stream_create(gpr_uint32 id, gpr_uint32 code) { *p++ = code; return slice; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/transport/chttp2/frame_rst_stream.h index 95f6b3d37db..83fc3806eb2 100644 --- a/src/core/transport/chttp2/frame_rst_stream.h +++ b/src/core/transport/chttp2/frame_rst_stream.h @@ -38,4 +38,4 @@ gpr_slice grpc_chttp2_rst_stream_create(gpr_uint32 stream_id, gpr_uint32 code); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H__ */ diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/transport/chttp2/frame_settings.c index a8fd189f798..06429e220b7 100644 --- a/src/core/transport/chttp2/frame_settings.c +++ b/src/core/transport/chttp2/frame_settings.c @@ -225,4 +225,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( break; } } -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_settings.h b/src/core/transport/chttp2/frame_settings.h index 1d4e5e03981..6cde2c6e47e 100644 --- a/src/core/transport/chttp2/frame_settings.h +++ b/src/core/transport/chttp2/frame_settings.h @@ -96,4 +96,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_SETTINGS_H__ */ diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c index a0540bba601..a8db7d66531 100644 --- a/src/core/transport/chttp2/frame_window_update.c +++ b/src/core/transport/chttp2/frame_window_update.c @@ -96,4 +96,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse( } return GRPC_CHTTP2_PARSE_OK; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/transport/chttp2/frame_window_update.h index 132793b644d..093263db170 100644 --- a/src/core/transport/chttp2/frame_window_update.h +++ b/src/core/transport/chttp2/frame_window_update.h @@ -52,4 +52,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame( grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse( void *parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H__ */ diff --git a/src/core/transport/chttp2/gen_hpack_tables.c b/src/core/transport/chttp2/gen_hpack_tables.c index ff6f948cc39..86b593129b0 100644 --- a/src/core/transport/chttp2/gen_hpack_tables.c +++ b/src/core/transport/chttp2/gen_hpack_tables.c @@ -359,4 +359,4 @@ int main(void) { generate_base64_inverse_table(); return 0; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index 823245b7e29..3fd8f672265 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -1391,4 +1391,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse( parser->is_eof = 0xde; } return GRPC_CHTTP2_PARSE_OK; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/hpack_parser.h b/src/core/transport/chttp2/hpack_parser.h index d81ffce5356..94acc8864f7 100644 --- a/src/core/transport/chttp2/hpack_parser.h +++ b/src/core/transport/chttp2/hpack_parser.h @@ -108,4 +108,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse( void *hpack_parser, grpc_chttp2_parse_state *state, gpr_slice slice, int is_last); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_PARSER_H__ */ diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/transport/chttp2/hpack_table.c index 5ba9fbff678..2c0159260f5 100644 --- a/src/core/transport/chttp2/hpack_table.c +++ b/src/core/transport/chttp2/hpack_table.c @@ -220,4 +220,4 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( } return r; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/transport/chttp2/hpack_table.h index b105b68db85..ea0fc1d0302 100644 --- a/src/core/transport/chttp2/hpack_table.h +++ b/src/core/transport/chttp2/hpack_table.h @@ -94,4 +94,4 @@ typedef struct { grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find( const grpc_chttp2_hptbl *tbl, grpc_mdelem *md); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HPACK_TABLE_H__ */ diff --git a/src/core/transport/chttp2/http2_errors.h b/src/core/transport/chttp2/http2_errors.h index b957cd8f6eb..1eecd175401 100644 --- a/src/core/transport/chttp2/http2_errors.h +++ b/src/core/transport/chttp2/http2_errors.h @@ -53,4 +53,4 @@ typedef enum { GRPC_CHTTP2__ERROR_DO_NOT_USE = -1 } grpc_chttp2_error_code; -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HTTP2_ERRORS_H__ */ diff --git a/src/core/transport/chttp2/huffsyms.c b/src/core/transport/chttp2/huffsyms.c index cfd3fe8ecb6..0a926e7e351 100644 --- a/src/core/transport/chttp2/huffsyms.c +++ b/src/core/transport/chttp2/huffsyms.c @@ -293,4 +293,4 @@ const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = { {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26}, - {0x3fffffff, 30}, }; \ No newline at end of file + {0x3fffffff, 30}, }; diff --git a/src/core/transport/chttp2/huffsyms.h b/src/core/transport/chttp2/huffsyms.h index f221b39b9e9..131c4acbebb 100644 --- a/src/core/transport/chttp2/huffsyms.h +++ b/src/core/transport/chttp2/huffsyms.h @@ -45,4 +45,4 @@ typedef struct { extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS]; -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HUFFSYMS_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_HUFFSYMS_H_ */ diff --git a/src/core/transport/chttp2/status_conversion.c b/src/core/transport/chttp2/status_conversion.c index 9c815fa1554..bf214b017a2 100644 --- a/src/core/transport/chttp2/status_conversion.c +++ b/src/core/transport/chttp2/status_conversion.c @@ -106,4 +106,4 @@ grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status) { int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status) { return 200; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/status_conversion.h b/src/core/transport/chttp2/status_conversion.h index 523a50d966b..8e2672008cf 100644 --- a/src/core/transport/chttp2/status_conversion.h +++ b/src/core/transport/chttp2/status_conversion.h @@ -47,4 +47,4 @@ grpc_status_code grpc_chttp2_http2_error_to_grpc_status( grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status); int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STATUS_CONVERSION_H__ */ diff --git a/src/core/transport/chttp2/stream_encoder.c b/src/core/transport/chttp2/stream_encoder.c index 6f73b4955fd..79cce553fa7 100644 --- a/src/core/transport/chttp2/stream_encoder.c +++ b/src/core/transport/chttp2/stream_encoder.c @@ -601,4 +601,4 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof, begin_frame(&st, DATA); } finish_frame(&st, 1, eof); -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/stream_encoder.h b/src/core/transport/chttp2/stream_encoder.h index e5b1cb4cff0..a99d61a553f 100644 --- a/src/core/transport/chttp2/stream_encoder.h +++ b/src/core/transport/chttp2/stream_encoder.h @@ -90,4 +90,4 @@ void grpc_chttp2_encode(grpc_stream_op *ops, size_t ops_count, int eof, grpc_chttp2_hpack_compressor *compressor, gpr_slice_buffer *output); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_ENCODER_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_ENCODER_H__ */ diff --git a/src/core/transport/chttp2/stream_map.c b/src/core/transport/chttp2/stream_map.c index 053dbc3ad26..580e32c582e 100644 --- a/src/core/transport/chttp2/stream_map.c +++ b/src/core/transport/chttp2/stream_map.c @@ -151,4 +151,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, f(user_data, map->keys[i], map->values[i]); } } -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/stream_map.h b/src/core/transport/chttp2/stream_map.h index 2d1f4c47a7b..3fb91fc88f7 100644 --- a/src/core/transport/chttp2/stream_map.h +++ b/src/core/transport/chttp2/stream_map.h @@ -78,4 +78,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map, void *value), void *user_data); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_MAP_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_STREAM_MAP_H__ */ diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/transport/chttp2/timeout_encoding.c index d9943503e2b..33915c4039f 100644 --- a/src/core/transport/chttp2/timeout_encoding.c +++ b/src/core/transport/chttp2/timeout_encoding.c @@ -181,4 +181,4 @@ int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout) { } p++; return is_all_whitespace(p); -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/timeout_encoding.h b/src/core/transport/chttp2/timeout_encoding.h index 5028d33237b..2bef8ba67f5 100644 --- a/src/core/transport/chttp2/timeout_encoding.h +++ b/src/core/transport/chttp2/timeout_encoding.h @@ -44,4 +44,4 @@ void grpc_chttp2_encode_timeout(gpr_timespec timeout, char *buffer); int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H_ */ diff --git a/src/core/transport/chttp2/varint.c b/src/core/transport/chttp2/varint.c index 2efef951ed4..0722c9ada9b 100644 --- a/src/core/transport/chttp2/varint.c +++ b/src/core/transport/chttp2/varint.c @@ -62,4 +62,4 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value, target[0] = (gpr_uint8)((tail_value) | 0x80); } target[tail_length - 1] &= 0x7f; -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2/varint.h b/src/core/transport/chttp2/varint.h index 60ce84dc412..8c353c66a72 100644 --- a/src/core/transport/chttp2/varint.h +++ b/src/core/transport/chttp2/varint.h @@ -71,4 +71,4 @@ void grpc_chttp2_hpack_write_varint_tail(gpr_uint32 tail_value, } \ } while (0) -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_VARINT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_VARINT_H__ */ diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 9d41671b3c4..551ae27e613 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1770,4 +1770,4 @@ void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, transport *t = gpr_malloc(sizeof(transport)); init_transport(t, setup, arg, channel_args, ep, slices, nslices, mdctx, is_client); -} \ No newline at end of file +} diff --git a/src/core/transport/chttp2_transport.h b/src/core/transport/chttp2_transport.h index 18edcd2919d..6fbc5961a1d 100644 --- a/src/core/transport/chttp2_transport.h +++ b/src/core/transport/chttp2_transport.h @@ -44,4 +44,4 @@ void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, size_t nslices, grpc_mdctx *metadata_context, int is_client); -#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ */ diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 0f999a1d48f..3dc23e7de23 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -544,4 +544,4 @@ gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *gs) { slice = s->base64_and_huffman; unlock(ctx); return slice; -} \ No newline at end of file +} diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index bc6839cd470..430cae6847c 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -136,4 +136,4 @@ const char *grpc_mdstr_as_c_string(grpc_mdstr *s); #define GRPC_MDSTR_KV_HASH(k_hash, v_hash) (GPR_ROTL((k_hash), 2) ^ (v_hash)) -#endif /* __GRPC_INTERNAL_TRANSPORT_METADATA_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_METADATA_H__ */ diff --git a/src/core/transport/stream_op.c b/src/core/transport/stream_op.c index f494292070d..c30e3a27f1d 100644 --- a/src/core/transport/stream_op.c +++ b/src/core/transport/stream_op.c @@ -170,4 +170,4 @@ void grpc_sopb_append(grpc_stream_op_buffer *sopb, grpc_stream_op *ops, memcpy(sopb->ops + orig_nops, ops, sizeof(grpc_stream_op) * nops); sopb->nops = new_nops; -} \ No newline at end of file +} diff --git a/src/core/transport/stream_op.h b/src/core/transport/stream_op.h index eadbfe0c32d..828a7f7226f 100644 --- a/src/core/transport/stream_op.h +++ b/src/core/transport/stream_op.h @@ -131,4 +131,4 @@ void grpc_sopb_add_flow_ctl_cb(grpc_stream_op_buffer *sopb, void grpc_sopb_append(grpc_stream_op_buffer *sopb, grpc_stream_op *ops, size_t nops); -#endif /* __GRPC_INTERNAL_TRANSPORT_STREAM_OP_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_STREAM_OP_H__ */ diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c index cfd203a1f61..ef0020dc58b 100644 --- a/src/core/transport/transport.c +++ b/src/core/transport/transport.c @@ -92,4 +92,4 @@ void grpc_transport_setup_cancel(grpc_transport_setup *setup) { void grpc_transport_setup_initiate(grpc_transport_setup *setup) { setup->vtable->initiate(setup); -} \ No newline at end of file +} diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index 52a91f2ba78..60193b1844c 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -254,4 +254,4 @@ void grpc_transport_setup_initiate(grpc_transport_setup *setup); used as a destruction call by setup). */ void grpc_transport_setup_cancel(grpc_transport_setup *setup); -#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_H__ */ diff --git a/src/core/transport/transport_impl.h b/src/core/transport/transport_impl.h index c807c4a19a4..d1e0b1920ea 100644 --- a/src/core/transport/transport_impl.h +++ b/src/core/transport/transport_impl.h @@ -84,4 +84,4 @@ struct grpc_transport { const grpc_transport_vtable *vtable; }; -#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_IMPL_H__ */ \ No newline at end of file +#endif /* __GRPC_INTERNAL_TRANSPORT_TRANSPORT_IMPL_H__ */ diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c index dbe5ef5bafa..e8af200284a 100644 --- a/src/core/tsi/fake_transport_security.c +++ b/src/core/tsi/fake_transport_security.c @@ -511,4 +511,4 @@ tsi_frame_protector* tsi_create_fake_protector( : *max_protected_frame_size; impl->base.vtable = &frame_protector_vtable; return &impl->base; -} \ No newline at end of file +} diff --git a/src/core/tsi/fake_transport_security.h b/src/core/tsi/fake_transport_security.h index 37076bb8721..36e62bce3da 100644 --- a/src/core/tsi/fake_transport_security.h +++ b/src/core/tsi/fake_transport_security.h @@ -58,4 +58,4 @@ tsi_frame_protector* tsi_create_fake_protector( } #endif -#endif /* __FAKE_TRANSPORT_SECURITY_H_ */ \ No newline at end of file +#endif /* __FAKE_TRANSPORT_SECURITY_H_ */ diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 0a3739910f5..2e59275ff80 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -1313,4 +1313,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name) { } } return 0; /* Not found. */ -} \ No newline at end of file +} diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/tsi/ssl_transport_security.h index 4ddff580550..3c1c4c01a2a 100644 --- a/src/core/tsi/ssl_transport_security.h +++ b/src/core/tsi/ssl_transport_security.h @@ -165,4 +165,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer* peer, const char* name); } #endif -#endif /* __SSL_TRANSPORT_SECURITY_H_ */ \ No newline at end of file +#endif /* __SSL_TRANSPORT_SECURITY_H_ */ diff --git a/src/core/tsi/transport_security.c b/src/core/tsi/transport_security.c index da7e13eec89..aeb9b3fc17d 100644 --- a/src/core/tsi/transport_security.c +++ b/src/core/tsi/transport_security.c @@ -358,4 +358,4 @@ tsi_result tsi_construct_peer(size_t property_count, tsi_peer* peer) { peer->property_count = property_count; } return TSI_OK; -} \ No newline at end of file +} diff --git a/src/core/tsi/transport_security.h b/src/core/tsi/transport_security.h index 28f60aa1a75..432da073463 100644 --- a/src/core/tsi/transport_security.h +++ b/src/core/tsi/transport_security.h @@ -115,4 +115,4 @@ char* tsi_strdup(const char* src); /* Sadly, no strdup in C89. */ } #endif -#endif /* __TRANSPORT_SECURITY_H_ */ \ No newline at end of file +#endif /* __TRANSPORT_SECURITY_H_ */ diff --git a/src/core/tsi/transport_security_interface.h b/src/core/tsi/transport_security_interface.h index 5dd4a598981..90e119ca8e4 100644 --- a/src/core/tsi/transport_security_interface.h +++ b/src/core/tsi/transport_security_interface.h @@ -361,4 +361,4 @@ void tsi_handshaker_destroy(tsi_handshaker* self); } #endif -#endif /* __TRANSPORT_SECURITY_INTERFACE_H_ */ \ No newline at end of file +#endif /* __TRANSPORT_SECURITY_INTERFACE_H_ */ diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 9a8ee15fdd3..ca69d66cbbf 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -99,4 +99,4 @@ void Channel::PerformOpsOnCall(CallOpBuffer *buf, Call *call) { grpc_call_start_batch(call->call(), ops, nops, buf)); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h index 46da754d8c2..06f5a8ffdfe 100644 --- a/src/cpp/client/channel.h +++ b/src/cpp/client/channel.h @@ -68,4 +68,4 @@ class Channel final : public ChannelInterface { } // namespace grpc -#endif // __GRPCPP_INTERNAL_CLIENT_CHANNEL_H__ \ No newline at end of file +#endif // __GRPCPP_INTERNAL_CLIENT_CHANNEL_H__ diff --git a/src/cpp/client/channel_arguments.cc b/src/cpp/client/channel_arguments.cc index a8c71b61960..abf0fc1c0ad 100644 --- a/src/cpp/client/channel_arguments.cc +++ b/src/cpp/client/channel_arguments.cc @@ -79,4 +79,4 @@ void ChannelArguments::SetChannelArgs(grpc_channel_args *channel_args) const { } } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 646c45a9639..80cbdd93acc 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -81,4 +81,4 @@ void ClientContext::TryCancel() { } } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 4e71492ad00..8fdd4834742 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -86,4 +86,4 @@ void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, call.PerformOps(buf); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 45502b93617..acf51cb90b1 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -50,4 +50,4 @@ std::shared_ptr CreateChannel( const ChannelArguments &args) { return std::shared_ptr(new Channel(target, creds, args)); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/credentials.cc b/src/cpp/client/credentials.cc index 90e278157ee..66571cad73d 100644 --- a/src/cpp/client/credentials.cc +++ b/src/cpp/client/credentials.cc @@ -112,4 +112,4 @@ std::unique_ptr CredentialsFactory::ComposeCredentials( return cpp_creds; } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/client/internal_stub.cc b/src/cpp/client/internal_stub.cc index 53b66b955d3..91724a4837a 100644 --- a/src/cpp/client/internal_stub.cc +++ b/src/cpp/client/internal_stub.cc @@ -33,4 +33,4 @@ #include -namespace grpc {} // namespace grpc \ No newline at end of file +namespace grpc {} // namespace grpc diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc index b7a6450d2c9..e29c6a053d8 100644 --- a/src/cpp/common/call.cc +++ b/src/cpp/common/call.cc @@ -283,4 +283,4 @@ void Call::PerformOps(CallOpBuffer* buffer) { call_hook_->PerformOpsOnCall(buffer, this); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index f2b75b410ab..c7d883d5b0e 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -82,4 +82,4 @@ bool CompletionQueue::Pluck(CompletionQueueTag *tag) { return ok; } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/common/rpc_method.cc b/src/cpp/common/rpc_method.cc index e536a1b1350..1654d4a262c 100644 --- a/src/cpp/common/rpc_method.cc +++ b/src/cpp/common/rpc_method.cc @@ -33,4 +33,4 @@ #include -namespace grpc {} // namespace grpc \ No newline at end of file +namespace grpc {} // namespace grpc diff --git a/src/cpp/proto/proto_utils.cc b/src/cpp/proto/proto_utils.cc index 57098b50c42..69a6bb080e0 100644 --- a/src/cpp/proto/proto_utils.cc +++ b/src/cpp/proto/proto_utils.cc @@ -70,4 +70,4 @@ bool DeserializeProto(grpc_byte_buffer *buffer, return msg->ParseFromString(msg_string); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/proto/proto_utils.h b/src/cpp/proto/proto_utils.h index b3b03289903..834884d5796 100644 --- a/src/cpp/proto/proto_utils.h +++ b/src/cpp/proto/proto_utils.h @@ -54,4 +54,4 @@ bool DeserializeProto(grpc_byte_buffer *buffer, google::protobuf::Message *msg); } // namespace grpc -#endif // __GRPCPP_INTERNAL_PROTO_PROTO_UTILS_H__ \ No newline at end of file +#endif // __GRPCPP_INTERNAL_PROTO_PROTO_UTILS_H__ diff --git a/src/cpp/server/async_server_context.cc b/src/cpp/server/async_server_context.cc index 84b083ead64..5f8c2ba10f4 100644 --- a/src/cpp/server/async_server_context.cc +++ b/src/cpp/server/async_server_context.cc @@ -92,4 +92,4 @@ bool AsyncServerContext::ParseRead(grpc_byte_buffer *read_buffer) { return success; } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 8c0844a3199..da98cf5ce0d 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -386,4 +386,4 @@ void Server::RunRpc() { } } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 1ca1acad944..3c2093c3638 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -100,4 +100,4 @@ std::unique_ptr ServerBuilder::BuildAndStart() { return server; } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index b9c82138f63..10cce450d79 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -67,4 +67,4 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/server_credentials.cc b/src/cpp/server/server_credentials.cc index fbd606246bc..69ad000ccc6 100644 --- a/src/cpp/server/server_credentials.cc +++ b/src/cpp/server/server_credentials.cc @@ -59,4 +59,4 @@ std::shared_ptr ServerCredentialsFactory::SslCredentials( return std::shared_ptr(new ServerCredentials(c_creds)); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/thread_pool.cc b/src/cpp/server/thread_pool.cc index 410e51d8b11..1ca98129d3e 100644 --- a/src/cpp/server/thread_pool.cc +++ b/src/cpp/server/thread_pool.cc @@ -77,4 +77,4 @@ void ThreadPool::ScheduleCallback(const std::function &callback) { cv_.notify_one(); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/server/thread_pool.h b/src/cpp/server/thread_pool.h index 77b0f33ddc4..283618f4b68 100644 --- a/src/cpp/server/thread_pool.h +++ b/src/cpp/server/thread_pool.h @@ -61,4 +61,4 @@ class ThreadPool final : public ThreadPoolInterface { } // namespace grpc -#endif // __GRPCPP_INTERNAL_SERVER_THREAD_POOL_H__ \ No newline at end of file +#endif // __GRPCPP_INTERNAL_SERVER_THREAD_POOL_H__ diff --git a/src/cpp/util/status.cc b/src/cpp/util/status.cc index f29415b5b8a..bbf80306686 100644 --- a/src/cpp/util/status.cc +++ b/src/cpp/util/status.cc @@ -38,4 +38,4 @@ namespace grpc { const Status &Status::OK = Status(); const Status &Status::Cancelled = Status(StatusCode::CANCELLED); -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index 56ac4765164..919e5623fa3 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -63,4 +63,4 @@ system_clock::time_point Timespec2Timepoint(gpr_timespec t) { return tp; } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/cpp/util/time.h b/src/cpp/util/time.h index 59c3b9d4064..9f9e582d070 100644 --- a/src/cpp/util/time.h +++ b/src/cpp/util/time.h @@ -48,4 +48,4 @@ std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); } // namespace grpc -#endif // __GRPCPP_INTERNAL_UTIL_TIME_H__ \ No newline at end of file +#endif // __GRPCPP_INTERNAL_UTIL_TIME_H__ diff --git a/src/csharp/GrpcApi/Empty.cs b/src/csharp/GrpcApi/Empty.cs index dadfd151ecc..7169ee2a4a5 100644 --- a/src/csharp/GrpcApi/Empty.cs +++ b/src/csharp/GrpcApi/Empty.cs @@ -7,12 +7,12 @@ using pbc = global::Google.ProtocolBuffers.Collections; using pbd = global::Google.ProtocolBuffers.Descriptors; using scg = global::System.Collections.Generic; namespace grpc.testing { - + namespace Proto { - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Empty { - + #region Extension registration public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { } @@ -26,7 +26,7 @@ namespace grpc.testing { get { return descriptor; } } private static pbd::FileDescriptor descriptor; - + static Empty() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( @@ -34,7 +34,7 @@ namespace grpc.testing { pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_grpc_testing_Empty__Descriptor = Descriptor.MessageTypes[0]; - internal__static_grpc_testing_Empty__FieldAccessorTable = + internal__static_grpc_testing_Empty__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_Empty__Descriptor, new string[] { }); return null; @@ -44,7 +44,7 @@ namespace grpc.testing { }, assigner); } #endregion - + } } #region Messages @@ -57,48 +57,48 @@ namespace grpc.testing { public static Empty DefaultInstance { get { return defaultInstance; } } - + public override Empty DefaultInstanceForType { get { return DefaultInstance; } } - + protected override Empty ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Proto.Empty.internal__static_grpc_testing_Empty__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Proto.Empty.internal__static_grpc_testing_Empty__FieldAccessorTable; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _emptyFieldNames; UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; size += UnknownFields.SerializedSize; memoizedSerializedSize = size; return size; } } - + public static Empty ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -132,14 +132,14 @@ namespace grpc.testing { private Empty MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Empty prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -153,10 +153,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Empty result; - + private Empty PrepareBuilder() { if (resultIsReadOnly) { Empty original = result; @@ -166,21 +166,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override Empty MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -188,15 +188,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.Empty.Descriptor; } } - + public override Empty DefaultInstanceForType { get { return global::grpc.testing.Empty.DefaultInstance; } } - + public override Empty BuildPartial() { if (resultIsReadOnly) { return result; @@ -204,7 +204,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Empty) { return MergeFrom((Empty) other); @@ -213,18 +213,18 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(Empty other) { if (other == global::grpc.testing.Empty.DefaultInstance) return this; PrepareBuilder(); this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -262,21 +262,21 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - + } static Empty() { object.ReferenceEquals(global::grpc.testing.Proto.Empty.Descriptor, null); } } - + #endregion - + } #endregion Designer generated code diff --git a/src/csharp/GrpcApi/Math.cs b/src/csharp/GrpcApi/Math.cs index 2d700337ac7..75b1e9dbc2a 100644 --- a/src/csharp/GrpcApi/Math.cs +++ b/src/csharp/GrpcApi/Math.cs @@ -7,12 +7,12 @@ using pbc = global::Google.ProtocolBuffers.Collections; using pbd = global::Google.ProtocolBuffers.Descriptors; using scg = global::System.Collections.Generic; namespace math { - + namespace Proto { - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Math { - + #region Extension registration public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { } @@ -34,38 +34,38 @@ namespace math { get { return descriptor; } } private static pbd::FileDescriptor descriptor; - + static Math() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "CgptYXRoLnByb3RvEgRtYXRoIiwKB0RpdkFyZ3MSEAoIZGl2aWRlbmQYASAB", - "KAMSDwoHZGl2aXNvchgCIAEoAyIvCghEaXZSZXBseRIQCghxdW90aWVudBgB", - "IAEoAxIRCglyZW1haW5kZXIYAiABKAMiGAoHRmliQXJncxINCgVsaW1pdBgB", - "IAEoAyISCgNOdW0SCwoDbnVtGAEgASgDIhkKCEZpYlJlcGx5Eg0KBWNvdW50", - "GAEgASgDMqQBCgRNYXRoEiYKA0RpdhINLm1hdGguRGl2QXJncxoOLm1hdGgu", - "RGl2UmVwbHkiABIuCgdEaXZNYW55Eg0ubWF0aC5EaXZBcmdzGg4ubWF0aC5E", - "aXZSZXBseSIAKAEwARIjCgNGaWISDS5tYXRoLkZpYkFyZ3MaCS5tYXRoLk51", + "CgptYXRoLnByb3RvEgRtYXRoIiwKB0RpdkFyZ3MSEAoIZGl2aWRlbmQYASAB", + "KAMSDwoHZGl2aXNvchgCIAEoAyIvCghEaXZSZXBseRIQCghxdW90aWVudBgB", + "IAEoAxIRCglyZW1haW5kZXIYAiABKAMiGAoHRmliQXJncxINCgVsaW1pdBgB", + "IAEoAyISCgNOdW0SCwoDbnVtGAEgASgDIhkKCEZpYlJlcGx5Eg0KBWNvdW50", + "GAEgASgDMqQBCgRNYXRoEiYKA0RpdhINLm1hdGguRGl2QXJncxoOLm1hdGgu", + "RGl2UmVwbHkiABIuCgdEaXZNYW55Eg0ubWF0aC5EaXZBcmdzGg4ubWF0aC5E", + "aXZSZXBseSIAKAEwARIjCgNGaWISDS5tYXRoLkZpYkFyZ3MaCS5tYXRoLk51", "bSIAMAESHwoDU3VtEgkubWF0aC5OdW0aCS5tYXRoLk51bSIAKAE=")); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_math_DivArgs__Descriptor = Descriptor.MessageTypes[0]; - internal__static_math_DivArgs__FieldAccessorTable = + internal__static_math_DivArgs__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_math_DivArgs__Descriptor, new string[] { "Dividend", "Divisor", }); internal__static_math_DivReply__Descriptor = Descriptor.MessageTypes[1]; - internal__static_math_DivReply__FieldAccessorTable = + internal__static_math_DivReply__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_math_DivReply__Descriptor, new string[] { "Quotient", "Remainder", }); internal__static_math_FibArgs__Descriptor = Descriptor.MessageTypes[2]; - internal__static_math_FibArgs__FieldAccessorTable = + internal__static_math_FibArgs__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_math_FibArgs__Descriptor, new string[] { "Limit", }); internal__static_math_Num__Descriptor = Descriptor.MessageTypes[3]; - internal__static_math_Num__FieldAccessorTable = + internal__static_math_Num__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_math_Num__Descriptor, new string[] { "Num_", }); internal__static_math_FibReply__Descriptor = Descriptor.MessageTypes[4]; - internal__static_math_FibReply__FieldAccessorTable = + internal__static_math_FibReply__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_math_FibReply__Descriptor, new string[] { "Count", }); pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); @@ -77,7 +77,7 @@ namespace math { }, assigner); } #endregion - + } } #region Messages @@ -90,23 +90,23 @@ namespace math { public static DivArgs DefaultInstance { get { return defaultInstance; } } - + public override DivArgs DefaultInstanceForType { get { return DefaultInstance; } } - + protected override DivArgs ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::math.Proto.Math.internal__static_math_DivArgs__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::math.Proto.Math.internal__static_math_DivArgs__FieldAccessorTable; } } - + public const int DividendFieldNumber = 1; private bool hasDividend; private long dividend_; @@ -116,7 +116,7 @@ namespace math { public long Dividend { get { return dividend_; } } - + public const int DivisorFieldNumber = 2; private bool hasDivisor; private long divisor_; @@ -126,13 +126,13 @@ namespace math { public long Divisor { get { return divisor_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _divArgsFieldNames; @@ -144,13 +144,13 @@ namespace math { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasDividend) { size += pb::CodedOutputStream.ComputeInt64Size(1, Dividend); @@ -163,7 +163,7 @@ namespace math { return size; } } - + public static DivArgs ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -197,14 +197,14 @@ namespace math { private DivArgs MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DivArgs prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -218,10 +218,10 @@ namespace math { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private DivArgs result; - + private DivArgs PrepareBuilder() { if (resultIsReadOnly) { DivArgs original = result; @@ -231,21 +231,21 @@ namespace math { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override DivArgs MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -253,15 +253,15 @@ namespace math { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::math.DivArgs.Descriptor; } } - + public override DivArgs DefaultInstanceForType { get { return global::math.DivArgs.DefaultInstance; } } - + public override DivArgs BuildPartial() { if (resultIsReadOnly) { return result; @@ -269,7 +269,7 @@ namespace math { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is DivArgs) { return MergeFrom((DivArgs) other); @@ -278,7 +278,7 @@ namespace math { return this; } } - + public override Builder MergeFrom(DivArgs other) { if (other == global::math.DivArgs.DefaultInstance) return this; PrepareBuilder(); @@ -291,11 +291,11 @@ namespace math { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -341,14 +341,14 @@ namespace math { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasDividend { get { return result.hasDividend; } } @@ -368,7 +368,7 @@ namespace math { result.dividend_ = 0L; return this; } - + public bool HasDivisor { get { return result.hasDivisor; } } @@ -393,7 +393,7 @@ namespace math { object.ReferenceEquals(global::math.Proto.Math.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class DivReply : pb::GeneratedMessage { private DivReply() { } @@ -403,23 +403,23 @@ namespace math { public static DivReply DefaultInstance { get { return defaultInstance; } } - + public override DivReply DefaultInstanceForType { get { return DefaultInstance; } } - + protected override DivReply ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::math.Proto.Math.internal__static_math_DivReply__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::math.Proto.Math.internal__static_math_DivReply__FieldAccessorTable; } } - + public const int QuotientFieldNumber = 1; private bool hasQuotient; private long quotient_; @@ -429,7 +429,7 @@ namespace math { public long Quotient { get { return quotient_; } } - + public const int RemainderFieldNumber = 2; private bool hasRemainder; private long remainder_; @@ -439,13 +439,13 @@ namespace math { public long Remainder { get { return remainder_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _divReplyFieldNames; @@ -457,13 +457,13 @@ namespace math { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasQuotient) { size += pb::CodedOutputStream.ComputeInt64Size(1, Quotient); @@ -476,7 +476,7 @@ namespace math { return size; } } - + public static DivReply ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -510,14 +510,14 @@ namespace math { private DivReply MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(DivReply prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -531,10 +531,10 @@ namespace math { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private DivReply result; - + private DivReply PrepareBuilder() { if (resultIsReadOnly) { DivReply original = result; @@ -544,21 +544,21 @@ namespace math { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override DivReply MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -566,15 +566,15 @@ namespace math { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::math.DivReply.Descriptor; } } - + public override DivReply DefaultInstanceForType { get { return global::math.DivReply.DefaultInstance; } } - + public override DivReply BuildPartial() { if (resultIsReadOnly) { return result; @@ -582,7 +582,7 @@ namespace math { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is DivReply) { return MergeFrom((DivReply) other); @@ -591,7 +591,7 @@ namespace math { return this; } } - + public override Builder MergeFrom(DivReply other) { if (other == global::math.DivReply.DefaultInstance) return this; PrepareBuilder(); @@ -604,11 +604,11 @@ namespace math { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -654,14 +654,14 @@ namespace math { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasQuotient { get { return result.hasQuotient; } } @@ -681,7 +681,7 @@ namespace math { result.quotient_ = 0L; return this; } - + public bool HasRemainder { get { return result.hasRemainder; } } @@ -706,7 +706,7 @@ namespace math { object.ReferenceEquals(global::math.Proto.Math.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FibArgs : pb::GeneratedMessage { private FibArgs() { } @@ -716,23 +716,23 @@ namespace math { public static FibArgs DefaultInstance { get { return defaultInstance; } } - + public override FibArgs DefaultInstanceForType { get { return DefaultInstance; } } - + protected override FibArgs ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::math.Proto.Math.internal__static_math_FibArgs__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::math.Proto.Math.internal__static_math_FibArgs__FieldAccessorTable; } } - + public const int LimitFieldNumber = 1; private bool hasLimit; private long limit_; @@ -742,13 +742,13 @@ namespace math { public long Limit { get { return limit_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _fibArgsFieldNames; @@ -757,13 +757,13 @@ namespace math { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasLimit) { size += pb::CodedOutputStream.ComputeInt64Size(1, Limit); @@ -773,7 +773,7 @@ namespace math { return size; } } - + public static FibArgs ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -807,14 +807,14 @@ namespace math { private FibArgs MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FibArgs prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -828,10 +828,10 @@ namespace math { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private FibArgs result; - + private FibArgs PrepareBuilder() { if (resultIsReadOnly) { FibArgs original = result; @@ -841,21 +841,21 @@ namespace math { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override FibArgs MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -863,15 +863,15 @@ namespace math { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::math.FibArgs.Descriptor; } } - + public override FibArgs DefaultInstanceForType { get { return global::math.FibArgs.DefaultInstance; } } - + public override FibArgs BuildPartial() { if (resultIsReadOnly) { return result; @@ -879,7 +879,7 @@ namespace math { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is FibArgs) { return MergeFrom((FibArgs) other); @@ -888,7 +888,7 @@ namespace math { return this; } } - + public override Builder MergeFrom(FibArgs other) { if (other == global::math.FibArgs.DefaultInstance) return this; PrepareBuilder(); @@ -898,11 +898,11 @@ namespace math { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -944,14 +944,14 @@ namespace math { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasLimit { get { return result.hasLimit; } } @@ -976,7 +976,7 @@ namespace math { object.ReferenceEquals(global::math.Proto.Math.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Num : pb::GeneratedMessage { private Num() { } @@ -986,23 +986,23 @@ namespace math { public static Num DefaultInstance { get { return defaultInstance; } } - + public override Num DefaultInstanceForType { get { return DefaultInstance; } } - + protected override Num ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::math.Proto.Math.internal__static_math_Num__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::math.Proto.Math.internal__static_math_Num__FieldAccessorTable; } } - + public const int Num_FieldNumber = 1; private bool hasNum_; private long num_; @@ -1012,13 +1012,13 @@ namespace math { public long Num_ { get { return num_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _numFieldNames; @@ -1027,13 +1027,13 @@ namespace math { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasNum_) { size += pb::CodedOutputStream.ComputeInt64Size(1, Num_); @@ -1043,7 +1043,7 @@ namespace math { return size; } } - + public static Num ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1077,14 +1077,14 @@ namespace math { private Num MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Num prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1098,10 +1098,10 @@ namespace math { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Num result; - + private Num PrepareBuilder() { if (resultIsReadOnly) { Num original = result; @@ -1111,21 +1111,21 @@ namespace math { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override Num MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -1133,15 +1133,15 @@ namespace math { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::math.Num.Descriptor; } } - + public override Num DefaultInstanceForType { get { return global::math.Num.DefaultInstance; } } - + public override Num BuildPartial() { if (resultIsReadOnly) { return result; @@ -1149,7 +1149,7 @@ namespace math { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Num) { return MergeFrom((Num) other); @@ -1158,7 +1158,7 @@ namespace math { return this; } } - + public override Builder MergeFrom(Num other) { if (other == global::math.Num.DefaultInstance) return this; PrepareBuilder(); @@ -1168,11 +1168,11 @@ namespace math { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -1214,14 +1214,14 @@ namespace math { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasNum_ { get { return result.hasNum_; } } @@ -1246,7 +1246,7 @@ namespace math { object.ReferenceEquals(global::math.Proto.Math.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class FibReply : pb::GeneratedMessage { private FibReply() { } @@ -1256,23 +1256,23 @@ namespace math { public static FibReply DefaultInstance { get { return defaultInstance; } } - + public override FibReply DefaultInstanceForType { get { return DefaultInstance; } } - + protected override FibReply ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::math.Proto.Math.internal__static_math_FibReply__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::math.Proto.Math.internal__static_math_FibReply__FieldAccessorTable; } } - + public const int CountFieldNumber = 1; private bool hasCount; private long count_; @@ -1282,13 +1282,13 @@ namespace math { public long Count { get { return count_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _fibReplyFieldNames; @@ -1297,13 +1297,13 @@ namespace math { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasCount) { size += pb::CodedOutputStream.ComputeInt64Size(1, Count); @@ -1313,7 +1313,7 @@ namespace math { return size; } } - + public static FibReply ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1347,14 +1347,14 @@ namespace math { private FibReply MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(FibReply prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1368,10 +1368,10 @@ namespace math { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private FibReply result; - + private FibReply PrepareBuilder() { if (resultIsReadOnly) { FibReply original = result; @@ -1381,21 +1381,21 @@ namespace math { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override FibReply MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -1403,15 +1403,15 @@ namespace math { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::math.FibReply.Descriptor; } } - + public override FibReply DefaultInstanceForType { get { return global::math.FibReply.DefaultInstance; } } - + public override FibReply BuildPartial() { if (resultIsReadOnly) { return result; @@ -1419,7 +1419,7 @@ namespace math { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is FibReply) { return MergeFrom((FibReply) other); @@ -1428,7 +1428,7 @@ namespace math { return this; } } - + public override Builder MergeFrom(FibReply other) { if (other == global::math.FibReply.DefaultInstance) return this; PrepareBuilder(); @@ -1438,11 +1438,11 @@ namespace math { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -1484,14 +1484,14 @@ namespace math { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasCount { get { return result.hasCount; } } @@ -1516,16 +1516,16 @@ namespace math { object.ReferenceEquals(global::math.Proto.Math.Descriptor, null); } } - + #endregion - + #region Services /* * Service generation is now disabled by default, use the following option to enable: * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; */ #endregion - + } #endregion Designer generated code diff --git a/src/csharp/GrpcApi/MathExamples.cs b/src/csharp/GrpcApi/MathExamples.cs index 07bcc9c9cd4..2202c52a277 100644 --- a/src/csharp/GrpcApi/MathExamples.cs +++ b/src/csharp/GrpcApi/MathExamples.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -72,10 +72,10 @@ namespace math public static void SumExample(MathGrpc.IMathServiceClient stub) { - List numbers = new List{new Num.Builder { Num_ = 1 }.Build(), + List numbers = new List{new Num.Builder { Num_ = 1 }.Build(), new Num.Builder { Num_ = 2 }.Build(), new Num.Builder { Num_ = 3 }.Build()}; - + var res = stub.Sum(); foreach (var num in numbers) { res.Inputs.OnNext(num); @@ -94,7 +94,7 @@ namespace math }; var recorder = new RecordingObserver(); - + var inputs = stub.DivMany(recorder); foreach (var input in divArgsList) { @@ -108,14 +108,14 @@ namespace math public static void DependendRequestsExample(MathGrpc.IMathServiceClient stub) { var numberList = new List - { new Num.Builder{ Num_ = 1 }.Build(), + { new Num.Builder{ Num_ = 1 }.Build(), new Num.Builder{ Num_ = 2 }.Build(), new Num.Builder{ Num_ = 3 }.Build() }; numberList.ToObservable(); //IObserver numbers; - //Task call = stub.Sum(out numbers); + //Task call = stub.Sum(out numbers); //foreach (var num in numberList) //{ // numbers.OnNext(num); diff --git a/src/csharp/GrpcApi/MathGrpc.cs b/src/csharp/GrpcApi/MathGrpc.cs index 606e7f02390..caea1608ecf 100644 --- a/src/csharp/GrpcApi/MathGrpc.cs +++ b/src/csharp/GrpcApi/MathGrpc.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -154,4 +154,4 @@ namespace math return new MathServiceClientStub(channel); } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcApi/MathServiceImpl.cs b/src/csharp/GrpcApi/MathServiceImpl.cs index ffd794d6c6b..1a2f98f8b26 100644 --- a/src/csharp/GrpcApi/MathServiceImpl.cs +++ b/src/csharp/GrpcApi/MathServiceImpl.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -59,7 +59,7 @@ namespace math // TODO: support cancellation.... throw new NotImplementedException("Not implemented yet"); } - + if (request.Limit > 0) { foreach (var num in FibInternal(request.Limit)) @@ -124,7 +124,7 @@ namespace math { this.responseObserver = responseObserver; } - + public void OnCompleted() { Task.Factory.StartNew(() => @@ -143,7 +143,7 @@ namespace math // callback is called from grpc threadpool which // currently only has one thread. // Same story for OnCompleted(). - Task.Factory.StartNew(() => + Task.Factory.StartNew(() => responseObserver.OnNext(DivInternal(value))); } } diff --git a/src/csharp/GrpcApi/Messages.cs b/src/csharp/GrpcApi/Messages.cs index 78e3404d226..386f377f08b 100644 --- a/src/csharp/GrpcApi/Messages.cs +++ b/src/csharp/GrpcApi/Messages.cs @@ -7,10 +7,10 @@ using pbc = global::Google.ProtocolBuffers.Collections; using pbd = global::Google.ProtocolBuffers.Descriptors; using scg = global::System.Collections.Generic; namespace grpc.testing { - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public static partial class Messages { - + #region Extension registration public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { } @@ -38,62 +38,62 @@ namespace grpc.testing { get { return descriptor; } } private static pbd::FileDescriptor descriptor; - + static Messages() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg5tZXNzYWdlcy5wcm90bxIMZ3JwYy50ZXN0aW5nIkAKB1BheWxvYWQSJwoE", - "dHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIMCgRib2R5", - "GAIgASgMIrEBCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5cGUYASAB", - "KA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9uc2Vfc2l6", - "ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", - "YWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRoX3Njb3Bl", - "GAUgASgIIl8KDlNpbXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5n", - "cnBjLnRlc3RpbmcuUGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0", - "aF9zY29wZRgDIAEoCSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYK", - "B3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJl", - "YW1pbmdJbnB1dENhbGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRf", - "c2l6ZRgBIAEoBSI3ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEo", - "BRITCgtpbnRlcnZhbF91cxgCIAEoBSK1AQoaU3RyZWFtaW5nT3V0cHV0Q2Fs", - "bFJlcXVlc3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGlu", - "Zy5QYXlsb2FkVHlwZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAu", - "Z3JwYy50ZXN0aW5nLlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMg", - "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQiRQobU3RyZWFtaW5nT3V0cHV0", - "Q2FsbFJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3Rpbmcu", - "UGF5bG9hZCo/CgtQYXlsb2FkVHlwZRIQCgxDT01QUkVTU0FCTEUQABISCg5V", + "Cg5tZXNzYWdlcy5wcm90bxIMZ3JwYy50ZXN0aW5nIkAKB1BheWxvYWQSJwoE", + "dHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIMCgRib2R5", + "GAIgASgMIrEBCg1TaW1wbGVSZXF1ZXN0EjAKDXJlc3BvbnNlX3R5cGUYASAB", + "KA4yGS5ncnBjLnRlc3RpbmcuUGF5bG9hZFR5cGUSFQoNcmVzcG9uc2Vfc2l6", + "ZRgCIAEoBRImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxv", + "YWQSFQoNZmlsbF91c2VybmFtZRgEIAEoCBIYChBmaWxsX29hdXRoX3Njb3Bl", + "GAUgASgIIl8KDlNpbXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5n", + "cnBjLnRlc3RpbmcuUGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0", + "aF9zY29wZRgDIAEoCSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYK", + "B3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJl", + "YW1pbmdJbnB1dENhbGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRf", + "c2l6ZRgBIAEoBSI3ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEo", + "BRITCgtpbnRlcnZhbF91cxgCIAEoBSK1AQoaU3RyZWFtaW5nT3V0cHV0Q2Fs", + "bFJlcXVlc3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGlu", + "Zy5QYXlsb2FkVHlwZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAu", + "Z3JwYy50ZXN0aW5nLlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMg", + "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQiRQobU3RyZWFtaW5nT3V0cHV0", + "Q2FsbFJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3Rpbmcu", + "UGF5bG9hZCo/CgtQYXlsb2FkVHlwZRIQCgxDT01QUkVTU0FCTEUQABISCg5V", "TkNPTVBSRVNTQUJMRRABEgoKBlJBTkRPTRAC")); pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { descriptor = root; internal__static_grpc_testing_Payload__Descriptor = Descriptor.MessageTypes[0]; - internal__static_grpc_testing_Payload__FieldAccessorTable = + internal__static_grpc_testing_Payload__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_Payload__Descriptor, new string[] { "Type", "Body", }); internal__static_grpc_testing_SimpleRequest__Descriptor = Descriptor.MessageTypes[1]; - internal__static_grpc_testing_SimpleRequest__FieldAccessorTable = + internal__static_grpc_testing_SimpleRequest__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_SimpleRequest__Descriptor, new string[] { "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", }); internal__static_grpc_testing_SimpleResponse__Descriptor = Descriptor.MessageTypes[2]; - internal__static_grpc_testing_SimpleResponse__FieldAccessorTable = + internal__static_grpc_testing_SimpleResponse__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_SimpleResponse__Descriptor, new string[] { "Payload", "Username", "OauthScope", }); internal__static_grpc_testing_StreamingInputCallRequest__Descriptor = Descriptor.MessageTypes[3]; - internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable = + internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_StreamingInputCallRequest__Descriptor, new string[] { "Payload", }); internal__static_grpc_testing_StreamingInputCallResponse__Descriptor = Descriptor.MessageTypes[4]; - internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable = + internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_StreamingInputCallResponse__Descriptor, new string[] { "AggregatedPayloadSize", }); internal__static_grpc_testing_ResponseParameters__Descriptor = Descriptor.MessageTypes[5]; - internal__static_grpc_testing_ResponseParameters__FieldAccessorTable = + internal__static_grpc_testing_ResponseParameters__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_ResponseParameters__Descriptor, new string[] { "Size", "IntervalUs", }); internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor = Descriptor.MessageTypes[6]; - internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable = + internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor, new string[] { "ResponseType", "ResponseParameters", "Payload", }); internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor = Descriptor.MessageTypes[7]; - internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable = + internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable = new pb::FieldAccess.FieldAccessorTable(internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor, new string[] { "Payload", }); return null; @@ -103,7 +103,7 @@ namespace grpc.testing { }, assigner); } #endregion - + } #region Enums public enum PayloadType { @@ -111,9 +111,9 @@ namespace grpc.testing { UNCOMPRESSABLE = 1, RANDOM = 2, } - + #endregion - + #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Payload : pb::GeneratedMessage { @@ -124,23 +124,23 @@ namespace grpc.testing { public static Payload DefaultInstance { get { return defaultInstance; } } - + public override Payload DefaultInstanceForType { get { return DefaultInstance; } } - + protected override Payload ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_Payload__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_Payload__FieldAccessorTable; } } - + public const int TypeFieldNumber = 1; private bool hasType; private global::grpc.testing.PayloadType type_ = global::grpc.testing.PayloadType.COMPRESSABLE; @@ -150,7 +150,7 @@ namespace grpc.testing { public global::grpc.testing.PayloadType Type { get { return type_; } } - + public const int BodyFieldNumber = 2; private bool hasBody; private pb::ByteString body_ = pb::ByteString.Empty; @@ -160,13 +160,13 @@ namespace grpc.testing { public pb::ByteString Body { get { return body_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _payloadFieldNames; @@ -178,13 +178,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasType) { size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Type); @@ -197,7 +197,7 @@ namespace grpc.testing { return size; } } - + public static Payload ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -231,14 +231,14 @@ namespace grpc.testing { private Payload MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(Payload prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -252,10 +252,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Payload result; - + private Payload PrepareBuilder() { if (resultIsReadOnly) { Payload original = result; @@ -265,21 +265,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override Payload MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -287,15 +287,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.Payload.Descriptor; } } - + public override Payload DefaultInstanceForType { get { return global::grpc.testing.Payload.DefaultInstance; } } - + public override Payload BuildPartial() { if (resultIsReadOnly) { return result; @@ -303,7 +303,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Payload) { return MergeFrom((Payload) other); @@ -312,7 +312,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(Payload other) { if (other == global::grpc.testing.Payload.DefaultInstance) return this; PrepareBuilder(); @@ -325,11 +325,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -383,14 +383,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasType { get { return result.hasType; } } @@ -410,7 +410,7 @@ namespace grpc.testing { result.type_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public bool HasBody { get { return result.hasBody; } } @@ -436,7 +436,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SimpleRequest : pb::GeneratedMessage { private SimpleRequest() { } @@ -446,23 +446,23 @@ namespace grpc.testing { public static SimpleRequest DefaultInstance { get { return defaultInstance; } } - + public override SimpleRequest DefaultInstanceForType { get { return DefaultInstance; } } - + protected override SimpleRequest ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleRequest__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleRequest__FieldAccessorTable; } } - + public const int ResponseTypeFieldNumber = 1; private bool hasResponseType; private global::grpc.testing.PayloadType responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; @@ -472,7 +472,7 @@ namespace grpc.testing { public global::grpc.testing.PayloadType ResponseType { get { return responseType_; } } - + public const int ResponseSizeFieldNumber = 2; private bool hasResponseSize; private int responseSize_; @@ -482,7 +482,7 @@ namespace grpc.testing { public int ResponseSize { get { return responseSize_; } } - + public const int PayloadFieldNumber = 3; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -492,7 +492,7 @@ namespace grpc.testing { public global::grpc.testing.Payload Payload { get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } } - + public const int FillUsernameFieldNumber = 4; private bool hasFillUsername; private bool fillUsername_; @@ -502,7 +502,7 @@ namespace grpc.testing { public bool FillUsername { get { return fillUsername_; } } - + public const int FillOauthScopeFieldNumber = 5; private bool hasFillOauthScope; private bool fillOauthScope_; @@ -512,13 +512,13 @@ namespace grpc.testing { public bool FillOauthScope { get { return fillOauthScope_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _simpleRequestFieldNames; @@ -539,13 +539,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasResponseType) { size += pb::CodedOutputStream.ComputeEnumSize(1, (int) ResponseType); @@ -567,7 +567,7 @@ namespace grpc.testing { return size; } } - + public static SimpleRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -601,14 +601,14 @@ namespace grpc.testing { private SimpleRequest MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SimpleRequest prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -622,10 +622,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private SimpleRequest result; - + private SimpleRequest PrepareBuilder() { if (resultIsReadOnly) { SimpleRequest original = result; @@ -635,21 +635,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override SimpleRequest MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -657,15 +657,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.SimpleRequest.Descriptor; } } - + public override SimpleRequest DefaultInstanceForType { get { return global::grpc.testing.SimpleRequest.DefaultInstance; } } - + public override SimpleRequest BuildPartial() { if (resultIsReadOnly) { return result; @@ -673,7 +673,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is SimpleRequest) { return MergeFrom((SimpleRequest) other); @@ -682,7 +682,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(SimpleRequest other) { if (other == global::grpc.testing.SimpleRequest.DefaultInstance) return this; PrepareBuilder(); @@ -704,11 +704,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -779,14 +779,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasResponseType { get { return result.hasResponseType; } } @@ -806,7 +806,7 @@ namespace grpc.testing { result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public bool HasResponseSize { get { return result.hasResponseSize; } } @@ -826,7 +826,7 @@ namespace grpc.testing { result.responseSize_ = 0; return this; } - + public bool HasPayload { get { return result.hasPayload; } } @@ -866,7 +866,7 @@ namespace grpc.testing { result.payload_ = null; return this; } - + public bool HasFillUsername { get { return result.hasFillUsername; } } @@ -886,7 +886,7 @@ namespace grpc.testing { result.fillUsername_ = false; return this; } - + public bool HasFillOauthScope { get { return result.hasFillOauthScope; } } @@ -911,7 +911,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class SimpleResponse : pb::GeneratedMessage { private SimpleResponse() { } @@ -921,23 +921,23 @@ namespace grpc.testing { public static SimpleResponse DefaultInstance { get { return defaultInstance; } } - + public override SimpleResponse DefaultInstanceForType { get { return DefaultInstance; } } - + protected override SimpleResponse ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleResponse__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_SimpleResponse__FieldAccessorTable; } } - + public const int PayloadFieldNumber = 1; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -947,7 +947,7 @@ namespace grpc.testing { public global::grpc.testing.Payload Payload { get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } } - + public const int UsernameFieldNumber = 2; private bool hasUsername; private string username_ = ""; @@ -957,7 +957,7 @@ namespace grpc.testing { public string Username { get { return username_; } } - + public const int OauthScopeFieldNumber = 3; private bool hasOauthScope; private string oauthScope_ = ""; @@ -967,13 +967,13 @@ namespace grpc.testing { public string OauthScope { get { return oauthScope_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _simpleResponseFieldNames; @@ -988,13 +988,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasPayload) { size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); @@ -1010,7 +1010,7 @@ namespace grpc.testing { return size; } } - + public static SimpleResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1044,14 +1044,14 @@ namespace grpc.testing { private SimpleResponse MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(SimpleResponse prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1065,10 +1065,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private SimpleResponse result; - + private SimpleResponse PrepareBuilder() { if (resultIsReadOnly) { SimpleResponse original = result; @@ -1078,21 +1078,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override SimpleResponse MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -1100,15 +1100,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.SimpleResponse.Descriptor; } } - + public override SimpleResponse DefaultInstanceForType { get { return global::grpc.testing.SimpleResponse.DefaultInstance; } } - + public override SimpleResponse BuildPartial() { if (resultIsReadOnly) { return result; @@ -1116,7 +1116,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is SimpleResponse) { return MergeFrom((SimpleResponse) other); @@ -1125,7 +1125,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(SimpleResponse other) { if (other == global::grpc.testing.SimpleResponse.DefaultInstance) return this; PrepareBuilder(); @@ -1141,11 +1141,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -1200,14 +1200,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -1247,7 +1247,7 @@ namespace grpc.testing { result.payload_ = null; return this; } - + public bool HasUsername { get { return result.hasUsername; } } @@ -1268,7 +1268,7 @@ namespace grpc.testing { result.username_ = ""; return this; } - + public bool HasOauthScope { get { return result.hasOauthScope; } } @@ -1294,7 +1294,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class StreamingInputCallRequest : pb::GeneratedMessage { private StreamingInputCallRequest() { } @@ -1304,23 +1304,23 @@ namespace grpc.testing { public static StreamingInputCallRequest DefaultInstance { get { return defaultInstance; } } - + public override StreamingInputCallRequest DefaultInstanceForType { get { return DefaultInstance; } } - + protected override StreamingInputCallRequest ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallRequest__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallRequest__FieldAccessorTable; } } - + public const int PayloadFieldNumber = 1; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -1330,13 +1330,13 @@ namespace grpc.testing { public global::grpc.testing.Payload Payload { get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _streamingInputCallRequestFieldNames; @@ -1345,13 +1345,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasPayload) { size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); @@ -1361,7 +1361,7 @@ namespace grpc.testing { return size; } } - + public static StreamingInputCallRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1395,14 +1395,14 @@ namespace grpc.testing { private StreamingInputCallRequest MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(StreamingInputCallRequest prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1416,10 +1416,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingInputCallRequest result; - + private StreamingInputCallRequest PrepareBuilder() { if (resultIsReadOnly) { StreamingInputCallRequest original = result; @@ -1429,21 +1429,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override StreamingInputCallRequest MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -1451,15 +1451,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.StreamingInputCallRequest.Descriptor; } } - + public override StreamingInputCallRequest DefaultInstanceForType { get { return global::grpc.testing.StreamingInputCallRequest.DefaultInstance; } } - + public override StreamingInputCallRequest BuildPartial() { if (resultIsReadOnly) { return result; @@ -1467,7 +1467,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingInputCallRequest) { return MergeFrom((StreamingInputCallRequest) other); @@ -1476,7 +1476,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(StreamingInputCallRequest other) { if (other == global::grpc.testing.StreamingInputCallRequest.DefaultInstance) return this; PrepareBuilder(); @@ -1486,11 +1486,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -1537,14 +1537,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -1589,7 +1589,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class StreamingInputCallResponse : pb::GeneratedMessage { private StreamingInputCallResponse() { } @@ -1599,23 +1599,23 @@ namespace grpc.testing { public static StreamingInputCallResponse DefaultInstance { get { return defaultInstance; } } - + public override StreamingInputCallResponse DefaultInstanceForType { get { return DefaultInstance; } } - + protected override StreamingInputCallResponse ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallResponse__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingInputCallResponse__FieldAccessorTable; } } - + public const int AggregatedPayloadSizeFieldNumber = 1; private bool hasAggregatedPayloadSize; private int aggregatedPayloadSize_; @@ -1625,13 +1625,13 @@ namespace grpc.testing { public int AggregatedPayloadSize { get { return aggregatedPayloadSize_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _streamingInputCallResponseFieldNames; @@ -1640,13 +1640,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasAggregatedPayloadSize) { size += pb::CodedOutputStream.ComputeInt32Size(1, AggregatedPayloadSize); @@ -1656,7 +1656,7 @@ namespace grpc.testing { return size; } } - + public static StreamingInputCallResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1690,14 +1690,14 @@ namespace grpc.testing { private StreamingInputCallResponse MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(StreamingInputCallResponse prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1711,10 +1711,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingInputCallResponse result; - + private StreamingInputCallResponse PrepareBuilder() { if (resultIsReadOnly) { StreamingInputCallResponse original = result; @@ -1724,21 +1724,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override StreamingInputCallResponse MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -1746,15 +1746,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.StreamingInputCallResponse.Descriptor; } } - + public override StreamingInputCallResponse DefaultInstanceForType { get { return global::grpc.testing.StreamingInputCallResponse.DefaultInstance; } } - + public override StreamingInputCallResponse BuildPartial() { if (resultIsReadOnly) { return result; @@ -1762,7 +1762,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingInputCallResponse) { return MergeFrom((StreamingInputCallResponse) other); @@ -1771,7 +1771,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(StreamingInputCallResponse other) { if (other == global::grpc.testing.StreamingInputCallResponse.DefaultInstance) return this; PrepareBuilder(); @@ -1781,11 +1781,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -1827,14 +1827,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasAggregatedPayloadSize { get { return result.hasAggregatedPayloadSize; } } @@ -1859,7 +1859,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class ResponseParameters : pb::GeneratedMessage { private ResponseParameters() { } @@ -1869,23 +1869,23 @@ namespace grpc.testing { public static ResponseParameters DefaultInstance { get { return defaultInstance; } } - + public override ResponseParameters DefaultInstanceForType { get { return DefaultInstance; } } - + protected override ResponseParameters ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_ResponseParameters__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_ResponseParameters__FieldAccessorTable; } } - + public const int SizeFieldNumber = 1; private bool hasSize; private int size_; @@ -1895,7 +1895,7 @@ namespace grpc.testing { public int Size { get { return size_; } } - + public const int IntervalUsFieldNumber = 2; private bool hasIntervalUs; private int intervalUs_; @@ -1905,13 +1905,13 @@ namespace grpc.testing { public int IntervalUs { get { return intervalUs_; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _responseParametersFieldNames; @@ -1923,13 +1923,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasSize) { size += pb::CodedOutputStream.ComputeInt32Size(1, Size); @@ -1942,7 +1942,7 @@ namespace grpc.testing { return size; } } - + public static ResponseParameters ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1976,14 +1976,14 @@ namespace grpc.testing { private ResponseParameters MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(ResponseParameters prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -1997,10 +1997,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private ResponseParameters result; - + private ResponseParameters PrepareBuilder() { if (resultIsReadOnly) { ResponseParameters original = result; @@ -2010,21 +2010,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override ResponseParameters MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -2032,15 +2032,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.ResponseParameters.Descriptor; } } - + public override ResponseParameters DefaultInstanceForType { get { return global::grpc.testing.ResponseParameters.DefaultInstance; } } - + public override ResponseParameters BuildPartial() { if (resultIsReadOnly) { return result; @@ -2048,7 +2048,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is ResponseParameters) { return MergeFrom((ResponseParameters) other); @@ -2057,7 +2057,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(ResponseParameters other) { if (other == global::grpc.testing.ResponseParameters.DefaultInstance) return this; PrepareBuilder(); @@ -2070,11 +2070,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -2120,14 +2120,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasSize { get { return result.hasSize; } } @@ -2147,7 +2147,7 @@ namespace grpc.testing { result.size_ = 0; return this; } - + public bool HasIntervalUs { get { return result.hasIntervalUs; } } @@ -2172,7 +2172,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class StreamingOutputCallRequest : pb::GeneratedMessage { private StreamingOutputCallRequest() { } @@ -2182,23 +2182,23 @@ namespace grpc.testing { public static StreamingOutputCallRequest DefaultInstance { get { return defaultInstance; } } - + public override StreamingOutputCallRequest DefaultInstanceForType { get { return DefaultInstance; } } - + protected override StreamingOutputCallRequest ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallRequest__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallRequest__FieldAccessorTable; } } - + public const int ResponseTypeFieldNumber = 1; private bool hasResponseType; private global::grpc.testing.PayloadType responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; @@ -2208,7 +2208,7 @@ namespace grpc.testing { public global::grpc.testing.PayloadType ResponseType { get { return responseType_; } } - + public const int ResponseParametersFieldNumber = 2; private pbc::PopsicleList responseParameters_ = new pbc::PopsicleList(); public scg::IList ResponseParametersList { @@ -2220,7 +2220,7 @@ namespace grpc.testing { public global::grpc.testing.ResponseParameters GetResponseParameters(int index) { return responseParameters_[index]; } - + public const int PayloadFieldNumber = 3; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -2230,13 +2230,13 @@ namespace grpc.testing { public global::grpc.testing.Payload Payload { get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _streamingOutputCallRequestFieldNames; @@ -2251,13 +2251,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasResponseType) { size += pb::CodedOutputStream.ComputeEnumSize(1, (int) ResponseType); @@ -2273,7 +2273,7 @@ namespace grpc.testing { return size; } } - + public static StreamingOutputCallRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -2308,14 +2308,14 @@ namespace grpc.testing { responseParameters_.MakeReadOnly(); return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(StreamingOutputCallRequest prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -2329,10 +2329,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingOutputCallRequest result; - + private StreamingOutputCallRequest PrepareBuilder() { if (resultIsReadOnly) { StreamingOutputCallRequest original = result; @@ -2342,21 +2342,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override StreamingOutputCallRequest MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -2364,15 +2364,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.StreamingOutputCallRequest.Descriptor; } } - + public override StreamingOutputCallRequest DefaultInstanceForType { get { return global::grpc.testing.StreamingOutputCallRequest.DefaultInstance; } } - + public override StreamingOutputCallRequest BuildPartial() { if (resultIsReadOnly) { return result; @@ -2380,7 +2380,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingOutputCallRequest) { return MergeFrom((StreamingOutputCallRequest) other); @@ -2389,7 +2389,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(StreamingOutputCallRequest other) { if (other == global::grpc.testing.StreamingOutputCallRequest.DefaultInstance) return this; PrepareBuilder(); @@ -2405,11 +2405,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -2472,14 +2472,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasResponseType { get { return result.hasResponseType; } } @@ -2499,7 +2499,7 @@ namespace grpc.testing { result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public pbc::IPopsicleList ResponseParametersList { get { return PrepareBuilder().responseParameters_; } } @@ -2543,7 +2543,7 @@ namespace grpc.testing { result.responseParameters_.Clear(); return this; } - + public bool HasPayload { get { return result.hasPayload; } } @@ -2588,7 +2588,7 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class StreamingOutputCallResponse : pb::GeneratedMessage { private StreamingOutputCallResponse() { } @@ -2598,23 +2598,23 @@ namespace grpc.testing { public static StreamingOutputCallResponse DefaultInstance { get { return defaultInstance; } } - + public override StreamingOutputCallResponse DefaultInstanceForType { get { return DefaultInstance; } } - + protected override StreamingOutputCallResponse ThisMessage { get { return this; } } - + public static pbd::MessageDescriptor Descriptor { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallResponse__Descriptor; } } - + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { get { return global::grpc.testing.Messages.internal__static_grpc_testing_StreamingOutputCallResponse__FieldAccessorTable; } } - + public const int PayloadFieldNumber = 1; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -2624,13 +2624,13 @@ namespace grpc.testing { public global::grpc.testing.Payload Payload { get { return payload_ ?? global::grpc.testing.Payload.DefaultInstance; } } - + public override bool IsInitialized { get { return true; } } - + public override void WriteTo(pb::ICodedOutputStream output) { int size = SerializedSize; string[] field_names = _streamingOutputCallResponseFieldNames; @@ -2639,13 +2639,13 @@ namespace grpc.testing { } UnknownFields.WriteTo(output); } - + private int memoizedSerializedSize = -1; public override int SerializedSize { get { int size = memoizedSerializedSize; if (size != -1) return size; - + size = 0; if (hasPayload) { size += pb::CodedOutputStream.ComputeMessageSize(1, Payload); @@ -2655,7 +2655,7 @@ namespace grpc.testing { return size; } } - + public static StreamingOutputCallResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -2689,14 +2689,14 @@ namespace grpc.testing { private StreamingOutputCallResponse MakeReadOnly() { return this; } - + public static Builder CreateBuilder() { return new Builder(); } public override Builder ToBuilder() { return CreateBuilder(this); } public override Builder CreateBuilderForType() { return new Builder(); } public static Builder CreateBuilder(StreamingOutputCallResponse prototype) { return new Builder(prototype); } - + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Builder : pb::GeneratedBuilder { protected override Builder ThisBuilder { @@ -2710,10 +2710,10 @@ namespace grpc.testing { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingOutputCallResponse result; - + private StreamingOutputCallResponse PrepareBuilder() { if (resultIsReadOnly) { StreamingOutputCallResponse original = result; @@ -2723,21 +2723,21 @@ namespace grpc.testing { } return result; } - + public override bool IsInitialized { get { return result.IsInitialized; } } - + protected override StreamingOutputCallResponse MessageBeingBuilt { get { return PrepareBuilder(); } } - + public override Builder Clear() { result = DefaultInstance; resultIsReadOnly = true; return this; } - + public override Builder Clone() { if (resultIsReadOnly) { return new Builder(result); @@ -2745,15 +2745,15 @@ namespace grpc.testing { return new Builder().MergeFrom(result); } } - + public override pbd::MessageDescriptor DescriptorForType { get { return global::grpc.testing.StreamingOutputCallResponse.Descriptor; } } - + public override StreamingOutputCallResponse DefaultInstanceForType { get { return global::grpc.testing.StreamingOutputCallResponse.DefaultInstance; } } - + public override StreamingOutputCallResponse BuildPartial() { if (resultIsReadOnly) { return result; @@ -2761,7 +2761,7 @@ namespace grpc.testing { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingOutputCallResponse) { return MergeFrom((StreamingOutputCallResponse) other); @@ -2770,7 +2770,7 @@ namespace grpc.testing { return this; } } - + public override Builder MergeFrom(StreamingOutputCallResponse other) { if (other == global::grpc.testing.StreamingOutputCallResponse.DefaultInstance) return this; PrepareBuilder(); @@ -2780,11 +2780,11 @@ namespace grpc.testing { this.MergeUnknownFields(other.UnknownFields); return this; } - + public override Builder MergeFrom(pb::ICodedInputStream input) { return MergeFrom(input, pb::ExtensionRegistry.Empty); } - + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { PrepareBuilder(); pb::UnknownFieldSet.Builder unknownFields = null; @@ -2831,14 +2831,14 @@ namespace grpc.testing { } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -2883,9 +2883,9 @@ namespace grpc.testing { object.ReferenceEquals(global::grpc.testing.Messages.Descriptor, null); } } - + #endregion - + } #endregion Designer generated code diff --git a/src/csharp/GrpcApi/Properties/AssemblyInfo.cs b/src/csharp/GrpcApi/Properties/AssemblyInfo.cs index 725f12c4860..e0a8e4357fc 100644 --- a/src/csharp/GrpcApi/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcApi/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("GrpcApi")] [assembly: AssemblyDescription ("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/csharp/GrpcApi/TestServiceGrpc.cs b/src/csharp/GrpcApi/TestServiceGrpc.cs index 067b21c252c..6534a44ef4f 100644 --- a/src/csharp/GrpcApi/TestServiceGrpc.cs +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcApiTests/MathClientServerTests.cs b/src/csharp/GrpcApiTests/MathClientServerTests.cs index bb3f75d4acb..bd298b0932f 100644 --- a/src/csharp/GrpcApiTests/MathClientServerTests.cs +++ b/src/csharp/GrpcApiTests/MathClientServerTests.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -96,7 +96,7 @@ namespace math.Tests var recorder = new RecordingObserver(); client.Fib(new FibArgs.Builder { Limit = 6 }.Build(), recorder); - CollectionAssert.AreEqual(new List{1, 1, 2, 3, 5, 8}, + CollectionAssert.AreEqual(new List{1, 1, 2, 3, 5, 8}, recorder.ToList().Result.ConvertAll((n) => n.Num_)); } diff --git a/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs b/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs index 0928404429f..5594e92e72b 100644 --- a/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("GrpcApiTests")] [assembly: AssemblyDescription("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/csharp/GrpcCore/Call.cs b/src/csharp/GrpcCore/Call.cs index 181210902f7..93a7507b2fa 100644 --- a/src/csharp/GrpcCore/Call.cs +++ b/src/csharp/GrpcCore/Call.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -43,7 +43,7 @@ namespace Google.GRPC.Core readonly Func responseDeserializer; readonly Channel channel; - public Call(string methodName, + public Call(string methodName, Func requestSerializer, Func responseDeserializer, TimeSpan timeout, diff --git a/src/csharp/GrpcCore/Calls.cs b/src/csharp/GrpcCore/Calls.cs index 101965600e0..d89d9a16f9b 100644 --- a/src/csharp/GrpcCore/Calls.cs +++ b/src/csharp/GrpcCore/Calls.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Channel.cs b/src/csharp/GrpcCore/Channel.cs index cd4f151f49f..d1f795541cc 100644 --- a/src/csharp/GrpcCore/Channel.cs +++ b/src/csharp/GrpcCore/Channel.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -82,4 +82,4 @@ namespace Google.GRPC.Core } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs b/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs index 507d0dd8ad3..f82fe5f26ce 100644 --- a/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs +++ b/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index ee1168621d0..c4f030267d2 100644 --- a/src/csharp/GrpcCore/GrpcEnvironment.cs +++ b/src/csharp/GrpcCore/GrpcEnvironment.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -52,7 +52,7 @@ namespace Google.GRPC.Core static object staticLock = new object(); static volatile GrpcEnvironment instance; - + readonly GrpcThreadPool threadPool; bool isClosed; @@ -60,7 +60,7 @@ namespace Google.GRPC.Core /// Makes sure GRPC environment is initialized. Subsequent invocations don't have any /// effect unless you call Shutdown first. /// Although normal use cases assume you will call this just once in your application's - /// lifetime (and call Shutdown once you're done), for the sake of easier testing it's + /// lifetime (and call Shutdown once you're done), for the sake of easier testing it's /// allowed to initialize the environment again after it has been successfully shutdown. /// public static void Initialize() { diff --git a/src/csharp/GrpcCore/Internal/AsyncCall.cs b/src/csharp/GrpcCore/Internal/AsyncCall.cs index a3b40e512c8..d5f3239e1e0 100644 --- a/src/csharp/GrpcCore/Internal/AsyncCall.cs +++ b/src/csharp/GrpcCore/Internal/AsyncCall.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -45,7 +45,7 @@ namespace Google.GRPC.Core.Internal /// Listener for call events that can be delivered from a completion queue. /// internal interface ICallEventListener { - + void OnClientMetadata(); void OnRead(byte[] payload); @@ -66,7 +66,7 @@ namespace Google.GRPC.Core.Internal readonly Func serializer; readonly Func deserializer; - // TODO: make sure the delegate doesn't get garbage collected while + // TODO: make sure the delegate doesn't get garbage collected while // native callbacks are in the completion queue. readonly EventCallbackDelegate callbackHandler; @@ -205,7 +205,7 @@ namespace Google.GRPC.Core.Internal CheckNotFinished(); CheckNoError(); CheckCancelNotRequested(); - + if (halfcloseRequested || halfclosed) { throw new InvalidOperationException("Already halfclosed."); @@ -218,7 +218,7 @@ namespace Google.GRPC.Core.Internal // TODO: wrap serialization... byte[] payload = serializer(msg); - + call.StartWrite(payload, buffered, callbackHandler); writeTcs = new TaskCompletionSource(); return writeTcs; @@ -317,7 +317,7 @@ namespace Google.GRPC.Core.Internal // grpc_call_cancel_with_status is threadsafe call.CancelWithStatus(status); } - + public void OnClientMetadata() { // TODO: implement.... @@ -434,7 +434,7 @@ namespace Google.GRPC.Core.Internal { call.Dispose(); } - } + } disposed = true; } } @@ -523,4 +523,4 @@ namespace Google.GRPC.Core.Internal } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index d91d2ac6cbf..e9ccd8d5f99 100644 --- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -59,8 +59,8 @@ namespace Google.GRPC.Core.Internal [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_invoke_old")] static extern GRPCCallError grpcsharp_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, - [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, - [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, + [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, + [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, UInt32 flags); [DllImport("grpc_csharp_ext.dll")] @@ -123,12 +123,12 @@ namespace Google.GRPC.Core.Internal } public void Invoke(CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, bool buffered) - { + { AssertCallOk(grpcsharp_call_invoke_old(this, cq, metadataReadTag, finishedTag, GetFlags(buffered))); } public void Invoke(CompletionQueueSafeHandle cq, bool buffered, EventCallbackDelegate metadataReadCallback, EventCallbackDelegate finishedCallback) - { + { AssertCallOk(grpcsharp_call_invoke_old_CALLBACK(this, cq, metadataReadCallback, finishedCallback, GetFlags(buffered))); } @@ -212,4 +212,4 @@ namespace Google.GRPC.Core.Internal return buffered ? 0 : GRPC_WRITE_BUFFER_HINT; } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs index f6af64c9679..379c83d5375 100644 --- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -64,4 +64,4 @@ namespace Google.GRPC.Core.Internal return true; } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs index fc2b1d54210..666f220b8c8 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Internal/Enums.cs b/src/csharp/GrpcCore/Internal/Enums.cs index c2eb1327b3f..d38896ec843 100644 --- a/src/csharp/GrpcCore/Internal/Enums.cs +++ b/src/csharp/GrpcCore/Internal/Enums.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -73,7 +73,7 @@ namespace Google.GRPC.Core.Internal GRPC_QUEUE_SHUTDOWN, /* operation completion */ - GRPC_OP_COMPLETE, + GRPC_OP_COMPLETE, /* A read has completed */ GRPC_READ, @@ -87,7 +87,7 @@ namespace Google.GRPC.Core.Internal /* The metadata array sent by server received at client */ GRPC_CLIENT_METADATA_READ, - /* An RPC has finished. The event contains status. + /* An RPC has finished. The event contains status. * On the server this will be OK or Cancelled. */ GRPC_FINISHED, diff --git a/src/csharp/GrpcCore/Internal/Event.cs b/src/csharp/GrpcCore/Internal/Event.cs index 9229472ccd7..6116e0975af 100644 --- a/src/csharp/GrpcCore/Internal/Event.cs +++ b/src/csharp/GrpcCore/Internal/Event.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -126,7 +126,7 @@ namespace Google.GRPC.Core.Internal // TODO: this is basically c&p of EventSafeHandle. Unify! /// - /// Not owned version of + /// Not owned version of /// grpc_event from grpc/grpc.h /// internal class EventSafeHandleNotOwned : SafeHandleZeroIsInvalid @@ -221,4 +221,4 @@ namespace Google.GRPC.Core.Internal return true; } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs index b768decc8c6..f8154fa2505 100644 --- a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs +++ b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs index c7d8a0a3c38..74a8ef7b6ea 100644 --- a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs +++ b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index 2ae0ad237d8..c91de97ce3b 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -111,4 +111,4 @@ namespace Google.GRPC.Core.Internal return true; } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs b/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs index 11207918426..1d29864b9f4 100644 --- a/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs +++ b/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs b/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs index 49410961cb4..60837de5e65 100644 --- a/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs +++ b/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs index 651003dae8b..38b75180dc5 100644 --- a/src/csharp/GrpcCore/Internal/Timespec.cs +++ b/src/csharp/GrpcCore/Internal/Timespec.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -106,7 +106,7 @@ namespace Google.GRPC.Core.Internal Timespec result; result.tv_nsec = new IntPtr(nanos % nanosPerSecond); - result.tv_sec = new IntPtr(tv_sec.ToInt64() + (timeSpan.Ticks / TimeSpan.TicksPerSecond) + overflow_sec); + result.tv_sec = new IntPtr(tv_sec.ToInt64() + (timeSpan.Ticks / TimeSpan.TicksPerSecond) + overflow_sec); return result; } } diff --git a/src/csharp/GrpcCore/Marshaller.cs b/src/csharp/GrpcCore/Marshaller.cs index 21bd26650b5..f031354fd2d 100644 --- a/src/csharp/GrpcCore/Marshaller.cs +++ b/src/csharp/GrpcCore/Marshaller.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -77,7 +77,7 @@ namespace Google.GRPC.Core { get { - return new Marshaller(System.Text.Encoding.UTF8.GetBytes, + return new Marshaller(System.Text.Encoding.UTF8.GetBytes, System.Text.Encoding.UTF8.GetString); } } diff --git a/src/csharp/GrpcCore/Method.cs b/src/csharp/GrpcCore/Method.cs index a8c647035d8..64a4f71396d 100644 --- a/src/csharp/GrpcCore/Method.cs +++ b/src/csharp/GrpcCore/Method.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Properties/AssemblyInfo.cs b/src/csharp/GrpcCore/Properties/AssemblyInfo.cs index 74aba257678..0907b868336 100644 --- a/src/csharp/GrpcCore/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcCore/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("GrpcCore")] [assembly: AssemblyDescription ("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/csharp/GrpcCore/RpcException.cs b/src/csharp/GrpcCore/RpcException.cs index 5d1ca3bcdf3..9ec1d2f2f33 100644 --- a/src/csharp/GrpcCore/RpcException.cs +++ b/src/csharp/GrpcCore/RpcException.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Server.cs b/src/csharp/GrpcCore/Server.cs index 62ffa70b713..0882a612995 100644 --- a/src/csharp/GrpcCore/Server.cs +++ b/src/csharp/GrpcCore/Server.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -47,7 +47,7 @@ namespace Google.GRPC.Core /// public class Server { - // TODO: make sure the delegate doesn't get garbage collected while + // TODO: make sure the delegate doesn't get garbage collected while // native callbacks are in the completion queue. readonly EventCallbackDelegate newRpcHandler; readonly EventCallbackDelegate serverShutdownHandler; @@ -94,7 +94,7 @@ namespace Google.GRPC.Core internal void RunRpc() { AllowOneRpc(); - + try { var rpcInfo = newRpcQueue.Take(); @@ -105,7 +105,7 @@ namespace Google.GRPC.Core if (!callHandlers.TryGetValue(rpcInfo.Method, out callHandler)) { callHandler = new NoSuchMethodCallHandler(); - } + } callHandler.StartCall(rpcInfo.Method, rpcInfo.Call, GetCompletionQueue()); } catch(Exception e) @@ -209,4 +209,4 @@ namespace Google.GRPC.Core } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index 12d0c936348..bcce4a091fb 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -60,7 +60,7 @@ namespace Google.GRPC.Core asyncCall.InitializeServer(call); asyncCall.Accept(cq); - + var request = asyncCall.ReadAsync().Result; var responseObserver = new ServerWritingObserver(asyncCall); diff --git a/src/csharp/GrpcCore/ServerCalls.cs b/src/csharp/GrpcCore/ServerCalls.cs index b95a0d97b4f..273029cab60 100644 --- a/src/csharp/GrpcCore/ServerCalls.cs +++ b/src/csharp/GrpcCore/ServerCalls.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/ServerServiceDefinition.cs b/src/csharp/GrpcCore/ServerServiceDefinition.cs index f0b4daf0719..1eb17837e44 100644 --- a/src/csharp/GrpcCore/ServerServiceDefinition.cs +++ b/src/csharp/GrpcCore/ServerServiceDefinition.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -73,7 +73,7 @@ namespace Google.GRPC.Core } public Builder AddMethod( - Method method, + Method method, UnaryRequestServerMethod handler) { callHandlers.Add(method.Name, ServerCalls.UnaryRequestCall(method, handler)); @@ -81,7 +81,7 @@ namespace Google.GRPC.Core } public Builder AddMethod( - Method method, + Method method, StreamingRequestServerMethod handler) { callHandlers.Add(method.Name, ServerCalls.StreamingRequestCall(method, handler)); diff --git a/src/csharp/GrpcCore/Status.cs b/src/csharp/GrpcCore/Status.cs index dce1e24d7ea..6430e6b7ab7 100644 --- a/src/csharp/GrpcCore/Status.cs +++ b/src/csharp/GrpcCore/Status.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -66,4 +66,4 @@ namespace Google.GRPC.Core } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/StatusCode.cs b/src/csharp/GrpcCore/StatusCode.cs index eccaae72f6d..ba99f9b5e0b 100644 --- a/src/csharp/GrpcCore/StatusCode.cs +++ b/src/csharp/GrpcCore/StatusCode.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Utils/RecordingObserver.cs b/src/csharp/GrpcCore/Utils/RecordingObserver.cs index 0cadfc0e4a0..0c784e1d356 100644 --- a/src/csharp/GrpcCore/Utils/RecordingObserver.cs +++ b/src/csharp/GrpcCore/Utils/RecordingObserver.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCore/Utils/RecordingQueue.cs b/src/csharp/GrpcCore/Utils/RecordingQueue.cs index d73fc0fc785..f8940d7584c 100644 --- a/src/csharp/GrpcCore/Utils/RecordingQueue.cs +++ b/src/csharp/GrpcCore/Utils/RecordingQueue.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -41,7 +41,7 @@ namespace Google.GRPC.Core.Utils // TODO: replace this by something that implements IAsyncEnumerator. /// /// Observer that allows us to await incoming messages one-by-one. - /// The implementation is not ideal and class will be probably replaced + /// The implementation is not ideal and class will be probably replaced /// by something more versatile in the future. /// public class RecordingQueue : IObserver diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index 1472db6e07e..44011565204 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -71,7 +71,7 @@ namespace Google.GRPC.Core.Tests Assert.AreEqual("ABC", Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken))); Assert.AreEqual("abcdef", Calls.BlockingUnaryCall(call, "abcdef", default(CancellationToken))); } - + server.ShutdownAsync().Wait(); GrpcEnvironment.Shutdown(); diff --git a/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs b/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs index 1bc6cce4017..8656b1bf016 100644 --- a/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs +++ b/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs b/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs index 565b1e2bd65..a93d843889f 100644 --- a/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("GrpcCoreTests")] [assembly: AssemblyDescription("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/csharp/GrpcCoreTests/ServerTest.cs b/src/csharp/GrpcCoreTests/ServerTest.cs index 1c70a3d6c44..43414a4cc49 100644 --- a/src/csharp/GrpcCoreTests/ServerTest.cs +++ b/src/csharp/GrpcCoreTests/ServerTest.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcCoreTests/TimespecTest.cs b/src/csharp/GrpcCoreTests/TimespecTest.cs index 2b03513cb7a..21698242191 100644 --- a/src/csharp/GrpcCoreTests/TimespecTest.cs +++ b/src/csharp/GrpcCoreTests/TimespecTest.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/InteropClient/Client.cs b/src/csharp/InteropClient/Client.cs index fcc6a572e40..945afe0642f 100644 --- a/src/csharp/InteropClient/Client.cs +++ b/src/csharp/InteropClient/Client.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -83,7 +83,7 @@ namespace Google.GRPC.Interop Console.WriteLine(" --test_case=TESTCASE"); Console.WriteLine(" --use_tls=BOOLEAN"); Console.WriteLine(" --use_test_ca=BOOLEAN"); - Console.WriteLine(); + Console.WriteLine(); Environment.Exit(1); } @@ -149,7 +149,7 @@ namespace Google.GRPC.Interop .SetResponseSize(314159) .SetPayload(CreateZerosPayload(271828)) .Build(); - + var response = client.UnaryCall(request); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); @@ -214,8 +214,8 @@ namespace Google.GRPC.Interop .SetResponseType(PayloadType.COMPRESSABLE) .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415)) .SetPayload(CreateZerosPayload(27182)).Build()); - - response = recorder.Queue.Take(); + + response = recorder.Queue.Take(); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); Assert.AreEqual(31415, response.Payload.Body.Length); @@ -224,7 +224,7 @@ namespace Google.GRPC.Interop .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(9)) .SetPayload(CreateZerosPayload(8)).Build()); - response = recorder.Queue.Take(); + response = recorder.Queue.Take(); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); Assert.AreEqual(9, response.Payload.Body.Length); @@ -233,7 +233,7 @@ namespace Google.GRPC.Interop .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(2635)) .SetPayload(CreateZerosPayload(1828)).Build()); - response = recorder.Queue.Take(); + response = recorder.Queue.Take(); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); Assert.AreEqual(2653, response.Payload.Body.Length); @@ -243,7 +243,7 @@ namespace Google.GRPC.Interop .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(58979)) .SetPayload(CreateZerosPayload(45904)).Build()); - response = recorder.Queue.Take(); + response = recorder.Queue.Take(); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); Assert.AreEqual(58979, response.Payload.Body.Length); diff --git a/src/csharp/InteropClient/Properties/AssemblyInfo.cs b/src/csharp/InteropClient/Properties/AssemblyInfo.cs index 1f3cc19a9de..00b4bd58955 100644 --- a/src/csharp/InteropClient/Properties/AssemblyInfo.cs +++ b/src/csharp/InteropClient/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("InteropClient")] [assembly: AssemblyDescription("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/csharp/MathClient/MathClient.cs b/src/csharp/MathClient/MathClient.cs index a54c8e38099..eb9b7b105b8 100644 --- a/src/csharp/MathClient/MathClient.cs +++ b/src/csharp/MathClient/MathClient.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -55,7 +55,7 @@ namespace math MathExamples.DivManyExample(stub); } - + GrpcEnvironment.Shutdown(); } } diff --git a/src/csharp/MathClient/Properties/AssemblyInfo.cs b/src/csharp/MathClient/Properties/AssemblyInfo.cs index f521cd63f0c..aa614943acb 100644 --- a/src/csharp/MathClient/Properties/AssemblyInfo.cs +++ b/src/csharp/MathClient/Properties/AssemblyInfo.cs @@ -1,7 +1,7 @@ using System.Reflection; using System.Runtime.CompilerServices; -// Information about this assembly is defined by the following attributes. +// Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle ("MathClient")] [assembly: AssemblyDescription ("")] @@ -15,7 +15,7 @@ using System.Runtime.CompilerServices; // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion ("1.0.*")] -// The following attributes are used to specify the signing key for the assembly, +// The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index 8180c2735fe..c165d26e47e 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -92,4 +92,4 @@ Handle MakeFastBuffer(Handle slowBuffer) { return NanEscapeScope(fastBuffer); } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/byte_buffer.h b/src/node/ext/byte_buffer.h index 52fee70a9db..5083674d394 100644 --- a/src/node/ext/byte_buffer.h +++ b/src/node/ext/byte_buffer.h @@ -57,4 +57,4 @@ v8::Handle MakeFastBuffer(v8::Handle slowBuffer); } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_BYTE_BUFFER_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_BYTE_BUFFER_H_ diff --git a/src/node/ext/call.h b/src/node/ext/call.h index e93349d65cb..933541ce5b6 100644 --- a/src/node/ext/call.h +++ b/src/node/ext/call.h @@ -128,4 +128,4 @@ class Call : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CALL_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_CALL_H_ diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index edeebe9702e..6c7a89e596d 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -179,4 +179,4 @@ NAN_METHOD(Channel::Close) { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/channel.h b/src/node/ext/channel.h index 3c0597715b2..bf793194d9a 100644 --- a/src/node/ext/channel.h +++ b/src/node/ext/channel.h @@ -76,4 +76,4 @@ class Channel : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CHANNEL_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_CHANNEL_H_ diff --git a/src/node/ext/completion_queue_async_worker.cc b/src/node/ext/completion_queue_async_worker.cc index bc5896b58bd..ca22527e6f5 100644 --- a/src/node/ext/completion_queue_async_worker.cc +++ b/src/node/ext/completion_queue_async_worker.cc @@ -101,4 +101,4 @@ void CompletionQueueAsyncWorker::HandleErrorCallback() { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/completion_queue_async_worker.h b/src/node/ext/completion_queue_async_worker.h index 1c02a345929..0ddb5b4cfd2 100644 --- a/src/node/ext/completion_queue_async_worker.h +++ b/src/node/ext/completion_queue_async_worker.h @@ -78,4 +78,4 @@ class CompletionQueueAsyncWorker : public NanAsyncWorker { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_COMPLETION_QUEUE_ASYNC_WORKER_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_COMPLETION_QUEUE_ASYNC_WORKER_H_ diff --git a/src/node/ext/credentials.cc b/src/node/ext/credentials.cc index cb1e8a79c1f..4b95c72bf73 100644 --- a/src/node/ext/credentials.cc +++ b/src/node/ext/credentials.cc @@ -200,4 +200,4 @@ NAN_METHOD(Credentials::CreateIam) { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/credentials.h b/src/node/ext/credentials.h index 576a5dbd47a..e60be3d4e15 100644 --- a/src/node/ext/credentials.h +++ b/src/node/ext/credentials.h @@ -78,4 +78,4 @@ class Credentials : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_CREDENTIALS_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_CREDENTIALS_H_ diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 4e1553fecd4..965186e0cc6 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -175,4 +175,4 @@ void init(Handle exports) { grpc::node::ServerCredentials::Init(exports); } -NODE_MODULE(grpc, init) \ No newline at end of file +NODE_MODULE(grpc, init) diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index c2e85df5b8b..ab45da8d199 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -286,4 +286,4 @@ NAN_METHOD(Server::Shutdown) { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/server.h b/src/node/ext/server.h index e4bb4d889ea..2056fe7d3f8 100644 --- a/src/node/ext/server.h +++ b/src/node/ext/server.h @@ -76,4 +76,4 @@ class Server : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_SERVER_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_SERVER_H_ diff --git a/src/node/ext/server_credentials.cc b/src/node/ext/server_credentials.cc index 9c9a1b38a7b..f75a2bf79c8 100644 --- a/src/node/ext/server_credentials.cc +++ b/src/node/ext/server_credentials.cc @@ -151,4 +151,4 @@ NAN_METHOD(ServerCredentials::CreateFake) { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/server_credentials.h b/src/node/ext/server_credentials.h index 7c916e774e3..f09902420c6 100644 --- a/src/node/ext/server_credentials.h +++ b/src/node/ext/server_credentials.h @@ -74,4 +74,4 @@ class ServerCredentials : public ::node::ObjectWrap { } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_SERVER_CREDENTIALS_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_SERVER_CREDENTIALS_H_ diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc index 5cece4a97d1..bc3237f7a6c 100644 --- a/src/node/ext/timeval.cc +++ b/src/node/ext/timeval.cc @@ -62,4 +62,4 @@ double TimespecToMilliseconds(gpr_timespec timespec) { } } // namespace node -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/src/node/ext/timeval.h b/src/node/ext/timeval.h index a85949f2674..0cada5ace96 100644 --- a/src/node/ext/timeval.h +++ b/src/node/ext/timeval.h @@ -45,4 +45,4 @@ gpr_timespec MillisecondsToTimespec(double millis); } // namespace node } // namespace grpc -#endif // NET_GRPC_NODE_TIMEVAL_H_ \ No newline at end of file +#endif // NET_GRPC_NODE_TIMEVAL_H_ diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c index 1587a8c7413..7e62c1b7a3d 100644 --- a/src/python/src/grpc/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -290,4 +290,4 @@ int pygrpc_add_call(PyObject *module) { PyErr_SetString(PyExc_ImportError, "Couldn't add Call type to module!"); } return 0; -} \ No newline at end of file +} diff --git a/src/ruby/bin/apis/google/protobuf/empty.rb b/src/ruby/bin/apis/google/protobuf/empty.rb index 9aaa19b4743..2f6bbc950b6 100644 --- a/src/ruby/bin/apis/google/protobuf/empty.rb +++ b/src/ruby/bin/apis/google/protobuf/empty.rb @@ -41,4 +41,4 @@ module Google module Protobuf Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass end -end \ No newline at end of file +end diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/src/ruby/bin/apis/pubsub_demo.rb index cd31efd9f11..6656a561309 100755 --- a/src/ruby/bin/apis/pubsub_demo.rb +++ b/src/ruby/bin/apis/pubsub_demo.rb @@ -275,4 +275,4 @@ def main NamedActions.new(pub, sub, args).method(args.action).call end -main \ No newline at end of file +main diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb index 63db5c3ec84..d61431f17af 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +++ b/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb @@ -171,4 +171,4 @@ module Tech AcknowledgeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.AcknowledgeRequest").msgclass NackRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.NackRequest").msgclass end -end \ No newline at end of file +end diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb index cb27ce60398..43c5265643a 100644 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +++ b/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb @@ -100,4 +100,4 @@ module Tech Stub = Service.rpc_stub_class end end -end \ No newline at end of file +end diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb index 94d4ad6c3e9..ef31f68f83b 100755 --- a/src/ruby/bin/interop/interop_client.rb +++ b/src/ruby/bin/interop/interop_client.rb @@ -348,4 +348,4 @@ def main NamedTests.new(stub, opts).method(opts['test_case']).call end -main \ No newline at end of file +main diff --git a/src/ruby/bin/interop/interop_server.rb b/src/ruby/bin/interop/interop_server.rb index 0e2b40bdcae..b3b7d0c5a3a 100755 --- a/src/ruby/bin/interop/interop_server.rb +++ b/src/ruby/bin/interop/interop_server.rb @@ -189,4 +189,4 @@ def main s.run end -main \ No newline at end of file +main diff --git a/src/ruby/bin/interop/test/cpp/interop/empty.rb b/src/ruby/bin/interop/test/cpp/interop/empty.rb index 0dd4d212933..3579fa5ded8 100644 --- a/src/ruby/bin/interop/test/cpp/interop/empty.rb +++ b/src/ruby/bin/interop/test/cpp/interop/empty.rb @@ -41,4 +41,4 @@ module Grpc module Testing Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.Empty").msgclass end -end \ No newline at end of file +end diff --git a/src/ruby/bin/interop/test/cpp/interop/messages.rb b/src/ruby/bin/interop/test/cpp/interop/messages.rb index 9e65b42caae..89c349b4060 100644 --- a/src/ruby/bin/interop/test/cpp/interop/messages.rb +++ b/src/ruby/bin/interop/test/cpp/interop/messages.rb @@ -86,4 +86,4 @@ module Grpc StreamingOutputCallResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.StreamingOutputCallResponse").msgclass PayloadType = Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.testing.PayloadType").enummodule end -end \ No newline at end of file +end diff --git a/src/ruby/bin/interop/test/cpp/interop/test.rb b/src/ruby/bin/interop/test/cpp/interop/test.rb index 0df3ec1f3a2..5948b50eaa5 100644 --- a/src/ruby/bin/interop/test/cpp/interop/test.rb +++ b/src/ruby/bin/interop/test/cpp/interop/test.rb @@ -40,4 +40,4 @@ end module Grpc module Testing end -end \ No newline at end of file +end diff --git a/src/ruby/bin/interop/test/cpp/interop/test_services.rb b/src/ruby/bin/interop/test/cpp/interop/test_services.rb index d50457f18c6..5a3146c581b 100644 --- a/src/ruby/bin/interop/test/cpp/interop/test_services.rb +++ b/src/ruby/bin/interop/test/cpp/interop/test_services.rb @@ -57,4 +57,4 @@ module Grpc Stub = Service.rpc_stub_class end end -end \ No newline at end of file +end diff --git a/src/ruby/bin/math.rb b/src/ruby/bin/math.rb index 7dc677b6a3a..323993ed439 100755 --- a/src/ruby/bin/math.rb +++ b/src/ruby/bin/math.rb @@ -58,4 +58,4 @@ module Math FibArgs = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibArgs").msgclass Num = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.Num").msgclass FibReply = Google::Protobuf::DescriptorPool.generated_pool.lookup("math.FibReply").msgclass -end \ No newline at end of file +end diff --git a/src/ruby/bin/math_client.rb b/src/ruby/bin/math_client.rb index 9a0687f6696..cb085d4d429 100755 --- a/src/ruby/bin/math_client.rb +++ b/src/ruby/bin/math_client.rb @@ -144,4 +144,4 @@ def main do_div_many(stub) end -main \ No newline at end of file +main diff --git a/src/ruby/bin/math_server.rb b/src/ruby/bin/math_server.rb index ff38b2a2501..93277e39320 100755 --- a/src/ruby/bin/math_server.rb +++ b/src/ruby/bin/math_server.rb @@ -187,4 +187,4 @@ def main s.run end -main \ No newline at end of file +main diff --git a/src/ruby/bin/math_services.rb b/src/ruby/bin/math_services.rb index c559ae0bb8a..cf58a53913f 100755 --- a/src/ruby/bin/math_services.rb +++ b/src/ruby/bin/math_services.rb @@ -53,4 +53,4 @@ module Math Stub = Service.rpc_stub_class end -end \ No newline at end of file +end diff --git a/src/ruby/bin/noproto_client.rb b/src/ruby/bin/noproto_client.rb index ec01e740f3e..44710520d29 100755 --- a/src/ruby/bin/noproto_client.rb +++ b/src/ruby/bin/noproto_client.rb @@ -105,4 +105,4 @@ def main logger.info("got a response: #{resp}") end -main \ No newline at end of file +main diff --git a/src/ruby/bin/noproto_server.rb b/src/ruby/bin/noproto_server.rb index 208a91f734b..435f8f4ebf4 100755 --- a/src/ruby/bin/noproto_server.rb +++ b/src/ruby/bin/noproto_server.rb @@ -109,4 +109,4 @@ def main s.run end -main \ No newline at end of file +main diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index c9f7d94165c..96c92e2be5d 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -73,4 +73,4 @@ $LDFLAGS << ' -lgrpc -lgpr -ldl' crash('need grpc lib') unless have_library('grpc', 'grpc_channel_destroy') have_library('grpc', 'grpc_channel_destroy') crash('need gpr lib') unless have_library('gpr', 'gpr_now') -create_makefile('grpc/grpc') \ No newline at end of file +create_makefile('grpc/grpc') diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c index 605703fd53f..ed9240ab637 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.c +++ b/src/ruby/ext/grpc/rb_byte_buffer.c @@ -238,4 +238,4 @@ grpc_byte_buffer *grpc_rb_get_wrapped_byte_buffer(VALUE v) { grpc_rb_byte_buffer *wrapper = NULL; Data_Get_Struct(v, grpc_rb_byte_buffer, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_byte_buffer.h b/src/ruby/ext/grpc/rb_byte_buffer.h index 935f206c619..c65f2153f8d 100644 --- a/src/ruby/ext/grpc/rb_byte_buffer.h +++ b/src/ruby/ext/grpc/rb_byte_buffer.h @@ -51,4 +51,4 @@ VALUE grpc_rb_byte_buffer_create_with_mark(VALUE mark, grpc_byte_buffer* bb); /* Gets the wrapped byte_buffer from its ruby object. */ grpc_byte_buffer* grpc_rb_get_wrapped_byte_buffer(VALUE v); -#endif /* GRPC_RB_BYTE_BUFFER_H_ */ \ No newline at end of file +#endif /* GRPC_RB_BYTE_BUFFER_H_ */ diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 9576075ffa1..12cf3bccc2b 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -566,4 +566,4 @@ VALUE grpc_rb_wrap_call(grpc_call *c) { UINT2NUM(NUM2UINT(obj) + 1)); } return Data_Wrap_Struct(rb_cCall, GC_NOT_MARKED, grpc_rb_call_destroy, c); -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index f2a3f3ed3be..ade6046e24f 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -56,4 +56,4 @@ extern VALUE rb_eCallError; /* Initializes the Call class. */ void Init_google_rpc_call(); -#endif /* GRPC_RB_CALL_H_ */ \ No newline at end of file +#endif /* GRPC_RB_CALL_H_ */ diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 116e7740561..3dbfb9dbfd0 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -261,4 +261,4 @@ grpc_channel *grpc_rb_get_wrapped_channel(VALUE v) { grpc_rb_channel *wrapper = NULL; Data_Get_Struct(v, grpc_rb_channel, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index 696f77e9418..bf77d774fee 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -46,4 +46,4 @@ void Init_google_rpc_channel(); /* Gets the wrapped channel from the ruby wrapper */ grpc_channel* grpc_rb_get_wrapped_channel(VALUE v); -#endif /* GRPC_RB_CHANNEL_H_ */ \ No newline at end of file +#endif /* GRPC_RB_CHANNEL_H_ */ diff --git a/src/ruby/ext/grpc/rb_channel_args.c b/src/ruby/ext/grpc/rb_channel_args.c index 4249db77689..532ee5e7859 100644 --- a/src/ruby/ext/grpc/rb_channel_args.c +++ b/src/ruby/ext/grpc/rb_channel_args.c @@ -151,4 +151,4 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, } rb_jump_tag(status); } -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_channel_args.h b/src/ruby/ext/grpc/rb_channel_args.h index ff12e90806c..78a333bd082 100644 --- a/src/ruby/ext/grpc/rb_channel_args.h +++ b/src/ruby/ext/grpc/rb_channel_args.h @@ -49,4 +49,4 @@ void grpc_rb_hash_convert_to_channel_args(VALUE src_hash, grpc_channel_args* dst); -#endif /* GRPC_RB_CHANNEL_ARGS_H_ */ \ No newline at end of file +#endif /* GRPC_RB_CHANNEL_ARGS_H_ */ diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 7ed586fbb12..60a28ce94bc 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -182,4 +182,4 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v) { grpc_completion_queue *cq = NULL; Data_Get_Struct(v, grpc_completion_queue, cq); return cq; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h index 61b27ab10f2..1f618f593f0 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.h +++ b/src/ruby/ext/grpc/rb_completion_queue.h @@ -47,4 +47,4 @@ extern VALUE rb_cCompletionQueue; /* Initializes the CompletionQueue class. */ void Init_google_rpc_completion_queue(); -#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */ \ No newline at end of file +#endif /* GRPC_RB_COMPLETION_QUEUE_H_ */ diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c index 9df58e2c69f..4e512760d7f 100644 --- a/src/ruby/ext/grpc/rb_credentials.c +++ b/src/ruby/ext/grpc/rb_credentials.c @@ -278,4 +278,4 @@ grpc_credentials *grpc_rb_get_wrapped_credentials(VALUE v) { grpc_rb_credentials *wrapper = NULL; Data_Get_Struct(v, grpc_rb_credentials, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h index 838d2abb3d7..be5574c3191 100644 --- a/src/ruby/ext/grpc/rb_credentials.h +++ b/src/ruby/ext/grpc/rb_credentials.h @@ -47,4 +47,4 @@ void Init_google_rpc_credentials(); /* Gets the wrapped credentials from the ruby wrapper */ grpc_credentials* grpc_rb_get_wrapped_credentials(VALUE v); -#endif /* GRPC_RB_CREDENTIALS_H_ */ \ No newline at end of file +#endif /* GRPC_RB_CREDENTIALS_H_ */ diff --git a/src/ruby/ext/grpc/rb_event.c b/src/ruby/ext/grpc/rb_event.c index 70147349d5c..3579f200735 100644 --- a/src/ruby/ext/grpc/rb_event.c +++ b/src/ruby/ext/grpc/rb_event.c @@ -358,4 +358,4 @@ VALUE grpc_rb_new_event(grpc_event *ev) { wrapper->mark = Qnil; return Data_Wrap_Struct(rb_cEvent, grpc_rb_event_mark, grpc_rb_event_free, wrapper); -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_event.h b/src/ruby/ext/grpc/rb_event.h index ee75231ae72..12f12868772 100644 --- a/src/ruby/ext/grpc/rb_event.h +++ b/src/ruby/ext/grpc/rb_event.h @@ -50,4 +50,4 @@ VALUE grpc_rb_new_event(grpc_event *ev); /* Initializes the Event and EventError classes. */ void Init_google_rpc_event(); -#endif /* GRPC_RB_EVENT_H_ */ \ No newline at end of file +#endif /* GRPC_RB_EVENT_H_ */ diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 2ec4ee5aacd..61b7ea29ff6 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -273,4 +273,4 @@ void Init_grpc() { Init_google_rpc_server_credentials(); Init_google_status_codes(); Init_google_time_consts(); -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 0cd79eaf854..7c7ef889687 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -74,4 +74,4 @@ VALUE grpc_rb_cannot_init_copy(VALUE copy, VALUE self); /* grpc_rb_time_timeval creates a gpr_timespec from a ruby time object. */ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval); -#endif /* GRPC_RB_H_ */ \ No newline at end of file +#endif /* GRPC_RB_H_ */ diff --git a/src/ruby/ext/grpc/rb_metadata.c b/src/ruby/ext/grpc/rb_metadata.c index f054ae9e98a..312cbf998f2 100644 --- a/src/ruby/ext/grpc/rb_metadata.c +++ b/src/ruby/ext/grpc/rb_metadata.c @@ -212,4 +212,4 @@ grpc_metadata *grpc_rb_get_wrapped_metadata(VALUE v) { grpc_rb_metadata *wrapper = NULL; Data_Get_Struct(v, grpc_rb_metadata, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_metadata.h b/src/ruby/ext/grpc/rb_metadata.h index 5873ca597ec..6c0f252378a 100644 --- a/src/ruby/ext/grpc/rb_metadata.h +++ b/src/ruby/ext/grpc/rb_metadata.h @@ -50,4 +50,4 @@ grpc_metadata* grpc_rb_get_wrapped_metadata(VALUE v); /* Initializes the Metadata class. */ void Init_google_rpc_metadata(); -#endif /* GRPC_RB_METADATA_H_ */ \ No newline at end of file +#endif /* GRPC_RB_METADATA_H_ */ diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 4789f2e8834..ee30419a1cb 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -275,4 +275,4 @@ grpc_server *grpc_rb_get_wrapped_server(VALUE v) { grpc_rb_server *wrapper = NULL; Data_Get_Struct(v, grpc_rb_server, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h index 7226359b2d9..6418db23fe8 100644 --- a/src/ruby/ext/grpc/rb_server.h +++ b/src/ruby/ext/grpc/rb_server.h @@ -47,4 +47,4 @@ void Init_google_rpc_server(); /* Gets the wrapped server from the ruby wrapper */ grpc_server* grpc_rb_get_wrapped_server(VALUE v); -#endif /* GRPC_RB_SERVER_H_ */ \ No newline at end of file +#endif /* GRPC_RB_SERVER_H_ */ diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index 41c0a955a7a..52175620392 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -207,4 +207,4 @@ grpc_server_credentials *grpc_rb_get_wrapped_server_credentials(VALUE v) { grpc_rb_server_credentials *wrapper = NULL; Data_Get_Struct(v, grpc_rb_server_credentials, wrapper); return wrapper->wrapped; -} \ No newline at end of file +} diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h index a2193cdc4e1..f73d2b1e1a6 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.h +++ b/src/ruby/ext/grpc/rb_server_credentials.h @@ -47,4 +47,4 @@ void Init_google_rpc_server_credentials(); /* Gets the wrapped server_credentials from the ruby wrapper */ grpc_server_credentials* grpc_rb_get_wrapped_server_credentials(VALUE v); -#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */ \ No newline at end of file +#endif /* GRPC_RB_SERVER_CREDENTIALS_H_ */ diff --git a/src/ruby/lib/grpc.rb b/src/ruby/lib/grpc.rb index 8836afd6dd3..39052265f2e 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -41,4 +41,4 @@ require 'grpc/generic/service' require 'grpc/generic/rpc_server' # alias GRPC -GRPC = Google::RPC \ No newline at end of file +GRPC = Google::RPC diff --git a/src/ruby/lib/grpc/core/event.rb b/src/ruby/lib/grpc/core/event.rb index bfde5dfe3bf..9beb4d1d72d 100644 --- a/src/ruby/lib/grpc/core/event.rb +++ b/src/ruby/lib/grpc/core/event.rb @@ -40,4 +40,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/core/time_consts.rb b/src/ruby/lib/grpc/core/time_consts.rb index 0b7c22d20b8..cfc2a7a6fa8 100644 --- a/src/ruby/lib/grpc/core/time_consts.rb +++ b/src/ruby/lib/grpc/core/time_consts.rb @@ -69,4 +69,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index d562f0503d9..7e8753e3243 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -60,4 +60,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/active_call.rb b/src/ruby/lib/grpc/generic/active_call.rb index 22218bd7546..67e019f0502 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -535,4 +535,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/bidi_call.rb b/src/ruby/lib/grpc/generic/bidi_call.rb index 2e470346ede..18b0d681fd6 100644 --- a/src/ruby/lib/grpc/generic/bidi_call.rb +++ b/src/ruby/lib/grpc/generic/bidi_call.rb @@ -220,4 +220,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/client_stub.rb b/src/ruby/lib/grpc/generic/client_stub.rb index 10405a922ee..a35fae1e2ed 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -407,4 +407,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index ea6abbc4008..51f7d794fee 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -148,4 +148,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb index 1ea9cfbef3a..438aa9a4168 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -403,4 +403,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/generic/service.rb b/src/ruby/lib/grpc/generic/service.rb index 77f0021e958..09ae6bee15a 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -234,4 +234,4 @@ module Google end end end -end \ No newline at end of file +end diff --git a/src/ruby/lib/grpc/logconfig.rb b/src/ruby/lib/grpc/logconfig.rb index 24c0913640d..47e0c5b212c 100644 --- a/src/ruby/lib/grpc/logconfig.rb +++ b/src/ruby/lib/grpc/logconfig.rb @@ -37,4 +37,4 @@ Logging.logger.root.level = :info # TODO: provide command-line configuration for logging Logging.logger['Google::RPC'].level = :debug Logging.logger['Google::RPC::ActiveCall'].level = :info -Logging.logger['Google::RPC::BidiCall'].level = :info \ No newline at end of file +Logging.logger['Google::RPC::BidiCall'].level = :info diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index de7ef5f8880..fb8356e1e8c 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -32,4 +32,4 @@ module Google module RPC VERSION = '0.0.1' end -end \ No newline at end of file +end diff --git a/src/ruby/spec/alloc_spec.rb b/src/ruby/spec/alloc_spec.rb index 1bd0e093bd7..88e7e2b3e7a 100644 --- a/src/ruby/spec/alloc_spec.rb +++ b/src/ruby/spec/alloc_spec.rb @@ -41,4 +41,4 @@ describe 'Wrapped classes where .new cannot create an instance' do expect { GRPC::Core::Event.new }.to raise_error(TypeError) end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/byte_buffer_spec.rb b/src/ruby/spec/byte_buffer_spec.rb index 76e3fae3582..e1833ebb3a0 100644 --- a/src/ruby/spec/byte_buffer_spec.rb +++ b/src/ruby/spec/byte_buffer_spec.rb @@ -64,4 +64,4 @@ describe GRPC::Core::ByteBuffer do expect(a_copy.dup.to_s).to eq('#dup') end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/call_spec.rb b/src/ruby/spec/call_spec.rb index 2a47eac23a3..26175645719 100644 --- a/src/ruby/spec/call_spec.rb +++ b/src/ruby/spec/call_spec.rb @@ -160,4 +160,4 @@ describe GRPC::Core::Call do def deadline Time.now + 2 # in 2 seconds; arbitrary end -end \ No newline at end of file +end diff --git a/src/ruby/spec/channel_spec.rb b/src/ruby/spec/channel_spec.rb index 8e514411e59..af73294abe4 100644 --- a/src/ruby/spec/channel_spec.rb +++ b/src/ruby/spec/channel_spec.rb @@ -178,4 +178,4 @@ describe GRPC::Core::Channel do expect(&blk).to_not raise_error end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/client_server_spec.rb b/src/ruby/spec/client_server_spec.rb index 734b6517c8f..52c985786a8 100644 --- a/src/ruby/spec/client_server_spec.rb +++ b/src/ruby/spec/client_server_spec.rb @@ -369,4 +369,4 @@ describe 'the secure http client/server' do # TODO: uncomment after updating the to the new c api # it_behaves_like 'GRPC metadata delivery works OK' do # end -end \ No newline at end of file +end diff --git a/src/ruby/spec/completion_queue_spec.rb b/src/ruby/spec/completion_queue_spec.rb index 89b418583ae..11d4e9959cb 100644 --- a/src/ruby/spec/completion_queue_spec.rb +++ b/src/ruby/spec/completion_queue_spec.rb @@ -71,4 +71,4 @@ describe GRPC::Core::CompletionQueue do expect { @cq.pluck(tag, a_time) }.not_to raise_error end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/credentials_spec.rb b/src/ruby/spec/credentials_spec.rb index 62a58fff434..001fecd12b6 100644 --- a/src/ruby/spec/credentials_spec.rb +++ b/src/ruby/spec/credentials_spec.rb @@ -74,4 +74,4 @@ describe Credentials do expect { Credentials.default }.to raise_error RuntimeError end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/event_spec.rb b/src/ruby/spec/event_spec.rb index e2b76a54a26..7d92fcd7928 100644 --- a/src/ruby/spec/event_spec.rb +++ b/src/ruby/spec/event_spec.rb @@ -50,4 +50,4 @@ describe GRPC::Core::CompletionType do blk = proc { Hash[mod.constants.collect { |c| [c, mod.const_get(c)] }] } expect(blk.call).to eq(@known_types) end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/active_call_spec.rb b/src/ruby/spec/generic/active_call_spec.rb index 3e54c1fd6f1..84bb7b4f9bd 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -370,4 +370,4 @@ describe GRPC::ActiveCall do def deadline Time.now + 1 # in 1 second; arbitrary end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb index 1609534f0d4..297a1338313 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -516,4 +516,4 @@ describe 'ClientStub' do INFINITE_FUTURE, finished_tag: finished_tag) end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/rpc_desc_spec.rb b/src/ruby/spec/generic/rpc_desc_spec.rb index 791395b3ace..8bff2a9a644 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -354,4 +354,4 @@ describe GRPC::RpcDesc do def other_error_alt(_call) fail(ArgumentError, 'other error') end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/rpc_server_pool_spec.rb b/src/ruby/spec/generic/rpc_server_pool_spec.rb index 6ffde325f6d..8383dc1533e 100644 --- a/src/ruby/spec/generic/rpc_server_pool_spec.rb +++ b/src/ruby/spec/generic/rpc_server_pool_spec.rb @@ -136,4 +136,4 @@ describe Pool do p.stop end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb index f8484d778c2..e8c70604461 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -401,4 +401,4 @@ describe GRPC::RpcServer do end end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/generic/service_spec.rb b/src/ruby/spec/generic/service_spec.rb index 21e4bd75f09..e7f5a65d3b3 100644 --- a/src/ruby/spec/generic/service_spec.rb +++ b/src/ruby/spec/generic/service_spec.rb @@ -339,4 +339,4 @@ describe GenericService do expect(c.include?(GenericService)).to be(true) end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/metadata_spec.rb b/src/ruby/spec/metadata_spec.rb index 3c479147415..24728666921 100644 --- a/src/ruby/spec/metadata_spec.rb +++ b/src/ruby/spec/metadata_spec.rb @@ -61,4 +61,4 @@ describe GRPC::Core::Metadata do expect(md.dup.value).to eq('a value') end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/server_credentials_spec.rb b/src/ruby/spec/server_credentials_spec.rb index a641a650fba..55598bc8dfd 100644 --- a/src/ruby/spec/server_credentials_spec.rb +++ b/src/ruby/spec/server_credentials_spec.rb @@ -66,4 +66,4 @@ describe GRPC::Core::ServerCredentials do expect(&blk).to_not raise_error end end -end \ No newline at end of file +end diff --git a/src/ruby/spec/server_spec.rb b/src/ruby/spec/server_spec.rb index 123e6455127..5b81f195371 100644 --- a/src/ruby/spec/server_spec.rb +++ b/src/ruby/spec/server_spec.rb @@ -209,4 +209,4 @@ describe Server do s.start s end -end \ No newline at end of file +end diff --git a/src/ruby/spec/spec_helper.rb b/src/ruby/spec/spec_helper.rb index 3838181bab3..837d2fc42a1 100644 --- a/src/ruby/spec/spec_helper.rb +++ b/src/ruby/spec/spec_helper.rb @@ -48,4 +48,4 @@ Faraday::Adapter.load_middleware(:test) RSpec.configure do |config| include RSpec::LoggingHelper config.capture_log_messages -end \ No newline at end of file +end diff --git a/src/ruby/spec/time_consts_spec.rb b/src/ruby/spec/time_consts_spec.rb index d090e71db3c..871e0e241ac 100644 --- a/src/ruby/spec/time_consts_spec.rb +++ b/src/ruby/spec/time_consts_spec.rb @@ -86,4 +86,4 @@ describe '#from_relative_time' do expect(abs.to_f).to be_within(epsilon).of(want.to_f) end end -end \ No newline at end of file +end diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index 71c4676df40..0345f99bdee 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -135,4 +135,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_create_channel_stack(); return 0; -} \ No newline at end of file +} diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c index 2b62aa02e17..22776f8ca13 100644 --- a/test/core/channel/metadata_buffer_test.c +++ b/test/core/channel/metadata_buffer_test.c @@ -198,4 +198,4 @@ int main(int argc, char **argv) { test_case(100, 100, 2); test_case(100, 100, 10000); return 0; -} \ No newline at end of file +} diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c index b46658b6dd9..4033c181310 100644 --- a/test/core/compression/message_compress_test.c +++ b/test/core/compression/message_compress_test.c @@ -190,4 +190,4 @@ int main(int argc, char **argv) { test_bad_data(); return 0; -} \ No newline at end of file +} diff --git a/test/core/echo/client.c b/test/core/echo/client.c index f6e9d665a5c..fb1e366b15b 100644 --- a/test/core/echo/client.c +++ b/test/core/echo/client.c @@ -136,4 +136,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/echo/echo_test.c b/test/core/echo/echo_test.c index fd531b93146..e2c4d22ef51 100644 --- a/test/core/echo/echo_test.c +++ b/test/core/echo/echo_test.c @@ -132,4 +132,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} \ No newline at end of file +} diff --git a/test/core/echo/server.c b/test/core/echo/server.c index 17b876af8c4..83da8b644d6 100644 --- a/test/core/echo/server.c +++ b/test/core/echo/server.c @@ -220,4 +220,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 82a0af0632b..9ed98a43457 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -496,4 +496,4 @@ void cq_expect_finished(cq_verifier *v, void *tag, ...) { void cq_expect_server_shutdown(cq_verifier *v, void *tag) { add(v, GRPC_SERVER_SHUTDOWN, tag); -} \ No newline at end of file +} diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h index 7357a664376..ad6481102e7 100644 --- a/test/core/end2end/cq_verifier.h +++ b/test/core/end2end/cq_verifier.h @@ -75,4 +75,4 @@ void cq_expect_server_shutdown(cq_verifier *v, void *tag); int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string); int contains_metadata(grpc_metadata_array *array, const char *key, const char *value); -#endif /* __GRPC_TEST_END2END_CQ_VERIFIER_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_END2END_CQ_VERIFIER_H__ */ diff --git a/test/core/end2end/data/prod_roots_certs.c b/test/core/end2end/data/prod_roots_certs.c index 001c7246e4f..0b1275f723a 100644 --- a/test/core/end2end/data/prod_roots_certs.c +++ b/test/core/end2end/data/prod_roots_certs.c @@ -11270,4 +11270,4 @@ const char prod_roots_certs[] = { 0x33, 0x50, 0x59, 0x74, 0x6c, 0x4e, 0x58, 0x4c, 0x66, 0x62, 0x51, 0x34, 0x64, 0x64, 0x49, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; diff --git a/test/core/end2end/data/server1_cert.c b/test/core/end2end/data/server1_cert.c index e2573fb9e11..d31f2e2d0ed 100644 --- a/test/core/end2end/data/server1_cert.c +++ b/test/core/end2end/data/server1_cert.c @@ -112,4 +112,4 @@ const char test_server1_cert[] = { 0x32, 0x77, 0x65, 0x2f, 0x4b, 0x44, 0x34, 0x6f, 0x6a, 0x66, 0x39, 0x73, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, - 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file + 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; diff --git a/test/core/end2end/data/server1_key.c b/test/core/end2end/data/server1_key.c index 2b6fbf3280e..d089660bfd2 100644 --- a/test/core/end2end/data/server1_key.c +++ b/test/core/end2end/data/server1_key.c @@ -105,4 +105,4 @@ const char test_server1_key[] = { 0x6e, 0x68, 0x66, 0x66, 0x46, 0x79, 0x65, 0x37, 0x53, 0x42, 0x58, 0x79, 0x61, 0x67, 0x3d, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x52, 0x53, 0x41, 0x20, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, - 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file + 0x45, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; diff --git a/test/core/end2end/data/ssl_test_data.h b/test/core/end2end/data/ssl_test_data.h index 72bce3ed257..ff89e0d69f2 100644 --- a/test/core/end2end/data/ssl_test_data.h +++ b/test/core/end2end/data/ssl_test_data.h @@ -40,4 +40,4 @@ extern const char test_server1_key[]; extern const char prod_roots_certs[]; -#endif /* __GRPC_TEST_END2END_DATA_SSL_TEST_DATA_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_END2END_DATA_SSL_TEST_DATA_H__ */ diff --git a/test/core/end2end/data/test_root_cert.c b/test/core/end2end/data/test_root_cert.c index 2b39f6c7eb0..58d98050175 100644 --- a/test/core/end2end/data/test_root_cert.c +++ b/test/core/end2end/data/test_root_cert.c @@ -98,4 +98,4 @@ const char test_root_cert[] = { 0x31, 0x59, 0x75, 0x58, 0x32, 0x72, 0x6e, 0x65, 0x78, 0x30, 0x4a, 0x68, 0x75, 0x54, 0x51, 0x66, 0x63, 0x49, 0x3d, 0x0a, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, - 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; \ No newline at end of file + 0x43, 0x41, 0x54, 0x45, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, 0x00}; diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index c37b71d1c58..2c4c3b77462 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -221,4 +221,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/end2end_tests.h b/test/core/end2end/end2end_tests.h index 3211fffad8a..8f2cd0f2e05 100644 --- a/test/core/end2end/end2end_tests.h +++ b/test/core/end2end/end2end_tests.h @@ -63,4 +63,4 @@ struct grpc_end2end_test_config { void grpc_end2end_tests(grpc_end2end_test_config config); -#endif /* __GRPC_TEST_END2END_END2END_TESTS_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_END2END_END2END_TESTS_H__ */ diff --git a/test/core/end2end/fixtures/chttp2_fake_security.c b/test/core/end2end/fixtures/chttp2_fake_security.c index de06f558562..039909f76cb 100644 --- a/test/core/end2end/fixtures/chttp2_fake_security.c +++ b/test/core/end2end/fixtures/chttp2_fake_security.c @@ -132,4 +132,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_fullstack.c b/test/core/end2end/fixtures/chttp2_fullstack.c index 4775d8ee6d9..ea367f4446b 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_fullstack.c @@ -114,4 +114,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_fullstack_uds.c b/test/core/end2end/fixtures/chttp2_fullstack_uds.c index a3afe9af2e1..27e4baf3c01 100644 --- a/test/core/end2end/fixtures/chttp2_fullstack_uds.c +++ b/test/core/end2end/fixtures/chttp2_fullstack_uds.c @@ -120,4 +120,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c index bd2f0600f48..1db9e727b86 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_fullstack.c @@ -159,4 +159,4 @@ int main(int argc, char **argv) { gpr_free(roots_filename); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c index 4af50bdd614..35e022c4947 100644 --- a/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c +++ b/test/core/end2end/fixtures/chttp2_simple_ssl_with_oauth2_fullstack.c @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_socket_pair.c b/test/core/end2end/fixtures/chttp2_socket_pair.c index 98907b901b9..759c6b4b9d7 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair.c @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c index 7a7095b588b..c814527a8f0 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c @@ -148,4 +148,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index a83c873387c..92e8e5ad6bf 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -78,4 +78,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 63fbf595b2a..faaa14727c9 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -224,4 +224,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c index 99e21f296c1..c6fb8b3ea2e 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed.c @@ -164,4 +164,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c index ecedbfb44dd..85b7599b195 100644 --- a/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_and_writes_closed_legacy.c @@ -164,4 +164,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept_and_writes_closed(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_accept_legacy.c b/test/core/end2end/tests/cancel_after_accept_legacy.c index 72d2942e226..345c31d31f8 100644 --- a/test/core/end2end/tests/cancel_after_accept_legacy.c +++ b/test/core/end2end/tests/cancel_after_accept_legacy.c @@ -156,4 +156,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_accept(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index 53f3d88964e..3c75024922b 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -188,4 +188,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_cancel_after_invoke(config, cancellation_modes[i], j); } } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_after_invoke_legacy.c b/test/core/end2end/tests/cancel_after_invoke_legacy.c index bcc2cc6cc6f..64af7cd3db2 100644 --- a/test/core/end2end/tests/cancel_after_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_after_invoke_legacy.c @@ -138,4 +138,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_after_invoke(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index b62a5635196..bee6dd2e7b9 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -182,4 +182,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i <= 6; i++) { test_cancel_before_invoke(config, i); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_before_invoke_legacy.c b/test/core/end2end/tests/cancel_before_invoke_legacy.c index 3329188717c..23e82cf2683 100644 --- a/test/core/end2end/tests/cancel_before_invoke_legacy.c +++ b/test/core/end2end/tests/cancel_before_invoke_legacy.c @@ -131,4 +131,4 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_cancel_before_invoke(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 370db8f230b..8228353b09b 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum.c @@ -128,4 +128,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c index b293489c557..869f091180c 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c +++ b/test/core/end2end/tests/cancel_in_a_vacuum_legacy.c @@ -128,4 +128,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 0; i < GPR_ARRAY_SIZE(cancellation_modes); i++) { test_cancel_in_a_vacuum(config, cancellation_modes[i]); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/cancel_test_helpers.h b/test/core/end2end/tests/cancel_test_helpers.h index e88daca014b..3dd74373531 100644 --- a/test/core/end2end/tests/cancel_test_helpers.h +++ b/test/core/end2end/tests/cancel_test_helpers.h @@ -48,4 +48,4 @@ static const cancellation_mode cancellation_modes[] = { {grpc_call_cancel, GRPC_STATUS_CANCELLED, ""}, {wait_for_deadline, GRPC_STATUS_DEADLINE_EXCEEDED, "Deadline Exceeded"}, }; -#endif \ No newline at end of file +#endif diff --git a/test/core/end2end/tests/census_simple_request.c b/test/core/end2end/tests/census_simple_request.c index 21f4b491d0d..003a8bef9b7 100644 --- a/test/core/end2end/tests/census_simple_request.c +++ b/test/core/end2end/tests/census_simple_request.c @@ -175,4 +175,4 @@ static void test_invoke_request_with_census( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_census(config, "census_simple_request", test_body); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/census_simple_request_legacy.c b/test/core/end2end/tests/census_simple_request_legacy.c index 21f4b491d0d..003a8bef9b7 100644 --- a/test/core/end2end/tests/census_simple_request_legacy.c +++ b/test/core/end2end/tests/census_simple_request_legacy.c @@ -175,4 +175,4 @@ static void test_invoke_request_with_census( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_census(config, "census_simple_request", test_body); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/disappearing_server.c b/test/core/end2end/tests/disappearing_server.c index ac7de77deaf..611589678f4 100644 --- a/test/core/end2end/tests/disappearing_server.c +++ b/test/core/end2end/tests/disappearing_server.c @@ -165,4 +165,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { disappearing_server_test(config); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/disappearing_server_legacy.c b/test/core/end2end/tests/disappearing_server_legacy.c index 6412e621017..ff8832a231e 100644 --- a/test/core/end2end/tests/disappearing_server_legacy.c +++ b/test/core/end2end/tests/disappearing_server_legacy.c @@ -165,4 +165,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { if (config.feature_mask & FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION) { disappearing_server_test(config); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c index ec760485d2d..49ec4715cc4 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls.c @@ -156,4 +156,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c index f4f19362fdf..2e3a05e6692 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_inflight_calls_legacy.c @@ -156,4 +156,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c index ae34e0c3c15..49dddc79759 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c @@ -124,4 +124,4 @@ static void test_early_server_shutdown_finishes_tags( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_tags(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c b/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c index 68c7743b4bb..ed8f839a973 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags_legacy.c @@ -124,4 +124,4 @@ static void test_early_server_shutdown_finishes_tags( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_tags(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/graceful_server_shutdown.c b/test/core/end2end/tests/graceful_server_shutdown.c index bd83efdf38c..ab9792e40ab 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.c +++ b/test/core/end2end/tests/graceful_server_shutdown.c @@ -157,4 +157,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/graceful_server_shutdown_legacy.c b/test/core/end2end/tests/graceful_server_shutdown_legacy.c index ecc1fb00965..852a153accd 100644 --- a/test/core/end2end/tests/graceful_server_shutdown_legacy.c +++ b/test/core/end2end/tests/graceful_server_shutdown_legacy.c @@ -157,4 +157,4 @@ static void test_early_server_shutdown_finishes_inflight_calls( void grpc_end2end_tests(grpc_end2end_test_config config) { test_early_server_shutdown_finishes_inflight_calls(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index 22e0a5a8936..2a302e2b137 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -180,4 +180,4 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_large_request(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/invoke_large_request_legacy.c b/test/core/end2end/tests/invoke_large_request_legacy.c index 54af896c7c7..875458e7f80 100644 --- a/test/core/end2end/tests/invoke_large_request_legacy.c +++ b/test/core/end2end/tests/invoke_large_request_legacy.c @@ -180,4 +180,4 @@ static void test_invoke_large_request(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_large_request(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index d204fbc9d72..85369b5aac4 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -271,4 +271,4 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_max_concurrent_streams(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/max_concurrent_streams_legacy.c b/test/core/end2end/tests/max_concurrent_streams_legacy.c index 67a03ccfa7d..0cb118d7950 100644 --- a/test/core/end2end/tests/max_concurrent_streams_legacy.c +++ b/test/core/end2end/tests/max_concurrent_streams_legacy.c @@ -271,4 +271,4 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_max_concurrent_streams(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index ed59e0f2a94..00d940ddb54 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -106,4 +106,4 @@ static void test_no_op(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } \ No newline at end of file +void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } diff --git a/test/core/end2end/tests/no_op_legacy.c b/test/core/end2end/tests/no_op_legacy.c index ed59e0f2a94..00d940ddb54 100644 --- a/test/core/end2end/tests/no_op_legacy.c +++ b/test/core/end2end/tests/no_op_legacy.c @@ -106,4 +106,4 @@ static void test_no_op(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } \ No newline at end of file +void grpc_end2end_tests(grpc_end2end_test_config config) { test_no_op(config); } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 1cb682b3f00..2930ba61430 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -200,4 +200,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/ping_pong_streaming_legacy.c b/test/core/end2end/tests/ping_pong_streaming_legacy.c index 8c7dcadf3f8..b2764e9f858 100644 --- a/test/core/end2end/tests/ping_pong_streaming_legacy.c +++ b/test/core/end2end/tests/ping_pong_streaming_legacy.c @@ -200,4 +200,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { for (i = 1; i < 10; i++) { test_pingpong_streaming(config, i); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c index 22a483b21de..843e9db9edd 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload.c @@ -250,4 +250,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c index ac18f00cda7..9c09e516fae 100644 --- a/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_binary_metadata_and_payload_legacy.c @@ -219,4 +219,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_metadata_and_payload.c index d4dabf3c63c..7f7b594d807 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload.c @@ -235,4 +235,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c index 5e1189f3566..ba330d5f5f8 100644 --- a/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_metadata_and_payload_legacy.c @@ -205,4 +205,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_payload.c b/test/core/end2end/tests/request_response_with_payload.c index ba20879fa27..a0dc0331f4e 100644 --- a/test/core/end2end/tests/request_response_with_payload.c +++ b/test/core/end2end/tests/request_response_with_payload.c @@ -243,4 +243,4 @@ static void test_invoke_10_request_response_with_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_payload_legacy.c b/test/core/end2end/tests/request_response_with_payload_legacy.c index b621cd4755b..be562748994 100644 --- a/test/core/end2end/tests/request_response_with_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_payload_legacy.c @@ -205,4 +205,4 @@ static void test_invoke_10_request_response_with_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_response_with_payload(config); test_invoke_10_request_response_with_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index e8213dc8e5e..bf3b19b62d4 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -239,4 +239,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c index 31058d3858d..0ed0f985ec8 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload_legacy.c @@ -210,4 +210,4 @@ static void test_request_response_with_metadata_and_payload( void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_response_with_metadata_and_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_with_large_metadata.c b/test/core/end2end/tests/request_with_large_metadata.c index 0d4fbd8660b..75341040188 100644 --- a/test/core/end2end/tests/request_with_large_metadata.c +++ b/test/core/end2end/tests/request_with_large_metadata.c @@ -225,4 +225,4 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_with_large_metadata(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_with_large_metadata_legacy.c b/test/core/end2end/tests/request_with_large_metadata_legacy.c index 35397ea93ab..bc3b3800139 100644 --- a/test/core/end2end/tests/request_with_large_metadata_legacy.c +++ b/test/core/end2end/tests/request_with_large_metadata_legacy.c @@ -169,4 +169,4 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_request_with_large_metadata(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 4b75b0057d5..bb13512ad42 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -213,4 +213,4 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/request_with_payload_legacy.c b/test/core/end2end/tests/request_with_payload_legacy.c index 26d91d13ae6..b56e08cf1fc 100644 --- a/test/core/end2end/tests/request_with_payload_legacy.c +++ b/test/core/end2end/tests/request_with_payload_legacy.c @@ -169,4 +169,4 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_request_with_payload(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 6ed48c0221a..0a3eb7c7b79 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -214,4 +214,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/simple_delayed_request_legacy.c b/test/core/end2end/tests/simple_delayed_request_legacy.c index 3a735f13be7..3c94de548ea 100644 --- a/test/core/end2end/tests/simple_delayed_request_legacy.c +++ b/test/core/end2end/tests/simple_delayed_request_legacy.c @@ -172,4 +172,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_simple_delayed_request_short(config); test_simple_delayed_request_long(config); } -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 3fc23493c3c..591bc52dc5b 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -217,4 +217,4 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_simple_request(config); test_invoke_10_simple_requests(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/simple_request_legacy.c b/test/core/end2end/tests/simple_request_legacy.c index e4b809734f6..2e30d101e18 100644 --- a/test/core/end2end/tests/simple_request_legacy.c +++ b/test/core/end2end/tests/simple_request_legacy.c @@ -229,4 +229,4 @@ void grpc_end2end_tests(grpc_end2end_test_config config) { test_invoke_simple_request(config, "simple_request_body2", simple_request_body2); test_invoke_10_simple_requests(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/thread_stress.c b/test/core/end2end/tests/thread_stress.c index 608a20659e9..c10b3737441 100644 --- a/test/core/end2end/tests/thread_stress.c +++ b/test/core/end2end/tests/thread_stress.c @@ -321,4 +321,4 @@ static void run_test(grpc_end2end_test_config config, int requests_in_flight) { void grpc_end2end_tests(grpc_end2end_test_config config) { run_test(config, 1000); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/thread_stress_legacy.c b/test/core/end2end/tests/thread_stress_legacy.c index 608a20659e9..c10b3737441 100644 --- a/test/core/end2end/tests/thread_stress_legacy.c +++ b/test/core/end2end/tests/thread_stress_legacy.c @@ -321,4 +321,4 @@ static void run_test(grpc_end2end_test_config config, int requests_in_flight) { void grpc_end2end_tests(grpc_end2end_test_config config) { run_test(config, 1000); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c index 58b7492c25b..5f8b9974d68 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read.c @@ -196,4 +196,4 @@ static void test_writes_done_hangs_with_pending_read( void grpc_end2end_tests(grpc_end2end_test_config config) { test_writes_done_hangs_with_pending_read(config); -} \ No newline at end of file +} diff --git a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c index 58b7492c25b..5f8b9974d68 100644 --- a/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c +++ b/test/core/end2end/tests/writes_done_hangs_with_pending_read_legacy.c @@ -196,4 +196,4 @@ static void test_writes_done_hangs_with_pending_read( void grpc_end2end_tests(grpc_end2end_test_config config) { test_writes_done_hangs_with_pending_read(config); -} \ No newline at end of file +} diff --git a/test/core/fling/client.c b/test/core/fling/client.c index 28bf967b2f9..68164b1c5a5 100644 --- a/test/core/fling/client.c +++ b/test/core/fling/client.c @@ -229,4 +229,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.c index c05798bbb7b..41ba995544b 100644 --- a/test/core/fling/fling_stream_test.c +++ b/test/core/fling/fling_stream_test.c @@ -109,4 +109,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} \ No newline at end of file +} diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c index 5d733d14be5..c0066cf1013 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_test.c @@ -109,4 +109,4 @@ int main(int argc, char **argv) { if (!WIFEXITED(status)) return 4; if (WEXITSTATUS(status)) return WEXITSTATUS(status); return 0; -} \ No newline at end of file +} diff --git a/test/core/fling/server.c b/test/core/fling/server.c index 27a69c83f77..59c303015a3 100644 --- a/test/core/fling/server.c +++ b/test/core/fling/server.c @@ -316,4 +316,4 @@ int main(int argc, char **argv) { grpc_completion_queue_destroy(cq); grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/httpcli/format_request_test.c b/test/core/httpcli/format_request_test.c index 0cad9ba5151..da850049e20 100644 --- a/test/core/httpcli/format_request_test.c +++ b/test/core/httpcli/format_request_test.c @@ -162,4 +162,4 @@ int main(int argc, char **argv) { test_format_post_request_content_type_override(); return 0; -} \ No newline at end of file +} diff --git a/test/core/httpcli/httpcli_test.c b/test/core/httpcli/httpcli_test.c index 7d9aa75b778..599b3ad4eaa 100644 --- a/test/core/httpcli/httpcli_test.c +++ b/test/core/httpcli/httpcli_test.c @@ -99,4 +99,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/httpcli/parser_test.c b/test/core/httpcli/parser_test.c index 4718107edd1..dacec0f72f7 100644 --- a/test/core/httpcli/parser_test.c +++ b/test/core/httpcli/parser_test.c @@ -152,4 +152,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/alarm_heap_test.c b/test/core/iomgr/alarm_heap_test.c index 5defe97885d..b3e1e64d0fe 100644 --- a/test/core/iomgr/alarm_heap_test.c +++ b/test/core/iomgr/alarm_heap_test.c @@ -274,4 +274,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/alarm_list_test.c b/test/core/iomgr/alarm_list_test.c index a1a56d6132c..f2ccd1fb357 100644 --- a/test/core/iomgr/alarm_list_test.c +++ b/test/core/iomgr/alarm_list_test.c @@ -141,4 +141,4 @@ int main(int argc, char **argv) { add_test(); destruction_test(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/alarm_test.c b/test/core/iomgr/alarm_test.c index 537bed47f75..18f57725a26 100644 --- a/test/core/iomgr/alarm_test.c +++ b/test/core/iomgr/alarm_test.c @@ -219,4 +219,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_grpc_alarm(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c index ea350c923ce..c08ee7d48f2 100644 --- a/test/core/iomgr/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -366,4 +366,4 @@ void grpc_endpoint_tests(grpc_endpoint_test_config config) { read_and_write_test(config, 1000000, 100000, 1, 0); read_and_write_test(config, 100000000, 100000, 1, 1); shutdown_during_write_test(config, 1000); -} \ No newline at end of file +} diff --git a/test/core/iomgr/endpoint_tests.h b/test/core/iomgr/endpoint_tests.h index f555a54203b..3be377c4e3d 100644 --- a/test/core/iomgr/endpoint_tests.h +++ b/test/core/iomgr/endpoint_tests.h @@ -54,4 +54,4 @@ struct grpc_endpoint_test_config { void grpc_endpoint_tests(grpc_endpoint_test_config config); -#endif /* __GRPC_TEST_IOMGR_ENDPOINT_TESTS_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_IOMGR_ENDPOINT_TESTS_H__ */ diff --git a/test/core/iomgr/fd_posix_test.c b/test/core/iomgr/fd_posix_test.c index 7f1f7412639..22090ead0ac 100644 --- a/test/core/iomgr/fd_posix_test.c +++ b/test/core/iomgr/fd_posix_test.c @@ -479,4 +479,4 @@ int main(int argc, char **argv) { test_grpc_fd_change(); grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 859aaf4629a..0961a3659f6 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -129,4 +129,4 @@ int main(int argc, char** argv) { test_unparseable_hostports(); grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/sockaddr_utils_test.c b/test/core/iomgr/sockaddr_utils_test.c index 110b09998d3..9f5e954b9de 100644 --- a/test/core/iomgr/sockaddr_utils_test.c +++ b/test/core/iomgr/sockaddr_utils_test.c @@ -230,4 +230,4 @@ int main(int argc, char **argv) { test_sockaddr_to_string(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/tcp_client_posix_test.c b/test/core/iomgr/tcp_client_posix_test.c index c8f1f53dbb3..ad5a3170448 100644 --- a/test/core/iomgr/tcp_client_posix_test.c +++ b/test/core/iomgr/tcp_client_posix_test.c @@ -176,4 +176,4 @@ int main(void) { test_times_out(); grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index a00b54da885..044802b8025 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -492,4 +492,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/tcp_server_posix_test.c b/test/core/iomgr/tcp_server_posix_test.c index 8409fb4f628..b26115bcd00 100644 --- a/test/core/iomgr/tcp_server_posix_test.c +++ b/test/core/iomgr/tcp_server_posix_test.c @@ -164,4 +164,4 @@ int main(int argc, char **argv) { gpr_mu_destroy(&mu); gpr_cv_destroy(&cv); return 0; -} \ No newline at end of file +} diff --git a/test/core/iomgr/time_averaged_stats_test.c b/test/core/iomgr/time_averaged_stats_test.c index 4329ee5198c..4206a1c58f3 100644 --- a/test/core/iomgr/time_averaged_stats_test.c +++ b/test/core/iomgr/time_averaged_stats_test.c @@ -205,4 +205,4 @@ int main(int argc, char **argv) { no_regress_some_persist_test(); some_regress_some_persist_test(); return 0; -} \ No newline at end of file +} diff --git a/test/core/json/json_rewrite.c b/test/core/json/json_rewrite.c index 23ea798feac..203e75c7d57 100644 --- a/test/core/json/json_rewrite.c +++ b/test/core/json/json_rewrite.c @@ -258,4 +258,4 @@ int main(int argc, char** argv) { gpr_cmdline_destroy(cl); return rewrite(stdin, stdout, indent) ? 0 : 1; -} \ No newline at end of file +} diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.c index 1b3383653df..78dff92a777 100644 --- a/test/core/json/json_rewrite_test.c +++ b/test/core/json/json_rewrite_test.c @@ -319,4 +319,4 @@ int main(int argc, char** argv) { test_rewrites(); gpr_log(GPR_INFO, "json_rewrite_test success"); return 0; -} \ No newline at end of file +} diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c index 1cfbbc4105a..0e315e51eee 100644 --- a/test/core/json/json_test.c +++ b/test/core/json/json_test.c @@ -175,4 +175,4 @@ int main(int argc, char **argv) { test_atypical(); gpr_log(GPR_INFO, "json_test success"); return 0; -} \ No newline at end of file +} diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index 6db618409cf..f0a3e26c4ee 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.c +++ b/test/core/network_benchmarks/low_level_ping_pong.c @@ -678,4 +678,4 @@ int main(int argc, char **argv) { gpr_cmdline_destroy(cmdline); return error; -} \ No newline at end of file +} diff --git a/test/core/security/base64_test.c b/test/core/security/base64_test.c index e306ea3cf6d..bfd5c487772 100644 --- a/test/core/security/base64_test.c +++ b/test/core/security/base64_test.c @@ -182,4 +182,4 @@ int main(int argc, char **argv) { test_url_safe_unsafe_mismtach_failure(); test_rfc4648_test_vectors(); return 0; -} \ No newline at end of file +} diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index cefe969c229..302869d70e2 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -622,4 +622,4 @@ int main(int argc, char **argv) { test_service_accounts_creds_http_failure(); test_service_accounts_creds_signing_failure(); return 0; -} \ No newline at end of file +} diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index dbd5f312626..369c34a5a5a 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -174,4 +174,4 @@ int main(int argc, char **argv) { gpr_cmdline_destroy(cl); grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c index 0457f6499af..8615fca5fbb 100644 --- a/test/core/security/json_token_test.c +++ b/test/core/security/json_token_test.c @@ -374,4 +374,4 @@ int main(int argc, char **argv) { test_parse_json_key_failure_no_private_key(); test_jwt_encode_and_sign(); return 0; -} \ No newline at end of file +} diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c index 1d0e36ddafc..03a4d3a1e69 100644 --- a/test/core/security/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -201,4 +201,4 @@ int main(int argc, char **argv) { grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index 8d15a9becc7..fbc96bbde61 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -586,4 +586,4 @@ void test_performance(void) { 1000 * write_time_micro / nrecords, (write_size * nrecords) / write_time_micro / 1000); } -} \ No newline at end of file +} diff --git a/test/core/statistics/census_log_tests.h b/test/core/statistics/census_log_tests.h index 89404c620b0..f829ab36833 100644 --- a/test/core/statistics/census_log_tests.h +++ b/test/core/statistics/census_log_tests.h @@ -48,4 +48,4 @@ void test_multiple_writers(); void test_performance(); void test_small_log(); -#endif /* __GRPC_TEST_STATISTICS_LOG_TESTS_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_STATISTICS_LOG_TESTS_H__ */ diff --git a/test/core/statistics/census_stub_test.c b/test/core/statistics/census_stub_test.c index 595c1f94ff0..26a45ae58a9 100644 --- a/test/core/statistics/census_stub_test.c +++ b/test/core/statistics/census_stub_test.c @@ -74,4 +74,4 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); test_census_stubs(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index a5d5fada7d0..9b7a712c18c 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -298,4 +298,4 @@ int main(int argc, char** argv) { test_insertion_with_same_key(); test_insertion_and_deletion_with_high_collision_rate(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/multiple_writers_circular_buffer_test.c b/test/core/statistics/multiple_writers_circular_buffer_test.c index 2db36997b19..a645e15918a 100644 --- a/test/core/statistics/multiple_writers_circular_buffer_test.c +++ b/test/core/statistics/multiple_writers_circular_buffer_test.c @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_multiple_writers_circular_log(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/multiple_writers_test.c b/test/core/statistics/multiple_writers_test.c index d87847c7f92..84aef15c1a9 100644 --- a/test/core/statistics/multiple_writers_test.c +++ b/test/core/statistics/multiple_writers_test.c @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_multiple_writers(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/performance_test.c b/test/core/statistics/performance_test.c index 81b2ed4553d..3c1e28241ec 100644 --- a/test/core/statistics/performance_test.c +++ b/test/core/statistics/performance_test.c @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_performance(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/quick_test.c b/test/core/statistics/quick_test.c index eb025d42e01..0e432314bba 100644 --- a/test/core/statistics/quick_test.c +++ b/test/core/statistics/quick_test.c @@ -51,4 +51,4 @@ int main(int argc, char **argv) { test_fill_log_with_straddling_records(); test_fill_circular_log_with_straddling_records(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/rpc_stats_test.c b/test/core/statistics/rpc_stats_test.c index 1ac4ce92c29..df076b9c1e4 100644 --- a/test/core/statistics/rpc_stats_test.c +++ b/test/core/statistics/rpc_stats_test.c @@ -194,4 +194,4 @@ int main(int argc, char** argv) { test_record_stats_on_unknown_op_id(); test_record_stats_with_trace_store_uninitialized(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/small_log_test.c b/test/core/statistics/small_log_test.c index eccae087b7a..c151b77f639 100644 --- a/test/core/statistics/small_log_test.c +++ b/test/core/statistics/small_log_test.c @@ -43,4 +43,4 @@ int main(int argc, char **argv) { srand(gpr_now().tv_nsec); test_small_log(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/trace_test.c b/test/core/statistics/trace_test.c index 21cc17be516..65b70e1006a 100644 --- a/test/core/statistics/trace_test.c +++ b/test/core/statistics/trace_test.c @@ -252,4 +252,4 @@ int main(int argc, char** argv) { test_trace_print(); test_get_active_ops(); return 0; -} \ No newline at end of file +} diff --git a/test/core/statistics/window_stats_test.c b/test/core/statistics/window_stats_test.c index c15469c20d5..d893f7f792b 100644 --- a/test/core/statistics/window_stats_test.c +++ b/test/core/statistics/window_stats_test.c @@ -314,4 +314,4 @@ int main(int argc, char* argv[]) { rolling_time_test(); infinite_interval_test(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/cancellable_test.c b/test/core/support/cancellable_test.c index c073597a83f..b2db1afc761 100644 --- a/test/core/support/cancellable_test.c +++ b/test/core/support/cancellable_test.c @@ -157,4 +157,4 @@ int main(int argc, char *argv[]) { grpc_test_init(argc, argv); test(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/cmdline_test.c b/test/core/support/cmdline_test.c index 677415a6eca..52c311f75c2 100644 --- a/test/core/support/cmdline_test.c +++ b/test/core/support/cmdline_test.c @@ -290,4 +290,4 @@ int main(int argc, char **argv) { test_flag_val_false(); test_many(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/env_test.c b/test/core/support/env_test.c index 025caa17c03..1f16af87a5a 100644 --- a/test/core/support/env_test.c +++ b/test/core/support/env_test.c @@ -61,4 +61,4 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); test_setenv_getenv(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/file_test.c b/test/core/support/file_test.c index f111a074482..c0c14ffa0e5 100644 --- a/test/core/support/file_test.c +++ b/test/core/support/file_test.c @@ -156,4 +156,4 @@ int main(int argc, char **argv) { test_load_small_file(); test_load_big_file(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/histogram_test.c b/test/core/support/histogram_test.c index 9fb3319e6fc..39944308743 100644 --- a/test/core/support/histogram_test.c +++ b/test/core/support/histogram_test.c @@ -175,4 +175,4 @@ int main(void) { test_percentile(); test_merge(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/host_port_test.c b/test/core/support/host_port_test.c index 22dbb0e81ad..eccc39a2db1 100644 --- a/test/core/support/host_port_test.c +++ b/test/core/support/host_port_test.c @@ -70,4 +70,4 @@ int main(int argc, char **argv) { test_join_host_port_garbage(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/log_test.c b/test/core/support/log_test.c index dfe30d45640..b39b0699134 100644 --- a/test/core/support/log_test.c +++ b/test/core/support/log_test.c @@ -56,4 +56,4 @@ int main(int argc, char **argv) { gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3); /* TODO(ctiller): should we add a GPR_ASSERT failure test here */ return 0; -} \ No newline at end of file +} diff --git a/test/core/support/murmur_hash_test.c b/test/core/support/murmur_hash_test.c index 63b938c0104..e3890a79dad 100644 --- a/test/core/support/murmur_hash_test.c +++ b/test/core/support/murmur_hash_test.c @@ -84,4 +84,4 @@ int main(int argc, char **argv) { gpr_murmur_hash3("xyz", 3, 0); verification_test(gpr_murmur_hash3, 0xB0F57EE3); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/slice_buffer_test.c b/test/core/support/slice_buffer_test.c index 3788d66c517..8301795dbfd 100644 --- a/test/core/support/slice_buffer_test.c +++ b/test/core/support/slice_buffer_test.c @@ -67,4 +67,4 @@ int main(int argc, char **argv) { gpr_slice_buffer_destroy(&buf); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/slice_test.c b/test/core/support/slice_test.c index 69cb56b4049..4ab3d6f45b9 100644 --- a/test/core/support/slice_test.c +++ b/test/core/support/slice_test.c @@ -224,4 +224,4 @@ int main(int argc, char **argv) { } test_slice_from_copied_string_works(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c index 4beabbe262a..a78e4782a29 100644 --- a/test/core/support/string_test.c +++ b/test/core/support/string_test.c @@ -151,4 +151,4 @@ int main(int argc, char **argv) { test_parse_uint32(); test_asprintf(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c index 827d3d322a2..43d05c6302b 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.c @@ -448,4 +448,4 @@ int main(int argc, char *argv[]) { test("refcount", &refinc, &refcheck, 1); test("timedevent", &inc_with_1ms_delay_event, NULL, 1); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index 6e10b23be52..c03a905d2af 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -87,4 +87,4 @@ int main(int argc, char *argv[]) { grpc_test_init(argc, argv); test(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index c9833dd4df8..2741e17f95f 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -252,4 +252,4 @@ int main(int argc, char *argv[]) { test_sticky_infinities(); test_similar(); return 0; -} \ No newline at end of file +} diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.c index 92f44b331be..feaf4363795 100644 --- a/test/core/support/useful_test.c +++ b/test/core/support/useful_test.c @@ -56,4 +56,4 @@ int main(int argc, char **argv) { GPR_ASSERT(GPR_ARRAY_SIZE(five) == 5); return 0; -} \ No newline at end of file +} diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index 51b1d8b8b15..b121abf7572 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -108,4 +108,4 @@ int main(int argc, char **argv) { test_read_one_slice(); test_read_one_slice_malloc(); return 0; -} \ No newline at end of file +} diff --git a/test/core/surface/completion_queue_benchmark.c b/test/core/surface/completion_queue_benchmark.c index 15b99db774d..9116fd0fe4c 100644 --- a/test/core/surface/completion_queue_benchmark.c +++ b/test/core/surface/completion_queue_benchmark.c @@ -165,4 +165,4 @@ int main(void) { } return 0; -} \ No newline at end of file +} diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index 3374da45b01..35f150c7815 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -405,4 +405,4 @@ int main(int argc, char **argv) { test_threading(10, 10); grpc_iomgr_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/surface/lame_client_test.c b/test/core/surface/lame_client_test.c index 497b4f926da..0142768261d 100644 --- a/test/core/surface/lame_client_test.c +++ b/test/core/surface/lame_client_test.c @@ -77,4 +77,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/core/surface/multi_init_test.c b/test/core/surface/multi_init_test.c index e5a753766ea..99b7a52ff98 100644 --- a/test/core/surface/multi_init_test.c +++ b/test/core/surface/multi_init_test.c @@ -60,4 +60,4 @@ int main(int argc, char **argv) { test(3); test_mixed(); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.c index b65f4dffbec..c2497d3b1a2 100644 --- a/test/core/transport/chttp2/alpn_test.c +++ b/test/core/transport/chttp2/alpn_test.c @@ -52,4 +52,4 @@ int main(int argc, char **argv) { test_alpn_success(); test_alpn_failure(); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c index 7e248968a71..983eaf5a0d7 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.c @@ -184,4 +184,4 @@ int main(int argc, char **argv) { expect_binary_header("-bin", 0); return all_ok ? 0 : 1; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c index b4769cb55f0..edab37b6879 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.c @@ -222,4 +222,4 @@ int main(int argc, char **argv) { test_vectors(GRPC_SLICE_SPLIT_MERGE_ALL); test_vectors(GRPC_SLICE_SPLIT_ONE_BYTE); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index 45036942337..f3da9f0d49c 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -271,4 +271,4 @@ int main(int argc, char **argv) { test_many_additions(); test_find(); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/status_conversion_test.c b/test/core/transport/chttp2/status_conversion_test.c index b39b58d323c..e2729a0a198 100644 --- a/test/core/transport/chttp2/status_conversion_test.c +++ b/test/core/transport/chttp2/status_conversion_test.c @@ -135,4 +135,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c index 94c1c96050e..3013533f9b9 100644 --- a/test/core/transport/chttp2/stream_encoder_test.c +++ b/test/core/transport/chttp2/stream_encoder_test.c @@ -330,4 +330,4 @@ int main(int argc, char **argv) { TEST(test_decode_random_headers_89); TEST(test_decode_random_headers_144); return g_failure; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/stream_map_test.c b/test/core/transport/chttp2/stream_map_test.c index 24c6b5998e1..49d58114f87 100644 --- a/test/core/transport/chttp2/stream_map_test.c +++ b/test/core/transport/chttp2/stream_map_test.c @@ -225,4 +225,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2/timeout_encoding_test.c b/test/core/transport/chttp2/timeout_encoding_test.c index 39c993ae595..fdb27a22ced 100644 --- a/test/core/transport/chttp2/timeout_encoding_test.c +++ b/test/core/transport/chttp2/timeout_encoding_test.c @@ -146,4 +146,4 @@ int main(int argc, char **argv) { test_decoding(); test_decoding_fails(); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/chttp2_transport_end2end_test.c b/test/core/transport/chttp2_transport_end2end_test.c index 4d278d44acf..a3c9f97ce4c 100644 --- a/test/core/transport/chttp2_transport_end2end_test.c +++ b/test/core/transport/chttp2_transport_end2end_test.c @@ -117,4 +117,4 @@ int main(int argc, char **argv) { gpr_log(GPR_INFO, "exiting"); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index 9947a4b4ab8..07867c6b247 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -279,4 +279,4 @@ int main(int argc, char **argv) { test_slices_work(); test_base64_and_huffman_works(); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/stream_op_test.c b/test/core/transport/stream_op_test.c index e69c5ec9dfe..58852238948 100644 --- a/test/core/transport/stream_op_test.c +++ b/test/core/transport/stream_op_test.c @@ -122,4 +122,4 @@ int main(int argc, char **argv) { gpr_slice_unref(test_slice_4); return 0; -} \ No newline at end of file +} diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c index 4bb36a1b61f..6a0848fa978 100644 --- a/test/core/transport/transport_end2end_tests.c +++ b/test/core/transport/transport_end2end_tests.c @@ -930,4 +930,4 @@ void grpc_transport_end2end_tests(grpc_transport_test_config *config) { grpc_mdctx_orphan(g_metadata_context); gpr_log(GPR_INFO, "tests completed ok"); -} \ No newline at end of file +} diff --git a/test/core/transport/transport_end2end_tests.h b/test/core/transport/transport_end2end_tests.h index e181b45a6f4..3dc2b9b0678 100644 --- a/test/core/transport/transport_end2end_tests.h +++ b/test/core/transport/transport_end2end_tests.h @@ -65,4 +65,4 @@ typedef struct grpc_transport_test_config { /* Run the test suite on one configuration */ void grpc_transport_end2end_tests(grpc_transport_test_config *config); -#endif /* __GRPC_TEST_TRANSPORT_TRANSPORT_END2END_TESTS_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_TRANSPORT_TRANSPORT_END2END_TESTS_H__ */ diff --git a/test/core/util/grpc_profiler.c b/test/core/util/grpc_profiler.c index 659322e05d3..35b9361c70c 100644 --- a/test/core/util/grpc_profiler.c +++ b/test/core/util/grpc_profiler.c @@ -51,4 +51,4 @@ void grpc_profiler_start(const char *filename) { } void grpc_profiler_stop(void) {} -#endif \ No newline at end of file +#endif diff --git a/test/core/util/grpc_profiler.h b/test/core/util/grpc_profiler.h index d4b9f6330c3..a31fcc1db5f 100644 --- a/test/core/util/grpc_profiler.h +++ b/test/core/util/grpc_profiler.h @@ -45,4 +45,4 @@ void grpc_profiler_stop(); } #endif /* __cplusplus */ -#endif /* __GRPC_TEST_UTIL_GRPC_PROFILER_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_UTIL_GRPC_PROFILER_H__ */ diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.c index 137ce561277..bf5bc84b483 100644 --- a/test/core/util/parse_hexstring.c +++ b/test/core/util/parse_hexstring.c @@ -67,4 +67,4 @@ gpr_slice parse_hexstring(const char *hexstring) { } return slice; -} \ No newline at end of file +} diff --git a/test/core/util/parse_hexstring.h b/test/core/util/parse_hexstring.h index 4cb1779b5f5..3fce0c9f7ac 100644 --- a/test/core/util/parse_hexstring.h +++ b/test/core/util/parse_hexstring.h @@ -38,4 +38,4 @@ gpr_slice parse_hexstring(const char *hexstring); -#endif /* __GRPC_TEST_UTIL_PARSE_HEXSTRING_H_ */ \ No newline at end of file +#endif /* __GRPC_TEST_UTIL_PARSE_HEXSTRING_H_ */ diff --git a/test/core/util/port.h b/test/core/util/port.h index bed94c9a0ac..2a12ab985e0 100644 --- a/test/core/util/port.h +++ b/test/core/util/port.h @@ -49,4 +49,4 @@ int grpc_pick_unused_port_or_die(); } #endif -#endif /* __GRPC_TEST_UTIL_PORT_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_UTIL_PORT_H__ */ diff --git a/test/core/util/port_posix.c b/test/core/util/port_posix.c index c4868a16c7b..f0fe1a0e7c3 100644 --- a/test/core/util/port_posix.c +++ b/test/core/util/port_posix.c @@ -146,4 +146,4 @@ int grpc_pick_unused_port_or_die(void) { return port; } -#endif /* GPR_POSIX_SOCKET */ \ No newline at end of file +#endif /* GPR_POSIX_SOCKET */ diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.c index c4d5f12e797..0f05072e505 100644 --- a/test/core/util/slice_splitter.c +++ b/test/core/util/slice_splitter.c @@ -135,4 +135,4 @@ gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices) { } return gpr_slice_new(out, length, gpr_free); -} \ No newline at end of file +} diff --git a/test/core/util/slice_splitter.h b/test/core/util/slice_splitter.h index 9f6f354aefa..b67fe737cbd 100644 --- a/test/core/util/slice_splitter.h +++ b/test/core/util/slice_splitter.h @@ -65,4 +65,4 @@ gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices); const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode); -#endif /* __GRPC_TEST_UTIL_SLICE_SPLITTER_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_UTIL_SLICE_SPLITTER_H__ */ diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 41768f2f72d..1c464073114 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -55,4 +55,4 @@ void grpc_test_init(int argc, char **argv) { /* seed rng with pid, so we don't end up with the same random numbers as a concurrently running test binary */ srand(seed()); -} \ No newline at end of file +} diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index b827e535446..b97fbfa6138 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -44,4 +44,4 @@ void grpc_test_init(int argc, char **argv); } #endif /* __cplusplus */ -#endif /* __GRPC_TEST_UTIL_TEST_CONFIG_H__ */ \ No newline at end of file +#endif /* __GRPC_TEST_UTIL_TEST_CONFIG_H__ */ diff --git a/test/cpp/client/channel_arguments_test.cc b/test/cpp/client/channel_arguments_test.cc index 59b5910e1ec..d98b38ab68f 100644 --- a/test/cpp/client/channel_arguments_test.cc +++ b/test/cpp/client/channel_arguments_test.cc @@ -121,4 +121,4 @@ TEST_F(ChannelArgumentsTest, SetString) { int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/test/cpp/client/credentials_test.cc b/test/cpp/client/credentials_test.cc index c26612caf2f..dc8d76d7eff 100644 --- a/test/cpp/client/credentials_test.cc +++ b/test/cpp/client/credentials_test.cc @@ -61,4 +61,4 @@ int main(int argc, char **argv) { int ret = RUN_ALL_TESTS(); grpc_shutdown(); return ret; -} \ No newline at end of file +} diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 7057fa07d0c..7101da1b2a6 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -525,4 +525,4 @@ int main(int argc, char** argv) { grpc_shutdown(); google::protobuf::ShutdownProtobufLibrary(); return result; -} \ No newline at end of file +} diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index c70930387af..d4ca3ef49e4 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -447,4 +447,4 @@ int main(int argc, char** argv) { grpc_shutdown(); google::protobuf::ShutdownProtobufLibrary(); return result; -} \ No newline at end of file +} diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 76cb05eee41..ab69e1eefd3 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -429,4 +429,4 @@ int main(int argc, char** argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index b08030fce78..f4b9f046504 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -224,4 +224,4 @@ int main(int argc, char** argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc index 1bca2524c2b..8369ef6562b 100644 --- a/test/cpp/qps/client.cc +++ b/test/cpp/qps/client.cc @@ -242,4 +242,4 @@ int main(int argc, char **argv) { grpc_shutdown(); return 0; -} \ No newline at end of file +} diff --git a/test/cpp/server/thread_pool_test.cc b/test/cpp/server/thread_pool_test.cc index bdaf523b2f6..824d7853160 100644 --- a/test/cpp/server/thread_pool_test.cc +++ b/test/cpp/server/thread_pool_test.cc @@ -74,4 +74,4 @@ int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); int result = RUN_ALL_TESTS(); return result; -} \ No newline at end of file +} diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc index bd6e62d1514..b0472d32a99 100644 --- a/test/cpp/util/create_test_channel.cc +++ b/test/cpp/util/create_test_channel.cc @@ -96,4 +96,4 @@ std::shared_ptr CreateTestChannel(const grpc::string& server, return CreateTestChannel(server, "foo.test.google.com", enable_ssl, false); } -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h index 19a9d2e83bb..3476b8354b1 100644 --- a/test/cpp/util/create_test_channel.h +++ b/test/cpp/util/create_test_channel.h @@ -56,4 +56,4 @@ std::shared_ptr CreateTestChannel( } // namespace grpc -#endif // __GRPCPP_TEST_UTIL_CREATE_TEST_CHANNEL_H_ \ No newline at end of file +#endif // __GRPCPP_TEST_UTIL_CREATE_TEST_CHANNEL_H_ diff --git a/test/cpp/util/status_test.cc b/test/cpp/util/status_test.cc index d7dacf03f66..8c6a3354fe4 100644 --- a/test/cpp/util/status_test.cc +++ b/test/cpp/util/status_test.cc @@ -73,4 +73,4 @@ int main(int argc, char **argv) { static_cast(GRPC_STATUS_DATA_LOSS)); return 0; -} \ No newline at end of file +} diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index a258eb02019..2e17add67fa 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -68,4 +68,4 @@ TEST_F(TimeTest, InfFuture) { } } // namespace -} // namespace grpc \ No newline at end of file +} // namespace grpc diff --git a/vsprojects/third_party/openssl/buildinf.h b/vsprojects/third_party/openssl/buildinf.h index f4345e461ec..0901f8d9ae1 100644 --- a/vsprojects/third_party/openssl/buildinf.h +++ b/vsprojects/third_party/openssl/buildinf.h @@ -43,4 +43,4 @@ #define CFLAGS "cl /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE " #define PLATFORM "VC-WIN32" #define DATE "Sat Dec 13 01:17:07 2014" -#endif \ No newline at end of file +#endif diff --git a/vsprojects/third_party/openssl/opensslconf.h b/vsprojects/third_party/openssl/opensslconf.h index 398d5eee19f..0f5ae4059f0 100644 --- a/vsprojects/third_party/openssl/opensslconf.h +++ b/vsprojects/third_party/openssl/opensslconf.h @@ -290,4 +290,4 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED !!!!! #endif /* HEADER_DES_LOCL_H */ #ifdef __cplusplus } -#endif \ No newline at end of file +#endif From fa61eade82e6ea9157717cb8366cefd41b34b920 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 09:24:05 -0800 Subject: [PATCH 142/232] Bug fix --- tools/distrib/check_copyright.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 68fac49d7d5..c81a1ea55bf 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -111,7 +111,7 @@ for filename in subprocess.check_output('git ls-tree -r --name-only -r HEAD', log(args.ancient, 'old', filename) if args.fix: with open(filename, 'w') as f: - f.write(text.replace('Copyright 2014, Google Inc.', 'Copyright 2015, Google Inc.')) + f.write(text.replace('Copyright 2014, Google Inc.', 'Copyright 2015, Google Inc.') + '\n') elif 'DO NOT EDIT' not in text and 'AssemblyInfo.cs' not in filename: log(1, 'missing', filename) From caa51e402c3b5637a3c344da634941309bbee880 Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Wed, 18 Feb 2015 09:24:37 -0800 Subject: [PATCH 143/232] Add back a missing test --- tools/gce_setup/cloud_prod_runner.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index 2abbc8d3cc6..e40c6afd095 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -2,7 +2,7 @@ main() { source grpc_docker.sh - test_cases=(large_unary empty_unary client_streaming server_streaming service_account_creds compute_engine_creds) + test_cases=(large_unary empty_unary ping_pong client_streaming server_streaming service_account_creds compute_engine_creds) clients=(cxx java go ruby node) for test_case in "${test_cases[@]}" do From ce5021b0b9f3d99f606ddf82b56f86077c5adc5a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 09:25:21 -0800 Subject: [PATCH 144/232] Add missing new-lines at end of file --- examples/pubsub/empty.proto | 6 +- examples/pubsub/label.proto | 6 +- examples/pubsub/pubsub.proto | 6 +- src/csharp/GrpcApi/proto/empty.proto | 6 +- src/csharp/GrpcApi/proto/math.proto | 6 +- src/csharp/GrpcApi/proto/messages.proto | 6 +- src/csharp/GrpcApi/proto/test.proto | 6 +- src/node/examples/math.proto | 6 +- src/node/examples/math_server.js | 2 +- src/node/examples/stock.proto | 2 +- src/node/index.js | 2 +- src/node/interop/empty.proto | 6 +- src/node/interop/interop_client.js | 2 +- src/node/interop/interop_server.js | 2 +- src/node/interop/messages.proto | 6 +- src/node/interop/test.proto | 6 +- src/node/src/common.js | 2 +- src/node/test/channel_test.js | 2 +- src/node/test/constant_test.js | 2 +- src/node/test/end_to_end_test.js | 2 +- src/node/test/interop_sanity_test.js | 2 +- src/node/test/math_client_test.js | 2 +- src/node/test/surface_test.js | 2 +- src/php/bin/interop_client.sh | 2 +- src/php/bin/run_gen_code_test.sh | 2 +- src/php/bin/run_tests.sh | 2 +- src/php/tests/generated_code/math.php | 60 +++---- src/php/tests/interop/messages.php | 168 +++++++++--------- .../grpc/_adapter/_lonely_rear_link_test.py | 2 +- .../src/grpc/early_adopter/interfaces.py | 2 +- src/ruby/bin/math.proto | 6 +- test/cpp/interop/empty.proto | 6 +- test/cpp/interop/messages.proto | 6 +- test/cpp/interop/test.proto | 6 +- test/cpp/qps/qpstest.proto | 6 +- test/cpp/util/echo.proto | 6 +- test/cpp/util/echo_duplicate.proto | 6 +- test/cpp/util/messages.proto | 6 +- tools/buildgen/build-cleaner.py | 12 +- tools/gce_setup/builder.sh | 2 +- tools/gce_setup/cloud_prod_runner.sh | 2 +- tools/gce_setup/compute_extras.sh | 2 +- tools/gce_setup/grpc_docker.sh | 2 +- tools/gce_setup/interop_test_runner.sh | 2 +- tools/gce_setup/new_grpc_docker_builder.sh | 2 +- .../new_grpc_docker_builder_on_startup.sh | 2 +- tools/gce_setup/shared_startup_funcs.sh | 2 +- tools/run_tests/build_node.sh | 2 +- tools/run_tests/build_php.sh | 2 +- tools/run_tests/build_python.sh | 2 +- tools/run_tests/run_node.sh | 2 +- tools/run_tests/run_python.sh | 2 +- 52 files changed, 207 insertions(+), 207 deletions(-) diff --git a/examples/pubsub/empty.proto b/examples/pubsub/empty.proto index c34738fb4a7..5d6eb108411 100644 --- a/examples/pubsub/empty.proto +++ b/examples/pubsub/empty.proto @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/examples/pubsub/label.proto b/examples/pubsub/label.proto index 08350b8ba22..0af15a25a61 100644 --- a/examples/pubsub/label.proto +++ b/examples/pubsub/label.proto @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/examples/pubsub/pubsub.proto b/examples/pubsub/pubsub.proto index 793cdae9e6f..ac896933201 100644 --- a/examples/pubsub/pubsub.proto +++ b/examples/pubsub/pubsub.proto @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 diff --git a/src/csharp/GrpcApi/proto/empty.proto b/src/csharp/GrpcApi/proto/empty.proto index c3bb940075b..4295a0a960c 100644 --- a/src/csharp/GrpcApi/proto/empty.proto +++ b/src/csharp/GrpcApi/proto/empty.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/csharp/GrpcApi/proto/math.proto b/src/csharp/GrpcApi/proto/math.proto index 074efadf893..5485d580c32 100644 --- a/src/csharp/GrpcApi/proto/math.proto +++ b/src/csharp/GrpcApi/proto/math.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/csharp/GrpcApi/proto/messages.proto b/src/csharp/GrpcApi/proto/messages.proto index e3814da406e..65a81404652 100644 --- a/src/csharp/GrpcApi/proto/messages.proto +++ b/src/csharp/GrpcApi/proto/messages.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/csharp/GrpcApi/proto/test.proto b/src/csharp/GrpcApi/proto/test.proto index c2437630b7d..927a3a83aa2 100644 --- a/src/csharp/GrpcApi/proto/test.proto +++ b/src/csharp/GrpcApi/proto/test.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/node/examples/math.proto b/src/node/examples/math.proto index 2cf6a036aa4..e34ad5e9672 100644 --- a/src/node/examples/math.proto +++ b/src/node/examples/math.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/node/examples/math_server.js b/src/node/examples/math_server.js index 42728d0bd94..89bc0de3ba0 100644 --- a/src/node/examples/math_server.js +++ b/src/node/examples/math_server.js @@ -135,4 +135,4 @@ if (require.main === module) { /** * See docs for server */ -module.exports = server; \ No newline at end of file +module.exports = server; diff --git a/src/node/examples/stock.proto b/src/node/examples/stock.proto index 2bc5c29d172..328e050aefb 100644 --- a/src/node/examples/stock.proto +++ b/src/node/examples/stock.proto @@ -59,4 +59,4 @@ service Stock { rpc GetHighestTradePrice(stream StockRequest) returns (StockReply) { } -} \ No newline at end of file +} diff --git a/src/node/index.js b/src/node/index.js index 167be3a7d05..fe1fb1d3997 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -105,4 +105,4 @@ exports.Credentials = grpc.Credentials; /** * ServerCredentials factories */ -exports.ServerCredentials = grpc.ServerCredentials; \ No newline at end of file +exports.ServerCredentials = grpc.ServerCredentials; diff --git a/src/node/interop/empty.proto b/src/node/interop/empty.proto index 98fc3a39070..f66a108c19b 100644 --- a/src/node/interop/empty.proto +++ b/src/node/interop/empty.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 4efc9667da4..d00724b247e 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -310,4 +310,4 @@ if (require.main === module) { /** * See docs for runTest */ -exports.runTest = runTest; \ No newline at end of file +exports.runTest = runTest; diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js index 2c9cf04cdbc..c97d2344550 100644 --- a/src/node/interop/interop_server.js +++ b/src/node/interop/interop_server.js @@ -201,4 +201,4 @@ if (require.main === module) { /** * See docs for getServer */ -exports.getServer = getServer; \ No newline at end of file +exports.getServer = getServer; diff --git a/src/node/interop/messages.proto b/src/node/interop/messages.proto index f53d99ab5b6..eb6526463d9 100644 --- a/src/node/interop/messages.proto +++ b/src/node/interop/messages.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/node/interop/test.proto b/src/node/interop/test.proto index c2437630b7d..927a3a83aa2 100644 --- a/src/node/interop/test.proto +++ b/src/node/interop/test.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/src/node/src/common.js b/src/node/src/common.js index c5b836231a4..848c96742d9 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -125,4 +125,4 @@ exports.fullyQualifiedName = fullyQualifiedName; /** * See docs for wrapIgnoreNull */ -exports.wrapIgnoreNull = wrapIgnoreNull; \ No newline at end of file +exports.wrapIgnoreNull = wrapIgnoreNull; diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js index 77708d163ed..449a8cc4c36 100644 --- a/src/node/test/channel_test.js +++ b/src/node/test/channel_test.js @@ -85,4 +85,4 @@ describe('channel', function() { }); }); }); -}); \ No newline at end of file +}); diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index 0affa403c8d..4a403868c7c 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -89,4 +89,4 @@ describe('constants', function() { 'call error missing: ' + callErrorNames[i]); } }); -}); \ No newline at end of file +}); diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js index 4fd6d8d2d0e..8e99d6f1628 100644 --- a/src/node/test/end_to_end_test.js +++ b/src/node/test/end_to_end_test.js @@ -233,4 +233,4 @@ describe('end-to-end', function() { }); }); }); -}); \ No newline at end of file +}); diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index 92e87b5d646..16def1fa708 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -79,4 +79,4 @@ describe('Interop tests', function() { interop_client.runTest(port, name_override, 'cancel_after_first_response', true, done); }); -}); \ No newline at end of file +}); diff --git a/src/node/test/math_client_test.js b/src/node/test/math_client_test.js index 97b95377fb4..fd946e0325d 100644 --- a/src/node/test/math_client_test.js +++ b/src/node/test/math_client_test.js @@ -113,4 +113,4 @@ describe('Math client', function() { done(); }); }); -}); \ No newline at end of file +}); diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index e6a63b1ed72..d6694724e54 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -125,4 +125,4 @@ describe('Cancelling surface client', function() { }); call.cancel(); }); -}); \ No newline at end of file +}); diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index e422e93989a..2c61ea8aa09 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -32,4 +32,4 @@ set +e cd $(dirname $0) php -d extension_dir=../ext/grpc/modules/ -d extension=grpc.so \ - ../tests/interop/interop_client.php $@ 1>&2 \ No newline at end of file + ../tests/interop/interop_client.php $@ 1>&2 diff --git a/src/php/bin/run_gen_code_test.sh b/src/php/bin/run_gen_code_test.sh index a1d760a5b07..3f176fb5e4a 100755 --- a/src/php/bin/run_gen_code_test.sh +++ b/src/php/bin/run_gen_code_test.sh @@ -31,4 +31,4 @@ cd $(dirname $0) GRPC_TEST_HOST=localhost:7070 php -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so /usr/local/bin/phpunit -v --debug --strict \ - ../tests/generated_code/GeneratedCodeTest.php \ No newline at end of file + ../tests/generated_code/GeneratedCodeTest.php diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index 33bfe289e28..c3358ed899f 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -43,4 +43,4 @@ done php \ -d extension_dir=../ext/grpc/modules/ \ -d extension=grpc.so \ - `which phpunit` -v --debug --strict ../tests/unit_tests \ No newline at end of file + `which phpunit` -v --debug --strict ../tests/unit_tests diff --git a/src/php/tests/generated_code/math.php b/src/php/tests/generated_code/math.php index d50f94e11c7..e97a5cf97eb 100755 --- a/src/php/tests/generated_code/math.php +++ b/src/php/tests/generated_code/math.php @@ -9,10 +9,10 @@ namespace math { /** @var int */ public $dividend = null; - + /** @var int */ public $divisor = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -52,7 +52,7 @@ namespace math { public function hasDividend(){ return $this->_has(1); } - + /** * Clear value * @@ -61,7 +61,7 @@ namespace math { public function clearDividend(){ return $this->_clear(1); } - + /** * Get value * @@ -70,7 +70,7 @@ namespace math { public function getDividend(){ return $this->_get(1); } - + /** * Set value * @@ -80,7 +80,7 @@ namespace math { public function setDividend( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -89,7 +89,7 @@ namespace math { public function hasDivisor(){ return $this->_has(2); } - + /** * Clear value * @@ -98,7 +98,7 @@ namespace math { public function clearDivisor(){ return $this->_clear(2); } - + /** * Get value * @@ -107,7 +107,7 @@ namespace math { public function getDivisor(){ return $this->_get(2); } - + /** * Set value * @@ -126,10 +126,10 @@ namespace math { /** @var int */ public $quotient = null; - + /** @var int */ public $remainder = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -169,7 +169,7 @@ namespace math { public function hasQuotient(){ return $this->_has(1); } - + /** * Clear value * @@ -178,7 +178,7 @@ namespace math { public function clearQuotient(){ return $this->_clear(1); } - + /** * Get value * @@ -187,7 +187,7 @@ namespace math { public function getQuotient(){ return $this->_get(1); } - + /** * Set value * @@ -197,7 +197,7 @@ namespace math { public function setQuotient( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -206,7 +206,7 @@ namespace math { public function hasRemainder(){ return $this->_has(2); } - + /** * Clear value * @@ -215,7 +215,7 @@ namespace math { public function clearRemainder(){ return $this->_clear(2); } - + /** * Get value * @@ -224,7 +224,7 @@ namespace math { public function getRemainder(){ return $this->_get(2); } - + /** * Set value * @@ -243,7 +243,7 @@ namespace math { /** @var int */ public $limit = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -275,7 +275,7 @@ namespace math { public function hasLimit(){ return $this->_has(1); } - + /** * Clear value * @@ -284,7 +284,7 @@ namespace math { public function clearLimit(){ return $this->_clear(1); } - + /** * Get value * @@ -293,7 +293,7 @@ namespace math { public function getLimit(){ return $this->_get(1); } - + /** * Set value * @@ -312,7 +312,7 @@ namespace math { /** @var int */ public $num = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -344,7 +344,7 @@ namespace math { public function hasNum(){ return $this->_has(1); } - + /** * Clear value * @@ -353,7 +353,7 @@ namespace math { public function clearNum(){ return $this->_clear(1); } - + /** * Get value * @@ -362,7 +362,7 @@ namespace math { public function getNum(){ return $this->_get(1); } - + /** * Set value * @@ -381,7 +381,7 @@ namespace math { /** @var int */ public $count = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -413,7 +413,7 @@ namespace math { public function hasCount(){ return $this->_has(1); } - + /** * Clear value * @@ -422,7 +422,7 @@ namespace math { public function clearCount(){ return $this->_clear(1); } - + /** * Get value * @@ -431,7 +431,7 @@ namespace math { public function getCount(){ return $this->_get(1); } - + /** * Set value * diff --git a/src/php/tests/interop/messages.php b/src/php/tests/interop/messages.php index 129c96fa136..a626a17ab37 100755 --- a/src/php/tests/interop/messages.php +++ b/src/php/tests/interop/messages.php @@ -17,10 +17,10 @@ namespace grpc\testing { /** @var int - \grpc\testing\PayloadType */ public $type = null; - + /** @var string */ public $body = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -61,7 +61,7 @@ namespace grpc\testing { public function hasType(){ return $this->_has(1); } - + /** * Clear value * @@ -70,7 +70,7 @@ namespace grpc\testing { public function clearType(){ return $this->_clear(1); } - + /** * Get value * @@ -79,7 +79,7 @@ namespace grpc\testing { public function getType(){ return $this->_get(1); } - + /** * Set value * @@ -89,7 +89,7 @@ namespace grpc\testing { public function setType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -98,7 +98,7 @@ namespace grpc\testing { public function hasBody(){ return $this->_has(2); } - + /** * Clear value * @@ -107,7 +107,7 @@ namespace grpc\testing { public function clearBody(){ return $this->_clear(2); } - + /** * Get value * @@ -116,7 +116,7 @@ namespace grpc\testing { public function getBody(){ return $this->_get(2); } - + /** * Set value * @@ -135,19 +135,19 @@ namespace grpc\testing { /** @var int - \grpc\testing\PayloadType */ public $response_type = null; - + /** @var int */ public $response_size = null; - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var boolean */ public $fill_username = null; - + /** @var boolean */ public $fill_oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -213,7 +213,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -222,7 +222,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -231,7 +231,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -241,7 +241,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -250,7 +250,7 @@ namespace grpc\testing { public function hasResponseSize(){ return $this->_has(2); } - + /** * Clear value * @@ -259,7 +259,7 @@ namespace grpc\testing { public function clearResponseSize(){ return $this->_clear(2); } - + /** * Get value * @@ -268,7 +268,7 @@ namespace grpc\testing { public function getResponseSize(){ return $this->_get(2); } - + /** * Set value * @@ -278,7 +278,7 @@ namespace grpc\testing { public function setResponseSize( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -287,7 +287,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -296,7 +296,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -305,7 +305,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -315,7 +315,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(3, $value); } - + /** * Check if has a value * @@ -324,7 +324,7 @@ namespace grpc\testing { public function hasFillUsername(){ return $this->_has(4); } - + /** * Clear value * @@ -333,7 +333,7 @@ namespace grpc\testing { public function clearFillUsername(){ return $this->_clear(4); } - + /** * Get value * @@ -342,7 +342,7 @@ namespace grpc\testing { public function getFillUsername(){ return $this->_get(4); } - + /** * Set value * @@ -352,7 +352,7 @@ namespace grpc\testing { public function setFillUsername( $value){ return $this->_set(4, $value); } - + /** * Check if has a value * @@ -361,7 +361,7 @@ namespace grpc\testing { public function hasFillOauthScope(){ return $this->_has(5); } - + /** * Clear value * @@ -370,7 +370,7 @@ namespace grpc\testing { public function clearFillOauthScope(){ return $this->_clear(5); } - + /** * Get value * @@ -379,7 +379,7 @@ namespace grpc\testing { public function getFillOauthScope(){ return $this->_get(5); } - + /** * Set value * @@ -398,13 +398,13 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var string */ public $username = null; - + /** @var string */ public $oauth_scope = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -453,7 +453,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -462,7 +462,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -471,7 +471,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -481,7 +481,7 @@ namespace grpc\testing { public function setPayload(\grpc\testing\Payload $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -490,7 +490,7 @@ namespace grpc\testing { public function hasUsername(){ return $this->_has(2); } - + /** * Clear value * @@ -499,7 +499,7 @@ namespace grpc\testing { public function clearUsername(){ return $this->_clear(2); } - + /** * Get value * @@ -508,7 +508,7 @@ namespace grpc\testing { public function getUsername(){ return $this->_get(2); } - + /** * Set value * @@ -518,7 +518,7 @@ namespace grpc\testing { public function setUsername( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -527,7 +527,7 @@ namespace grpc\testing { public function hasOauthScope(){ return $this->_has(3); } - + /** * Clear value * @@ -536,7 +536,7 @@ namespace grpc\testing { public function clearOauthScope(){ return $this->_clear(3); } - + /** * Get value * @@ -545,7 +545,7 @@ namespace grpc\testing { public function getOauthScope(){ return $this->_get(3); } - + /** * Set value * @@ -564,7 +564,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -597,7 +597,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -606,7 +606,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -615,7 +615,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -634,7 +634,7 @@ namespace grpc\testing { /** @var int */ public $aggregated_payload_size = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -666,7 +666,7 @@ namespace grpc\testing { public function hasAggregatedPayloadSize(){ return $this->_has(1); } - + /** * Clear value * @@ -675,7 +675,7 @@ namespace grpc\testing { public function clearAggregatedPayloadSize(){ return $this->_clear(1); } - + /** * Get value * @@ -684,7 +684,7 @@ namespace grpc\testing { public function getAggregatedPayloadSize(){ return $this->_get(1); } - + /** * Set value * @@ -703,10 +703,10 @@ namespace grpc\testing { /** @var int */ public $size = null; - + /** @var int */ public $interval_us = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -746,7 +746,7 @@ namespace grpc\testing { public function hasSize(){ return $this->_has(1); } - + /** * Clear value * @@ -755,7 +755,7 @@ namespace grpc\testing { public function clearSize(){ return $this->_clear(1); } - + /** * Get value * @@ -764,7 +764,7 @@ namespace grpc\testing { public function getSize(){ return $this->_get(1); } - + /** * Set value * @@ -774,7 +774,7 @@ namespace grpc\testing { public function setSize( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -783,7 +783,7 @@ namespace grpc\testing { public function hasIntervalUs(){ return $this->_has(2); } - + /** * Clear value * @@ -792,7 +792,7 @@ namespace grpc\testing { public function clearIntervalUs(){ return $this->_clear(2); } - + /** * Get value * @@ -801,7 +801,7 @@ namespace grpc\testing { public function getIntervalUs(){ return $this->_get(2); } - + /** * Set value * @@ -820,13 +820,13 @@ namespace grpc\testing { /** @var int - \grpc\testing\PayloadType */ public $response_type = null; - + /** @var \grpc\testing\ResponseParameters[] */ public $response_parameters = array(); - + /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -877,7 +877,7 @@ namespace grpc\testing { public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -886,7 +886,7 @@ namespace grpc\testing { public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -895,7 +895,7 @@ namespace grpc\testing { public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -905,7 +905,7 @@ namespace grpc\testing { public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -914,7 +914,7 @@ namespace grpc\testing { public function hasResponseParameters(){ return $this->_has(2); } - + /** * Clear value * @@ -923,7 +923,7 @@ namespace grpc\testing { public function clearResponseParameters(){ return $this->_clear(2); } - + /** * Get value * @@ -933,7 +933,7 @@ namespace grpc\testing { public function getResponseParameters($idx = NULL){ return $this->_get(2, $idx); } - + /** * Set value * @@ -943,7 +943,7 @@ namespace grpc\testing { public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ return $this->_set(2, $value, $idx); } - + /** * Get all elements of * @@ -952,7 +952,7 @@ namespace grpc\testing { public function getResponseParametersList(){ return $this->_get(2); } - + /** * Add a new element to * @@ -962,7 +962,7 @@ namespace grpc\testing { public function addResponseParameters(\grpc\testing\ResponseParameters $value){ return $this->_add(2, $value); } - + /** * Check if has a value * @@ -971,7 +971,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -980,7 +980,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -989,7 +989,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -1008,7 +1008,7 @@ namespace grpc\testing { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -1041,7 +1041,7 @@ namespace grpc\testing { public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -1050,7 +1050,7 @@ namespace grpc\testing { public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -1059,7 +1059,7 @@ namespace grpc\testing { public function getPayload(){ return $this->_get(1); } - + /** * Set value * diff --git a/src/python/src/grpc/_adapter/_lonely_rear_link_test.py b/src/python/src/grpc/_adapter/_lonely_rear_link_test.py index fd502a1c817..9a13309a182 100644 --- a/src/python/src/grpc/_adapter/_lonely_rear_link_test.py +++ b/src/python/src/grpc/_adapter/_lonely_rear_link_test.py @@ -83,7 +83,7 @@ class LonelyRearLinkTest(unittest.TestCase): with fore_link.condition: self.assertIsNot(fore_link.tickets[-1].kind, packets.Kind.COMPLETION) - + @unittest.skip('TODO(nathaniel): This seems to have broken in the last few weeks; fix it.') def testLonelyClientCommencementPacket(self): self._perform_lonely_client_test_with_ticket_kind( diff --git a/src/python/src/grpc/early_adopter/interfaces.py b/src/python/src/grpc/early_adopter/interfaces.py index c2806c235cf..8d9a3121333 100644 --- a/src/python/src/grpc/early_adopter/interfaces.py +++ b/src/python/src/grpc/early_adopter/interfaces.py @@ -181,7 +181,7 @@ class RpcMethod(object): class Server(object): """A GRPC Server.""" __metaclass__ = abc.ABCMeta - + @abc.abstractmethod def start(self): diff --git a/src/ruby/bin/math.proto b/src/ruby/bin/math.proto index 2cf6a036aa4..e34ad5e9672 100755 --- a/src/ruby/bin/math.proto +++ b/src/ruby/bin/math.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/interop/empty.proto b/test/cpp/interop/empty.proto index 98fc3a39070..f66a108c19b 100644 --- a/test/cpp/interop/empty.proto +++ b/test/cpp/interop/empty.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/interop/messages.proto b/test/cpp/interop/messages.proto index e3814da406e..65a81404652 100644 --- a/test/cpp/interop/messages.proto +++ b/test/cpp/interop/messages.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/interop/test.proto b/test/cpp/interop/test.proto index 32b8c63195f..b55780e5cde 100644 --- a/test/cpp/interop/test.proto +++ b/test/cpp/interop/test.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto index ffe7ecae56a..68ec6149f59 100644 --- a/test/cpp/qps/qpstest.proto +++ b/test/cpp/qps/qpstest.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto index 01369c540f9..58ec680ecd0 100644 --- a/test/cpp/util/echo.proto +++ b/test/cpp/util/echo.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto index b0b07269cf6..e54c016d2f3 100644 --- a/test/cpp/util/echo_duplicate.proto +++ b/test/cpp/util/echo_duplicate.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto index 3e4b38b839f..9c27f6869ec 100644 --- a/test/cpp/util/messages.proto +++ b/test/cpp/util/messages.proto @@ -1,11 +1,11 @@ // 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 @@ -15,7 +15,7 @@ // * 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 diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 478ff4c58dc..880f3e26a48 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -40,13 +40,13 @@ TEST = (os.environ.get('TEST', 'false') == 'true') _TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets'] _VERSION_KEYS = ['major', 'minor', 'micro', 'build'] _ELEM_KEYS = [ - 'name', - 'build', + 'name', + 'build', 'run', - 'language', - 'public_headers', - 'headers', - 'src', + 'language', + 'public_headers', + 'headers', + 'src', 'deps'] def rebuild_as_ordered_dict(indict, special_keys): diff --git a/tools/gce_setup/builder.sh b/tools/gce_setup/builder.sh index 1a175dee9dd..d4dbd75426c 100755 --- a/tools/gce_setup/builder.sh +++ b/tools/gce_setup/builder.sh @@ -55,4 +55,4 @@ main() { } set -x -main "$@" \ No newline at end of file +main "$@" diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index dd076ccf747..efb06c8521b 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -50,4 +50,4 @@ main() { } set -x -main "$@" \ No newline at end of file +main "$@" diff --git a/tools/gce_setup/compute_extras.sh b/tools/gce_setup/compute_extras.sh index 7b691b064ef..a0835a12ed4 100755 --- a/tools/gce_setup/compute_extras.sh +++ b/tools/gce_setup/compute_extras.sh @@ -281,4 +281,4 @@ find_named_ip() { gcloud compute addresses list | sed -e 's/ \+/ /g' \ | grep $name | cut -d' ' -f 3 -} \ No newline at end of file +} diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 0ffce7cd0c7..664150bca01 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1117,4 +1117,4 @@ _grpc_gce_test_flags() { echo " --default_service_account=155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel@developer.gserviceaccount.com --oauth_scope=https://www.googleapis.com/auth/xapi.zoo" } -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python \ No newline at end of file +# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index cebae549dc4..247c28450e8 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -64,4 +64,4 @@ main() { } set -x -main "$@" \ No newline at end of file +main "$@" diff --git a/tools/gce_setup/new_grpc_docker_builder.sh b/tools/gce_setup/new_grpc_docker_builder.sh index 4bef368ebaf..8a9ece33170 100755 --- a/tools/gce_setup/new_grpc_docker_builder.sh +++ b/tools/gce_setup/new_grpc_docker_builder.sh @@ -179,4 +179,4 @@ main() { } set -x -main "$@" \ No newline at end of file +main "$@" diff --git a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh index 388803aa3b8..30eb0377c29 100755 --- a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh +++ b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh @@ -167,4 +167,4 @@ main() { } set -x -main "$@" \ No newline at end of file +main "$@" diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index 1d56856c0b5..fe00e0c53da 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -534,4 +534,4 @@ grpc_docker_sync_service_account() { return 1 } gsutil cp $src $gcs_acct_path $local_acct_path -} \ No newline at end of file +} diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh index 29a1fa12d03..c3e88c565d2 100755 --- a/tools/run_tests/build_node.sh +++ b/tools/run_tests/build_node.sh @@ -45,4 +45,4 @@ export GRPC_NO_INSTALL=yes cd src/node -npm install \ No newline at end of file +npm install diff --git a/tools/run_tests/build_php.sh b/tools/run_tests/build_php.sh index bec0ce4553f..2d52a6e33b4 100755 --- a/tools/run_tests/build_php.sh +++ b/tools/run_tests/build_php.sh @@ -44,4 +44,4 @@ cd src/php cd ext/grpc phpize ./configure --enable-grpc=$root -make \ No newline at end of file +make diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh index d7a58838b43..9303a67a1e6 100755 --- a/tools/run_tests/build_python.sh +++ b/tools/run_tests/build_python.sh @@ -40,4 +40,4 @@ virtualenv python2.7_virtual_environment ln -sf $root/include/grpc python2.7_virtual_environment/include/grpc source python2.7_virtual_environment/bin/activate pip install enum34==1.0.4 futures==2.2.0 protobuf==3.0.0-alpha-1 -CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src \ No newline at end of file +CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh index 699b5f3fa13..ccf1b9d6f54 100755 --- a/tools/run_tests/run_node.sh +++ b/tools/run_tests/run_node.sh @@ -35,4 +35,4 @@ cd $(dirname $0)/../.. root=`pwd` -$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test \ No newline at end of file +$root/src/node/node_modules/mocha/bin/mocha $root/src/node/test diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index 7ce4b253427..f21f854b09a 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -51,4 +51,4 @@ python2.7 -B -m grpc.framework.face.future_invocation_asynchronous_event_service python2.7 -B -m grpc.framework.foundation._later_test python2.7 -B -m grpc.framework.foundation._logging_pool_test # TODO(nathaniel): Get tests working under 3.4 (requires 3.X-friendly protobuf) -# python3.4 -B -m unittest discover -s src/python -p '*.py' \ No newline at end of file +# python3.4 -B -m unittest discover -s src/python -p '*.py' From 5b41d4ff4095fa99a31d07f22a8e69947196df9d Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Feb 2015 10:21:57 -0800 Subject: [PATCH 145/232] Added interop support for default root SSL certs --- src/node/interop/interop_client.js | 14 +++++++++++--- src/node/test/interop_sanity_test.js | 21 +++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 8737af6cde9..00284d0855a 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -280,11 +280,16 @@ var test_cases = { * @param {function} done Callback to call when the test is completed. Included * primarily for use with mocha */ -function runTest(address, host_override, test_case, tls, done) { +function runTest(address, host_override, test_case, tls, test_ca, done) { // TODO(mlumish): enable TLS functionality var options = {}; if (tls) { - var ca_path = path.join(__dirname, '../test/data/ca.pem'); + var ca_path; + if (test_ca) { + ca_path = path.join(__dirname, '../test/data/ca.pem'); + } else { + ca_path = process.env.SSL_CERT_FILE; + } var ca_data = fs.readFileSync(ca_path); var creds = grpc.Credentials.createSsl(ca_data); options.credentials = creds; @@ -304,7 +309,10 @@ if (require.main === module) { 'use_tls', 'use_test_ca'] }); runTest(argv.server_host + ':' + argv.server_port, argv.server_host_override, - argv.test_case, argv.use_tls === 'true'); + argv.test_case, argv.use_tls === 'true', argv.use_test_ca === 'true', + function () { + console.log('OK:', argv.test_case); + }); } /** diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index 81cd9fa5b95..070a02e0fe8 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -53,30 +53,35 @@ describe('Interop tests', function() { }); // This depends on not using a binary stream it('should pass empty_unary', function(done) { - interop_client.runTest(port, name_override, 'empty_unary', true, done); + interop_client.runTest(port, name_override, 'empty_unary', true, true, + done); }); // This fails due to an unknown bug it('should pass large_unary', function(done) { - interop_client.runTest(port, name_override, 'large_unary', true, done); + interop_client.runTest(port, name_override, 'large_unary', true, true, + done); }); it('should pass client_streaming', function(done) { - interop_client.runTest(port, name_override, 'client_streaming', true, done); + interop_client.runTest(port, name_override, 'client_streaming', true, true, + done); }); it('should pass server_streaming', function(done) { - interop_client.runTest(port, name_override, 'server_streaming', true, done); + interop_client.runTest(port, name_override, 'server_streaming', true, true, + done); }); it('should pass ping_pong', function(done) { - interop_client.runTest(port, name_override, 'ping_pong', true, done); + interop_client.runTest(port, name_override, 'ping_pong', true, true, done); }); it('should pass empty_stream', function(done) { - interop_client.runTest(port, name_override, 'empty_stream', true, done); + interop_client.runTest(port, name_override, 'empty_stream', true, true, + done); }); it('should pass cancel_after_begin', function(done) { interop_client.runTest(port, name_override, 'cancel_after_begin', true, - done); + true, done); }); it('should pass cancel_after_first_response', function(done) { interop_client.runTest(port, name_override, 'cancel_after_first_response', - true, done); + true, true, done); }); }); From d0d007e6d1139625e05ebd5859289c08a8668033 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 10:28:09 -0800 Subject: [PATCH 146/232] change metadata getters to return const& --- include/grpc++/client_context.h | 4 ++-- include/grpc++/server_context.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 7f1069ea5ee..8345a6f5aff 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -81,12 +81,12 @@ class ClientContext { void AddMetadata(const grpc::string &meta_key, const grpc::string &meta_value); - std::multimap GetServerInitialMetadata() { + const std::multimap& GetServerInitialMetadata() { GPR_ASSERT(initial_metadata_received_); return recv_initial_metadata_; } - std::multimap GetServerTrailingMetadata() { + const std::multimap& GetServerTrailingMetadata() { // TODO(yangg) check finished return trailing_metadata_; } diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 853f91f4671..3a7b693f9a9 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -76,7 +76,7 @@ class ServerContext final { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); - std::multimap client_metadata() { + const std::multimap& client_metadata() { return client_metadata_; } From 47b30b0b26e676d78e2683d1f9bb710ab237f138 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Feb 2015 11:31:55 -0800 Subject: [PATCH 147/232] Added prod SSL support to Node Dockerfile --- tools/dockerfile/grpc_node/Dockerfile | 7 +++++++ tools/gce_setup/grpc_docker.sh | 19 ++++++++++++++++--- tools/gce_setup/shared_startup_funcs.sh | 4 ++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tools/dockerfile/grpc_node/Dockerfile b/tools/dockerfile/grpc_node/Dockerfile index ce582d2ef12..59aa8cfd1c6 100644 --- a/tools/dockerfile/grpc_node/Dockerfile +++ b/tools/dockerfile/grpc_node/Dockerfile @@ -11,4 +11,11 @@ RUN make install_c -C /var/local/git/grpc RUN cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild +# Add a cacerts directory containing the Google root pem file, allowing the +# ruby client to access the production test instance +ADD cacerts cacerts + +# Add a service_account directory containing the auth creds file +ADD service_account service_account + CMD ["/usr/bin/nodejs", "/var/local/git/grpc/src/node/interop/interop_server.js", "--use_tls=true", "--port=8040"] \ No newline at end of file diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 1c38582cb81..980a4f6932a 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -766,7 +766,7 @@ grpc_interop_test() { echo " $ssh_cmd" echo "on $host" [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & PID=$! sleep 10 echo "pid is $PID" @@ -821,7 +821,7 @@ grpc_cloud_prod_test() { echo " $ssh_cmd" echo "on $host" [[ $dry_run == 1 ]] && return 0 # don't run the command on a dry run - gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & + gcloud compute $project_opt ssh $zone_opt $host --command "$cmd" & PID=$! sleep 10 echo "pid is $PID" @@ -1015,11 +1015,24 @@ grpc_interop_gen_php_cmd() { # cmd=$($grpc_gen_test_cmd $flags) grpc_interop_gen_node_cmd() { local cmd_prefix="sudo docker run grpc/node"; - local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; + local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true --use_test_ca=true"; local the_cmd="$cmd_prefix $test_script $@"; echo $the_cmd } +# constructs the full dockerized node interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_gen_node_cmd() { + local cmd_prefix="sudo docker run grpc/node"; + local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; + local gfe_flags=$(_grpc_prod_gfe_flags); + local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; + echo $the_cmd +} + # constructs the full dockerized cpp interop test cmd. # # call-seq: diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index a6f73d16367..2257466d58b 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -388,6 +388,10 @@ grpc_dockerfile_install() { grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; } + [[ $image_label == "grpc/node" ]] && { + grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; + grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; + } [[ $image_label == "grpc/cxx" ]] && { grpc_docker_sync_roots_pem $dockerfile_dir/cacerts || return 1; grpc_docker_sync_service_account $dockerfile_dir/service_account || return 1; From 7cc2c309f3615a365a0ce0f19d8dac1a42b34c4c Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 12:33:37 -0800 Subject: [PATCH 148/232] Mac-specific Makefile inclusions and installation instructions Not yet fully building due to some gtest anomalies on Mac. --- INSTALL | 38 +++++++++++++++++++++++++++++++++++++ Makefile | 2 ++ templates/Makefile.template | 2 ++ 3 files changed, 42 insertions(+) diff --git a/INSTALL b/INSTALL index d2f08ec677e..f1e7aa7bf43 100644 --- a/INSTALL +++ b/INSTALL @@ -95,6 +95,44 @@ will need clang and its instrumented libc++: # apt-get install clang libc++-dev +Mac-specific notes: +------------------- + +For a Mac system, git is not available by default. You will first need to +install Xcode from the Mac AppStore and then run the following command from a +terminal: + + $ sudo xcode-select --install + +You should also install "port" following the instructions at +https://www.macports.org . This will reside in /opt/local/bin/port for +most Mac installations. Do the "git submodule" command listed above. + +Then execute the following for all the needed build dependencies + + $ sudo /opt/local/bin/port install autoconf automake libtool gflags cmake + $ mkdir ~/gtest + $ svn checkout http://googletest.googlecode.com/svn/trunk/ gtest-svn + $ mkdir mybuild + $ cd mybuild + $ cmake ../gtest-svn + $ make + $ make gtest.a gtest_main.a + $ sudo cp libgtest.a libgtest_main.a /opt/local/lib + $ sudo mkdir /opt/local/include/gtest + $ sudo cp -pr ../gtest-svn/include/gtest /opt/local/include/gtest + +We will also need to make openssl and install it appropriately + + $ cd + $ cd third_party/openssl + $ sudo make install + $ cd ../../ + +If you are going to make changes and need to regenerate the projects file, +you will need to install certain modules for python. + + $ sudo easy_install simplejson mako A word on OpenSSL ----------------- diff --git a/Makefile b/Makefile index 485042b5b3e..97a00e0a1a1 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,9 @@ LDFLAGS += -g -fPIC INCLUDES = . include $(GENDIR) ifeq ($(SYSTEM),Darwin) +INCLUDES += /usr/local/ssl/include /opt/local/include LIBS = m z +LDFLAGS += -L/usr/local/ssl/lib -L/opt/local/lib else LIBS = rt m z pthread LDFLAGS += -pthread diff --git a/templates/Makefile.template b/templates/Makefile.template index 3e0f77c0142..d107801e083 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -194,7 +194,9 @@ LDFLAGS += -g -fPIC INCLUDES = . include $(GENDIR) ifeq ($(SYSTEM),Darwin) +INCLUDES += /usr/local/ssl/include /opt/local/include LIBS = m z +LDFLAGS += -L/usr/local/ssl/lib -L/opt/local/lib else LIBS = rt m z pthread LDFLAGS += -pthread From 67fb94a9b41e4a88cb1a2035cdbee6bc0a0a8f9f Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 12:40:25 -0800 Subject: [PATCH 149/232] remove nonexistent stream_context_interface.h from build.json --- Makefile | 1 - build.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 485042b5b3e..e45b128dbed 100644 --- a/Makefile +++ b/Makefile @@ -3025,7 +3025,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server_credentials.h \ include/grpc++/status.h \ include/grpc++/stream.h \ - include/grpc++/stream_context_interface.h \ LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) diff --git a/build.json b/build.json index 07af69126b8..4bca52e3027 100644 --- a/build.json +++ b/build.json @@ -415,8 +415,7 @@ "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", "include/grpc++/status.h", - "include/grpc++/stream.h", - "include/grpc++/stream_context_interface.h" + "include/grpc++/stream.h" ], "headers": [ "src/cpp/client/channel.h", From 60ea9130e10fad6a1de0275120f14416712de449 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 12:40:25 -0800 Subject: [PATCH 150/232] remove nonexistent stream_context_interface.h from build.json --- Makefile | 1 - build.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 485042b5b3e..e45b128dbed 100644 --- a/Makefile +++ b/Makefile @@ -3025,7 +3025,6 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server_credentials.h \ include/grpc++/status.h \ include/grpc++/stream.h \ - include/grpc++/stream_context_interface.h \ LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) diff --git a/build.json b/build.json index 07af69126b8..4bca52e3027 100644 --- a/build.json +++ b/build.json @@ -415,8 +415,7 @@ "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", "include/grpc++/status.h", - "include/grpc++/stream.h", - "include/grpc++/stream_context_interface.h" + "include/grpc++/stream.h" ], "headers": [ "src/cpp/client/channel.h", From 337a2ddba59563e7370b133d63ab8bd9ebeb7232 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 13 Feb 2015 15:41:41 -0800 Subject: [PATCH 151/232] migration to new C API --- src/csharp/GrpcApi/MathGrpc.cs | 6 +- src/csharp/GrpcApi/TestServiceGrpc.cs | 6 +- src/csharp/GrpcCore/Calls.cs | 58 +-- src/csharp/GrpcCore/GrpcCore.csproj | 6 +- src/csharp/GrpcCore/Internal/AsyncCall.cs | 493 ++++++++++-------- .../Internal/BatchContextSafeHandle.cs | 96 ++++ .../GrpcCore/Internal/CallSafeHandle.cs | 138 ++--- ...ver.cs => ClientStreamingInputObserver.cs} | 15 +- .../Internal/CompletionQueueSafeHandle.cs | 16 - src/csharp/GrpcCore/Internal/Event.cs | 224 -------- .../GrpcCore/Internal/GrpcThreadPool.cs | 47 +- .../Internal/SafeHandleZeroIsInvalid.cs | 6 + .../GrpcCore/Internal/ServerSafeHandle.cs | 16 +- ...er.cs => ServerStreamingOutputObserver.cs} | 10 +- src/csharp/GrpcCore/Server.cs | 31 +- src/csharp/GrpcCore/ServerCallHandler.cs | 28 +- src/csharp/GrpcCoreTests/ClientServerTest.cs | 67 ++- src/csharp/ext/grpc_csharp_ext.c | 365 +++++++++++++ 18 files changed, 953 insertions(+), 675 deletions(-) create mode 100644 src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs rename src/csharp/GrpcCore/Internal/{StreamingInputObserver.cs => ClientStreamingInputObserver.cs} (88%) delete mode 100644 src/csharp/GrpcCore/Internal/Event.cs rename src/csharp/GrpcCore/Internal/{ServerWritingObserver.cs => ServerStreamingOutputObserver.cs} (87%) diff --git a/src/csharp/GrpcApi/MathGrpc.cs b/src/csharp/GrpcApi/MathGrpc.cs index caea1608ecf..44e704e4969 100644 --- a/src/csharp/GrpcApi/MathGrpc.cs +++ b/src/csharp/GrpcApi/MathGrpc.cs @@ -81,7 +81,7 @@ namespace math Task DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)); - Task Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); + void Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); ClientStreamingAsyncResult Sum(CancellationToken token = default(CancellationToken)); @@ -109,10 +109,10 @@ namespace math return Calls.AsyncUnaryCall(call, request, token); } - public Task Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public void Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) { var call = new Google.GRPC.Core.Call(fibMethod, channel); - return Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + Calls.AsyncServerStreamingCall(call, request, responseObserver, token); } public ClientStreamingAsyncResult Sum(CancellationToken token = default(CancellationToken)) diff --git a/src/csharp/GrpcApi/TestServiceGrpc.cs b/src/csharp/GrpcApi/TestServiceGrpc.cs index 6534a44ef4f..64d5c095633 100644 --- a/src/csharp/GrpcApi/TestServiceGrpc.cs +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -99,7 +99,7 @@ namespace grpc.testing Task UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)); - Task StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); + void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); ClientStreamingAsyncResult StreamingInputCall(CancellationToken token = default(CancellationToken)); @@ -141,9 +141,9 @@ namespace grpc.testing return Calls.AsyncUnaryCall(call, request, token); } - public Task StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) { + public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) { var call = new Google.GRPC.Core.Call(streamingOutputCallMethod, channel); - return Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + Calls.AsyncServerStreamingCall(call, request, responseObserver, token); } public ClientStreamingAsyncResult StreamingInputCall(CancellationToken token = default(CancellationToken)) diff --git a/src/csharp/GrpcCore/Calls.cs b/src/csharp/GrpcCore/Calls.cs index d89d9a16f9b..e5ddd879d68 100644 --- a/src/csharp/GrpcCore/Calls.cs +++ b/src/csharp/GrpcCore/Calls.cs @@ -47,50 +47,42 @@ namespace Google.GRPC.Core { public static TResponse BlockingUnaryCall(Call call, TRequest req, CancellationToken token) { - //TODO: implement this in real synchronous style once new GRPC C core API is available. - return AsyncUnaryCall(call, req, token).Result; + //TODO: implement this in real synchronous style. + try { + return AsyncUnaryCall(call, req, token).Result; + } catch(AggregateException ae) { + foreach (var e in ae.InnerExceptions) + { + if (e is RpcException) + { + throw e; + } + } + throw; + } } public static async Task AsyncUnaryCall(Call call, TRequest req, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestSerializer, call.ResponseDeserializer); - asyncCall.Initialize(call.Channel, call.MethodName); - asyncCall.Start(false, GetCompletionQueue()); - - await asyncCall.WriteAsync(req); - await asyncCall.WritesCompletedAsync(); - - TResponse response = await asyncCall.ReadAsync(); - - Status status = await asyncCall.Finished; - - if (status.StatusCode != StatusCode.GRPC_STATUS_OK) - { - throw new RpcException(status); - } - return response; + asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); + return await asyncCall.UnaryCallAsync(req); } - public static async Task AsyncServerStreamingCall(Call call, TRequest req, IObserver outputs, CancellationToken token) + public static void AsyncServerStreamingCall(Call call, TRequest req, IObserver outputs, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestSerializer, call.ResponseDeserializer); - asyncCall.Initialize(call.Channel, call.MethodName); - asyncCall.Start(false, GetCompletionQueue()); - asyncCall.StartReadingToStream(outputs); - - await asyncCall.WriteAsync(req); - await asyncCall.WritesCompletedAsync(); + asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); + asyncCall.StartServerStreamingCall(req, outputs); } public static ClientStreamingAsyncResult AsyncClientStreamingCall(Call call, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestSerializer, call.ResponseDeserializer); - asyncCall.Initialize(call.Channel, call.MethodName); - asyncCall.Start(false, GetCompletionQueue()); - - var task = asyncCall.ReadAsync(); - var inputs = new StreamingInputObserver(asyncCall); + asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); + var task = asyncCall.ClientStreamingCallAsync(); + var inputs = new ClientStreamingInputObserver(asyncCall); return new ClientStreamingAsyncResult(task, inputs); } @@ -102,12 +94,10 @@ namespace Google.GRPC.Core public static IObserver DuplexStreamingCall(Call call, IObserver outputs, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestSerializer, call.ResponseDeserializer); - asyncCall.Initialize(call.Channel, call.MethodName); - asyncCall.Start(false, GetCompletionQueue()); + asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.MethodName); - asyncCall.StartReadingToStream(outputs); - var inputs = new StreamingInputObserver(asyncCall); - return inputs; + asyncCall.StartDuplexStreamingCall(outputs); + return new ClientStreamingInputObserver(asyncCall); } private static CompletionQueueSafeHandle GetCompletionQueue() { diff --git a/src/csharp/GrpcCore/GrpcCore.csproj b/src/csharp/GrpcCore/GrpcCore.csproj index 34b9f6dfb82..a574f181c8a 100644 --- a/src/csharp/GrpcCore/GrpcCore.csproj +++ b/src/csharp/GrpcCore/GrpcCore.csproj @@ -47,21 +47,21 @@ - - - + + + diff --git a/src/csharp/GrpcCore/Internal/AsyncCall.cs b/src/csharp/GrpcCore/Internal/AsyncCall.cs index d5f3239e1e0..ae7428978ea 100644 --- a/src/csharp/GrpcCore/Internal/AsyncCall.cs +++ b/src/csharp/GrpcCore/Internal/AsyncCall.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -41,39 +41,28 @@ using Google.GRPC.Core.Internal; namespace Google.GRPC.Core.Internal { - /// - /// Listener for call events that can be delivered from a completion queue. - /// - internal interface ICallEventListener { - - void OnClientMetadata(); - - void OnRead(byte[] payload); - - void OnWriteAccepted(GRPCOpError error); - - void OnFinishAccepted(GRPCOpError error); - - // ignore the status on server - void OnFinished(Status status); - } - /// /// Handle native call lifecycle and provides convenience methods. /// - internal class AsyncCall: ICallEventListener, IDisposable + internal class AsyncCall : IDisposable { readonly Func serializer; readonly Func deserializer; - // TODO: make sure the delegate doesn't get garbage collected while + // TODO: make sure the delegate doesn't get garbage collected while // native callbacks are in the completion queue. - readonly EventCallbackDelegate callbackHandler; + readonly CompletionCallbackDelegate unaryResponseHandler; + readonly CompletionCallbackDelegate finishedHandler; + readonly CompletionCallbackDelegate writeFinishedHandler; + readonly CompletionCallbackDelegate readFinishedHandler; + readonly CompletionCallbackDelegate halfclosedHandler; + readonly CompletionCallbackDelegate finishedServersideHandler; object myLock = new object(); bool disposed; CallSafeHandle call; + bool server; bool started; bool errorOccured; @@ -85,54 +74,25 @@ namespace Google.GRPC.Core.Internal TaskCompletionSource writeTcs; TaskCompletionSource readTcs; + + TaskCompletionSource finishedServersideTcs = new TaskCompletionSource(); TaskCompletionSource halfcloseTcs = new TaskCompletionSource(); TaskCompletionSource finishedTcs = new TaskCompletionSource(); + TaskCompletionSource unaryResponseTcs; + IObserver readObserver; public AsyncCall(Func serializer, Func deserializer) { this.serializer = serializer; this.deserializer = deserializer; - this.callbackHandler = HandleEvent; - } - - public Task WriteAsync(TWrite msg) - { - return StartWrite(msg, false).Task; - } - - public Task WritesCompletedAsync() - { - WritesDone(); - return halfcloseTcs.Task; - } - - public Task WriteStatusAsync(Status status) - { - WriteStatus(status); - return halfcloseTcs.Task; - } - - public Task ReadAsync() - { - return StartRead().Task; - } - - public Task Halfclosed - { - get - { - return halfcloseTcs.Task; - } - } - - public Task Finished - { - get - { - return finishedTcs.Task; - } + this.unaryResponseHandler = HandleUnaryResponseCompletion; + this.finishedHandler = HandleFinished; + this.writeFinishedHandler = HandleWriteFinished; + this.readFinishedHandler = HandleReadFinished; + this.halfclosedHandler = HandleHalfclosed; + this.finishedServersideHandler = HandleFinishedServerside; } /// @@ -147,14 +107,14 @@ namespace Google.GRPC.Core.Internal throw new InvalidOperationException("Already registered an observer."); } this.readObserver = readObserver; - StartRead(); + ReceiveMessageAsync(); } } - public void Initialize(Channel channel, String methodName) { + public void Initialize(Channel channel, CompletionQueueSafeHandle cq, String methodName) { lock (myLock) { - this.call = CallSafeHandle.Create(channel.Handle, methodName, channel.Target, Timespec.InfFuture); + this.call = CallSafeHandle.Create(channel.Handle, cq, methodName, channel.Target, Timespec.InfFuture); } } @@ -163,42 +123,75 @@ namespace Google.GRPC.Core.Internal lock(myLock) { this.call = call; + started = true; + server = true; } } - // Client only - public void Start(bool buffered, CompletionQueueSafeHandle cq) + + public Task UnaryCallAsync(TWrite msg) { lock (myLock) { - if (started) - { - throw new InvalidOperationException("Already started."); - } - - call.Invoke(cq, buffered, callbackHandler, callbackHandler); started = true; + halfcloseRequested = true; + + // TODO: handle serialization error... + byte[] payload = serializer(msg); + + unaryResponseTcs = new TaskCompletionSource(); + call.StartUnary(payload, unaryResponseHandler); + + return unaryResponseTcs.Task; } } - // Server only - public void Accept(CompletionQueueSafeHandle cq) + public Task ClientStreamingCallAsync() { lock (myLock) { - if (started) - { - throw new InvalidOperationException("Already started."); - } + started = true; + + unaryResponseTcs = new TaskCompletionSource(); + call.StartClientStreaming(unaryResponseHandler); + + return unaryResponseTcs.Task; + } + } - call.ServerAccept(cq, callbackHandler); - call.ServerEndInitialMetadata(0); + public void StartServerStreamingCall(TWrite msg, IObserver readObserver) + { + lock (myLock) + { started = true; + halfcloseRequested = true; + + this.readObserver = readObserver; + + // TODO: handle serialization error... + byte[] payload = serializer(msg); + + call.StartServerStreaming(payload, finishedHandler); + + ReceiveMessageAsync(); } } - public TaskCompletionSource StartWrite(TWrite msg, bool buffered) + public void StartDuplexStreamingCall(IObserver readObserver) { + lock (myLock) + { + started = true; + + this.readObserver = readObserver; + + call.StartDuplexStreaming(finishedHandler); + + ReceiveMessageAsync(); + } + } + + public Task SendMessageAsync(TWrite msg) { lock (myLock) { CheckStarted(); @@ -219,14 +212,13 @@ namespace Google.GRPC.Core.Internal // TODO: wrap serialization... byte[] payload = serializer(msg); - call.StartWrite(payload, buffered, callbackHandler); + call.StartSendMessage(payload, writeFinishedHandler); writeTcs = new TaskCompletionSource(); - return writeTcs; + return writeTcs.Task; } } - // client only - public void WritesDone() + public Task SendCloseFromClientAsync() { lock (myLock) { @@ -240,13 +232,13 @@ namespace Google.GRPC.Core.Internal throw new InvalidOperationException("Already halfclosed."); } - call.WritesDone(callbackHandler); + call.StartSendCloseFromClient(halfclosedHandler); halfcloseRequested = true; + return halfcloseTcs.Task; } } - // server only - public void WriteStatus(Status status) + public Task SendStatusFromServerAsync(Status status) { lock (myLock) { @@ -260,12 +252,13 @@ namespace Google.GRPC.Core.Internal throw new InvalidOperationException("Already halfclosed."); } - call.StartWriteStatus(status, callbackHandler); + call.StartSendStatusFromServer(status, halfclosedHandler); halfcloseRequested = true; + return halfcloseTcs.Task; } } - public TaskCompletionSource StartRead() + public Task ReceiveMessageAsync() { lock (myLock) { @@ -285,10 +278,19 @@ namespace Google.GRPC.Core.Internal throw new InvalidOperationException("Only one read can be pending at a time"); } - call.StartRead(callbackHandler); + call.StartReceiveMessage(readFinishedHandler); readTcs = new TaskCompletionSource(); - return readTcs; + return readTcs.Task; + } + } + + internal Task StartServerSide() + { + lock (myLock) + { + call.StartServerSide(finishedServersideHandler); + return finishedServersideTcs.Task; } } @@ -317,107 +319,7 @@ namespace Google.GRPC.Core.Internal // grpc_call_cancel_with_status is threadsafe call.CancelWithStatus(status); } - - public void OnClientMetadata() - { - // TODO: implement.... - } - - public void OnRead(byte[] payload) - { - TaskCompletionSource oldTcs = null; - IObserver observer = null; - lock (myLock) - { - oldTcs = readTcs; - readTcs = null; - if (payload == null) - { - doneWithReading = true; - } - observer = readObserver; - } - - // TODO: wrap deserialization... - TRead msg = payload != null ? deserializer(payload) : default(TRead); - - oldTcs.SetResult(msg); - - // TODO: make sure we deliver reads in the right order. - - if (observer != null) - { - if (payload != null) - { - // TODO: wrap to handle exceptions - observer.OnNext(msg); - - // start a new read - StartRead(); - } - else - { - // TODO: wrap to handle exceptions; - observer.OnCompleted(); - } - - } - } - - public void OnWriteAccepted(GRPCOpError error) - { - TaskCompletionSource oldTcs = null; - lock (myLock) - { - UpdateErrorOccured(error); - oldTcs = writeTcs; - writeTcs = null; - } - - if (errorOccured) - { - // TODO: use the right type of exception... - oldTcs.SetException(new Exception("Write failed")); - } - else - { - // TODO: where does the continuation run? - oldTcs.SetResult(null); - } - } - - public void OnFinishAccepted(GRPCOpError error) - { - lock (myLock) - { - UpdateErrorOccured(error); - halfclosed = true; - } - - if (errorOccured) - { - halfcloseTcs.SetException(new Exception("Halfclose failed")); - - } - else - { - halfcloseTcs.SetResult(null); - } - - } - - public void OnFinished(Status status) - { - lock (myLock) - { - finishedStatus = status; - - DisposeResourcesIfNeeded(); - } - finishedTcs.SetResult(status); - - } - + public void Dispose() { Dispose(true); @@ -434,7 +336,7 @@ namespace Google.GRPC.Core.Internal { call.Dispose(); } - } + } disposed = true; } } @@ -489,38 +391,195 @@ namespace Google.GRPC.Core.Internal } } - private void HandleEvent(IntPtr eventPtr) { + private void CompleteStreamObserver(Status status) { + if (status.StatusCode != StatusCode.GRPC_STATUS_OK) + { + // TODO: wrap to handle exceptions; + readObserver.OnError(new RpcException(status)); + } else { + // TODO: wrap to handle exceptions; + readObserver.OnCompleted(); + } + } + + private void HandleUnaryResponseCompletion(GRPCOpError error, IntPtr batchContextPtr) { + try { + + TaskCompletionSource tcs; + lock(myLock) { + tcs = unaryResponseTcs; + } + + // we're done with this call, get rid of the native object. + call.Dispose(); + + var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + + if (error != GRPCOpError.GRPC_OP_OK) { + tcs.SetException(new RpcException( + new Status(StatusCode.GRPC_STATUS_INTERNAL, "Internal error occured.") + )); + return; + } + + var status = ctx.GetReceivedStatus(); + if (status.StatusCode != StatusCode.GRPC_STATUS_OK) { + tcs.SetException(new RpcException(status)); + return; + } + + // TODO: handle deserialize error... + var msg = deserializer(ctx.GetReceivedMessage()); + tcs.SetResult(msg); + } catch(Exception e) { + Console.WriteLine("Caught exception in a native handler: " + e); + } + } + + private void HandleWriteFinished(GRPCOpError error, IntPtr batchContextPtr) { + try { + + TaskCompletionSource oldTcs = null; + lock (myLock) + { + UpdateErrorOccured(error); + oldTcs = writeTcs; + writeTcs = null; + } + + if (errorOccured) + { + // TODO: use the right type of exception... + oldTcs.SetException(new Exception("Write failed")); + } + else + { + // TODO: where does the continuation run? + oldTcs.SetResult(null); + } + + } catch(Exception e) { + Console.WriteLine("Caught exception in a native handler: " + e); + } + } + + private void HandleHalfclosed(GRPCOpError error, IntPtr batchContextPtr) { + try { + lock (myLock) + { + UpdateErrorOccured(error); + halfclosed = true; + } + + if (errorOccured) + { + halfcloseTcs.SetException(new Exception("Halfclose failed")); + + } + else + { + halfcloseTcs.SetResult(null); + } + } catch(Exception e) { + Console.WriteLine("Caught exception in a native handler: " + e); + } + } + + private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) { try { - var ev = new EventSafeHandleNotOwned(eventPtr); - switch (ev.GetCompletionType()) + + var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + var payload = ctx.GetReceivedMessage(); + + TaskCompletionSource oldTcs = null; + IObserver observer = null; + + Nullable status = null; + + lock (myLock) { - case GRPCCompletionType.GRPC_CLIENT_METADATA_READ: - OnClientMetadata(); - break; + oldTcs = readTcs; + readTcs = null; + if (payload == null) + { + doneWithReading = true; + } + observer = readObserver; + status = finishedStatus; + } + + // TODO: wrap deserialization... + TRead msg = payload != null ? deserializer(payload) : default(TRead); - case GRPCCompletionType.GRPC_READ: - byte[] payload = ev.GetReadData(); - OnRead(payload); - break; + oldTcs.SetResult(msg); - case GRPCCompletionType.GRPC_WRITE_ACCEPTED: - OnWriteAccepted(ev.GetWriteAccepted()); - break; + // TODO: make sure we deliver reads in the right order. - case GRPCCompletionType.GRPC_FINISH_ACCEPTED: - OnFinishAccepted(ev.GetFinishAccepted()); - break; + if (observer != null) { + if (payload != null) + { + // TODO: wrap to handle exceptions + observer.OnNext(msg); + + // start a new read + ReceiveMessageAsync(); + } + else + { + if (!server) { + if (status.HasValue) { + CompleteStreamObserver(status.Value); + } + } else { + // TODO: wrap to handle exceptions.. + observer.OnCompleted(); + } + // TODO: completeStreamObserver serverside... + } + } + } catch(Exception e) { + Console.WriteLine("Caught exception in a native handler: " + e); + } + } + + private void HandleFinished(GRPCOpError error, IntPtr batchContextPtr) { + try { + var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + var status = ctx.GetReceivedStatus(); + + bool wasDoneWithReading; + + lock (myLock) + { + finishedStatus = status; - case GRPCCompletionType.GRPC_FINISHED: - OnFinished(ev.GetFinished()); - break; + DisposeResourcesIfNeeded(); - default: - throw new ArgumentException("Unexpected completion type"); + wasDoneWithReading = doneWithReading; } + + if (wasDoneWithReading) { + CompleteStreamObserver(status); + } + + } catch(Exception e) { + Console.WriteLine("Caught exception in a native handler: " + e); + } + } + + private void HandleFinishedServerside(GRPCOpError error, IntPtr batchContextPtr) { + try { + var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + + // TODO: handle error ... + + finishedServersideTcs.SetResult(null); + + call.Dispose(); + } catch(Exception e) { Console.WriteLine("Caught exception in a native handler: " + e); } } } -} +} \ No newline at end of file diff --git a/src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs b/src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs new file mode 100644 index 00000000000..ddfd94a3b56 --- /dev/null +++ b/src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs @@ -0,0 +1,96 @@ +#region Copyright notice and license + +// 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. + +#endregion + +using System; +using System.Runtime.InteropServices; +using Google.GRPC.Core; + +namespace Google.GRPC.Core.Internal +{ + /// + /// Not owned version of + /// grpcsharp_batch_context + /// + internal class BatchContextSafeHandleNotOwned : SafeHandleZeroIsInvalid + { + [DllImport("grpc_csharp_ext.dll")] + static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandleNotOwned ctx); + + [DllImport("grpc_csharp_ext.dll")] + static extern void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandleNotOwned ctx, byte[] buffer, UIntPtr bufferLen); + + [DllImport("grpc_csharp_ext.dll")] + static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandleNotOwned ctx); + + [DllImport("grpc_csharp_ext.dll")] + static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandleNotOwned ctx); // returns const char* + + [DllImport("grpc_csharp_ext.dll")] + static extern CallSafeHandle grpcsharp_batch_context_server_rpc_new_call(BatchContextSafeHandleNotOwned ctx); + + [DllImport("grpc_csharp_ext.dll")] + static extern IntPtr grpcsharp_batch_context_server_rpc_new_method(BatchContextSafeHandleNotOwned ctx); // returns const char* + + public BatchContextSafeHandleNotOwned(IntPtr handle) : base(false) + { + SetHandle(handle); + } + + public Status GetReceivedStatus() + { + // TODO: can the native method return string directly? + string details = Marshal.PtrToStringAnsi(grpcsharp_batch_context_recv_status_on_client_details(this)); + return new Status(grpcsharp_batch_context_recv_status_on_client_status(this), details); + } + + public byte[] GetReceivedMessage() + { + IntPtr len = grpcsharp_batch_context_recv_message_length(this); + if (len == new IntPtr(-1)) + { + return null; + } + byte[] data = new byte[(int) len]; + grpcsharp_batch_context_recv_message_to_buffer(this, data, new UIntPtr((ulong)data.Length)); + return data; + } + + public CallSafeHandle GetServerRpcNewCall() { + return grpcsharp_batch_context_server_rpc_new_call(this); + } + + public string GetServerRpcNewMethod() { + return Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this)); + } + } +} \ No newline at end of file diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index e9ccd8d5f99..55d66a62ca7 100644 --- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -38,8 +38,8 @@ using Google.GRPC.Core; namespace Google.GRPC.Core.Internal { - // TODO: we need to make sure that the delegates are not collected before invoked. - internal delegate void EventCallbackDelegate(IntPtr eventPtr); + //TODO: rename the delegate + internal delegate void CompletionCallbackDelegate(GRPCOpError error, IntPtr batchContextPtr); /// /// grpc_call from @@ -49,142 +49,108 @@ namespace Google.GRPC.Core.Internal const UInt32 GRPC_WRITE_BUFFER_HINT = 1; [DllImport("grpc_csharp_ext.dll")] - static extern CallSafeHandle grpcsharp_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline); + static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags); + static extern GRPCCallError grpcsharp_call_cancel(CallSafeHandle call); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags); - - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_invoke_old")] - static extern GRPCCallError grpcsharp_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, - [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, - [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, - UInt32 flags); + static extern GRPCCallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag); - - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_server_accept_old")] - static extern GRPCCallError grpcsharp_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback); + static extern GRPCCallError grpcsharp_call_start_unary(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback, + byte[] send_buffer, UIntPtr send_buffer_len); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags); + static extern GRPCCallError grpcsharp_call_start_client_streaming(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_cancel(CallSafeHandle call); + static extern GRPCCallError grpcsharp_call_start_server_streaming(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback, + byte[] send_buffer, UIntPtr send_buffer_len); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); + static extern GRPCCallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag); - - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_write_status_old")] - static extern GRPCCallError grpcsharp_call_start_write_status_old_CALLBACK(CallSafeHandle call, StatusCode statusCode, string statusMessage, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); + static extern GRPCCallError grpcsharp_call_send_message(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback, + byte[] send_buffer, UIntPtr send_buffer_len); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_writes_done_old(CallSafeHandle call, IntPtr tag); - - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_writes_done_old")] - static extern GRPCCallError grpcsharp_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); + static extern GRPCCallError grpcsharp_call_send_close_from_client(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_call_start_read_old(CallSafeHandle call, IntPtr tag); - - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_read_old")] - static extern GRPCCallError grpcsharp_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); + static extern GRPCCallError grpcsharp_call_send_status_from_server(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback, StatusCode statusCode, string statusMessage); [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_call_start_write_from_copied_buffer(CallSafeHandle call, - byte[] buffer, UIntPtr length, - IntPtr tag, UInt32 flags); + static extern GRPCCallError grpcsharp_call_recv_message(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_write_from_copied_buffer")] - static extern void grpcsharp_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call, - byte[] buffer, UIntPtr length, - [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback, - UInt32 flags); + [DllImport("grpc_csharp_ext.dll")] + static extern GRPCCallError grpcsharp_call_start_serverside(CallSafeHandle call, + [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); - [DllImport("grpc_csharp_ext.dll")] + [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_call_destroy(IntPtr call); - private CallSafeHandle() - { - } - - /// - /// Creates a client call. - /// - public static CallSafeHandle Create(ChannelSafeHandle channel, string method, string host, Timespec deadline) - { - return grpcsharp_channel_create_call_old(channel, method, host, deadline); - } - - public void Invoke(CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, bool buffered) - { - AssertCallOk(grpcsharp_call_invoke_old(this, cq, metadataReadTag, finishedTag, GetFlags(buffered))); - } - - public void Invoke(CompletionQueueSafeHandle cq, bool buffered, EventCallbackDelegate metadataReadCallback, EventCallbackDelegate finishedCallback) - { - AssertCallOk(grpcsharp_call_invoke_old_CALLBACK(this, cq, metadataReadCallback, finishedCallback, GetFlags(buffered))); - } - public void ServerAccept(CompletionQueueSafeHandle cq, IntPtr finishedTag) + private CallSafeHandle() { - AssertCallOk(grpcsharp_call_server_accept_old(this, cq, finishedTag)); } - public void ServerAccept(CompletionQueueSafeHandle cq, EventCallbackDelegate callback) + public static CallSafeHandle Create(ChannelSafeHandle channel, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline) { - AssertCallOk(grpcsharp_call_server_accept_old_CALLBACK(this, cq, callback)); + return grpcsharp_channel_create_call(channel, cq, method, host, deadline); } - public void ServerEndInitialMetadata(UInt32 flags) + public void StartUnary(byte[] payload, CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_server_end_initial_metadata_old(this, flags)); + AssertCallOk(grpcsharp_call_start_unary(this, callback, payload, new UIntPtr((ulong) payload.Length))); } - public void StartWrite(byte[] payload, IntPtr tag, bool buffered) + public void StartClientStreaming(CompletionCallbackDelegate callback) { - grpcsharp_call_start_write_from_copied_buffer(this, payload, new UIntPtr((ulong) payload.Length), tag, GetFlags(buffered)); + AssertCallOk(grpcsharp_call_start_client_streaming(this, callback)); } - public void StartWrite(byte[] payload, bool buffered, EventCallbackDelegate callback) + public void StartServerStreaming(byte[] payload, CompletionCallbackDelegate callback) { - grpcsharp_call_start_write_from_copied_buffer_CALLBACK(this, payload, new UIntPtr((ulong) payload.Length), callback, GetFlags(buffered)); + AssertCallOk(grpcsharp_call_start_server_streaming(this, callback, payload, new UIntPtr((ulong) payload.Length))); } - public void StartWriteStatus(Status status, IntPtr tag) + public void StartDuplexStreaming(CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_start_write_status_old(this, status.StatusCode, status.Detail, tag)); + AssertCallOk(grpcsharp_call_start_duplex_streaming(this, callback)); } - public void StartWriteStatus(Status status, EventCallbackDelegate callback) + public void StartSendMessage(byte[] payload, CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_start_write_status_old_CALLBACK(this, status.StatusCode, status.Detail, callback)); + AssertCallOk(grpcsharp_call_send_message(this, callback, payload, new UIntPtr((ulong) payload.Length))); } - public void WritesDone(IntPtr tag) + public void StartSendCloseFromClient(CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_writes_done_old(this, tag)); + AssertCallOk(grpcsharp_call_send_close_from_client(this, callback)); } - public void WritesDone(EventCallbackDelegate callback) + public void StartSendStatusFromServer(Status status, CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_writes_done_old_CALLBACK(this, callback)); + AssertCallOk(grpcsharp_call_send_status_from_server(this, callback, status.StatusCode, status.Detail)); } - public void StartRead(IntPtr tag) + public void StartReceiveMessage(CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_start_read_old(this, tag)); + AssertCallOk(grpcsharp_call_recv_message(this, callback)); } - public void StartRead(EventCallbackDelegate callback) + public void StartServerSide(CompletionCallbackDelegate callback) { - AssertCallOk(grpcsharp_call_start_read_old_CALLBACK(this, callback)); + AssertCallOk(grpcsharp_call_start_serverside(this, callback)); } public void Cancel() @@ -212,4 +178,4 @@ namespace Google.GRPC.Core.Internal return buffered ? 0 : GRPC_WRITE_BUFFER_HINT; } } -} +} \ No newline at end of file diff --git a/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs b/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs similarity index 88% rename from src/csharp/GrpcCore/Internal/StreamingInputObserver.cs rename to src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs index 60837de5e65..4d10a9bdf96 100644 --- a/src/csharp/GrpcCore/Internal/StreamingInputObserver.cs +++ b/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs @@ -2,11 +2,11 @@ // 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 @@ -16,7 +16,7 @@ // * 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 @@ -36,19 +36,20 @@ using Google.GRPC.Core.Internal; namespace Google.GRPC.Core.Internal { - internal class StreamingInputObserver : IObserver + internal class ClientStreamingInputObserver : IObserver { readonly AsyncCall call; - public StreamingInputObserver(AsyncCall call) + public ClientStreamingInputObserver(AsyncCall call) { this.call = call; } public void OnCompleted() { + // TODO: how bad is the Wait here? - call.WritesCompletedAsync().Wait(); + call.SendCloseFromClientAsync().Wait(); } public void OnError(Exception error) @@ -59,7 +60,7 @@ namespace Google.GRPC.Core.Internal public void OnNext(TWrite value) { // TODO: how bad is the Wait here? - call.WriteAsync(value).Wait(); + call.SendMessageAsync(value).Wait(); } } } diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs index 666f220b8c8..5ea436df197 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -45,12 +45,6 @@ namespace Google.GRPC.Core.Internal [DllImport("grpc_csharp_ext.dll")] static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create(); - [DllImport("grpc_csharp_ext.dll")] - static extern EventSafeHandle grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag, Timespec deadline); - - [DllImport("grpc_csharp_ext.dll")] - static extern EventSafeHandle grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq, Timespec deadline); - [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq); @@ -69,21 +63,11 @@ namespace Google.GRPC.Core.Internal return grpcsharp_completion_queue_create(); } - public EventSafeHandle Next(Timespec deadline) - { - return grpcsharp_completion_queue_next(this, deadline); - } - public GRPCCompletionType NextWithCallback() { return grpcsharp_completion_queue_next_with_callback(this); } - public EventSafeHandle Pluck(IntPtr tag, Timespec deadline) - { - return grpcsharp_completion_queue_pluck(this, tag, deadline); - } - public void Shutdown() { grpcsharp_completion_queue_shutdown(this); diff --git a/src/csharp/GrpcCore/Internal/Event.cs b/src/csharp/GrpcCore/Internal/Event.cs deleted file mode 100644 index 6116e0975af..00000000000 --- a/src/csharp/GrpcCore/Internal/Event.cs +++ /dev/null @@ -1,224 +0,0 @@ -#region Copyright notice and license - -// 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. - -#endregion - -using System; -using System.Runtime.InteropServices; -using Google.GRPC.Core; - -namespace Google.GRPC.Core.Internal -{ - /// - /// grpc_event from grpc/grpc.h - /// - internal class EventSafeHandle : SafeHandleZeroIsInvalid - { - [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_event_finish(IntPtr ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCompletionType grpcsharp_event_type(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern CallSafeHandle grpcsharp_event_call(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCOpError grpcsharp_event_write_accepted(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCOpError grpcsharp_event_finish_accepted(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern StatusCode grpcsharp_event_finished_status(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_finished_details(EventSafeHandle ev); // returns const char* - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_read_length(EventSafeHandle ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_event_read_copy_to_buffer(EventSafeHandle ev, byte[] buffer, UIntPtr bufferLen); - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_server_rpc_new_method(EventSafeHandle ev); // returns const char* - - public GRPCCompletionType GetCompletionType() - { - return grpcsharp_event_type(this); - } - - public GRPCOpError GetWriteAccepted() - { - return grpcsharp_event_write_accepted(this); - } - - public GRPCOpError GetFinishAccepted() - { - return grpcsharp_event_finish_accepted(this); - } - - public Status GetFinished() - { - // TODO: can the native method return string directly? - string details = Marshal.PtrToStringAnsi(grpcsharp_event_finished_details(this)); - return new Status(grpcsharp_event_finished_status(this), details); - } - - public byte[] GetReadData() - { - IntPtr len = grpcsharp_event_read_length(this); - if (len == new IntPtr(-1)) - { - return null; - } - byte[] data = new byte[(int) len]; - grpcsharp_event_read_copy_to_buffer(this, data, new UIntPtr((ulong)data.Length)); - return data; - } - - public CallSafeHandle GetCall() { - return grpcsharp_event_call(this); - } - - public string GetServerRpcNewMethod() { - // TODO: can the native method return string directly? - return Marshal.PtrToStringAnsi(grpcsharp_event_server_rpc_new_method(this)); - } - - //TODO: client_metadata_read event type - - protected override bool ReleaseHandle() - { - grpcsharp_event_finish(handle); - return true; - } - } - - // TODO: this is basically c&p of EventSafeHandle. Unify! - /// - /// Not owned version of - /// grpc_event from grpc/grpc.h - /// - internal class EventSafeHandleNotOwned : SafeHandleZeroIsInvalid - { - [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_event_finish(IntPtr ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCompletionType grpcsharp_event_type(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern CallSafeHandle grpcsharp_event_call(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCOpError grpcsharp_event_write_accepted(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCOpError grpcsharp_event_finish_accepted(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern StatusCode grpcsharp_event_finished_status(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_finished_details(EventSafeHandleNotOwned ev); // returns const char* - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_read_length(EventSafeHandleNotOwned ev); - - [DllImport("grpc_csharp_ext.dll")] - static extern void grpcsharp_event_read_copy_to_buffer(EventSafeHandleNotOwned ev, byte[] buffer, UIntPtr bufferLen); - - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_event_server_rpc_new_method(EventSafeHandleNotOwned ev); // returns const char* - - public EventSafeHandleNotOwned() : base(false) - { - } - - public EventSafeHandleNotOwned(IntPtr handle) : base(false) - { - SetHandle(handle); - } - - public GRPCCompletionType GetCompletionType() - { - return grpcsharp_event_type(this); - } - - public GRPCOpError GetWriteAccepted() - { - return grpcsharp_event_write_accepted(this); - } - - public GRPCOpError GetFinishAccepted() - { - return grpcsharp_event_finish_accepted(this); - } - - public Status GetFinished() - { - // TODO: can the native method return string directly? - string details = Marshal.PtrToStringAnsi(grpcsharp_event_finished_details(this)); - return new Status(grpcsharp_event_finished_status(this), details); - } - - public byte[] GetReadData() - { - IntPtr len = grpcsharp_event_read_length(this); - if (len == new IntPtr(-1)) - { - return null; - } - byte[] data = new byte[(int) len]; - grpcsharp_event_read_copy_to_buffer(this, data, new UIntPtr((ulong)data.Length)); - return data; - } - - public CallSafeHandle GetCall() { - return grpcsharp_event_call(this); - } - - public string GetServerRpcNewMethod() { - // TODO: can the native method return string directly? - return Marshal.PtrToStringAnsi(grpcsharp_event_server_rpc_new_method(this)); - } - - //TODO: client_metadata_read event type - - protected override bool ReleaseHandle() - { - grpcsharp_event_finish(handle); - return true; - } - } -} diff --git a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs index f8154fa2505..634a0b2d721 100644 --- a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs +++ b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs @@ -48,7 +48,6 @@ namespace Google.GRPC.Core.Internal readonly object myLock = new object(); readonly List threads = new List(); readonly int poolSize; - readonly Action eventHandler; CompletionQueueSafeHandle cq; @@ -56,11 +55,6 @@ namespace Google.GRPC.Core.Internal this.poolSize = poolSize; } - internal GrpcThreadPool(int poolSize, Action eventHandler) { - this.poolSize = poolSize; - this.eventHandler = eventHandler; - } - public void Start() { lock (myLock) @@ -104,34 +98,19 @@ namespace Google.GRPC.Core.Internal } } - private Thread CreateAndStartThread(int i) { - Action body; - if (eventHandler != null) - { - body = ThreadBodyWithHandler; - } - else - { - body = ThreadBodyNoHandler; - } - var thread = new Thread(new ThreadStart(body)); + private Thread CreateAndStartThread(int i) + { + var thread = new Thread(new ThreadStart(RunHandlerLoop)); thread.IsBackground = false; thread.Start(); - if (eventHandler != null) - { - thread.Name = "grpc_server_newrpc " + i; - } - else - { - thread.Name = "grpc " + i; - } + thread.Name = "grpc " + i; return thread; } /// /// Body of the polling thread. /// - private void ThreadBodyNoHandler() + private void RunHandlerLoop() { GRPCCompletionType completionType; do @@ -140,22 +119,6 @@ namespace Google.GRPC.Core.Internal } while(completionType != GRPCCompletionType.GRPC_QUEUE_SHUTDOWN); Console.WriteLine("Completion queue has shutdown successfully, thread " + Thread.CurrentThread.Name + " exiting."); } - - /// - /// Body of the polling thread. - /// - private void ThreadBodyWithHandler() - { - GRPCCompletionType completionType; - do - { - using (EventSafeHandle ev = cq.Next(Timespec.InfFuture)) { - completionType = ev.GetCompletionType(); - eventHandler(ev); - } - } while(completionType != GRPCCompletionType.GRPC_QUEUE_SHUTDOWN); - Console.WriteLine("Completion queue has shutdown successfully, thread " + Thread.CurrentThread.Name + " exiting."); - } } } diff --git a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs index 74a8ef7b6ea..59f08d4ca89 100644 --- a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs +++ b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs @@ -56,6 +56,12 @@ namespace Google.GRPC.Core.Internal return handle == IntPtr.Zero; } } + + protected override bool ReleaseHandle() + { + // handle is not owned. + return true; + } } } diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index c91de97ce3b..c0966028008 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -38,13 +38,16 @@ using System.Collections.Concurrent; namespace Google.GRPC.Core.Internal { + // TODO: we need to make sure that the delegates are not collected before invoked. + internal delegate void ServerShutdownCallbackDelegate(IntPtr eventPtr); + /// /// grpc_server from grpc/grpc.h /// internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid { - [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_server_request_call_old")] - static extern GRPCCallError grpcsharp_server_request_call_old_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); + [DllImport("grpc_csharp_ext.dll")] + static extern GRPCCallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, [MarshalAs(UnmanagedType.FunctionPtr)] CompletionCallbackDelegate callback); [DllImport("grpc_csharp_ext.dll")] static extern ServerSafeHandle grpcsharp_server_create(CompletionQueueSafeHandle cq, IntPtr args); @@ -63,8 +66,9 @@ namespace Google.GRPC.Core.Internal [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_server_shutdown(ServerSafeHandle server); + // TODO: get rid of the old callback style [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_server_shutdown_and_notify")] - static extern void grpcsharp_server_shutdown_and_notify_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); + static extern void grpcsharp_server_shutdown_and_notify_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] ServerShutdownCallbackDelegate callback); [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_server_destroy(IntPtr server); @@ -95,14 +99,14 @@ namespace Google.GRPC.Core.Internal grpcsharp_server_shutdown(this); } - public void ShutdownAndNotify(EventCallbackDelegate callback) + public void ShutdownAndNotify(ServerShutdownCallbackDelegate callback) { grpcsharp_server_shutdown_and_notify_CALLBACK(this, callback); } - public GRPCCallError RequestCall(EventCallbackDelegate callback) + public GRPCCallError RequestCall(CompletionQueueSafeHandle cq, CompletionCallbackDelegate callback) { - return grpcsharp_server_request_call_old_CALLBACK(this, callback); + return grpcsharp_server_request_call(this, cq, callback); } protected override bool ReleaseHandle() diff --git a/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs b/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs similarity index 87% rename from src/csharp/GrpcCore/Internal/ServerWritingObserver.cs rename to src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs index 1d29864b9f4..e9cb65cb3b0 100644 --- a/src/csharp/GrpcCore/Internal/ServerWritingObserver.cs +++ b/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs @@ -40,11 +40,11 @@ namespace Google.GRPC.Core.Internal /// Observer that writes all arriving messages to a call abstraction (in blocking fashion) /// and then halfcloses the call. Used for server-side call handling. /// - internal class ServerWritingObserver : IObserver + internal class ServerStreamingOutputObserver : IObserver { readonly AsyncCall call; - public ServerWritingObserver(AsyncCall call) + public ServerStreamingOutputObserver(AsyncCall call) { this.call = call; } @@ -52,19 +52,19 @@ namespace Google.GRPC.Core.Internal public void OnCompleted() { // TODO: how bad is the Wait here? - call.WriteStatusAsync(new Status(StatusCode.GRPC_STATUS_OK, "")).Wait(); + call.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_OK, "")).Wait(); } public void OnError(Exception error) { - // TODO: handle this... + // TODO: implement this... throw new InvalidOperationException("This should never be called."); } public void OnNext(TWrite value) { // TODO: how bad is the Wait here? - call.WriteAsync(value).Wait(); + call.SendMessageAsync(value).Wait(); } } } diff --git a/src/csharp/GrpcCore/Server.cs b/src/csharp/GrpcCore/Server.cs index 0882a612995..91842d81821 100644 --- a/src/csharp/GrpcCore/Server.cs +++ b/src/csharp/GrpcCore/Server.cs @@ -49,8 +49,8 @@ namespace Google.GRPC.Core { // TODO: make sure the delegate doesn't get garbage collected while // native callbacks are in the completion queue. - readonly EventCallbackDelegate newRpcHandler; - readonly EventCallbackDelegate serverShutdownHandler; + readonly ServerShutdownCallbackDelegate serverShutdownHandler; + readonly CompletionCallbackDelegate newServerRpcHandler; readonly BlockingCollection newRpcQueue = new BlockingCollection(); readonly ServerSafeHandle handle; @@ -61,9 +61,8 @@ namespace Google.GRPC.Core public Server() { - // TODO: what is the tag for server shutdown? this.handle = ServerSafeHandle.NewServer(GetCompletionQueue(), IntPtr.Zero); - this.newRpcHandler = HandleNewRpc; + this.newServerRpcHandler = HandleNewServerRpc; this.serverShutdownHandler = HandleServerShutdown; } @@ -99,7 +98,7 @@ namespace Google.GRPC.Core { var rpcInfo = newRpcQueue.Take(); - Console.WriteLine("Server received RPC " + rpcInfo.Method); + //Console.WriteLine("Server received RPC " + rpcInfo.Method); IServerCallHandler callHandler; if (!callHandlers.TryGetValue(rpcInfo.Method, out callHandler)) @@ -138,23 +137,25 @@ namespace Google.GRPC.Core private void AllowOneRpc() { - AssertCallOk(handle.RequestCall(newRpcHandler)); + AssertCallOk(handle.RequestCall(GetCompletionQueue(), newServerRpcHandler)); } - private void HandleNewRpc(IntPtr eventPtr) - { - try - { - var ev = new EventSafeHandleNotOwned(eventPtr); - var rpcInfo = new NewRpcInfo(ev.GetCall(), ev.GetServerRpcNewMethod()); + private void HandleNewServerRpc(GRPCOpError error, IntPtr batchContextPtr) { + try { + var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + + if (error != GRPCOpError.GRPC_OP_OK) { + // TODO: handle error + } + + var rpcInfo = new NewRpcInfo(ctx.GetServerRpcNewCall(), ctx.GetServerRpcNewMethod()); // after server shutdown, the callback returns with null call if (!rpcInfo.Call.IsInvalid) { newRpcQueue.Add(rpcInfo); } - } - catch (Exception e) - { + + } catch(Exception e) { Console.WriteLine("Caught exception in a native handler: " + e); } } diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index bcce4a091fb..3bc3b153964 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -59,15 +59,16 @@ namespace Google.GRPC.Core method.RequestMarshaller.Deserializer); asyncCall.InitializeServer(call); - asyncCall.Accept(cq); + + var finishedTask = asyncCall.StartServerSide(); - var request = asyncCall.ReadAsync().Result; + var request = asyncCall.ReceiveMessageAsync().Result; - var responseObserver = new ServerWritingObserver(asyncCall); + var responseObserver = new ServerStreamingOutputObserver(asyncCall); handler(request, responseObserver); - asyncCall.Halfclosed.Wait(); - asyncCall.Finished.Wait(); + finishedTask.Wait(); + } } @@ -89,16 +90,16 @@ namespace Google.GRPC.Core method.RequestMarshaller.Deserializer); asyncCall.InitializeServer(call); - asyncCall.Accept(cq); - var responseObserver = new ServerWritingObserver(asyncCall); + var finishedTask = asyncCall.StartServerSide(); + + var responseObserver = new ServerStreamingOutputObserver(asyncCall); var requestObserver = handler(responseObserver); // feed the requests asyncCall.StartReadingToStream(requestObserver); - asyncCall.Halfclosed.Wait(); - asyncCall.Finished.Wait(); + finishedTask.Wait(); } } @@ -110,11 +111,14 @@ namespace Google.GRPC.Core AsyncCall asyncCall = new AsyncCall( (payload) => payload, (payload) => payload); + asyncCall.InitializeServer(call); - asyncCall.Accept(cq); - asyncCall.WriteStatusAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); - asyncCall.Finished.Wait(); + var finishedTask = asyncCall.StartServerSide(); + + asyncCall.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); + + finishedTask.Wait(); } } } diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index 44011565204..dd3fc7038e7 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -36,6 +36,7 @@ using NUnit.Framework; using Google.GRPC.Core; using Google.GRPC.Core.Internal; using System.Threading; +using System.Diagnostics; using System.Threading.Tasks; using Google.GRPC.Core.Utils; @@ -52,7 +53,7 @@ namespace Google.GRPC.Core.Tests Marshallers.StringMarshaller); [Test] - public void EmptyCall() + public void UnaryCall() { GrpcEnvironment.Initialize(); @@ -69,6 +70,7 @@ namespace Google.GRPC.Core.Tests var call = new Call(unaryEchoStringMethod, channel); Assert.AreEqual("ABC", Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken))); + Assert.AreEqual("abcdef", Calls.BlockingUnaryCall(call, "abcdef", default(CancellationToken))); } @@ -77,11 +79,72 @@ namespace Google.GRPC.Core.Tests GrpcEnvironment.Shutdown(); } + [Test] + public void UnaryCallPerformance() + { + GrpcEnvironment.Initialize(); + + Server server = new Server(); + server.AddServiceDefinition( + ServerServiceDefinition.CreateBuilder("someService") + .AddMethod(unaryEchoStringMethod, HandleUnaryEchoString).Build()); + + int port = server.AddPort(host + ":0"); + server.Start(); + + using (Channel channel = new Channel(host + ":" + port)) + { + var call = new Call(unaryEchoStringMethod, channel); + + var stopwatch = new Stopwatch(); + stopwatch.Start(); + for (int i = 0; i < 1000; i++) + { + Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); + } + stopwatch.Stop(); + Console.WriteLine("Elapsed time: " + stopwatch.ElapsedMilliseconds + "ms"); + } + + server.ShutdownAsync().Wait(); + + GrpcEnvironment.Shutdown(); + } + + + [Test] + public void UnknownMethodHandler() + { + GrpcEnvironment.Initialize(); + + Server server = new Server(); + server.AddServiceDefinition( + ServerServiceDefinition.CreateBuilder("someService").Build()); + + int port = server.AddPort(host + ":0"); + server.Start(); + + using (Channel channel = new Channel(host + ":" + port)) + { + var call = new Call(unaryEchoStringMethod, channel); + + try { + Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); + Assert.Fail(); + } catch(RpcException e) { + Assert.AreEqual(StatusCode.GRPC_STATUS_UNIMPLEMENTED, e.Status.StatusCode); + } + } + + server.ShutdownAsync().Wait(); + + GrpcEnvironment.Shutdown(); + } + private void HandleUnaryEchoString(string request, IObserver responseObserver) { responseObserver.OnNext(request); responseObserver.OnCompleted(); } - } } diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index c7949af44ec..eff862537b0 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -32,9 +32,11 @@ */ #include +#include #include #include #include +#include #include @@ -58,6 +60,134 @@ grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) { return bb; } +typedef void(GPR_CALLTYPE * callback_funcptr)(grpc_op_error op_error, void *batch_context); + +/* + * Helper to maintain lifetime of batch op inputs and store batch op outputs. + */ +typedef struct gprcsharp_batch_context { + grpc_metadata_array send_initial_metadata; + grpc_byte_buffer *send_message; + struct { + grpc_metadata_array trailing_metadata; + char *status_details; + } send_status_from_server; + grpc_metadata_array recv_initial_metadata; + grpc_byte_buffer *recv_message; + struct { + grpc_metadata_array trailing_metadata; + grpc_status_code status; + char *status_details; + size_t status_details_capacity; + } recv_status_on_client; + int recv_close_on_server_cancelled; + struct { + grpc_call *call; + grpc_call_details call_details; + grpc_metadata_array request_metadata; + } server_rpc_new; + + /* callback will be called upon completion */ + callback_funcptr callback; + +} grpcsharp_batch_context; + +grpcsharp_batch_context *grpcsharp_batch_context_create() { + grpcsharp_batch_context *ctx = gpr_malloc(sizeof(grpcsharp_batch_context)); + memset(ctx, 0, sizeof(grpcsharp_batch_context)); + return ctx; +} + +/** + * Destroys metadata array including keys and values. + */ +void grpcsharp_metadata_array_destroy_recursive(grpc_metadata_array *array) { + if (!array->metadata) { + return; + } + /* TODO: destroy also keys and values */ + grpc_metadata_array_destroy(array); +} + +void grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { + if (!ctx) { + return; + } + grpcsharp_metadata_array_destroy_recursive(&(ctx->send_initial_metadata)); + + grpc_byte_buffer_destroy(ctx->send_message); + + grpcsharp_metadata_array_destroy_recursive(&(ctx->send_status_from_server.trailing_metadata)); + gpr_free(ctx->send_status_from_server.status_details); + + grpc_metadata_array_destroy(&(ctx->recv_initial_metadata)); + + grpc_byte_buffer_destroy(ctx->recv_message); + + grpc_metadata_array_destroy(&(ctx->recv_status_on_client.trailing_metadata)); + gpr_free((void*) ctx->recv_status_on_client.status_details); + + /* NOTE: ctx->server_rpc_new.call is not destroyed because callback handler is supposed + to take its ownership. */ + + grpc_call_details_destroy(&(ctx->server_rpc_new.call_details)); + grpc_metadata_array_destroy(&(ctx->server_rpc_new.request_metadata)); + + gpr_free(ctx); +} + +GPR_EXPORT gpr_intptr GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(const grpcsharp_batch_context *ctx) { + if (!ctx->recv_message) { + return -1; + } + return grpc_byte_buffer_length(ctx->recv_message); +} + +/* + * Copies data from recv_message to a buffer. Fatal error occurs if + * buffer is too small. + */ +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_batch_context_recv_message_to_buffer(const grpcsharp_batch_context *ctx, char *buffer, + size_t buffer_len) { + grpc_byte_buffer_reader *reader; + gpr_slice slice; + size_t offset = 0; + + reader = grpc_byte_buffer_reader_create(ctx->recv_message); + + while (grpc_byte_buffer_reader_next(reader, &slice)) { + size_t len = GPR_SLICE_LENGTH(slice); + GPR_ASSERT(offset + len <= buffer_len); + memcpy(buffer + offset, GPR_SLICE_START_PTR(slice), + GPR_SLICE_LENGTH(slice)); + offset += len; + gpr_slice_unref(slice); + } + grpc_byte_buffer_reader_destroy(reader); +} + +GPR_EXPORT grpc_status_code GPR_CALLTYPE +grpcsharp_batch_context_recv_status_on_client_status(const grpcsharp_batch_context *ctx) { + return ctx->recv_status_on_client.status; +} + +GPR_EXPORT const char *GPR_CALLTYPE +grpcsharp_batch_context_recv_status_on_client_details(const grpcsharp_batch_context *ctx) { + return ctx->recv_status_on_client.status_details; +} + +GPR_EXPORT grpc_call* GPR_CALLTYPE +grpcsharp_batch_context_server_rpc_new_call(const grpcsharp_batch_context *ctx) { + return ctx->server_rpc_new.call; +} + +GPR_EXPORT const char *GPR_CALLTYPE +grpcsharp_batch_context_server_rpc_new_method(const grpcsharp_batch_context *ctx) { + return ctx->server_rpc_new.call_details.method; +} + + /* Init & shutdown */ GPR_EXPORT void GPR_CALLTYPE grpcsharp_init(void) { grpc_init(); } @@ -96,11 +226,18 @@ grpcsharp_completion_queue_destroy(grpc_completion_queue *cq) { GPR_EXPORT grpc_completion_type GPR_CALLTYPE grpcsharp_completion_queue_next_with_callback(grpc_completion_queue *cq) { grpc_event *ev; + grpcsharp_batch_context *batch_context; grpc_completion_type t; void(GPR_CALLTYPE * callback)(grpc_event *); ev = grpc_completion_queue_next(cq, gpr_inf_future); t = ev->type; + if (t == GRPC_OP_COMPLETE && ev->tag) { + /* NEW API handler */ + batch_context = (grpcsharp_batch_context *) ev->tag; + batch_context->callback(ev->data.op_complete, batch_context); + grpcsharp_batch_context_destroy(batch_context); + } else if (ev->tag) { /* call the callback in ev->tag */ /* C forbids to cast object pointers to function pointers, so @@ -128,6 +265,12 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_destroy(grpc_channel *channel) { grpc_channel_destroy(channel); } +GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call(grpc_channel *channel, grpc_completion_queue *cq, + const char *method, + const char *host, gpr_timespec deadline) { + return grpc_channel_create_call(channel, cq, method, host, deadline); +} + GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call_old(grpc_channel *channel, const char *method, const char *host, gpr_timespec deadline) { @@ -145,6 +288,12 @@ grpcsharp_event_type(const grpc_event *event) { return event->type; } +GPR_EXPORT grpc_op_error GPR_CALLTYPE +grpcsharp_event_op_complete(const grpc_event *event) { + GPR_ASSERT(event->type == GRPC_OP_COMPLETE); + return event->data.op_complete; +} + GPR_EXPORT grpc_op_error GPR_CALLTYPE grpcsharp_event_write_accepted(const grpc_event *event) { GPR_ASSERT(event->type == GRPC_WRITE_ACCEPTED); @@ -343,3 +492,219 @@ grpcsharp_server_shutdown_and_notify(grpc_server *server, void *tag) { GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) { grpc_server_destroy(server); } + +/* New API Experiments */ + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(grpc_call *call, + callback_funcptr callback, + const char *send_buffer, size_t send_buffer_len) { + /* TODO: don't use magic number */ + grpc_op ops[6]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + /* TODO: implement sending the metadata... */ + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + /* ctx->send_initial_metadata is already zeroed out. */ + ops[0].data.send_initial_metadata.count = 0; + ops[0].data.send_initial_metadata.metadata = NULL; + + ops[1].op = GRPC_OP_SEND_MESSAGE; + ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ops[1].data.send_message = ctx->send_message; + + ops[2].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + + ops[3].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[3].data.recv_initial_metadata = &(ctx->recv_initial_metadata); + + ops[4].op = GRPC_OP_RECV_MESSAGE; + ops[4].data.recv_message = &(ctx->recv_message); + + ops[5].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + ops[5].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); + ops[5].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + /* not using preallocation for status_details */ + ops[5].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); + ops[5].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(grpc_call *call, + callback_funcptr callback) { + /* TODO: don't use magic number */ + grpc_op ops[4]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + /* TODO: implement sending the metadata... */ + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + /* ctx->send_initial_metadata is already zeroed out. */ + ops[0].data.send_initial_metadata.count = 0; + ops[0].data.send_initial_metadata.metadata = NULL; + + ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[1].data.recv_initial_metadata = &(ctx->recv_initial_metadata); + + ops[2].op = GRPC_OP_RECV_MESSAGE; + ops[2].data.recv_message = &(ctx->recv_message); + + ops[3].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + ops[3].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); + ops[3].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + /* not using preallocation for status_details */ + ops[3].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); + ops[3].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(grpc_call *call, + callback_funcptr callback, + const char *send_buffer, size_t send_buffer_len) { + /* TODO: don't use magic number */ + grpc_op ops[5]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + /* TODO: implement sending the metadata... */ + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + /* ctx->send_initial_metadata is already zeroed out. */ + ops[0].data.send_initial_metadata.count = 0; + ops[0].data.send_initial_metadata.metadata = NULL; + + ops[1].op = GRPC_OP_SEND_MESSAGE; + ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ops[1].data.send_message = ctx->send_message; + + ops[2].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + + ops[3].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[3].data.recv_initial_metadata = &(ctx->recv_initial_metadata); + + ops[4].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + ops[4].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); + ops[4].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + /* not using preallocation for status_details */ + ops[4].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); + ops[4].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(grpc_call *call, + callback_funcptr callback) { + /* TODO: don't use magic number */ + grpc_op ops[3]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + /* TODO: implement sending the metadata... */ + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + /* ctx->send_initial_metadata is already zeroed out. */ + ops[0].data.send_initial_metadata.count = 0; + ops[0].data.send_initial_metadata.metadata = NULL; + + ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; + ops[1].data.recv_initial_metadata = &(ctx->recv_initial_metadata); + + ops[2].op = GRPC_OP_RECV_STATUS_ON_CLIENT; + ops[2].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); + ops[2].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + /* not using preallocation for status_details */ + ops[2].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); + ops[2].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(grpc_call *call, + callback_funcptr callback, + const char *send_buffer, size_t send_buffer_len) { + /* TODO: don't use magic number */ + grpc_op ops[1]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + ops[0].op = GRPC_OP_SEND_MESSAGE; + ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); + ops[0].data.send_message = ctx->send_message; + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(grpc_call *call, + callback_funcptr callback) { + /* TODO: don't use magic number */ + grpc_op ops[1]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + ops[0].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(grpc_call *call, + callback_funcptr callback, grpc_status_code status_code, const char* status_details) { + /* TODO: don't use magic number */ + grpc_op ops[1]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + ops[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; + ops[0].data.send_status_from_server.status = status_code; + ops[0].data.send_status_from_server.status_details = gpr_strdup(status_details); + ops[0].data.send_status_from_server.trailing_metadata = NULL; + ops[0].data.send_status_from_server.trailing_metadata_count = 0; + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_message(grpc_call *call, + callback_funcptr callback) { + /* TODO: don't use magic number */ + grpc_op ops[1]; + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + ops[0].op = GRPC_OP_RECV_MESSAGE; + ops[0].data.recv_message = &(ctx->recv_message); + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_serverside(grpc_call *call, + callback_funcptr callback) { + /* TODO: don't use magic number */ + grpc_op ops[2]; + + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; + ops[0].data.send_initial_metadata.count = 0; + ops[0].data.send_initial_metadata.metadata = NULL; + + ops[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER; + ops[1].data.recv_close_on_server.cancelled = (&ctx->recv_close_on_server_cancelled); + + return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); +} + + +GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call(grpc_server *server, + grpc_completion_queue *cq, callback_funcptr callback) { + + grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); + ctx->callback = callback; + + return grpc_server_request_call(server, &(ctx->server_rpc_new.call), + &(ctx->server_rpc_new.call_details), + &(ctx->server_rpc_new.request_metadata), + cq, ctx); +} + + + + From 3f8962c52d06602f6be73bed56e72e76f6ea7407 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 17 Feb 2015 19:20:39 -0800 Subject: [PATCH 152/232] removal of unused methods in extension library --- src/csharp/ext/grpc_csharp_ext.c | 236 +++++-------------------------- 1 file changed, 34 insertions(+), 202 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index eff862537b0..2961a708be8 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -201,18 +201,6 @@ grpcsharp_completion_queue_create(void) { return grpc_completion_queue_create(); } -GPR_EXPORT grpc_event *GPR_CALLTYPE -grpcsharp_completion_queue_next(grpc_completion_queue *cq, - gpr_timespec deadline) { - return grpc_completion_queue_next(cq, deadline); -} - -GPR_EXPORT grpc_event *GPR_CALLTYPE -grpcsharp_completion_queue_pluck(grpc_completion_queue *cq, void *tag, - gpr_timespec deadline) { - return grpc_completion_queue_pluck(cq, tag, deadline); -} - GPR_EXPORT void GPR_CALLTYPE grpcsharp_completion_queue_shutdown(grpc_completion_queue *cq) { grpc_completion_queue_shutdown(cq); @@ -271,101 +259,6 @@ GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call(grpc_channel *c return grpc_channel_create_call(channel, cq, method, host, deadline); } -GPR_EXPORT grpc_call *GPR_CALLTYPE -grpcsharp_channel_create_call_old(grpc_channel *channel, const char *method, - const char *host, gpr_timespec deadline) { - return grpc_channel_create_call_old(channel, method, host, deadline); -} - -/* Event */ - -GPR_EXPORT void GPR_CALLTYPE grpcsharp_event_finish(grpc_event *event) { - grpc_event_finish(event); -} - -GPR_EXPORT grpc_completion_type GPR_CALLTYPE -grpcsharp_event_type(const grpc_event *event) { - return event->type; -} - -GPR_EXPORT grpc_op_error GPR_CALLTYPE -grpcsharp_event_op_complete(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_OP_COMPLETE); - return event->data.op_complete; -} - -GPR_EXPORT grpc_op_error GPR_CALLTYPE -grpcsharp_event_write_accepted(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_WRITE_ACCEPTED); - return event->data.invoke_accepted; -} - -GPR_EXPORT grpc_op_error GPR_CALLTYPE -grpcsharp_event_finish_accepted(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_FINISH_ACCEPTED); - return event->data.finish_accepted; -} - -GPR_EXPORT grpc_status_code GPR_CALLTYPE -grpcsharp_event_finished_status(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_FINISHED); - return event->data.finished.status; -} - -GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_event_finished_details(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_FINISHED); - return event->data.finished.details; -} - -GPR_EXPORT gpr_intptr GPR_CALLTYPE -grpcsharp_event_read_length(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_READ); - if (!event->data.read) { - return -1; - } - return grpc_byte_buffer_length(event->data.read); -} - -/* - * Copies data from read event to a buffer. Fatal error occurs if - * buffer is too small. - */ -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_event_read_copy_to_buffer(const grpc_event *event, char *buffer, - size_t buffer_len) { - grpc_byte_buffer_reader *reader; - gpr_slice slice; - size_t offset = 0; - - GPR_ASSERT(event->type == GRPC_READ); - reader = grpc_byte_buffer_reader_create(event->data.read); - - GPR_ASSERT(event->data.read); - while (grpc_byte_buffer_reader_next(reader, &slice)) { - size_t len = GPR_SLICE_LENGTH(slice); - GPR_ASSERT(offset + len <= buffer_len); - memcpy(buffer + offset, GPR_SLICE_START_PTR(slice), - GPR_SLICE_LENGTH(slice)); - offset += len; - gpr_slice_unref(slice); - } - grpc_byte_buffer_reader_destroy(reader); -} - -GPR_EXPORT grpc_call *GPR_CALLTYPE -grpcsharp_event_call(const grpc_event *event) { - /* we only allow this for newly incoming server calls. */ - GPR_ASSERT(event->type == GRPC_SERVER_RPC_NEW); - return event->call; -} - -GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_event_server_rpc_new_method(const grpc_event *event) { - GPR_ASSERT(event->type == GRPC_SERVER_RPC_NEW); - return event->data.server_rpc_new.method; -} - /* Timespec */ GPR_EXPORT gpr_timespec GPR_CALLTYPE gprsharp_now(void) { return gpr_now(); } @@ -380,31 +273,6 @@ GPR_EXPORT gpr_int32 GPR_CALLTYPE gprsharp_sizeof_timespec(void) { /* Call */ -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_add_metadata_old(grpc_call *call, grpc_metadata *metadata, - gpr_uint32 flags) { - return grpc_call_add_metadata_old(call, metadata, flags); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_invoke_old(grpc_call *call, grpc_completion_queue *cq, - void *metadata_read_tag, void *finished_tag, - gpr_uint32 flags) { - return grpc_call_invoke_old(call, cq, metadata_read_tag, finished_tag, flags); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_server_accept_old(grpc_call *call, grpc_completion_queue *cq, - void *finished_tag) { - return grpc_call_server_accept_old(call, cq, finished_tag); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_server_end_initial_metadata_old(grpc_call *call, - gpr_uint32 flags) { - return grpc_call_server_end_initial_metadata_old(call, flags); -} - GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_cancel(grpc_call *call) { return grpc_call_cancel(call); } @@ -415,30 +283,6 @@ grpcsharp_call_cancel_with_status(grpc_call *call, grpc_status_code status, return grpc_call_cancel_with_status(call, status, description); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_write_old(grpc_call *call, grpc_byte_buffer *byte_buffer, - void *tag, gpr_uint32 flags) { - return grpc_call_start_write_old(call, byte_buffer, tag, flags); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_write_status_old(grpc_call *call, - grpc_status_code status_code, - const char *status_message, void *tag) { - return grpc_call_start_write_status_old(call, status_code, status_message, - tag); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_writes_done_old(grpc_call *call, void *tag) { - return grpc_call_writes_done_old(call, tag); -} - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_call_start_read_old(grpc_call *call, void *tag) { - return grpc_call_start_read_old(call, tag); -} - GPR_EXPORT void GPR_CALLTYPE grpcsharp_call_destroy(grpc_call *call) { grpc_call_destroy(call); } @@ -453,48 +297,6 @@ grpcsharp_call_start_write_from_copied_buffer(grpc_call *call, grpc_byte_buffer_destroy(byte_buffer); } -/* Server */ - -GPR_EXPORT grpc_call_error GPR_CALLTYPE -grpcsharp_server_request_call_old(grpc_server *server, void *tag_new) { - return grpc_server_request_call_old(server, tag_new); -} - -GPR_EXPORT grpc_server *GPR_CALLTYPE -grpcsharp_server_create(grpc_completion_queue *cq, - const grpc_channel_args *args) { - return grpc_server_create(cq, args); -} - -GPR_EXPORT int GPR_CALLTYPE -grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) { - return grpc_server_add_http2_port(server, addr); -} - -GPR_EXPORT int GPR_CALLTYPE -grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) { - return grpc_server_add_secure_http2_port(server, addr); -} - -GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) { - grpc_server_start(server); -} - -GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown(grpc_server *server) { - grpc_server_shutdown(server); -} - -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_server_shutdown_and_notify(grpc_server *server, void *tag) { - grpc_server_shutdown_and_notify(server, tag); -} - -GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) { - grpc_server_destroy(server); -} - -/* New API Experiments */ - GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(grpc_call *call, callback_funcptr callback, const char *send_buffer, size_t send_buffer_len) { @@ -692,6 +494,40 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_serverside(grpc_cal return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); } +/* Server */ + +GPR_EXPORT grpc_server *GPR_CALLTYPE +grpcsharp_server_create(grpc_completion_queue *cq, + const grpc_channel_args *args) { + return grpc_server_create(cq, args); +} + +GPR_EXPORT int GPR_CALLTYPE +grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) { + return grpc_server_add_http2_port(server, addr); +} + +GPR_EXPORT int GPR_CALLTYPE +grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) { + return grpc_server_add_secure_http2_port(server, addr); +} + +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) { + grpc_server_start(server); +} + +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_shutdown(grpc_server *server) { + grpc_server_shutdown(server); +} + +GPR_EXPORT void GPR_CALLTYPE +grpcsharp_server_shutdown_and_notify(grpc_server *server, void *tag) { + grpc_server_shutdown_and_notify(server, tag); +} + +GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) { + grpc_server_destroy(server); +} GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call(grpc_server *server, grpc_completion_queue *cq, callback_funcptr callback) { @@ -704,7 +540,3 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call(grpc_serve &(ctx->server_rpc_new.request_metadata), cq, ctx); } - - - - From a96afb013babf5afd8d47b195d616cd03b93d677 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Tue, 17 Feb 2015 19:23:55 -0800 Subject: [PATCH 153/232] renaming file name to match class name --- src/csharp/GrpcCore/GrpcCore.csproj | 2 +- ...chContextSafeHandle.cs => BatchContextSafeHandleNotOwned.cs} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/csharp/GrpcCore/Internal/{BatchContextSafeHandle.cs => BatchContextSafeHandleNotOwned.cs} (100%) diff --git a/src/csharp/GrpcCore/GrpcCore.csproj b/src/csharp/GrpcCore/GrpcCore.csproj index a574f181c8a..ee76b742ce4 100644 --- a/src/csharp/GrpcCore/GrpcCore.csproj +++ b/src/csharp/GrpcCore/GrpcCore.csproj @@ -59,9 +59,9 @@ - + diff --git a/src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs b/src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs similarity index 100% rename from src/csharp/GrpcCore/Internal/BatchContextSafeHandle.cs rename to src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs From 607307d0beca6b3742ba446390603b42f5a57c19 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 11:05:45 -0800 Subject: [PATCH 154/232] Cleanup of AsyncCall.cs --- .../GrpcApiTests/MathClientServerTests.cs | 18 +- src/csharp/GrpcCore/GrpcEnvironment.cs | 2 +- src/csharp/GrpcCore/Internal/AsyncCall.cs | 325 ++++++++++-------- src/csharp/GrpcCore/ServerCallHandler.cs | 11 +- src/csharp/GrpcCoreTests/ClientServerTest.cs | 23 +- 5 files changed, 203 insertions(+), 176 deletions(-) diff --git a/src/csharp/GrpcApiTests/MathClientServerTests.cs b/src/csharp/GrpcApiTests/MathClientServerTests.cs index bd298b0932f..9056142097b 100644 --- a/src/csharp/GrpcApiTests/MathClientServerTests.cs +++ b/src/csharp/GrpcApiTests/MathClientServerTests.cs @@ -64,6 +64,15 @@ namespace math.Tests client = MathGrpc.NewStub(channel); } + [TestFixtureTearDown] + public void Cleanup() + { + channel.Dispose(); + + server.ShutdownAsync().Wait(); + GrpcEnvironment.Shutdown(); + } + [Test] public void Div1() { @@ -136,15 +145,6 @@ namespace math.Tests CollectionAssert.AreEqual(new long[] {3, 4, 3}, result.ConvertAll((divReply) => divReply.Quotient)); CollectionAssert.AreEqual(new long[] {1, 16, 1}, result.ConvertAll((divReply) => divReply.Remainder)); } - - [TestFixtureTearDown] - public void Cleanup() - { - channel.Dispose(); - - server.ShutdownAsync().Wait(); - GrpcEnvironment.Shutdown(); - } } } diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index c4f030267d2..55a6cac8f69 100644 --- a/src/csharp/GrpcCore/GrpcEnvironment.cs +++ b/src/csharp/GrpcCore/GrpcEnvironment.cs @@ -42,7 +42,7 @@ namespace Google.GRPC.Core /// public class GrpcEnvironment { - const int THREAD_POOL_SIZE = 1; + const int THREAD_POOL_SIZE = 4; [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_init(); diff --git a/src/csharp/GrpcCore/Internal/AsyncCall.cs b/src/csharp/GrpcCore/Internal/AsyncCall.cs index ae7428978ea..ce0ba30d53d 100644 --- a/src/csharp/GrpcCore/Internal/AsyncCall.cs +++ b/src/csharp/GrpcCore/Internal/AsyncCall.cs @@ -42,15 +42,13 @@ using Google.GRPC.Core.Internal; namespace Google.GRPC.Core.Internal { /// - /// Handle native call lifecycle and provides convenience methods. + /// Handles native call lifecycle and provides convenience methods. /// - internal class AsyncCall : IDisposable + internal class AsyncCall { readonly Func serializer; readonly Func deserializer; - // TODO: make sure the delegate doesn't get garbage collected while - // native callbacks are in the completion queue. readonly CompletionCallbackDelegate unaryResponseHandler; readonly CompletionCallbackDelegate finishedHandler; readonly CompletionCallbackDelegate writeFinishedHandler; @@ -59,35 +57,44 @@ namespace Google.GRPC.Core.Internal readonly CompletionCallbackDelegate finishedServersideHandler; object myLock = new object(); - bool disposed; + GCHandle gchandle; CallSafeHandle call; + bool disposed; bool server; + bool started; bool errorOccured; - bool cancelRequested; + bool readingDone; bool halfcloseRequested; bool halfclosed; - bool doneWithReading; - Nullable finishedStatus; + bool finished; + // Completion of a pending write if not null. TaskCompletionSource writeTcs; + + // Completion of a pending read if not null. TaskCompletionSource readTcs; - TaskCompletionSource finishedServersideTcs = new TaskCompletionSource(); - TaskCompletionSource halfcloseTcs = new TaskCompletionSource(); - TaskCompletionSource finishedTcs = new TaskCompletionSource(); + // Completion of a pending halfclose if not null. + TaskCompletionSource halfcloseTcs; + // Completion of a pending unary response if not null. TaskCompletionSource unaryResponseTcs; + // Set after status is received on client. Only used for server streaming and duplex streaming calls. + Nullable finishedStatus; + TaskCompletionSource finishedServersideTcs = new TaskCompletionSource(); + + // For streaming, the reads will be delivered to this observer. IObserver readObserver; public AsyncCall(Func serializer, Func deserializer) { this.serializer = serializer; this.deserializer = deserializer; - this.unaryResponseHandler = HandleUnaryResponseCompletion; + this.unaryResponseHandler = HandleUnaryResponse; this.finishedHandler = HandleFinished; this.writeFinishedHandler = HandleWriteFinished; this.readFinishedHandler = HandleReadFinished; @@ -95,46 +102,23 @@ namespace Google.GRPC.Core.Internal this.finishedServersideHandler = HandleFinishedServerside; } - /// - /// Initiates reading to given observer. - /// - public void StartReadingToStream(IObserver readObserver) { - lock (myLock) - { - CheckStarted(); - if (this.readObserver != null) - { - throw new InvalidOperationException("Already registered an observer."); - } - this.readObserver = readObserver; - ReceiveMessageAsync(); - } - } - - public void Initialize(Channel channel, CompletionQueueSafeHandle cq, String methodName) { - lock (myLock) - { - this.call = CallSafeHandle.Create(channel.Handle, cq, methodName, channel.Target, Timespec.InfFuture); - } + public void Initialize(Channel channel, CompletionQueueSafeHandle cq, String methodName) + { + InitializeInternal(CallSafeHandle.Create(channel.Handle, cq, methodName, channel.Target, Timespec.InfFuture), false); } public void InitializeServer(CallSafeHandle call) { - lock(myLock) - { - this.call = call; - started = true; - server = true; - } + InitializeInternal(call, true); } - public Task UnaryCallAsync(TWrite msg) { lock (myLock) { started = true; halfcloseRequested = true; + readingDone = true; // TODO: handle serialization error... byte[] payload = serializer(msg); @@ -151,6 +135,7 @@ namespace Google.GRPC.Core.Internal lock (myLock) { started = true; + readingDone = true; unaryResponseTcs = new TaskCompletionSource(); call.StartClientStreaming(unaryResponseHandler); @@ -191,15 +176,43 @@ namespace Google.GRPC.Core.Internal } } - public Task SendMessageAsync(TWrite msg) { + public Task ServerSideUnaryRequestCallAsync() + { lock (myLock) { + started = true; + call.StartServerSide(finishedServersideHandler); + return finishedServersideTcs.Task; + } + } + + public Task ServerSideStreamingRequestCallAsync(IObserver readObserver) + { + lock (myLock) + { + started = true; + call.StartServerSide(finishedServersideHandler); + + if (this.readObserver != null) + { + throw new InvalidOperationException("Already registered an observer."); + } + this.readObserver = readObserver; + ReceiveMessageAsync(); + + return finishedServersideTcs.Task; + } + } + + public Task SendMessageAsync(TWrite msg) + { + lock (myLock) + { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); CheckNoError(); - CheckCancelNotRequested(); - if (halfcloseRequested || halfclosed) + if (halfcloseRequested) { throw new InvalidOperationException("Already halfclosed."); } @@ -222,18 +235,19 @@ namespace Google.GRPC.Core.Internal { lock (myLock) { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); CheckNoError(); - CheckCancelNotRequested(); - if (halfcloseRequested || halfclosed) + if (halfcloseRequested) { throw new InvalidOperationException("Already halfclosed."); } call.StartSendCloseFromClient(halfclosedHandler); + halfcloseRequested = true; + halfcloseTcs = new TaskCompletionSource(); return halfcloseTcs.Task; } } @@ -242,18 +256,18 @@ namespace Google.GRPC.Core.Internal { lock (myLock) { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); CheckNoError(); - CheckCancelNotRequested(); - if (halfcloseRequested || halfclosed) + if (halfcloseRequested) { throw new InvalidOperationException("Already halfclosed."); } call.StartSendStatusFromServer(status, halfclosedHandler); halfcloseRequested = true; + halfcloseTcs = new TaskCompletionSource(); return halfcloseTcs.Task; } } @@ -262,13 +276,11 @@ namespace Google.GRPC.Core.Internal { lock (myLock) { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); CheckNoError(); - // TODO: add check for not cancelled? - - if (doneWithReading) + if (readingDone) { throw new InvalidOperationException("Already read the last message."); } @@ -285,22 +297,12 @@ namespace Google.GRPC.Core.Internal } } - internal Task StartServerSide() - { - lock (myLock) - { - call.StartServerSide(finishedServersideHandler); - return finishedServersideTcs.Task; - } - } - public void Cancel() { lock (myLock) { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); - cancelRequested = true; } // grpc_call_cancel is threadsafe @@ -311,41 +313,23 @@ namespace Google.GRPC.Core.Internal { lock (myLock) { + CheckNotDisposed(); CheckStarted(); - CheckNotFinished(); - cancelRequested = true; } // grpc_call_cancel_with_status is threadsafe call.CancelWithStatus(status); } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposed) - { - if (disposing) - { - if (call != null) - { - call.Dispose(); - } - } - disposed = true; - } - } - private void UpdateErrorOccured(GRPCOpError error) + private void InitializeInternal(CallSafeHandle call, bool server) { - if (error == GRPCOpError.GRPC_OP_ERROR) + lock (myLock) { - errorOccured = true; + // Make sure this object and the delegated held by it will not be garbage collected + // before we release this handle. + gchandle = GCHandle.Alloc(this); + this.call = call; + this.server = server; } } @@ -357,41 +341,46 @@ namespace Google.GRPC.Core.Internal } } - private void CheckNoError() + private void CheckNotDisposed() { - if (errorOccured) + if (disposed) { - throw new InvalidOperationException("Error occured when processing call."); + throw new InvalidOperationException("Call has already been disposed."); } } - private void CheckNotFinished() + private void CheckNoError() { - if (finishedStatus.HasValue) + if (errorOccured) { - throw new InvalidOperationException("Already finished."); + throw new InvalidOperationException("Error occured when processing call."); } } - private void CheckCancelNotRequested() + private bool ReleaseResourcesIfPossible() { - if (cancelRequested) + if (!disposed && call != null) { - throw new InvalidOperationException("Cancel has been requested."); + if (halfclosed && readingDone && finished) + { + ReleaseResources(); + return true; + } } + return false; } - private void DisposeResourcesIfNeeded() + private void ReleaseResources() { - if (call != null && started && finishedStatus.HasValue) - { - // TODO: should we also wait for all the pending events to finish? - + if (call != null) { call.Dispose(); } + gchandle.Free(); + disposed = true; } - private void CompleteStreamObserver(Status status) { + private void CompleteStreamObserver(Status status) + { if (status.StatusCode != StatusCode.GRPC_STATUS_OK) { // TODO: wrap to handle exceptions; @@ -402,20 +391,27 @@ namespace Google.GRPC.Core.Internal } } - private void HandleUnaryResponseCompletion(GRPCOpError error, IntPtr batchContextPtr) { - try { - + /// + /// Handler for unary response completion. + /// + private void HandleUnaryResponse(GRPCOpError error, IntPtr batchContextPtr) + { + try + { TaskCompletionSource tcs; - lock(myLock) { + lock(myLock) + { + finished = true; + halfclosed = true; tcs = unaryResponseTcs; - } - // we're done with this call, get rid of the native object. - call.Dispose(); + ReleaseResourcesIfPossible(); + } var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); - if (error != GRPCOpError.GRPC_OP_OK) { + if (error != GRPCOpError.GRPC_OP_OK) + { tcs.SetException(new RpcException( new Status(StatusCode.GRPC_STATUS_INTERNAL, "Internal error occured.") )); @@ -423,7 +419,8 @@ namespace Google.GRPC.Core.Internal } var status = ctx.GetReceivedStatus(); - if (status.StatusCode != StatusCode.GRPC_STATUS_OK) { + if (status.StatusCode != StatusCode.GRPC_STATUS_OK) + { tcs.SetException(new RpcException(status)); return; } @@ -431,18 +428,20 @@ namespace Google.GRPC.Core.Internal // TODO: handle deserialize error... var msg = deserializer(ctx.GetReceivedMessage()); tcs.SetResult(msg); - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } - private void HandleWriteFinished(GRPCOpError error, IntPtr batchContextPtr) { - try { - + private void HandleWriteFinished(GRPCOpError error, IntPtr batchContextPtr) + { + try + { TaskCompletionSource oldTcs = null; lock (myLock) { - UpdateErrorOccured(error); oldTcs = writeTcs; writeTcs = null; } @@ -458,20 +457,25 @@ namespace Google.GRPC.Core.Internal oldTcs.SetResult(null); } - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } - private void HandleHalfclosed(GRPCOpError error, IntPtr batchContextPtr) { - try { + private void HandleHalfclosed(GRPCOpError error, IntPtr batchContextPtr) + { + try + { lock (myLock) { - UpdateErrorOccured(error); halfclosed = true; + + ReleaseResourcesIfPossible(); } - if (errorOccured) + if (error != GRPCOpError.GRPC_OP_OK) { halfcloseTcs.SetException(new Exception("Halfclose failed")); @@ -480,14 +484,17 @@ namespace Google.GRPC.Core.Internal { halfcloseTcs.SetResult(null); } - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } - private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) { - try { - + private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) + { + try + { var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); var payload = ctx.GetReceivedMessage(); @@ -502,7 +509,7 @@ namespace Google.GRPC.Core.Internal readTcs = null; if (payload == null) { - doneWithReading = true; + readingDone = true; } observer = readObserver; status = finishedStatus; @@ -515,7 +522,8 @@ namespace Google.GRPC.Core.Internal // TODO: make sure we deliver reads in the right order. - if (observer != null) { + if (observer != null) + { if (payload != null) { // TODO: wrap to handle exceptions @@ -526,58 +534,81 @@ namespace Google.GRPC.Core.Internal } else { - if (!server) { - if (status.HasValue) { + if (!server) + { + if (status.HasValue) + { CompleteStreamObserver(status.Value); } - } else { + } + else + { // TODO: wrap to handle exceptions.. observer.OnCompleted(); } // TODO: completeStreamObserver serverside... } } - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } - private void HandleFinished(GRPCOpError error, IntPtr batchContextPtr) { - try { + private void HandleFinished(GRPCOpError error, IntPtr batchContextPtr) + { + try + { var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); var status = ctx.GetReceivedStatus(); - bool wasDoneWithReading; + bool wasReadingDone; lock (myLock) { + finished = true; finishedStatus = status; - DisposeResourcesIfNeeded(); + wasReadingDone = readingDone; - wasDoneWithReading = doneWithReading; + ReleaseResourcesIfPossible(); } - if (wasDoneWithReading) { + if (wasReadingDone) { CompleteStreamObserver(status); } - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } - private void HandleFinishedServerside(GRPCOpError error, IntPtr batchContextPtr) { - try { + private void HandleFinishedServerside(GRPCOpError error, IntPtr batchContextPtr) + { + try + { var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); + lock(myLock) + { + finished = true; + + // TODO: because of the way server calls are implemented, we need to set + // reading done to true here. Should be fixed in the future. + readingDone = true; + + ReleaseResourcesIfPossible(); + } // TODO: handle error ... finishedServersideTcs.SetResult(null); - call.Dispose(); - - } catch(Exception e) { + } + catch(Exception e) + { Console.WriteLine("Caught exception in a native handler: " + e); } } diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index 3bc3b153964..73dfa52def8 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -60,7 +60,7 @@ namespace Google.GRPC.Core asyncCall.InitializeServer(call); - var finishedTask = asyncCall.StartServerSide(); + var finishedTask = asyncCall.ServerSideUnaryRequestCallAsync(); var request = asyncCall.ReceiveMessageAsync().Result; @@ -91,14 +91,9 @@ namespace Google.GRPC.Core asyncCall.InitializeServer(call); - var finishedTask = asyncCall.StartServerSide(); - var responseObserver = new ServerStreamingOutputObserver(asyncCall); var requestObserver = handler(responseObserver); - - // feed the requests - asyncCall.StartReadingToStream(requestObserver); - + var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(requestObserver); finishedTask.Wait(); } } @@ -114,7 +109,7 @@ namespace Google.GRPC.Core asyncCall.InitializeServer(call); - var finishedTask = asyncCall.StartServerSide(); + var finishedTask = asyncCall.ServerSideUnaryRequestCallAsync(); asyncCall.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index dd3fc7038e7..37d770e0c04 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -52,11 +52,21 @@ namespace Google.GRPC.Core.Tests Marshallers.StringMarshaller, Marshallers.StringMarshaller); - [Test] - public void UnaryCall() + [TestFixtureSetUp] + public void Init() + { + GrpcEnvironment.Initialize(); + } + + [TestFixtureTearDown] + public void Cleanup() { GrpcEnvironment.Initialize(); + } + [Test] + public void UnaryCall() + { Server server = new Server(); server.AddServiceDefinition( ServerServiceDefinition.CreateBuilder("someService") @@ -82,8 +92,6 @@ namespace Google.GRPC.Core.Tests [Test] public void UnaryCallPerformance() { - GrpcEnvironment.Initialize(); - Server server = new Server(); server.AddServiceDefinition( ServerServiceDefinition.CreateBuilder("someService") @@ -107,16 +115,11 @@ namespace Google.GRPC.Core.Tests } server.ShutdownAsync().Wait(); - - GrpcEnvironment.Shutdown(); } - [Test] public void UnknownMethodHandler() { - GrpcEnvironment.Initialize(); - Server server = new Server(); server.AddServiceDefinition( ServerServiceDefinition.CreateBuilder("someService").Build()); @@ -137,8 +140,6 @@ namespace Google.GRPC.Core.Tests } server.ShutdownAsync().Wait(); - - GrpcEnvironment.Shutdown(); } private void HandleUnaryEchoString(string request, IObserver responseObserver) { From fa21673cf8469a9fdc5848de4a9a9d9914b8e5e4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 11:06:44 -0800 Subject: [PATCH 155/232] clang-format --- src/csharp/ext/grpc_csharp_ext.c | 186 ++++++++++++++++++------------- 1 file changed, 108 insertions(+), 78 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 2961a708be8..1dd6c692e5f 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -60,7 +60,8 @@ grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) { return bb; } -typedef void(GPR_CALLTYPE * callback_funcptr)(grpc_op_error op_error, void *batch_context); +typedef void(GPR_CALLTYPE *callback_funcptr)(grpc_op_error op_error, + void *batch_context); /* * Helper to maintain lifetime of batch op inputs and store batch op outputs. @@ -117,7 +118,8 @@ void grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { grpc_byte_buffer_destroy(ctx->send_message); - grpcsharp_metadata_array_destroy_recursive(&(ctx->send_status_from_server.trailing_metadata)); + grpcsharp_metadata_array_destroy_recursive( + &(ctx->send_status_from_server.trailing_metadata)); gpr_free(ctx->send_status_from_server.status_details); grpc_metadata_array_destroy(&(ctx->recv_initial_metadata)); @@ -125,9 +127,10 @@ void grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { grpc_byte_buffer_destroy(ctx->recv_message); grpc_metadata_array_destroy(&(ctx->recv_status_on_client.trailing_metadata)); - gpr_free((void*) ctx->recv_status_on_client.status_details); + gpr_free((void *)ctx->recv_status_on_client.status_details); - /* NOTE: ctx->server_rpc_new.call is not destroyed because callback handler is supposed + /* NOTE: ctx->server_rpc_new.call is not destroyed because callback handler is + supposed to take its ownership. */ grpc_call_details_destroy(&(ctx->server_rpc_new.call_details)); @@ -136,20 +139,20 @@ void grpcsharp_batch_context_destroy(grpcsharp_batch_context *ctx) { gpr_free(ctx); } -GPR_EXPORT gpr_intptr GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(const grpcsharp_batch_context *ctx) { +GPR_EXPORT gpr_intptr GPR_CALLTYPE grpcsharp_batch_context_recv_message_length( + const grpcsharp_batch_context *ctx) { if (!ctx->recv_message) { - return -1; - } - return grpc_byte_buffer_length(ctx->recv_message); + return -1; + } + return grpc_byte_buffer_length(ctx->recv_message); } /* * Copies data from recv_message to a buffer. Fatal error occurs if * buffer is too small. */ -GPR_EXPORT void GPR_CALLTYPE -grpcsharp_batch_context_recv_message_to_buffer(const grpcsharp_batch_context *ctx, char *buffer, - size_t buffer_len) { +GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer( + const grpcsharp_batch_context *ctx, char *buffer, size_t buffer_len) { grpc_byte_buffer_reader *reader; gpr_slice slice; size_t offset = 0; @@ -168,26 +171,28 @@ grpcsharp_batch_context_recv_message_to_buffer(const grpcsharp_batch_context *ct } GPR_EXPORT grpc_status_code GPR_CALLTYPE -grpcsharp_batch_context_recv_status_on_client_status(const grpcsharp_batch_context *ctx) { +grpcsharp_batch_context_recv_status_on_client_status( + const grpcsharp_batch_context *ctx) { return ctx->recv_status_on_client.status; } GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_batch_context_recv_status_on_client_details(const grpcsharp_batch_context *ctx) { +grpcsharp_batch_context_recv_status_on_client_details( + const grpcsharp_batch_context *ctx) { return ctx->recv_status_on_client.status_details; } -GPR_EXPORT grpc_call* GPR_CALLTYPE -grpcsharp_batch_context_server_rpc_new_call(const grpcsharp_batch_context *ctx) { +GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_batch_context_server_rpc_new_call( + const grpcsharp_batch_context *ctx) { return ctx->server_rpc_new.call; } GPR_EXPORT const char *GPR_CALLTYPE -grpcsharp_batch_context_server_rpc_new_method(const grpcsharp_batch_context *ctx) { +grpcsharp_batch_context_server_rpc_new_method( + const grpcsharp_batch_context *ctx) { return ctx->server_rpc_new.call_details.method; } - /* Init & shutdown */ GPR_EXPORT void GPR_CALLTYPE grpcsharp_init(void) { grpc_init(); } @@ -222,11 +227,10 @@ grpcsharp_completion_queue_next_with_callback(grpc_completion_queue *cq) { t = ev->type; if (t == GRPC_OP_COMPLETE && ev->tag) { /* NEW API handler */ - batch_context = (grpcsharp_batch_context *) ev->tag; + batch_context = (grpcsharp_batch_context *)ev->tag; batch_context->callback(ev->data.op_complete, batch_context); grpcsharp_batch_context_destroy(batch_context); - } else - if (ev->tag) { + } else if (ev->tag) { /* call the callback in ev->tag */ /* C forbids to cast object pointers to function pointers, so * we cast to intptr first. @@ -253,9 +257,10 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_channel_destroy(grpc_channel *channel) { grpc_channel_destroy(channel); } -GPR_EXPORT grpc_call *GPR_CALLTYPE grpcsharp_channel_create_call(grpc_channel *channel, grpc_completion_queue *cq, - const char *method, - const char *host, gpr_timespec deadline) { +GPR_EXPORT grpc_call *GPR_CALLTYPE +grpcsharp_channel_create_call(grpc_channel *channel, grpc_completion_queue *cq, + const char *method, const char *host, + gpr_timespec deadline) { return grpc_channel_create_call(channel, cq, method, host, deadline); } @@ -297,9 +302,9 @@ grpcsharp_call_start_write_from_copied_buffer(grpc_call *call, grpc_byte_buffer_destroy(byte_buffer); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(grpc_call *call, - callback_funcptr callback, - const char *send_buffer, size_t send_buffer_len) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_start_unary(grpc_call *call, callback_funcptr callback, + const char *send_buffer, size_t send_buffer_len) { /* TODO: don't use magic number */ grpc_op ops[6]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -324,17 +329,22 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_unary(grpc_call *ca ops[4].data.recv_message = &(ctx->recv_message); ops[5].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - ops[5].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); - ops[5].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + ops[5].data.recv_status_on_client.trailing_metadata = + &(ctx->recv_status_on_client.trailing_metadata); + ops[5].data.recv_status_on_client.status = + &(ctx->recv_status_on_client.status); /* not using preallocation for status_details */ - ops[5].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); - ops[5].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + ops[5].data.recv_status_on_client.status_details = + &(ctx->recv_status_on_client.status_details); + ops[5].data.recv_status_on_client.status_details_capacity = + &(ctx->recv_status_on_client.status_details_capacity); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(grpc_call *call, - callback_funcptr callback) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_start_client_streaming(grpc_call *call, + callback_funcptr callback) { /* TODO: don't use magic number */ grpc_op ops[4]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -353,18 +363,24 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_client_streaming(gr ops[2].data.recv_message = &(ctx->recv_message); ops[3].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - ops[3].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); - ops[3].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + ops[3].data.recv_status_on_client.trailing_metadata = + &(ctx->recv_status_on_client.trailing_metadata); + ops[3].data.recv_status_on_client.status = + &(ctx->recv_status_on_client.status); /* not using preallocation for status_details */ - ops[3].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); - ops[3].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + ops[3].data.recv_status_on_client.status_details = + &(ctx->recv_status_on_client.status_details); + ops[3].data.recv_status_on_client.status_details_capacity = + &(ctx->recv_status_on_client.status_details_capacity); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(grpc_call *call, - callback_funcptr callback, - const char *send_buffer, size_t send_buffer_len) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_start_server_streaming(grpc_call *call, + callback_funcptr callback, + const char *send_buffer, + size_t send_buffer_len) { /* TODO: don't use magic number */ grpc_op ops[5]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -386,17 +402,22 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_server_streaming(gr ops[3].data.recv_initial_metadata = &(ctx->recv_initial_metadata); ops[4].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - ops[4].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); - ops[4].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + ops[4].data.recv_status_on_client.trailing_metadata = + &(ctx->recv_status_on_client.trailing_metadata); + ops[4].data.recv_status_on_client.status = + &(ctx->recv_status_on_client.status); /* not using preallocation for status_details */ - ops[4].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); - ops[4].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + ops[4].data.recv_status_on_client.status_details = + &(ctx->recv_status_on_client.status_details); + ops[4].data.recv_status_on_client.status_details_capacity = + &(ctx->recv_status_on_client.status_details_capacity); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(grpc_call *call, - callback_funcptr callback) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_start_duplex_streaming(grpc_call *call, + callback_funcptr callback) { /* TODO: don't use magic number */ grpc_op ops[3]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -412,18 +433,22 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_duplex_streaming(gr ops[1].data.recv_initial_metadata = &(ctx->recv_initial_metadata); ops[2].op = GRPC_OP_RECV_STATUS_ON_CLIENT; - ops[2].data.recv_status_on_client.trailing_metadata = &(ctx->recv_status_on_client.trailing_metadata); - ops[2].data.recv_status_on_client.status = &(ctx->recv_status_on_client.status); + ops[2].data.recv_status_on_client.trailing_metadata = + &(ctx->recv_status_on_client.trailing_metadata); + ops[2].data.recv_status_on_client.status = + &(ctx->recv_status_on_client.status); /* not using preallocation for status_details */ - ops[2].data.recv_status_on_client.status_details = &(ctx->recv_status_on_client.status_details); - ops[2].data.recv_status_on_client.status_details_capacity = &(ctx->recv_status_on_client.status_details_capacity); + ops[2].data.recv_status_on_client.status_details = + &(ctx->recv_status_on_client.status_details); + ops[2].data.recv_status_on_client.status_details_capacity = + &(ctx->recv_status_on_client.status_details_capacity); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(grpc_call *call, - callback_funcptr callback, - const char *send_buffer, size_t send_buffer_len) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_send_message(grpc_call *call, callback_funcptr callback, + const char *send_buffer, size_t send_buffer_len) { /* TODO: don't use magic number */ grpc_op ops[1]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -433,11 +458,12 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_message(grpc_call *c ctx->send_message = string_to_byte_buffer(send_buffer, send_buffer_len); ops[0].data.send_message = ctx->send_message; - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(grpc_call *call, - callback_funcptr callback) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_send_close_from_client(grpc_call *call, + callback_funcptr callback) { /* TODO: don't use magic number */ grpc_op ops[1]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -445,11 +471,14 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_close_from_client(gr ops[0].op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(grpc_call *call, - callback_funcptr callback, grpc_status_code status_code, const char* status_details) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_send_status_from_server(grpc_call *call, + callback_funcptr callback, + grpc_status_code status_code, + const char *status_details) { /* TODO: don't use magic number */ grpc_op ops[1]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -457,15 +486,16 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_send_status_from_server(g ops[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; ops[0].data.send_status_from_server.status = status_code; - ops[0].data.send_status_from_server.status_details = gpr_strdup(status_details); + ops[0].data.send_status_from_server.status_details = + gpr_strdup(status_details); ops[0].data.send_status_from_server.trailing_metadata = NULL; ops[0].data.send_status_from_server.trailing_metadata_count = 0; - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_message(grpc_call *call, - callback_funcptr callback) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_recv_message(grpc_call *call, callback_funcptr callback) { /* TODO: don't use magic number */ grpc_op ops[1]; grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); @@ -473,11 +503,11 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_recv_message(grpc_call *c ops[0].op = GRPC_OP_RECV_MESSAGE; ops[0].data.recv_message = &(ctx->recv_message); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_serverside(grpc_call *call, - callback_funcptr callback) { +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_call_start_serverside(grpc_call *call, callback_funcptr callback) { /* TODO: don't use magic number */ grpc_op ops[2]; @@ -489,9 +519,10 @@ GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_call_start_serverside(grpc_cal ops[0].data.send_initial_metadata.metadata = NULL; ops[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER; - ops[1].data.recv_close_on_server.cancelled = (&ctx->recv_close_on_server_cancelled); + ops[1].data.recv_close_on_server.cancelled = + (&ctx->recv_close_on_server_cancelled); - return grpc_call_start_batch(call, ops, sizeof(ops)/sizeof(ops[0]), ctx); + return grpc_call_start_batch(call, ops, sizeof(ops) / sizeof(ops[0]), ctx); } /* Server */ @@ -529,14 +560,13 @@ GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_destroy(grpc_server *server) { grpc_server_destroy(server); } -GPR_EXPORT grpc_call_error GPR_CALLTYPE grpcsharp_server_request_call(grpc_server *server, - grpc_completion_queue *cq, callback_funcptr callback) { - +GPR_EXPORT grpc_call_error GPR_CALLTYPE +grpcsharp_server_request_call(grpc_server *server, grpc_completion_queue *cq, + callback_funcptr callback) { grpcsharp_batch_context *ctx = grpcsharp_batch_context_create(); ctx->callback = callback; - return grpc_server_request_call(server, &(ctx->server_rpc_new.call), - &(ctx->server_rpc_new.call_details), - &(ctx->server_rpc_new.request_metadata), - cq, ctx); + return grpc_server_request_call( + server, &(ctx->server_rpc_new.call), &(ctx->server_rpc_new.call_details), + &(ctx->server_rpc_new.request_metadata), cq, ctx); } From 37afb9ab2b2e5a8f6a3bae2546e26eda22256976 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 11:20:04 -0800 Subject: [PATCH 156/232] fixing unknown method call handler on server --- src/csharp/GrpcCore/ServerCallHandler.cs | 18 +++++++++++++++++- src/csharp/GrpcCoreTests/ClientServerTest.cs | 2 -- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index 73dfa52def8..48d1eaa3359 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -109,12 +109,28 @@ namespace Google.GRPC.Core asyncCall.InitializeServer(call); - var finishedTask = asyncCall.ServerSideUnaryRequestCallAsync(); + var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(new NullObserver()); asyncCall.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); finishedTask.Wait(); } } + + internal class NullObserver : IObserver + { + public void OnCompleted() + { + } + + public void OnError(Exception error) + { + } + + public void OnNext(T value) + { + } + + } } diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index 37d770e0c04..d0e357e29a6 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -85,8 +85,6 @@ namespace Google.GRPC.Core.Tests } server.ShutdownAsync().Wait(); - - GrpcEnvironment.Shutdown(); } [Test] From 8d7ce43aa4993cf71e57de9a7c2ae94b01248bef Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 11:20:43 -0800 Subject: [PATCH 157/232] formatting --- src/csharp/GrpcCoreTests/ClientServerTest.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index d0e357e29a6..e76189974d3 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -140,7 +140,8 @@ namespace Google.GRPC.Core.Tests server.ShutdownAsync().Wait(); } - private void HandleUnaryEchoString(string request, IObserver responseObserver) { + private void HandleUnaryEchoString(string request, IObserver responseObserver) + { responseObserver.OnNext(request); responseObserver.OnCompleted(); } From 8d2e572371afc771b107d1ba6fb56375bd7d46be Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 12:41:14 -0800 Subject: [PATCH 158/232] got rid of server_add_secure_http2_port --- src/csharp/GrpcCore/Internal/ServerSafeHandle.cs | 8 +------- src/csharp/ext/grpc_csharp_ext.c | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index c0966028008..047bde1addf 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -52,13 +52,8 @@ namespace Google.GRPC.Core.Internal [DllImport("grpc_csharp_ext.dll")] static extern ServerSafeHandle grpcsharp_server_create(CompletionQueueSafeHandle cq, IntPtr args); - // TODO: check int representation size [DllImport("grpc_csharp_ext.dll")] - static extern int grpcsharp_server_add_http2_port(ServerSafeHandle server, string addr); - - // TODO: check int representation size - [DllImport("grpc_csharp_ext.dll")] - static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr); + static extern Int32 grpcsharp_server_add_http2_port(ServerSafeHandle server, string addr); [DllImport("grpc_csharp_ext.dll")] static extern void grpcsharp_server_start(ServerSafeHandle server); @@ -85,7 +80,6 @@ namespace Google.GRPC.Core.Internal public int AddPort(string addr) { - // TODO: also grpc_server_add_secure_http2_port... return grpcsharp_server_add_http2_port(this, addr); } diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 1dd6c692e5f..304ee9cf34c 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -533,16 +533,11 @@ grpcsharp_server_create(grpc_completion_queue *cq, return grpc_server_create(cq, args); } -GPR_EXPORT int GPR_CALLTYPE +GPR_EXPORT gpr_int32 GPR_CALLTYPE grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) { return grpc_server_add_http2_port(server, addr); } -GPR_EXPORT int GPR_CALLTYPE -grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) { - return grpc_server_add_secure_http2_port(server, addr); -} - GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) { grpc_server_start(server); } From 492968f7d92bae2b9c88059521ad2f5c81594d8f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 13:14:03 -0800 Subject: [PATCH 159/232] Server side cancellation receive support --- include/grpc++/completion_queue.h | 2 +- include/grpc++/server_context.h | 20 +++----- include/grpc++/stream.h | 12 ----- src/cpp/common/completion_queue.cc | 5 +- src/cpp/server/server.cc | 8 ++- src/cpp/server/server_context.cc | 70 ++++++++++++++++++++++---- test/cpp/end2end/async_end2end_test.cc | 12 ++++- 7 files changed, 87 insertions(+), 42 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 9a4fa9f2e10..cec0ef0a8d7 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -114,7 +114,7 @@ class CompletionQueue { bool Pluck(CompletionQueueTag *tag); // Does a single polling pluck on tag - void TryPluck(CompletionQueueTag *tag); + void TryPluck(CompletionQueueTag *tag, bool forever); grpc_completion_queue *cq_; // owned }; diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index e2e14d9ef76..81dcb21d139 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -34,8 +34,6 @@ #ifndef __GRPCPP_SERVER_CONTEXT_H_ #define __GRPCPP_SERVER_CONTEXT_H_ -#include - #include #include #include @@ -63,7 +61,9 @@ class ServerWriter; template class ServerReaderWriter; +class Call; class CallOpBuffer; +class CompletionQueue; class Server; // Interface of server side rpc context. @@ -79,7 +79,7 @@ class ServerContext final { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); - bool IsCancelled() { return completion_op_.CheckCancelled(cq_); } + bool IsCancelled(); std::multimap client_metadata() { return client_metadata_; @@ -102,22 +102,14 @@ class ServerContext final { template friend class ::grpc::ServerReaderWriter; - class CompletionOp final : public CompletionQueueTag { - public: - bool FinalizeResult(void** tag, bool* status) override; - - bool CheckCancelled(CompletionQueue* cq); + class CompletionOp; - private: - std::mutex mu_; - bool finalized_ = false; - int cancelled_ = 0; - }; + void BeginCompletionOp(Call* call); ServerContext(gpr_timespec deadline, grpc_metadata* metadata, size_t metadata_count); - CompletionOp completion_op_; + CompletionOp* completion_op_ = nullptr; std::chrono::system_clock::time_point deadline_; grpc_call* call_ = nullptr; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 20ba3fb7905..a37062b42d7 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -576,8 +576,6 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { if (status.IsOk()) { finish_buf_.AddSendMessage(msg); } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -589,8 +587,6 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -636,8 +632,6 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, if (status.IsOk()) { finish_buf_.AddSendMessage(msg); } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -649,8 +643,6 @@ class ServerAsyncReader : public ServerAsyncStreamingInterface, finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -697,8 +689,6 @@ class ServerAsyncWriter : public ServerAsyncStreamingInterface, finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -753,8 +743,6 @@ class ServerAsyncReaderWriter : public ServerAsyncStreamingInterface, finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index c330d21a467..f9bb8689b63 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -88,10 +88,11 @@ bool CompletionQueue::Pluck(CompletionQueueTag* tag) { } } -void CompletionQueue::TryPluck(CompletionQueueTag* tag) { +void CompletionQueue::TryPluck(CompletionQueueTag* tag, bool forever) { std::unique_ptr ev; - ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_past)); + ev.reset(grpc_completion_queue_pluck( + cq_, tag, forever ? gpr_inf_future : gpr_inf_past)); if (!ev) return; bool ok = ev->data.op_complete == GRPC_OP_OK; void* ignored = tag; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 8fffea640f7..cf6b02293fb 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -205,6 +205,7 @@ class Server::SyncRequest final : public CompletionQueueTag { if (has_response_payload_) { res.reset(method_->AllocateResponseProto()); } + ctx_.BeginCompletionOp(&call_); auto status = method_->handler()->RunHandler( MethodHandler::HandlerParameter(&call_, &ctx_, req.get(), res.get())); CallOpBuffer buf; @@ -215,10 +216,12 @@ class Server::SyncRequest final : public CompletionQueueTag { buf.AddSendMessage(*res); } buf.AddServerSendStatus(&ctx_.trailing_metadata_, status); - bool cancelled; - buf.AddServerRecvClose(&cancelled); call_.PerformOps(&buf); GPR_ASSERT(cq_.Pluck(&buf)); + void* ignored_tag; + bool ignored_ok; + cq_.Shutdown(); + GPR_ASSERT(cq_.Next(&ignored_tag, &ignored_ok) == false); } private: @@ -332,6 +335,7 @@ class Server::AsyncRequest final : public CompletionQueueTag { } ctx_->call_ = call_; Call call(call_, server_, cq_); + ctx_->BeginCompletionOp(&call); // just the pointers inside call are copied here stream_->BindCall(&call); delete this; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index b9d85b95e93..9412f2762f0 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -34,10 +34,59 @@ #include #include #include +#include #include "src/cpp/util/time.h" namespace grpc { +// CompletionOp + +class ServerContext::CompletionOp final : public CallOpBuffer { + public: + CompletionOp(); + bool FinalizeResult(void** tag, bool* status) override; + + bool CheckCancelled(CompletionQueue* cq); + + void Unref(); + + private: + std::mutex mu_; + int refs_ = 2; // initial refs: one in the server context, one in the cq + bool finalized_ = false; + bool cancelled_ = false; +}; + +ServerContext::CompletionOp::CompletionOp() { AddServerRecvClose(&cancelled_); } + +void ServerContext::CompletionOp::Unref() { + std::unique_lock lock(mu_); + if (--refs_ == 0) { + lock.unlock(); + delete this; + } +} + +bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) { + cq->TryPluck(this, false); + std::lock_guard g(mu_); + return finalized_ ? cancelled_ : false; +} + +bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { + GPR_ASSERT(CallOpBuffer::FinalizeResult(tag, status)); + std::unique_lock lock(mu_); + finalized_ = true; + if (!*status) cancelled_ = true; + if (--refs_ == 0) { + lock.unlock(); + delete this; + } + return false; +} + +// ServerContext body + ServerContext::ServerContext() {} ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata, @@ -55,6 +104,15 @@ ServerContext::~ServerContext() { if (call_) { grpc_call_destroy(call_); } + if (completion_op_) { + completion_op_->Unref(); + } +} + +void ServerContext::BeginCompletionOp(Call* call) { + GPR_ASSERT(!completion_op_); + completion_op_ = new CompletionOp(); + call->PerformOps(completion_op_); } void ServerContext::AddInitialMetadata(const grpc::string& key, @@ -67,16 +125,8 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, trailing_metadata_.insert(std::make_pair(key, value)); } -bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) { - cq->TryPluck(this); - std::lock_guard g(mu_); - return finalized_ ? cancelled_ != 0 : false; -} - -bool ServerContext::CompletionOp::FinalizeResult(void** tag, bool* status) { - std::lock_guard g(mu_); - finalized_ = true; - return false; +bool ServerContext::IsCancelled() { + return completion_op_ && completion_op_->CheckCancelled(cq_); } } // namespace grpc diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 7e827cb0e57..2e28a86d97f 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -90,7 +90,17 @@ class AsyncEnd2endTest : public ::testing::Test { server_ = builder.BuildAndStart(); } - void TearDown() override { server_->Shutdown(); } + void TearDown() override { + server_->Shutdown(); + void* ignored_tag; + bool ignored_ok; + cli_cq_.Shutdown(); + srv_cq_.Shutdown(); + while (cli_cq_.Next(&ignored_tag, &ignored_ok)) + ; + while (srv_cq_.Next(&ignored_tag, &ignored_ok)) + ; + } void ResetStub() { std::shared_ptr channel = From 1a305b1d9dc19910ad81df88f494cf282747bc54 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 13:37:06 -0800 Subject: [PATCH 160/232] Make valgrind a bit more useful --- tools/run_tests/run_tests.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 72a4b0cd122..64478b37532 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -62,15 +62,18 @@ class SimpleConfig(object): # ValgrindConfig: compile with some CONFIG=config, but use valgrind to run class ValgrindConfig(object): - def __init__(self, config, tool): + def __init__(self, config, tool, args=[]): self.build_config = config self.tool = tool + self.args = args self.maxjobs = 2 * multiprocessing.cpu_count() self.allow_hashing = False def job_spec(self, binary, hash_targets): - return jobset.JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool, binary], - hash_targets=None) + return jobset.JobSpec(cmdline=['valgrind', '--tool=%s' % self.tool] + + self.args + [binary], + shortname='valgrind %s' % binary, + hash_targets=None) class CLanguage(object): @@ -144,7 +147,7 @@ _CONFIGS = { 'asan': SimpleConfig('asan', environ={ 'ASAN_OPTIONS': 'detect_leaks=1:color=always:suppressions=tools/tsan_suppressions.txt'}), 'gcov': SimpleConfig('gcov'), - 'memcheck': ValgrindConfig('valgrind', 'memcheck'), + 'memcheck': ValgrindConfig('valgrind', 'memcheck', ['--leak-check=full']), 'helgrind': ValgrindConfig('dbg', 'helgrind') } From 1c7bdf5c9cea090420fa2994f70341bd700c92f9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 13:55:31 -0800 Subject: [PATCH 161/232] removed reference to missing grpc_server_add_secure_http2_port --- src/csharp/ext/grpc_csharp_ext.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index c7949af44ec..a8d4b0e2e35 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -322,11 +322,6 @@ grpcsharp_server_add_http2_port(grpc_server *server, const char *addr) { return grpc_server_add_http2_port(server, addr); } -GPR_EXPORT int GPR_CALLTYPE -grpcsharp_server_add_secure_http2_port(grpc_server *server, const char *addr) { - return grpc_server_add_secure_http2_port(server, addr); -} - GPR_EXPORT void GPR_CALLTYPE grpcsharp_server_start(grpc_server *server) { grpc_server_start(server); } From efad8fadd36899ff98ff616c349d181f2f1e4004 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 13:59:46 -0800 Subject: [PATCH 162/232] Spam cleanup, test speedup --- src/core/surface/call.c | 1 - src/core/transport/chttp2_transport.c | 2 -- test/core/transport/metadata_test.c | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 89a6ba63b27..40caa938680 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -313,7 +313,6 @@ static void set_status_code(grpc_call *call, status_source source, } if (flush && !grpc_bbq_empty(&call->incoming_queue)) { - gpr_log(GPR_ERROR, "Flushing unread messages due to error status %d", status); grpc_bbq_flush(&call->incoming_queue); } } diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 551ae27e613..6999d581028 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1025,8 +1025,6 @@ static void cancel_stream_inner(transport *t, stream *s, gpr_uint32 id, int had_outgoing; char buffer[GPR_LTOA_MIN_BUFSIZE]; - gpr_log(GPR_DEBUG, "cancel %d", id); - if (s) { /* clear out any unreported input & output: nobody cares anymore */ had_outgoing = s->outgoing_sopb.nops != 0; diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index 07867c6b247..d003582a2ff 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -44,7 +44,7 @@ #define LOG_TEST() gpr_log(GPR_INFO, "%s", __FUNCTION__) /* a large number */ -#define MANY 100000 +#define MANY 10000 static void test_no_op(void) { grpc_mdctx *ctx; From 6a769e0f52e57f6871f1146489e33765e7d9aa03 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Wed, 18 Feb 2015 14:04:29 -0800 Subject: [PATCH 163/232] Update README.md --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 99e19db337b..ab7fc083fde 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,22 @@ Copyright 2015 Google Inc. See grpc/INSTALL for installation instructions for various platforms. +#Repository Structure + +This repository contains source code for gRPC libraries for multiple lanugages. + + * C source code: [src/core] (src/core) + * C++ source code: [src/cpp] (src/cpp) + * Python source code: [src/python] (src/python) + * Python source code: [src/ruby] (src/ruby) + * Ruby source code: [src/node] (src/node) + * PHP source code: [src/php] (src/php) + * Python source code: [src/csharp] (src/csharp) + +Java source code is in [grpc-java] (http://github.com/grpc/grpc-java) repository. +Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. + + #Overview From ec77624a9f56c1158e1e425c0cbdba591ad2d86a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 14:06:56 -0800 Subject: [PATCH 164/232] fix typo: shutdown should be used in teardown. --- src/csharp/GrpcCoreTests/ClientServerTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index e76189974d3..ba43e4f6a07 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -61,7 +61,7 @@ namespace Google.GRPC.Core.Tests [TestFixtureTearDown] public void Cleanup() { - GrpcEnvironment.Initialize(); + GrpcEnvironment.Shutdown(); } [Test] From a16fee215fc093629cb9c869f48c9457f10f1f0b Mon Sep 17 00:00:00 2001 From: David Klempner Date: Wed, 18 Feb 2015 14:15:45 -0800 Subject: [PATCH 165/232] Correct the comment documenting how to disable having multiple threads in epoll wait. --- src/core/iomgr/pollset_multipoller_with_epoll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/iomgr/pollset_multipoller_with_epoll.c index 9fb28195062..a1c3938a33c 100644 --- a/src/core/iomgr/pollset_multipoller_with_epoll.c +++ b/src/core/iomgr/pollset_multipoller_with_epoll.c @@ -93,7 +93,7 @@ static int multipoll_with_epoll_pollset_maybe_work( /* If you want to ignore epoll's ability to sanely handle parallel pollers, * for a more apples-to-apples performance comparison with poll, add a - * if (pollset->counter == 0) { return 0 } + * if (pollset->counter != 0) { return 0; } * here. */ From 9be83eec1de2932946d61b774788ca18fb41e2fe Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 14:16:15 -0800 Subject: [PATCH 166/232] Fix use-after-free. Transport and channel have different lifetimes, but share a metadata context. Make the metadata context ref counted, and have transport take a ref. --- src/core/security/credentials.c | 6 +++--- src/core/surface/channel.c | 2 +- src/core/transport/chttp2_transport.c | 12 +++++++++--- src/core/transport/metadata.c | 19 +++++++++++++------ src/core/transport/metadata.h | 3 ++- test/core/channel/channel_stack_test.c | 2 +- test/core/channel/metadata_buffer_test.c | 2 +- test/core/security/credentials_test.c | 14 +++++++------- .../core/transport/chttp2/hpack_parser_test.c | 2 +- test/core/transport/chttp2/hpack_table_test.c | 6 +++--- .../transport/chttp2/stream_encoder_test.c | 2 +- test/core/transport/metadata_test.c | 18 +++++++++--------- test/core/transport/transport_end2end_tests.c | 2 +- 13 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index b2e0fd215a9..60e82d9dfae 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -313,7 +313,7 @@ static void oauth2_token_fetcher_destroy(grpc_credentials *creds) { grpc_mdelem_unref(c->access_token_md); } gpr_mu_destroy(&c->mu); - grpc_mdctx_orphan(c->md_ctx); + grpc_mdctx_unref(c->md_ctx); gpr_free(c); } @@ -587,7 +587,7 @@ static void fake_oauth2_destroy(grpc_credentials *creds) { if (c->access_token_md != NULL) { grpc_mdelem_unref(c->access_token_md); } - grpc_mdctx_orphan(c->md_ctx); + grpc_mdctx_unref(c->md_ctx); gpr_free(c); } @@ -897,7 +897,7 @@ static void iam_destroy(grpc_credentials *creds) { grpc_iam_credentials *c = (grpc_iam_credentials *)creds; grpc_mdelem_unref(c->token_md); grpc_mdelem_unref(c->authority_selector_md); - grpc_mdctx_orphan(c->md_ctx); + grpc_mdctx_unref(c->md_ctx); gpr_free(c); } diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index e308c60410f..e38734c6a49 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -146,7 +146,7 @@ static void destroy_channel(void *p, int ok) { grpc_mdstr_unref(channel->grpc_message_string); grpc_mdstr_unref(channel->path_string); grpc_mdstr_unref(channel->authority_string); - grpc_mdctx_orphan(channel->metadata_context); + grpc_mdctx_unref(channel->metadata_context); gpr_free(channel); } diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 6999d581028..5b2d0a5e5b7 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -336,11 +336,9 @@ static void recv_data(void *tp, gpr_slice *slices, size_t nslices, * CONSTRUCTION/DESTRUCTION/REFCOUNTING */ -static void unref_transport(transport *t) { +static void destruct_transport(transport *t) { size_t i; - if (!gpr_unref(&t->refs)) return; - gpr_mu_lock(&t->mu); GPR_ASSERT(t->ep == NULL); @@ -380,9 +378,16 @@ static void unref_transport(transport *t) { grpc_sopb_destroy(&t->nuke_later_sopb); + grpc_mdctx_unref(t->metadata_context); + gpr_free(t); } +static void unref_transport(transport *t) { + if (!gpr_unref(&t->refs)) return; + destruct_transport(t); +} + static void ref_transport(transport *t) { gpr_ref(&t->refs); } static void init_transport(transport *t, grpc_transport_setup_callback setup, @@ -401,6 +406,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, gpr_ref_init(&t->refs, 2); gpr_mu_init(&t->mu); gpr_cv_init(&t->cv); + grpc_mdctx_ref(mdctx); t->metadata_context = mdctx; t->str_grpc_timeout = grpc_mdstr_from_string(t->metadata_context, "grpc-timeout"); diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 3dc23e7de23..1c15716fadf 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -79,7 +79,7 @@ typedef struct internal_metadata { struct grpc_mdctx { gpr_uint32 hash_seed; - int orphaned; + int refs; gpr_mu mu; @@ -114,7 +114,7 @@ static void unlock(grpc_mdctx *ctx) { mdelems on every unlock (instead of the usual 'I'm too loaded' trigger case), since otherwise we can be stuck waiting for a garbage collection that will never happen. */ - if (ctx->orphaned) { + if (ctx->refs == 0) { /* uncomment if you're having trouble diagnosing an mdelem leak to make things clearer (slows down destruction a lot, however) */ /* gc_mdtab(ctx); */ @@ -139,7 +139,7 @@ static void ref_md(internal_metadata *md) { grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed) { grpc_mdctx *ctx = gpr_malloc(sizeof(grpc_mdctx)); - ctx->orphaned = 0; + ctx->refs = 1; ctx->hash_seed = seed; gpr_mu_init(&ctx->mu); ctx->strtab = gpr_malloc(sizeof(internal_string *) * INITIAL_STRTAB_CAPACITY); @@ -197,10 +197,17 @@ static void metadata_context_destroy(grpc_mdctx *ctx) { gpr_free(ctx); } -void grpc_mdctx_orphan(grpc_mdctx *ctx) { +void grpc_mdctx_ref(grpc_mdctx *ctx) { lock(ctx); - GPR_ASSERT(!ctx->orphaned); - ctx->orphaned = 1; + GPR_ASSERT(ctx->refs > 0); + ctx->refs++; + unlock(ctx); +} + +void grpc_mdctx_unref(grpc_mdctx *ctx) { + lock(ctx); + GPR_ASSERT(ctx->refs > 0); + ctx->refs--; unlock(ctx); } diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index 430cae6847c..7a56e346901 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -84,7 +84,8 @@ struct grpc_mdelem { /* Create/orphan a metadata context */ grpc_mdctx *grpc_mdctx_create(void); grpc_mdctx *grpc_mdctx_create_with_seed(gpr_uint32 seed); -void grpc_mdctx_orphan(grpc_mdctx *mdctx); +void grpc_mdctx_ref(grpc_mdctx *mdctx); +void grpc_mdctx_unref(grpc_mdctx *mdctx); /* Test only accessors to internal state - only for testing this code - do not rely on it outside of metadata_test.c */ diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index 0345f99bdee..59a4564220b 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -128,7 +128,7 @@ static void test_create_channel_stack(void) { grpc_channel_stack_destroy(channel_stack); gpr_free(channel_stack); - grpc_mdctx_orphan(metadata_context); + grpc_mdctx_unref(metadata_context); } int main(int argc, char **argv) { diff --git a/test/core/channel/metadata_buffer_test.c b/test/core/channel/metadata_buffer_test.c index 22776f8ca13..ba8100b7d2f 100644 --- a/test/core/channel/metadata_buffer_test.c +++ b/test/core/channel/metadata_buffer_test.c @@ -182,7 +182,7 @@ static void test_case(size_t key_prefix_len, size_t value_prefix_len, gpr_free(stk); grpc_metadata_buffer_destroy(&buffer, GRPC_OP_OK); - grpc_mdctx_orphan(mdctx); + grpc_mdctx_unref(mdctx); } int main(int argc, char **argv) { diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index 302869d70e2..f911db6de1f 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -138,7 +138,7 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) { GPR_ASSERT(!strcmp(grpc_mdstr_as_c_string(token_elem->value), "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_")); grpc_mdelem_unref(token_elem); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { @@ -150,7 +150,7 @@ static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { @@ -161,7 +161,7 @@ static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { @@ -176,7 +176,7 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { @@ -190,7 +190,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { @@ -205,7 +205,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( @@ -220,7 +220,7 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( &response, ctx, &token_elem, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void check_metadata(expected_md *expected, grpc_mdelem **md_elems, diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c index edab37b6879..86c6bb1f56a 100644 --- a/test/core/transport/chttp2/hpack_parser_test.c +++ b/test/core/transport/chttp2/hpack_parser_test.c @@ -214,7 +214,7 @@ static void test_vectors(grpc_slice_split_mode mode) { "set-cookie", "foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1", NULL); grpc_chttp2_hpack_parser_destroy(&parser); - grpc_mdctx_orphan(mdctx); + grpc_mdctx_unref(mdctx); } int main(int argc, char **argv) { diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index f3da9f0d49c..d1e5f0829a8 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -126,7 +126,7 @@ static void test_static_lookup(void) { assert_index(&tbl, 61, "www-authenticate", ""); grpc_chttp2_hptbl_destroy(&tbl); - grpc_mdctx_orphan(mdctx); + grpc_mdctx_unref(mdctx); } static void test_many_additions(void) { @@ -158,7 +158,7 @@ static void test_many_additions(void) { } grpc_chttp2_hptbl_destroy(&tbl); - grpc_mdctx_orphan(mdctx); + grpc_mdctx_unref(mdctx); } static grpc_chttp2_hptbl_find_result find_simple(grpc_chttp2_hptbl *tbl, @@ -262,7 +262,7 @@ static void test_find(void) { GPR_ASSERT(r.has_value == 0); grpc_chttp2_hptbl_destroy(&tbl); - grpc_mdctx_orphan(mdctx); + grpc_mdctx_unref(mdctx); } int main(int argc, char **argv) { diff --git a/test/core/transport/chttp2/stream_encoder_test.c b/test/core/transport/chttp2/stream_encoder_test.c index 3013533f9b9..5c7801079fe 100644 --- a/test/core/transport/chttp2/stream_encoder_test.c +++ b/test/core/transport/chttp2/stream_encoder_test.c @@ -309,7 +309,7 @@ static void run_test(void (*test)(), const char *name) { grpc_sopb_init(&g_sopb); test(); grpc_chttp2_hpack_compressor_destroy(&g_compressor); - grpc_mdctx_orphan(g_mdctx); + grpc_mdctx_unref(g_mdctx); grpc_sopb_destroy(&g_sopb); } diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c index d003582a2ff..f345cebdb6a 100644 --- a/test/core/transport/metadata_test.c +++ b/test/core/transport/metadata_test.c @@ -52,7 +52,7 @@ static void test_no_op(void) { LOG_TEST(); ctx = grpc_mdctx_create(); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_create_string(void) { @@ -71,7 +71,7 @@ static void test_create_string(void) { GPR_ASSERT(gpr_slice_str_cmp(s3->slice, "very much not hello") == 0); grpc_mdstr_unref(s1); grpc_mdstr_unref(s2); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); grpc_mdstr_unref(s3); } @@ -95,7 +95,7 @@ static void test_create_metadata(void) { grpc_mdelem_unref(m1); grpc_mdelem_unref(m2); grpc_mdelem_unref(m3); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_create_many_ephemeral_metadata(void) { @@ -116,7 +116,7 @@ static void test_create_many_ephemeral_metadata(void) { /* capacity should not grow */ GPR_ASSERT(mdtab_capacity_before == grpc_mdctx_get_mdtab_capacity_test_only(ctx)); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_create_many_persistant_metadata(void) { @@ -145,7 +145,7 @@ static void test_create_many_persistant_metadata(void) { for (i = 0; i < MANY; i++) { grpc_mdelem_unref(created[i]); } - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); gpr_free(created); } @@ -171,7 +171,7 @@ static void test_spin_creating_the_same_thing(void) { GPR_ASSERT(grpc_mdctx_get_mdtab_count_test_only(ctx) == 1); GPR_ASSERT(grpc_mdctx_get_mdtab_free_test_only(ctx) == 1); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_things_stick_around(void) { @@ -218,7 +218,7 @@ static void test_things_stick_around(void) { } } - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); gpr_free(strs); gpr_free(shuf); } @@ -245,7 +245,7 @@ static void test_slices_work(void) { gpr_slice_unref(slice); grpc_mdstr_unref(str); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } static void test_base64_and_huffman_works(void) { @@ -264,7 +264,7 @@ static void test_base64_and_huffman_works(void) { gpr_slice_unref(slice2); grpc_mdstr_unref(str); - grpc_mdctx_orphan(ctx); + grpc_mdctx_unref(ctx); } int main(int argc, char **argv) { diff --git a/test/core/transport/transport_end2end_tests.c b/test/core/transport/transport_end2end_tests.c index 6a0848fa978..6d13bf1f8c9 100644 --- a/test/core/transport/transport_end2end_tests.c +++ b/test/core/transport/transport_end2end_tests.c @@ -927,7 +927,7 @@ void grpc_transport_end2end_tests(grpc_transport_test_config *config) { test_request_with_flow_ctl_cb(config, interesting_message_lengths[i]); } - grpc_mdctx_orphan(g_metadata_context); + grpc_mdctx_unref(g_metadata_context); gpr_log(GPR_INFO, "tests completed ok"); } From 3a5e5495e53868378a0c46e16990671f2fab565d Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 14:32:38 -0800 Subject: [PATCH 167/232] Async client api change. Add a ClientAsyncResponseReader. Make the api similar to streaming and symmetric to server side. --- Makefile | 1 + build.json | 1 + include/grpc++/async_unary_call.h | 144 ++++++++++++++++++++++++ include/grpc++/client_context.h | 4 + include/grpc++/impl/client_unary_call.h | 7 -- include/grpc++/stream.h | 54 --------- src/compiler/cpp_generator.cc | 22 ++-- src/cpp/client/client_unary_call.cc | 26 ----- test/cpp/end2end/async_end2end_test.cc | 82 ++++++++------ 9 files changed, 213 insertions(+), 128 deletions(-) create mode 100644 include/grpc++/async_unary_call.h diff --git a/Makefile b/Makefile index 58bbc7a783e..3794d943f66 100644 --- a/Makefile +++ b/Makefile @@ -2978,6 +2978,7 @@ LIBGRPC++_SRC = \ src/cpp/util/time.cc \ PUBLIC_HEADERS_CXX += \ + include/grpc++/async_unary_call.h \ include/grpc++/channel_arguments.h \ include/grpc++/channel_interface.h \ include/grpc++/client_context.h \ diff --git a/build.json b/build.json index 07af69126b8..a980e94687a 100644 --- a/build.json +++ b/build.json @@ -398,6 +398,7 @@ "build": "all", "language": "c++", "public_headers": [ + "include/grpc++/async_unary_call.h", "include/grpc++/channel_arguments.h", "include/grpc++/channel_interface.h", "include/grpc++/client_context.h", diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h new file mode 100644 index 00000000000..2c437960cbe --- /dev/null +++ b/include/grpc++/async_unary_call.h @@ -0,0 +1,144 @@ +/* + * + * Copyright 2014, 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. + * + */ + +#ifndef __GRPCPP_ASYNC_UNARY_CALL_H__ +#define __GRPCPP_ASYNC_UNARY_CALL_H__ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace grpc { +template +class ClientAsyncResponseReader final { + public: + ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq, + const RpcMethod& method, ClientContext* context, + const google::protobuf::Message& request, void* tag) + : context_(context), + call_(channel->CreateCall(method, context, cq)) { + init_buf_.Reset(tag); + init_buf_.AddSendInitialMetadata(&context->send_initial_metadata_); + init_buf_.AddSendMessage(request); + init_buf_.AddClientSendClose(); + call_.PerformOps(&init_buf_); + } + + void ReadInitialMetadata(void* tag) { + GPR_ASSERT(!context_->initial_metadata_received_); + + meta_buf_.Reset(tag); + meta_buf_.AddRecvInitialMetadata(context_); + call_.PerformOps(&meta_buf_); + } + + void Finish(R* msg, Status* status, void* tag) { + finish_buf_.Reset(tag); + if (!context_->initial_metadata_received_) { + finish_buf_.AddRecvInitialMetadata(context_); + } + finish_buf_.AddRecvMessage(msg); + finish_buf_.AddClientRecvStatus(context_, status); + call_.PerformOps(&finish_buf_); + } + + + private: + ClientContext* context_ = nullptr; + Call call_; + CallOpBuffer init_buf_; + CallOpBuffer meta_buf_; + CallOpBuffer finish_buf_; +}; + +template +class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { + public: + explicit ServerAsyncResponseWriter(ServerContext* ctx) + : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} + + void SendInitialMetadata(void* tag) { + GPR_ASSERT(!ctx_->sent_initial_metadata_); + + meta_buf_.Reset(tag); + meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + call_.PerformOps(&meta_buf_); + } + + void Finish(const W& msg, const Status& status, void* tag) { + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + // The response is dropped if the status is not OK. + if (status.IsOk()) { + finish_buf_.AddSendMessage(msg); + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_buf_); + } + + void FinishWithError(const Status& status, void* tag) { + GPR_ASSERT(!status.IsOk()); + finish_buf_.Reset(tag); + if (!ctx_->sent_initial_metadata_) { + finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); + ctx_->sent_initial_metadata_ = true; + } + bool cancelled = false; + finish_buf_.AddServerRecvClose(&cancelled); + finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); + call_.PerformOps(&finish_buf_); + } + + private: + void BindCall(Call* call) override { call_ = *call; } + + Call call_; + ServerContext* ctx_; + CallOpBuffer meta_buf_; + CallOpBuffer finish_buf_; +}; + +} // namespace grpc + +#endif // __GRPCPP_ASYNC_UNARY_CALL_H__ diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 8345a6f5aff..29aef7ae5da 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -72,6 +72,8 @@ template class ClientAsyncWriter; template class ClientAsyncReaderWriter; +template +class ClientAsyncResponseReader; class ClientContext { public: @@ -119,6 +121,8 @@ class ClientContext { friend class ::grpc::ClientAsyncWriter; template friend class ::grpc::ClientAsyncReaderWriter; + template + friend class ::grpc::ClientAsyncResponseReader; grpc_call *call() { return call_; } void set_call(grpc_call *call) { diff --git a/include/grpc++/impl/client_unary_call.h b/include/grpc++/impl/client_unary_call.h index 22a8a04c823..f94538560e0 100644 --- a/include/grpc++/impl/client_unary_call.h +++ b/include/grpc++/impl/client_unary_call.h @@ -48,13 +48,6 @@ class CompletionQueue; class RpcMethod; class Status; -// Wrapper that begins an asynchronous unary call -void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result, Status *status, - CompletionQueue *cq, void *tag); - // Wrapper that performs a blocking unary call Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index 20ba3fb7905..740189fcd02 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -550,60 +550,6 @@ class ClientAsyncReaderWriter final : public ClientAsyncStreamingInterface, CallOpBuffer finish_buf_; }; -// TODO(yangg) Move out of stream.h -template -class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { - public: - explicit ServerAsyncResponseWriter(ServerContext* ctx) - : call_(nullptr, nullptr, nullptr), ctx_(ctx) {} - - void SendInitialMetadata(void* tag) { - GPR_ASSERT(!ctx_->sent_initial_metadata_); - - meta_buf_.Reset(tag); - meta_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - call_.PerformOps(&meta_buf_); - } - - void Finish(const W& msg, const Status& status, void* tag) { - finish_buf_.Reset(tag); - if (!ctx_->sent_initial_metadata_) { - finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - // The response is dropped if the status is not OK. - if (status.IsOk()) { - finish_buf_.AddSendMessage(msg); - } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); - finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_buf_); - } - - void FinishWithError(const Status& status, void* tag) { - GPR_ASSERT(!status.IsOk()); - finish_buf_.Reset(tag); - if (!ctx_->sent_initial_metadata_) { - finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); - ctx_->sent_initial_metadata_ = true; - } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); - finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); - call_.PerformOps(&finish_buf_); - } - - private: - void BindCall(Call* call) override { call_ = *call; } - - Call call_; - ServerContext* ctx_; - CallOpBuffer meta_buf_; - CallOpBuffer finish_buf_; -}; - template class ServerAsyncReader : public ServerAsyncStreamingInterface, public AsyncReaderInterface { diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index 60dc02d7af9..6229170c2a8 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -126,6 +126,8 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { "class RpcService;\n" "class ServerContext;\n"; if (HasUnaryCalls(file)) { + temp.append( + "template class ClientAsyncResponseReader;\n"); temp.append( "template class ServerAsyncResponseWriter;\n"); } @@ -160,7 +162,8 @@ std::string GetHeaderIncludes(const google::protobuf::FileDescriptor *file) { } std::string GetSourceIncludes() { - return "#include \n" + return "#include \n" + "#include \n" "#include \n" "#include \n" "#include \n" @@ -181,9 +184,9 @@ void PrintHeaderClientMethod(google::protobuf::io::Printer *printer, "::grpc::Status $Method$(::grpc::ClientContext* context, " "const $Request$& request, $Response$* response);\n"); printer->Print(*vars, - "void $Method$(::grpc::ClientContext* context, " - "const $Request$& request, $Response$* response, " - "::grpc::Status* status, " + "::grpc::ClientAsyncResponseReader< $Response$>* " + "$Method$(::grpc::ClientContext* context, " + "const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag);\n"); } else if (ClientOnlyStreaming(method)) { printer->Print(*vars, @@ -378,14 +381,15 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "context, request, response);\n" "}\n\n"); printer->Print(*vars, - "void $Service$::Stub::$Method$(" - "::grpc::ClientContext* context, " - "const $Request$& request, $Response$* response, ::grpc::Status* status, " + "::grpc::ClientAsyncResponseReader< $Response$>* " + "$Service$::Stub::$Method$(::grpc::ClientContext* context, " + "const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, - " ::grpc::AsyncUnaryCall(channel()," + " return new ClientAsyncResponseReader< $Response$>(" + "channel(), cq, " "::grpc::RpcMethod($Service$_method_names[$Idx$]), " - "context, request, response, status, cq, tag);\n" + "context, request, tag);\n" "}\n\n"); } else if (ClientOnlyStreaming(method)) { printer->Print( diff --git a/src/cpp/client/client_unary_call.cc b/src/cpp/client/client_unary_call.cc index 03a03261285..1bc1db5fb0a 100644 --- a/src/cpp/client/client_unary_call.cc +++ b/src/cpp/client/client_unary_call.cc @@ -60,30 +60,4 @@ Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, GPR_ASSERT((cq.Pluck(&buf) && buf.got_message) || !status.IsOk()); return status; } - -class ClientAsyncRequest final : public CallOpBuffer { - public: - void FinalizeResult(void **tag, bool *status) override { - CallOpBuffer::FinalizeResult(tag, status); - delete this; - } -}; - -void AsyncUnaryCall(ChannelInterface *channel, const RpcMethod &method, - ClientContext *context, - const google::protobuf::Message &request, - google::protobuf::Message *result, Status *status, - CompletionQueue *cq, void *tag) { - ClientAsyncRequest *buf = new ClientAsyncRequest; - buf->Reset(tag); - Call call(channel->CreateCall(method, context, cq)); - buf->AddSendInitialMetadata(context); - buf->AddSendMessage(request); - buf->AddRecvInitialMetadata(context); - buf->AddRecvMessage(result); - buf->AddClientSendClose(); - buf->AddClientRecvStatus(context, status); - call.PerformOps(buf); -} - } // namespace grpc diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 7e827cb0e57..2848ffce1f2 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -38,6 +38,7 @@ #include "test/cpp/util/echo_duplicate.pb.h" #include "test/cpp/util/echo.pb.h" #include "src/cpp/util/time.h" +#include #include #include #include @@ -124,21 +125,23 @@ class AsyncEnd2endTest : public ::testing::Test { grpc::ServerAsyncResponseWriter response_writer(&srv_ctx); send_request.set_message("Hello"); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + std::unique_ptr > + response_reader(stub_->Echo( + &cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); server_ok(2); EXPECT_EQ(send_request.message(), recv_request.message()); + client_ok(1); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); - server_ok(3); - client_ok(1); + response_reader->Finish(&recv_response, &recv_status, tag(4)); + client_ok(4); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); @@ -341,8 +344,8 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta2.first, meta2.second); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + std::unique_ptr > response_reader( + stub_->Echo(&cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); @@ -352,13 +355,15 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); EXPECT_EQ(2, client_initial_metadata.size()); + client_ok(1); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(3)); server_ok(3); - client_ok(1); + response_reader->Finish(&recv_response, &recv_status, tag(4)); + client_ok(4); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); @@ -381,8 +386,8 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { std::pair meta1("key1", "val1"); std::pair meta2("key2", "val2"); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + std::unique_ptr > response_reader( + stub_->Echo(&cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); @@ -390,22 +395,26 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { EXPECT_EQ(send_request.message(), recv_request.message()); srv_ctx.AddInitialMetadata(meta1.first, meta1.second); srv_ctx.AddInitialMetadata(meta2.first, meta2.second); + client_ok(1); response_writer.SendInitialMetadata(tag(3)); server_ok(3); - send_response.set_message(recv_request.message()); - response_writer.Finish(send_response, Status::OK, tag(4)); + response_reader->ReadInitialMetadata(tag(4)); + client_ok(4); + auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); + EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); + EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); + EXPECT_EQ(2, server_initial_metadata.size()); - server_ok(4); + send_response.set_message(recv_request.message()); + response_writer.Finish(send_response, Status::OK, tag(5)); + server_ok(5); - client_ok(1); + response_reader->Finish(&recv_response, &recv_status, tag(6)); + client_ok(6); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); - auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); - EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); - EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); - EXPECT_EQ(2, server_initial_metadata.size()); } TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { @@ -425,8 +434,8 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { std::pair meta1("key1", "val1"); std::pair meta2("key2", "val2"); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + std::unique_ptr > response_reader( + stub_->Echo(&cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); @@ -434,6 +443,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { EXPECT_EQ(send_request.message(), recv_request.message()); response_writer.SendInitialMetadata(tag(3)); server_ok(3); + client_ok(1); send_response.set_message(recv_request.message()); srv_ctx.AddTrailingMetadata(meta1.first, meta1.second); @@ -442,8 +452,9 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { server_ok(4); - client_ok(1); + response_reader->Finish(&recv_response, &recv_status, tag(5)); + client_ok(5); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); @@ -467,17 +478,20 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { send_request.set_message("Hello"); std::pair meta1("key1", "val1"); - std::pair meta2("key2-bin", {"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13}); + std::pair meta2( + "key2-bin", {"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc", 13}); std::pair meta3("key3", "val3"); - std::pair meta6("key4-bin", {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14}); + std::pair meta6("key4-bin", + {"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d", 14}); std::pair meta5("key5", "val5"); - std::pair meta4("key6-bin", {"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15}); + std::pair meta4("key6-bin", + {"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee", 15}); cli_ctx.AddMetadata(meta1.first, meta1.second); cli_ctx.AddMetadata(meta2.first, meta2.second); - stub_->Echo( - &cli_ctx, send_request, &recv_response, &recv_status, &cli_cq_, tag(1)); + std::unique_ptr > response_reader( + stub_->Echo(&cli_ctx, send_request, &cli_cq_, tag(1))); service_.RequestEcho( &srv_ctx, &recv_request, &response_writer, &srv_cq_, tag(2)); @@ -487,27 +501,31 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); EXPECT_EQ(2, client_initial_metadata.size()); + client_ok(1); srv_ctx.AddInitialMetadata(meta3.first, meta3.second); srv_ctx.AddInitialMetadata(meta4.first, meta4.second); response_writer.SendInitialMetadata(tag(3)); server_ok(3); + response_reader->ReadInitialMetadata(tag(4)); + client_ok(4); + auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); + EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); + EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); + EXPECT_EQ(2, server_initial_metadata.size()); send_response.set_message(recv_request.message()); srv_ctx.AddTrailingMetadata(meta5.first, meta5.second); srv_ctx.AddTrailingMetadata(meta6.first, meta6.second); - response_writer.Finish(send_response, Status::OK, tag(4)); + response_writer.Finish(send_response, Status::OK, tag(5)); - server_ok(4); + server_ok(5); - client_ok(1); + response_reader->Finish(&recv_response, &recv_status, tag(6)); + client_ok(6); EXPECT_EQ(send_response.message(), recv_response.message()); EXPECT_TRUE(recv_status.IsOk()); - auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); - EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); - EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); - EXPECT_EQ(2, server_initial_metadata.size()); auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); EXPECT_EQ(meta5.second, server_trailing_metadata.find(meta5.first)->second); EXPECT_EQ(meta6.second, server_trailing_metadata.find(meta6.first)->second); From 68bc778b63c1e82ec8c68cf9e2b9be23c0b9104d Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 14:41:40 -0800 Subject: [PATCH 168/232] 2015 --- include/grpc++/async_unary_call.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 2c437960cbe..105250ce9d7 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -1,6 +1,6 @@ /* * - * Copyright 2014, Google Inc. + * Copyright 2015, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 9b98bd89af3e715e98f7111b9a389ecc92dbb20c Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 18 Feb 2015 22:47:25 +0000 Subject: [PATCH 169/232] Add a src/python/README.md. --- src/python/README.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 src/python/README.md diff --git a/src/python/README.md b/src/python/README.md new file mode 100755 index 00000000000..be2f2bedf9c --- /dev/null +++ b/src/python/README.md @@ -0,0 +1,34 @@ +GRPC Python +========= + +The Python facility of GRPC. + + +Prerequisites +----------------------- + +Python 2.7, virtualenv, pip, libprotobuf-dev, and libprotoc-dev. + + +Building from source +---------------------- + +- Build the GRPC core +E.g, from the root of the grpc [git repo](https://github.com/google/grpc) +``` +$ make shared_c static_c +``` + +- Use build_python.sh to build the Python code and install it into a virtual environment +``` +$ tools/run_tests/build_python.sh +``` + + +Testing +----------------------- + +- Use run_python.sh to run GRPC as it was installed into the virtual environment +``` +$ tools/run_tests/run_python.sh +``` From 8c3ed009a835e01dcee690cecaeeaf7fecf3e98e Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Feb 2015 15:00:56 -0800 Subject: [PATCH 170/232] Added auth functionality and interop tests --- src/node/index.js | 32 +++++ src/node/interop/interop_client.js | 48 ++++++- src/node/interop/messages.proto | 10 +- src/node/package.json | 3 +- src/node/src/client.js | 193 +++++++++++++++++------------ 5 files changed, 206 insertions(+), 80 deletions(-) diff --git a/src/node/index.js b/src/node/index.js index baef4d03c68..8b5b1ea9a61 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -73,6 +73,36 @@ function load(filename) { return loadObject(builder.ns); } +/** + * Get a function that a client can use to update metadata with authentication + * information from a Google Auth credential object. + * @param {Object} credential The credential object to use + * @return {function(Object, callback)} Metadata updater function + */ +function getGoogleAuthDelegate(credential) { + /** + * Update a metadata object with authentication information. + * @param {Object} metadata Metadata object + * @param {function(Error, Object)} callback + */ + return function updateMetadata(metadata, callback) { + metadata = _.clone(metadata); + if (metadata.Authorization) { + metadata.Authorization = _.clone(metadata.Authorization); + } else { + metadata.Authorization = []; + } + credential.getAccessToken(function(err, token) { + if (err) { + callback(err); + return; + } + metadata.Authorization.push('Bearer ' + token); + callback(null, metadata); + }); + }; +} + /** * See docs for loadObject */ @@ -106,3 +136,5 @@ exports.Credentials = grpc.Credentials; * ServerCredentials factories */ exports.ServerCredentials = grpc.ServerCredentials; + +exports.getGoogleAuthDelegate = getGoogleAuthDelegate; diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 00284d0855a..9a19a509f39 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -35,9 +35,14 @@ var fs = require('fs'); var path = require('path'); var grpc = require('..'); var testProto = grpc.load(__dirname + '/test.proto').grpc.testing; +var GoogleAuth = require('googleauth'); var assert = require('assert'); +var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo'; +var AUTH_SCOPE_RESPONSE = 'xapi.zoo'; +var AUTH_USER = '155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk@developer.gserviceaccount.com'; + /** * Create a buffer filled with size zeroes * @param {number} size The length of the buffer @@ -255,6 +260,45 @@ function cancelAfterFirstResponse(client, done) { }); } +/** + * Run one of the authentication tests. + * @param {Client} client The client to test against + * @param {function} done Callback to call when the test is completed. Included + * primarily for use with mocha + */ +function authTest(client, done) { + (new GoogleAuth()).getApplicationDefault(function(err, credential) { + assert.ifError(err); + if (credential.createScopedRequired()) { + credential = credential.createScoped(AUTH_SCOPE); + } + client.updateMetadata = grpc.getGoogleAuthDelegate(credential); + var arg = { + response_type: testProto.PayloadType.COMPRESSABLE, + response_size: 314159, + payload: { + body: zeroBuffer(271828) + }, + fill_username: true, + fill_oauth_scope: true + }; + var call = client.unaryCall(arg, function(err, resp) { + assert.ifError(err); + assert.strictEqual(resp.payload.type, testProto.PayloadType.COMPRESSABLE); + assert.strictEqual(resp.payload.body.limit - resp.payload.body.offset, + 314159); + assert.strictEqual(resp.username, AUTH_USER); + assert.strictEqual(resp.oauth_scope, AUTH_SCOPE_RESPONSE); + }); + call.on('status', function(status) { + assert.strictEqual(status.code, grpc.status.OK); + if (done) { + done(); + } + }); + }); +} + /** * Map from test case names to test functions */ @@ -266,7 +310,9 @@ var test_cases = { ping_pong: pingPong, empty_stream: emptyStream, cancel_after_begin: cancelAfterBegin, - cancel_after_first_response: cancelAfterFirstResponse + cancel_after_first_response: cancelAfterFirstResponse, + compute_engine_creds: authTest, + service_account_creds: authTest }; /** diff --git a/src/node/interop/messages.proto b/src/node/interop/messages.proto index 29db0dd8b1a..1d95154cf49 100644 --- a/src/node/interop/messages.proto +++ b/src/node/interop/messages.proto @@ -36,6 +36,12 @@ message SimpleRequest { // Optional input payload sent along with the request. optional Payload payload = 3; + + // Whether SimpleResponse should include username. + optional bool fill_username = 4; + + // Whether SimpleResponse should include OAuth scope. + optional bool fill_oauth_scope = 5; } // Unary response, as configured by the request. @@ -44,7 +50,9 @@ message SimpleResponse { optional Payload payload = 1; // The user the request came from, for verifying authentication was // successful when the client expected it. - optional int64 effective_gaia_user_id = 2; + optional string username = 2; + // OAuth scope. + optional string oauth_scope = 3; } // Client-streaming request. diff --git a/src/node/package.json b/src/node/package.json index 8f81014c1e8..821641ce19b 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -14,7 +14,8 @@ }, "devDependencies": { "mocha": "~1.21.0", - "minimist": "^1.1.0" + "minimist": "^1.1.0", + "googleauth": "google/google-auth-library-nodejs" }, "main": "index.js" } diff --git a/src/node/src/client.js b/src/node/src/client.js index 81fa65eb263..19c3144c7d9 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -224,25 +224,32 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { emitter.cancel = function cancel() { call.cancel(); }; - var client_batch = {}; - client_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; - client_batch[grpc.opType.SEND_MESSAGE] = serialize(argument); - client_batch[grpc.opType.SEND_CLOSE_FROM_CLIENT] = true; - client_batch[grpc.opType.RECV_INITIAL_METADATA] = true; - client_batch[grpc.opType.RECV_MESSAGE] = true; - client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; - call.startBatch(client_batch, function(err, response) { - if (err) { - callback(err); + this.updateMetadata(metadata, function(error, metadata) { + if (error) { + call.cancel(); + callback(error); return; } - if (response.status.code != grpc.status.OK) { - callback(response.status); - return; - } - emitter.emit('status', response.status); - emitter.emit('metadata', response.metadata); - callback(null, deserialize(response.read)); + var client_batch = {}; + client_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; + client_batch[grpc.opType.SEND_MESSAGE] = serialize(argument); + client_batch[grpc.opType.SEND_CLOSE_FROM_CLIENT] = true; + client_batch[grpc.opType.RECV_INITIAL_METADATA] = true; + client_batch[grpc.opType.RECV_MESSAGE] = true; + client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; + call.startBatch(client_batch, function(err, response) { + if (err) { + callback(err); + return; + } + if (response.status.code != grpc.status.OK) { + callback(response.status); + return; + } + emitter.emit('status', response.status); + emitter.emit('metadata', response.metadata); + callback(null, deserialize(response.read)); + }); }); return emitter; } @@ -279,30 +286,37 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) { metadata = {}; } var stream = new ClientWritableStream(call, serialize); - var metadata_batch = {}; - metadata_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; - metadata_batch[grpc.opType.RECV_INITIAL_METADATA] = true; - call.startBatch(metadata_batch, function(err, response) { - if (err) { - callback(err); - return; - } - stream.emit('metadata', response.metadata); - }); - var client_batch = {}; - client_batch[grpc.opType.RECV_MESSAGE] = true; - client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; - call.startBatch(client_batch, function(err, response) { - if (err) { - callback(err); - return; - } - if (response.status.code != grpc.status.OK) { - callback(response.status); + this.updateMetadata(metadata, function(error, metadata) { + if (error) { + call.cancel(); + callback(error); return; } - stream.emit('status', response.status); - callback(null, deserialize(response.read)); + var metadata_batch = {}; + metadata_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; + metadata_batch[grpc.opType.RECV_INITIAL_METADATA] = true; + call.startBatch(metadata_batch, function(err, response) { + if (err) { + callback(err); + return; + } + stream.emit('metadata', response.metadata); + }); + var client_batch = {}; + client_batch[grpc.opType.RECV_MESSAGE] = true; + client_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; + call.startBatch(client_batch, function(err, response) { + if (err) { + callback(err); + return; + } + if (response.status.code != grpc.status.OK) { + callback(response.status); + return; + } + stream.emit('status', response.status); + callback(null, deserialize(response.read)); + }); }); return stream; } @@ -339,24 +353,31 @@ function makeServerStreamRequestFunction(method, serialize, deserialize) { metadata = {}; } var stream = new ClientReadableStream(call, deserialize); - var start_batch = {}; - start_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; - start_batch[grpc.opType.RECV_INITIAL_METADATA] = true; - start_batch[grpc.opType.SEND_MESSAGE] = serialize(argument); - start_batch[grpc.opType.SEND_CLOSE_FROM_CLIENT] = true; - call.startBatch(start_batch, function(err, response) { - if (err) { - throw err; - } - stream.emit('metadata', response.metadata); - }); - var status_batch = {}; - status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; - call.startBatch(status_batch, function(err, response) { - if (err) { - throw err; + this.updateMetadata(metadata, function(error, metadata) { + if (error) { + call.cancel(); + stream.emit('error', error); + return; } - stream.emit('status', response.status); + var start_batch = {}; + start_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; + start_batch[grpc.opType.RECV_INITIAL_METADATA] = true; + start_batch[grpc.opType.SEND_MESSAGE] = serialize(argument); + start_batch[grpc.opType.SEND_CLOSE_FROM_CLIENT] = true; + call.startBatch(start_batch, function(err, response) { + if (err) { + throw err; + } + stream.emit('metadata', response.metadata); + }); + var status_batch = {}; + status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; + call.startBatch(status_batch, function(err, response) { + if (err) { + throw err; + } + stream.emit('status', response.status); + }); }); return stream; } @@ -391,22 +412,29 @@ function makeBidiStreamRequestFunction(method, serialize, deserialize) { metadata = {}; } var stream = new ClientDuplexStream(call, serialize, deserialize); - var start_batch = {}; - start_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; - start_batch[grpc.opType.RECV_INITIAL_METADATA] = true; - call.startBatch(start_batch, function(err, response) { - if (err) { - throw err; - } - stream.emit('metadata', response.metadata); - }); - var status_batch = {}; - status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; - call.startBatch(status_batch, function(err, response) { - if (err) { - throw err; + this.updateMetadata(metadata, function(error, metadata) { + if (error) { + call.cancel(); + stream.emit('error', error); + return; } - stream.emit('status', response.status); + var start_batch = {}; + start_batch[grpc.opType.SEND_INITIAL_METADATA] = metadata; + start_batch[grpc.opType.RECV_INITIAL_METADATA] = true; + call.startBatch(start_batch, function(err, response) { + if (err) { + throw err; + } + stream.emit('metadata', response.metadata); + }); + var status_batch = {}; + status_batch[grpc.opType.RECV_STATUS_ON_CLIENT] = true; + call.startBatch(status_batch, function(err, response) { + if (err) { + throw err; + } + stream.emit('status', response.status); + }); }); return stream; } @@ -438,8 +466,17 @@ function makeClientConstructor(service) { * @constructor * @param {string} address The address of the server to connect to * @param {Object} options Options to pass to the underlying channel + * @param {function(Object, function)=} updateMetadata function to update the + * metadata for each request */ - function Client(address, options) { + function Client(address, options, updateMetadata) { + if (updateMetadata) { + this.updateMetadata = updateMetadata; + } else { + this.updateMetadata = function(metadata, callback) { + callback(null, metadata); + }; + } this.channel = new grpc.Channel(address, options); } @@ -458,11 +495,13 @@ function makeClientConstructor(service) { method_type = 'unary'; } } - Client.prototype[decapitalize(method.name)] = - requester_makers[method_type]( - prefix + capitalize(method.name), - common.serializeCls(method.resolvedRequestType.build()), - common.deserializeCls(method.resolvedResponseType.build())); + var serialize = common.serializeCls(method.resolvedRequestType.build()); + var deserialize = common.deserializeCls( + method.resolvedResponseType.build()); + Client.prototype[decapitalize(method.name)] = requester_makers[method_type]( + prefix + capitalize(method.name), serialize, deserialize); + Client.prototype[decapitalize(method.name)].serialize = serialize; + Client.prototype[decapitalize(method.name)].deserialize = deserialize; }); Client.service = service; From 501d9d0811ad5c22db2615e38af9d5c95cb5cfa1 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Feb 2015 15:06:45 -0800 Subject: [PATCH 171/232] Added node auth interop test command --- tools/gce_setup/grpc_docker.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 980a4f6932a..3499735f4ab 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1020,7 +1020,7 @@ grpc_interop_gen_node_cmd() { echo $the_cmd } -# constructs the full dockerized node interop test cmd. +# constructs the full dockerized node gce=>prod interop test cmd. # # call-seq: # flags= .... # generic flags to include the command @@ -1033,6 +1033,21 @@ grpc_cloud_prod_gen_node_cmd() { echo $the_cmd } +# constructs the full dockerized node service_account auth interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_auth_service_account_creds_gen_node_cmd() { + local cmd_prefix="sudo docker run grpc/node"; + local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; + local gfe_flags=$(_grpc_prod_gfe_flags); + local env_prefix="SSL_CERT_FILE=/cacerts/roots.pem" + env_prefix+=" GOOGLE_APPLICATION_CREDENTIALS=/service_account/stubbyCloudTestingTest-7dd63462c60c.json" + local the_cmd="$env_prefix $cmd_prefix $test_script $gfe_flags $@"; + echo $the_cmd +} + # constructs the full dockerized cpp interop test cmd. # # call-seq: From 2ec0b3ea59ea0869d07153c8f54894aea5192693 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 15:03:12 -0800 Subject: [PATCH 172/232] make grpc_csharp_ext compile and install independently from the grpc and gpr libraries --- Makefile | 52 +++++++++++++++++++++++-------------- build.json | 2 +- templates/Makefile.template | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e1991da5ecd..f1fa9dba127 100644 --- a/Makefile +++ b/Makefile @@ -892,16 +892,19 @@ $(LIBDIR)/$(CONFIG)/protobuf/libprotobuf.a: third_party/protobuf/configure static: static_c static_cxx -static_c: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a +static_c: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a static_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++.a shared: shared_c shared_cxx -shared_c: $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) +shared_c: $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) shared_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) +shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) +grpc_csharp_ext: shared_csharp + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a @@ -1765,8 +1768,6 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[STRIP] Stripping libgrpc.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc.a - $(E) "[STRIP] Stripping libgrpc_csharp_ext.a" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.a $(E) "[STRIP] Stripping libgrpc_unsecure.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a endif @@ -1783,8 +1784,6 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgpr.$(SHARED_EXT) $(E) "[STRIP] Stripping libgrpc.so" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc.$(SHARED_EXT) - $(E) "[STRIP] Stripping libgrpc_csharp_ext.so" - $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(E) "[STRIP] Stripping libgrpc_unsecure.so" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.$(SHARED_EXT) endif @@ -1795,6 +1794,12 @@ ifeq ($(CONFIG),opt) $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) endif +strip-shared_csharp: shared_csharp +ifeq ($(CONFIG),opt) + $(E) "[STRIP] Stripping libgrpc_csharp_ext.so" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) +endif + ifeq ($(NO_PROTOC),true) $(GENDIR)/examples/pubsub/empty.pb.cc: protoc_dep_error else @@ -1913,6 +1918,10 @@ install_c: install-headers_c install-static_c install-shared_c install_cxx: install-headers_cxx install-static_cxx install-shared_cxx +install_csharp: install-shared_csharp install_c + +install_grpc_csharp_ext: install_csharp + install-headers: install-headers_c install-headers_cxx install-headers_c: @@ -1930,8 +1939,6 @@ install-static_c: static_c strip-static_c $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgpr.a $(prefix)/lib/libgpr.a $(E) "[INSTALL] Installing libgrpc.a" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc.a $(prefix)/lib/libgrpc.a - $(E) "[INSTALL] Installing libgrpc_csharp_ext.a" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.a $(prefix)/lib/libgrpc_csharp_ext.a $(E) "[INSTALL] Installing libgrpc_unsecure.a" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(prefix)/lib/libgrpc_unsecure.a @@ -1962,17 +1969,6 @@ ifneq ($(SYSTEM),Darwin) $(Q) ln -sf libgrpc.$(SHARED_EXT) $(prefix)/lib/libgrpc.so endif endif -ifeq ($(SYSTEM),MINGW32) - $(E) "[INSTALL] Installing grpc_csharp_ext.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/grpc_csharp_ext.$(SHARED_EXT) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext-imp.a $(prefix)/lib/libgrpc_csharp_ext-imp.a -else - $(E) "[INSTALL] Installing libgrpc_csharp_ext.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.$(SHARED_EXT) -ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so -endif -endif ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing grpc_unsecure.$(SHARED_EXT)" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc_unsecure.$(SHARED_EXT) $(prefix)/lib/grpc_unsecure.$(SHARED_EXT) @@ -2008,6 +2004,24 @@ ifneq ($(SYSTEM),Darwin) endif endif +install-shared_csharp: shared_csharp strip-shared_csharp +ifeq ($(SYSTEM),MINGW32) + $(E) "[INSTALL] Installing grpc_csharp_ext.$(SHARED_EXT)" + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/grpc_csharp_ext.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext-imp.a $(prefix)/lib/libgrpc_csharp_ext-imp.a +else + $(E) "[INSTALL] Installing libgrpc_csharp_ext.$(SHARED_EXT)" + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf libgrpc_csharp_ext.$(SHARED_EXT) $(prefix)/lib/libgrpc_csharp_ext.so +endif +endif +ifneq ($(SYSTEM),MINGW32) +ifneq ($(SYSTEM),Darwin) + $(Q) ldconfig +endif +endif + clean: $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) diff --git a/build.json b/build.json index a09296479a1..c552228496d 100644 --- a/build.json +++ b/build.json @@ -345,7 +345,7 @@ { "name": "grpc_csharp_ext", "build": "all", - "language": "c", + "language": "csharp", "src": [ "src/csharp/ext/grpc_csharp_ext.c" ], diff --git a/templates/Makefile.template b/templates/Makefile.template index d107801e083..178ace6bcf0 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -529,6 +529,15 @@ shared_cxx: \ % endfor +shared_csharp: shared_c \ +% for lib in libs: +% if lib.build == 'all' and lib.language == 'csharp': + $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT)\ +% endif +% endfor + +grpc_csharp_ext: shared_csharp + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: \ @@ -662,6 +671,18 @@ ifeq ($(CONFIG),opt) % endfor endif +strip-shared_csharp: shared_csharp +ifeq ($(CONFIG),opt) +% for lib in libs: +% if lib.language == "csharp": +% if lib.build == "all": + $(E) "[STRIP] Stripping lib${lib.name}.so" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) +% endif +% endif +% endfor +endif + % for p in protos: ifeq ($(NO_PROTOC),true) $(GENDIR)/${p}.pb.cc: protoc_dep_error @@ -701,6 +722,10 @@ install_c: install-headers_c install-static_c install-shared_c install_cxx: install-headers_cxx install-static_cxx install-shared_cxx +install_csharp: install-shared_csharp install_c + +install_grpc_csharp_ext: install_csharp + install-headers: install-headers_c install-headers_cxx install-headers_c: @@ -781,6 +806,30 @@ ifneq ($(SYSTEM),Darwin) endif endif +install-shared_csharp: shared_csharp strip-shared_csharp +% for lib in libs: +% if lib.language == "csharp": +% if lib.build == "all": +ifeq ($(SYSTEM),MINGW32) + $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a +else + $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) +ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so +endif +endif +% endif +% endif +% endfor +ifneq ($(SYSTEM),MINGW32) +ifneq ($(SYSTEM),Darwin) + $(Q) ldconfig +endif +endif + clean: $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) From bb0c65b7b4fc3a5f9faadf9651ffe47fb2ecbb82 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 15:15:28 -0800 Subject: [PATCH 173/232] updated C# readme --- src/csharp/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/csharp/README.md b/src/csharp/README.md index a16f1e719e1..f56ddabda5a 100755 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -25,10 +25,11 @@ INSTALLATION AND USAGE: WINDOWS INSTALLATION AND USAGE: LINUX & MONO ------------------------------------ -- Compile and install the gRPC C Core library +- Compile and install the gRPC C# extension library (that will be used via + P/Invoke from C#). ``` -make shared_c -sudo make install +make grpc_csharp_ext +sudo make install_grpc_csharp_ext ``` - Prerequisites for development: Mono framework, MonoDevelop (IDE) From c7625b0e5f89575bd74c5ab84962624fce6a7a80 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 15:18:58 -0800 Subject: [PATCH 174/232] Move header #include --- include/grpc++/server_context.h | 1 - src/cpp/server/server_context.cc | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 5b999909b19..d327d8b41e5 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -36,7 +36,6 @@ #include #include -#include #include "config.h" diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 71e3b464d9a..92775c9492a 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -32,6 +32,9 @@ */ #include + +#include + #include #include #include From d24d13d6eb295f263ffca3def45dd6dc4b053ced Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 15:35:32 -0800 Subject: [PATCH 175/232] Simplify TryPluck --- include/grpc++/completion_queue.h | 2 +- src/cpp/common/completion_queue.cc | 20 ++++++++------------ src/cpp/server/server_context.cc | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index 0bfbd5db7c5..0075482d717 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -114,7 +114,7 @@ class CompletionQueue { bool Pluck(CompletionQueueTag *tag); // Does a single polling pluck on tag - void TryPluck(CompletionQueueTag *tag, bool forever); + void TryPluck(CompletionQueueTag *tag); grpc_completion_queue *cq_; // owned }; diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 5d186e06cc4..414966c1cdf 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -77,22 +77,18 @@ bool CompletionQueue::Next(void** tag, bool* ok) { bool CompletionQueue::Pluck(CompletionQueueTag* tag) { std::unique_ptr ev; - for (;;) { - ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future)); - bool ok = ev->data.op_complete == GRPC_OP_OK; - void* ignored = tag; - if (tag->FinalizeResult(&ignored, &ok)) { - GPR_ASSERT(ignored == tag); - return ok; - } - } + ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_future)); + bool ok = ev->data.op_complete == GRPC_OP_OK; + void* ignored = tag; + GPR_ASSERT(tag->FinalizeResult(&ignored, &ok)); + GPR_ASSERT(ignored == tag); + return ok; } -void CompletionQueue::TryPluck(CompletionQueueTag* tag, bool forever) { +void CompletionQueue::TryPluck(CompletionQueueTag* tag) { std::unique_ptr ev; - ev.reset(grpc_completion_queue_pluck( - cq_, tag, forever ? gpr_inf_future : gpr_inf_past)); + ev.reset(grpc_completion_queue_pluck(cq_, tag, gpr_inf_past)); if (!ev) return; bool ok = ev->data.op_complete == GRPC_OP_OK; void* ignored = tag; diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 92775c9492a..1aa18bcac57 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -71,7 +71,7 @@ void ServerContext::CompletionOp::Unref() { } bool ServerContext::CompletionOp::CheckCancelled(CompletionQueue* cq) { - cq->TryPluck(this, false); + cq->TryPluck(this); std::lock_guard g(mu_); return finalized_ ? cancelled_ : false; } From 2f2afd20be26023815b9a289be844dcfb5802a70 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 15:47:41 -0800 Subject: [PATCH 176/232] fixed string.h include --- src/csharp/ext/grpc_csharp_ext.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 304ee9cf34c..5f9f22cab10 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -31,12 +31,13 @@ * */ +#include "src/core/support/string.h" + #include #include #include #include #include -#include #include From e9defd77deed9648b0174cc30ea357185ce71915 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 15:49:08 -0800 Subject: [PATCH 177/232] Delete symlink to my home directory --- include/grpc/grpc | 1 - 1 file changed, 1 deletion(-) delete mode 120000 include/grpc/grpc diff --git a/include/grpc/grpc b/include/grpc/grpc deleted file mode 120000 index fc80ad1c867..00000000000 --- a/include/grpc/grpc +++ /dev/null @@ -1 +0,0 @@ -/home/craig/grpc-ct/include/grpc \ No newline at end of file From 2627e4e0a917cc438bff186d0bea2bee030ac98a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 15:54:14 -0800 Subject: [PATCH 178/232] Merge with async unary changes --- include/grpc++/async_unary_call.h | 4 ---- src/compiler/cpp_generator.cc | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index 105250ce9d7..b4a654c4a98 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -111,8 +111,6 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { if (status.IsOk()) { finish_buf_.AddSendMessage(msg); } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } @@ -124,8 +122,6 @@ class ServerAsyncResponseWriter final : public ServerAsyncStreamingInterface { finish_buf_.AddSendInitialMetadata(&ctx_->initial_metadata_); ctx_->sent_initial_metadata_ = true; } - bool cancelled = false; - finish_buf_.AddServerRecvClose(&cancelled); finish_buf_.AddServerSendStatus(&ctx_->trailing_metadata_, status); call_.PerformOps(&finish_buf_); } diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index b73b000a1cb..f10824e6b07 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -386,7 +386,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, - " return new ClientAsyncResponseReader< $Response$>(" + " return new ::grpc::ClientAsyncResponseReader< $Response$>(" "channel(), cq, " "::grpc::RpcMethod($Service$_method_names[$Idx$]), " "context, request, tag);\n" From 897931903ba2781afe0edeed60d3fae3fb8b726e Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Wed, 18 Feb 2015 15:58:01 -0800 Subject: [PATCH 179/232] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab7fc083fde..714a513fc91 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ See grpc/INSTALL for installation instructions for various platforms. #Repository Structure -This repository contains source code for gRPC libraries for multiple lanugages. +This repository contains source code for gRPC libraries for multiple lanugages written on top +of shared C core library [src/core] (src/core). - * C source code: [src/core] (src/core) * C++ source code: [src/cpp] (src/cpp) * Python source code: [src/python] (src/python) * Python source code: [src/ruby] (src/ruby) From 839ed1078e9c94d8a0cc6a72d1208113e169772e Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Wed, 18 Feb 2015 16:06:21 -0800 Subject: [PATCH 180/232] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 714a513fc91..2b049d206bd 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,10 @@ of shared C core library [src/core] (src/core). * C++ source code: [src/cpp] (src/cpp) * Python source code: [src/python] (src/python) - * Python source code: [src/ruby] (src/ruby) - * Ruby source code: [src/node] (src/node) + * Ruby source code: [src/ruby] (src/ruby) + * NodeJS source code: [src/node] (src/node) * PHP source code: [src/php] (src/php) - * Python source code: [src/csharp] (src/csharp) + * C# source code: [src/csharp] (src/csharp) Java source code is in [grpc-java] (http://github.com/grpc/grpc-java) repository. Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. From 59ea16ff44843aaf4501f361d31af564ee7f2bcf Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 16:18:08 -0800 Subject: [PATCH 181/232] Fix a race where an fd can be deleted during polling --- src/core/iomgr/fd_posix.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/iomgr/fd_posix.c b/src/core/iomgr/fd_posix.c index e3571e8e280..4f52339bc14 100644 --- a/src/core/iomgr/fd_posix.c +++ b/src/core/iomgr/fd_posix.c @@ -295,6 +295,8 @@ gpr_uint32 grpc_fd_begin_poll(grpc_fd *fd, grpc_pollset *pollset, grpc_fd_watcher *watcher) { /* keep track of pollers that have requested our events, in case they change */ + grpc_fd_ref(fd); + gpr_mu_lock(&fd->watcher_mu); watcher->next = &fd->watcher_root; watcher->prev = watcher->next->prev; @@ -312,6 +314,8 @@ void grpc_fd_end_poll(grpc_fd_watcher *watcher) { watcher->next->prev = watcher->prev; watcher->prev->next = watcher->next; gpr_mu_unlock(&watcher->fd->watcher_mu); + + grpc_fd_unref(watcher->fd); } void grpc_fd_become_readable(grpc_fd *fd, int allow_synchronous_callback) { From 9409ad80208b7fe6376c926dc8bf8282d9004a36 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Wed, 18 Feb 2015 16:19:56 -0800 Subject: [PATCH 182/232] Adds copyright notices to the GRPCClient files. --- src/objective-c/GRPCClient/GRPCCall.h | 33 +++++++++++++++++++ src/objective-c/GRPCClient/GRPCCall.m | 33 +++++++++++++++++++ src/objective-c/GRPCClient/GRPCMethodName.h | 33 +++++++++++++++++++ src/objective-c/GRPCClient/GRPCMethodName.m | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCChannel.h | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCChannel.m | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCCompletionQueue.h | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCCompletionQueue.m | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCDelegateWrapper.h | 33 +++++++++++++++++++ .../GRPCClient/private/GRPCDelegateWrapper.m | 33 +++++++++++++++++++ .../private/GRPCMethodName+HTTP2Encoding.h | 33 +++++++++++++++++++ .../private/GRPCMethodName+HTTP2Encoding.m | 33 +++++++++++++++++++ .../GRPCClient/private/NSData+GRPC.h | 33 +++++++++++++++++++ .../GRPCClient/private/NSData+GRPC.m | 33 +++++++++++++++++++ .../GRPCClient/private/NSDictionary+GRPC.h | 33 +++++++++++++++++++ .../GRPCClient/private/NSDictionary+GRPC.m | 33 +++++++++++++++++++ .../GRPCClient/private/NSError+GRPC.h | 33 +++++++++++++++++++ .../GRPCClient/private/NSError+GRPC.m | 33 +++++++++++++++++++ 18 files changed, 594 insertions(+) diff --git a/src/objective-c/GRPCClient/GRPCCall.h b/src/objective-c/GRPCClient/GRPCCall.h index db138fd1ee3..10437cb8bcb 100644 --- a/src/objective-c/GRPCClient/GRPCCall.h +++ b/src/objective-c/GRPCClient/GRPCCall.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import #import diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index b9248be5dbc..46a1e232e35 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCCall.h" #include diff --git a/src/objective-c/GRPCClient/GRPCMethodName.h b/src/objective-c/GRPCClient/GRPCMethodName.h index 4fb86d20991..a62c4797885 100644 --- a/src/objective-c/GRPCClient/GRPCMethodName.h +++ b/src/objective-c/GRPCClient/GRPCMethodName.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // See the README file for an introduction to this library. diff --git a/src/objective-c/GRPCClient/GRPCMethodName.m b/src/objective-c/GRPCClient/GRPCMethodName.m index be9fd4b85bc..fbaf24b9f08 100644 --- a/src/objective-c/GRPCClient/GRPCMethodName.m +++ b/src/objective-c/GRPCClient/GRPCMethodName.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCMethodName.h" @implementation GRPCMethodName diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index 8772acc12fb..7442f1fae44 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import struct grpc_channel; diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index af4a01ee05d..3e6952cfa38 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCChannel.h" #import diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h index 503df94dd49..0a8e397443e 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import struct grpc_completion_queue; diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index d2508daec42..c81e9a2a988 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCCompletionQueue.h" #import diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h index 70a07f817f4..b8a73b12df9 100644 --- a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h +++ b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import @protocol GRXWriteable; diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m index 7c64850d7e8..73a2f51f1b9 100644 --- a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m +++ b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCDelegateWrapper.h" #import diff --git a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h index 504c669f920..05e35bb1a39 100644 --- a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h +++ b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import #import "GRPCMethodName.h" diff --git a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m index 2e9fe8d60b1..3fb9af25ec4 100644 --- a/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m +++ b/src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "GRPCMethodName+HTTP2Encoding.h" @implementation GRPCMethodName (HTTP2Encoding) diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.h b/src/objective-c/GRPCClient/private/NSData+GRPC.h index 8cb7b76ebca..936c2a0e8ae 100644 --- a/src/objective-c/GRPCClient/private/NSData+GRPC.h +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import struct grpc_byte_buffer; diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m index 47f7a07d7a8..b5f952722cd 100644 --- a/src/objective-c/GRPCClient/private/NSData+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "NSData+GRPC.h" #include diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h index b717b108e4b..bf0233fd460 100644 --- a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h +++ b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import struct grpc_metadata; diff --git a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m index a24396d3a95..345ff3e1e6d 100644 --- a/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSDictionary+GRPC.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "NSDictionary+GRPC.h" #include diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.h b/src/objective-c/GRPCClient/private/NSError+GRPC.h index 949d1dd819f..b7439fa0673 100644 --- a/src/objective-c/GRPCClient/private/NSError+GRPC.h +++ b/src/objective-c/GRPCClient/private/NSError+GRPC.h @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import // TODO(jcanizales): Make the domain string public. diff --git a/src/objective-c/GRPCClient/private/NSError+GRPC.m b/src/objective-c/GRPCClient/private/NSError+GRPC.m index 73ce112f151..4fc1249efc2 100644 --- a/src/objective-c/GRPCClient/private/NSError+GRPC.m +++ b/src/objective-c/GRPCClient/private/NSError+GRPC.m @@ -1,3 +1,36 @@ +/* + * + * Copyright 2014, 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. + * + */ + #import "NSError+GRPC.h" #include From 522d7122a8ac44adb4885782287ed73214b9f48d Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 19 Feb 2015 01:28:02 +0100 Subject: [PATCH 183/232] Polishing Makefile to better install targets. -) renamed cpp_plugin and ruby_plugin to grpc_cpp_plugin and grpc_ruby_plugin. -) installing plugins. -) install will now run protobuf's installation too. -) adding documentation about installation prefix. --- INSTALL | 5 +++ Makefile | 68 ++++++++++++++++++++++++----------- build.json | 4 +-- templates/Makefile.template | 70 +++++++++++++++---------------------- 4 files changed, 84 insertions(+), 63 deletions(-) diff --git a/INSTALL b/INSTALL index f1e7aa7bf43..2f5f29c788f 100644 --- a/INSTALL +++ b/INSTALL @@ -23,6 +23,11 @@ Building the python wrapper requires the following: # apt-get install python-all-dev python-virtualenv +If you want to install in a different directory than the default /usr/lib, you can +override it on the command line: + + # make install prefix=/opt + ******************************* * More detailled instructions * diff --git a/Makefile b/Makefile index f1fa9dba127..68dd0048978 100644 --- a/Makefile +++ b/Makefile @@ -332,9 +332,9 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS= $(BINDIR)/$(CONFIG)/cpp_plugin $(BINDIR)/$(CONFIG)/ruby_plugin +PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin ifeq ($(DEP_MISSING),) -all: static shared +all: static shared plugins dep_error: @echo "You shouldn't see this message - all of your dependencies are correct." else @@ -498,7 +498,7 @@ timeout_encoding_test: $(BINDIR)/$(CONFIG)/timeout_encoding_test transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test -cpp_plugin: $(BINDIR)/$(CONFIG)/cpp_plugin +grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin credentials_test: $(BINDIR)/$(CONFIG)/credentials_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test interop_client: $(BINDIR)/$(CONFIG)/interop_client @@ -508,7 +508,7 @@ pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test qps_client: $(BINDIR)/$(CONFIG)/qps_client qps_server: $(BINDIR)/$(CONFIG)/qps_server -ruby_plugin: $(BINDIR)/$(CONFIG)/ruby_plugin +grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin status_test: $(BINDIR)/$(CONFIG)/status_test thread_pool_test: $(BINDIR)/$(CONFIG)/thread_pool_test chttp2_fake_security_cancel_after_accept_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test @@ -905,6 +905,8 @@ shared_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++.$(SHARED_EXT) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/libgrpc_csharp_ext.$(SHARED_EXT) grpc_csharp_ext: shared_csharp +plugins: $(PROTOC_PLUGINS) + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_thread_stress_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_test_writes_done_hangs_with_pending_read_legacy.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a @@ -1912,7 +1914,7 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -install: install_c install_cxx +install: install_c install_cxx install-protobuf install-plugins install_c: install-headers_c install-static_c install-shared_c @@ -1946,6 +1948,8 @@ install-static_cxx: static_cxx strip-static_cxx $(E) "[INSTALL] Installing libgrpc++.a" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a + + install-shared_c: shared_c strip-shared_c ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing gpr.$(SHARED_EXT)" @@ -1986,7 +1990,8 @@ ifneq ($(SYSTEM),Darwin) endif endif -install-shared_cxx: shared_cxx strip-shared_cxx + +install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing grpc++.$(SHARED_EXT)" $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/grpc++.$(SHARED_EXT) $(prefix)/lib/grpc++.$(SHARED_EXT) @@ -2004,6 +2009,7 @@ ifneq ($(SYSTEM),Darwin) endif endif + install-shared_csharp: shared_csharp strip-shared_csharp ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing grpc_csharp_ext.$(SHARED_EXT)" @@ -2022,7 +2028,29 @@ ifneq ($(SYSTEM),Darwin) endif endif + +install-protobuf: $(PROTOBUF_DEP) +ifneq ($(PROTOBUF_DEP),) + $(E) "[INSTALL] Installing embedded protobufs" + $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) +ifneq ($(SYSTEM),MINGW32) +ifneq ($(SYSTEM),Darwin) + $(Q) ldconfig +endif +endif +endif + +install-plugins: $(PROTOC_PLUGINS) +ifeq ($(SYSTEM),MINGW32) + $(Q) false +else + $(E) "[INSTALL] Installing grpc protoc plugins" + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin +endif + clean: + $(E) "[CLEAN] Cleaning build directories." $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) @@ -7350,35 +7378,35 @@ endif endif -CPP_PLUGIN_SRC = \ +GRPC_CPP_PLUGIN_SRC = \ src/compiler/cpp_generator.cc \ src/compiler/cpp_plugin.cc \ -CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CPP_PLUGIN_SRC)))) +GRPC_CPP_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_CPP_PLUGIN_SRC)))) ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/cpp_plugin: protobuf_dep_error +$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/cpp_plugin: $(PROTOBUF_DEP) $(CPP_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_cpp_plugin: $(PROTOBUF_DEP) $(GRPC_CPP_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/cpp_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_CPP_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_cpp_plugin endif $(OBJDIR)/$(CONFIG)/src/compiler/cpp_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/cpp_plugin.o: -deps_cpp_plugin: $(CPP_PLUGIN_OBJS:.o=.dep) +deps_grpc_cpp_plugin: $(GRPC_CPP_PLUGIN_OBJS:.o=.dep) ifneq ($(NO_DEPS),true) --include $(CPP_PLUGIN_OBJS:.o=.dep) +-include $(GRPC_CPP_PLUGIN_OBJS:.o=.dep) endif @@ -7677,35 +7705,35 @@ endif endif -RUBY_PLUGIN_SRC = \ +GRPC_RUBY_PLUGIN_SRC = \ src/compiler/ruby_generator.cc \ src/compiler/ruby_plugin.cc \ -RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(RUBY_PLUGIN_SRC)))) +GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC)))) ifeq ($(NO_PROTOBUF),true) # You can't build the protoc plugins if you don't have protobuf 3.0.0+. -$(BINDIR)/$(CONFIG)/ruby_plugin: protobuf_dep_error +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error else -$(BINDIR)/$(CONFIG)/ruby_plugin: $(PROTOBUF_DEP) $(RUBY_PLUGIN_OBJS) +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) $(E) "[HOSTLD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/ruby_plugin + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin endif $(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: $(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: -deps_ruby_plugin: $(RUBY_PLUGIN_OBJS:.o=.dep) +deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) ifneq ($(NO_DEPS),true) --include $(RUBY_PLUGIN_OBJS:.o=.dep) +-include $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) endif diff --git a/build.json b/build.json index c552228496d..c7c640d2c21 100644 --- a/build.json +++ b/build.json @@ -1575,7 +1575,7 @@ ] }, { - "name": "cpp_plugin", + "name": "grpc_cpp_plugin", "build": "protoc", "language": "c++", "headers": [ @@ -1747,7 +1747,7 @@ ] }, { - "name": "ruby_plugin", + "name": "grpc_ruby_plugin", "build": "protoc", "language": "c++", "src": [ diff --git a/templates/Makefile.template b/templates/Makefile.template index 178ace6bcf0..79ec95dd138 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -349,7 +349,7 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS=\ +PROTOC_PLUGINS =\ % for tgt in targets: % if tgt.build == 'protoc': $(BINDIR)/$(CONFIG)/${tgt.name}\ @@ -357,7 +357,7 @@ PROTOC_PLUGINS=\ % endfor ifeq ($(DEP_MISSING),) -all: static shared\ +all: static shared plugins\ % for tgt in targets: % if tgt.build == 'all': $(BINDIR)/$(CONFIG)/${tgt.name}\ @@ -538,6 +538,8 @@ shared_csharp: shared_c \ grpc_csharp_ext: shared_csharp +plugins: $(PROTOC_PLUGINS) + privatelibs: privatelibs_c privatelibs_cxx privatelibs_c: \ @@ -716,7 +718,7 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< -install: install_c install_cxx +install: install_c install_cxx install-protobuf install-plugins install_c: install-headers_c install-static_c install-shared_c @@ -758,9 +760,9 @@ install-static_cxx: static_cxx strip-static_cxx % endif % endfor -install-shared_c: shared_c strip-shared_c +<%def name="install_shared(lang_filter)">\ % for lib in libs: -% if lib.language == "c": +% if lib.language == lang_filter: % if lib.build == "all": ifeq ($(SYSTEM),MINGW32) $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" @@ -781,56 +783,42 @@ ifneq ($(SYSTEM),Darwin) $(Q) ldconfig endif endif + -install-shared_cxx: shared_cxx strip-shared_cxx -% for lib in libs: -% if lib.language == "c++": -% if lib.build == "all": -ifeq ($(SYSTEM),MINGW32) - $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a -else - $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) -ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so -endif -endif -% endif -% endif -% endfor +install-shared_c: shared_c strip-shared_c +${install_shared("c")} + +install-shared_cxx: shared_cxx strip-shared_cxx install-shared_c +${install_shared("c++")} + +install-shared_csharp: shared_csharp strip-shared_csharp +${install_shared("csharp")} + +install-protobuf: $(PROTOBUF_DEP) +ifneq ($(PROTOBUF_DEP),) + $(E) "[INSTALL] Installing embedded protobufs" + $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) $(Q) ldconfig endif endif +endif -install-shared_csharp: shared_csharp strip-shared_csharp -% for lib in libs: -% if lib.language == "csharp": -% if lib.build == "all": +install-plugins: $(PROTOC_PLUGINS) ifeq ($(SYSTEM),MINGW32) - $(E) "[INSTALL] Installing ${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/${lib.name}.$(SHARED_EXT) $(prefix)/lib/${lib.name}.$(SHARED_EXT) - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}-imp.a $(prefix)/lib/lib${lib.name}-imp.a + $(Q) false else - $(E) "[INSTALL] Installing lib${lib.name}.$(SHARED_EXT)" - $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.$(SHARED_EXT) -ifneq ($(SYSTEM),Darwin) - $(Q) ln -sf lib${lib.name}.$(SHARED_EXT) $(prefix)/lib/lib${lib.name}.so -endif -endif -% endif + $(E) "[INSTALL] Installing grpc protoc plugins" +% for tgt in targets: +% if tgt.build == 'protoc': + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/${tgt.name} $(prefix)/bin/${tgt.name} % endif % endfor -ifneq ($(SYSTEM),MINGW32) -ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig -endif endif clean: + $(E) "[CLEAN] Cleaning build directories." $(Q) $(RM) -rf $(OBJDIR) $(LIBDIR) $(BINDIR) $(GENDIR) From bdc8baf4fc76baef38fb572e51755bd4e60aa349 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 18 Feb 2015 17:06:34 -0800 Subject: [PATCH 184/232] Added comment about where Google credentials come from --- src/node/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node/index.js b/src/node/index.js index f7cbdf004e2..1bef2072dde 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -75,7 +75,8 @@ function load(filename) { /** * Get a function that a client can use to update metadata with authentication - * information from a Google Auth credential object. + * information from a Google Auth credential object, which comes from the + * googleauth library. * @param {Object} credential The credential object to use * @return {function(Object, callback)} Metadata updater function */ From 43a2b176f1825151a379cb171896f134580ae4c4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 17:17:51 -0800 Subject: [PATCH 185/232] Fix a TSAN reported race I think this was the frequent crash in uds_cancel_after_invoke. The race happens because a channel is deleted concurrently with an address being resolved (and UDS gets the resolution fast enough for this to actually happen). The fix is to guarantee no callbacks will be made after cancel has been called (which was the original guaranteee that got lost somewhere). --- src/core/channel/client_setup.c | 29 ++++++++++++++++++++++++ src/core/channel/client_setup.h | 6 +++++ src/core/surface/channel_create.c | 5 +++- src/core/surface/secure_channel_create.c | 5 +++- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/core/channel/client_setup.c b/src/core/channel/client_setup.c index bb6d3638074..6d892d6c924 100644 --- a/src/core/channel/client_setup.c +++ b/src/core/channel/client_setup.c @@ -49,8 +49,11 @@ struct grpc_client_setup { grpc_alarm backoff_alarm; gpr_timespec current_backoff_interval; int in_alarm; + int in_cb; + int cancelled; gpr_mu mu; + gpr_cv cv; grpc_client_setup_request *active_request; int refs; }; @@ -67,6 +70,7 @@ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r) { static void destroy_setup(grpc_client_setup *s) { gpr_mu_destroy(&s->mu); + gpr_cv_destroy(&s->cv); s->done(s->user_data); grpc_channel_args_destroy(s->args); gpr_free(s); @@ -111,6 +115,10 @@ static void setup_cancel(grpc_transport_setup *sp) { int cancel_alarm = 0; gpr_mu_lock(&s->mu); + s->cancelled = 1; + while (s->in_cb) { + gpr_cv_wait(&s->cv, &s->mu, gpr_inf_future); + } GPR_ASSERT(s->refs > 0); /* effectively cancels the current request (if any) */ @@ -129,6 +137,24 @@ static void setup_cancel(grpc_transport_setup *sp) { } } +int grpc_client_setup_cb_begin(grpc_client_setup_request *r) { + gpr_mu_lock(&r->setup->mu); + if (r->setup->cancelled) { + gpr_mu_unlock(&r->setup->mu); + return 0; + } + r->setup->in_cb++; + gpr_mu_unlock(&r->setup->mu); + return 1; +} + +void grpc_client_setup_cb_end(grpc_client_setup_request *r) { + gpr_mu_lock(&r->setup->mu); + r->setup->in_cb--; + if (r->setup->cancelled) gpr_cv_signal(&r->setup->cv); + gpr_mu_unlock(&r->setup->mu); +} + /* vtable for transport setup */ static const grpc_transport_setup_vtable setup_vtable = {setup_initiate, setup_cancel}; @@ -142,6 +168,7 @@ void grpc_client_setup_create_and_attach( s->base.vtable = &setup_vtable; gpr_mu_init(&s->mu); + gpr_cv_init(&s->cv); s->refs = 1; s->mdctx = mdctx; s->initiate = initiate; @@ -151,6 +178,8 @@ void grpc_client_setup_create_and_attach( s->args = grpc_channel_args_copy(args); s->current_backoff_interval = gpr_time_from_micros(1000000); s->in_alarm = 0; + s->in_cb = 0; + s->cancelled = 0; grpc_client_channel_set_transport_setup(newly_minted_channel, &s->base); } diff --git a/src/core/channel/client_setup.h b/src/core/channel/client_setup.h index 6ac3fe62f19..f2b64265bc3 100644 --- a/src/core/channel/client_setup.h +++ b/src/core/channel/client_setup.h @@ -58,6 +58,12 @@ void grpc_client_setup_request_finish(grpc_client_setup_request *r, const grpc_channel_args *grpc_client_setup_get_channel_args( grpc_client_setup_request *r); +/* Call before calling back into the setup listener, and call only if + this function returns 1. If it returns 1, also promise to call + grpc_client_setup_cb_end */ +int grpc_client_setup_cb_begin(grpc_client_setup_request *r); +void grpc_client_setup_cb_end(grpc_client_setup_request *r); + /* Get the deadline for a request passed in to initiate. Implementations should make a best effort to honor this deadline. */ gpr_timespec grpc_client_setup_request_deadline(grpc_client_setup_request *r); diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c index 7a5f62ed53e..3104b1d00d5 100644 --- a/src/core/surface/channel_create.c +++ b/src/core/surface/channel_create.c @@ -107,13 +107,16 @@ static void on_connect(void *rp, grpc_endpoint *tcp) { } else { return; } - } else { + } else if (grpc_client_setup_cb_begin(r->cs_request)) { grpc_create_chttp2_transport( r->setup->setup_callback, r->setup->setup_user_data, grpc_client_setup_get_channel_args(r->cs_request), tcp, NULL, 0, grpc_client_setup_get_mdctx(r->cs_request), 1); + grpc_client_setup_cb_end(r->cs_request); done(r, 1); return; + } else { + done(r, 0); } } diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index c6968f4b24b..8e56868d420 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -97,12 +97,15 @@ static void on_secure_transport_setup_done(void *rp, if (status != GRPC_SECURITY_OK) { gpr_log(GPR_ERROR, "Secure transport setup failed with error %d.", status); done(r, 0); - } else { + } else if (grpc_client_setup_cb_begin(r->cs_request)) { grpc_create_chttp2_transport( r->setup->setup_callback, r->setup->setup_user_data, grpc_client_setup_get_channel_args(r->cs_request), secure_endpoint, NULL, 0, grpc_client_setup_get_mdctx(r->cs_request), 1); + grpc_client_setup_cb_end(r->cs_request); done(r, 1); + } else { + done(r, 0); } } From 90bd7c4c4daec7cc777439ba69688e995b01889f Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Wed, 18 Feb 2015 18:51:16 -0800 Subject: [PATCH 186/232] Fixing sprintf and a few other things. --- src/core/security/credentials.c | 6 ++++++ src/core/security/json_token.c | 9 ++++----- test/core/security/fetch_oauth2.c | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 60e82d9dfae..a21c27bff94 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -336,6 +336,12 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( grpc_credentials_status status = GRPC_CREDENTIALS_OK; grpc_json *json = NULL; + if (response == NULL) { + gpr_log(GPR_ERROR, "Received NULL response."); + status = GRPC_CREDENTIALS_ERROR; + goto end; + } + if (response->body_length > 0) { null_terminated_body = gpr_malloc(response->body_length + 1); null_terminated_body[response->body_length] = '\0'; diff --git a/src/core/security/json_token.c b/src/core/security/json_token.c index c85b0cd8475..20d62e2b438 100644 --- a/src/core/security/json_token.c +++ b/src/core/security/json_token.c @@ -206,15 +206,14 @@ static char *encoded_jwt_claim(const grpc_auth_json_key *json_key, char *result = NULL; gpr_timespec now = gpr_now(); gpr_timespec expiration = gpr_time_add(now, token_lifetime); - /* log10(2^64) ~= 20 */ - char now_str[24]; - char expiration_str[24]; + char now_str[GPR_LTOA_MIN_BUFSIZE]; + char expiration_str[GPR_LTOA_MIN_BUFSIZE]; if (gpr_time_cmp(token_lifetime, grpc_max_auth_token_lifetime) > 0) { gpr_log(GPR_INFO, "Cropping token lifetime to maximum allowed value."); expiration = gpr_time_add(now, grpc_max_auth_token_lifetime); } - sprintf(now_str, "%ld", now.tv_sec); - sprintf(expiration_str, "%ld", expiration.tv_sec); + gpr_ltoa(now.tv_sec, now_str); + gpr_ltoa(expiration.tv_sec, expiration_str); child = create_child(NULL, json, "iss", json_key->client_email, GRPC_JSON_STRING); diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c index 369c34a5a5a..63150874489 100644 --- a/test/core/security/fetch_oauth2.c +++ b/test/core/security/fetch_oauth2.c @@ -95,7 +95,7 @@ static grpc_credentials *create_service_account_creds( break; } current += bytes_read; - } while (sizeof(json_key) > (current - json_key)); + } while (sizeof(json_key) > (size_t)(current - json_key)); if ((current - json_key) == sizeof(json_key)) { gpr_log(GPR_ERROR, "Json key file %s exceeds size limit (%d bytes).", From 20d6c1aa2ac95a1415620398266199c85fd21e90 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 22:01:22 -0800 Subject: [PATCH 187/232] Do not need a Mac-specific CPU header yet as there are no CPU-specific features in use yet --- src/core/support/cpu_posix.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c index 91f722530ca..91ce80c364e 100644 --- a/src/core/support/cpu_posix.c +++ b/src/core/support/cpu_posix.c @@ -35,8 +35,6 @@ #ifdef GPR_CPU_POSIX -#include "src/core/support/cpu.h" - #include #include #include From cad5f0a44859e27736bfb4ce5fc374781c54bbc1 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 22:02:52 -0800 Subject: [PATCH 188/232] Some compilers expect class SyncRequest to be declared fully and not just forward-declared before the constructor for Server because this is needed to manage exception handling for the class std::list that is templated on SyncRequest --- src/cpp/server/server.cc | 156 +++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 78 deletions(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index da98cf5ce0d..0d0d38a1151 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -49,84 +49,6 @@ namespace grpc { -Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, - ServerCredentials* creds) - : started_(false), - shutdown_(false), - num_running_cb_(0), - thread_pool_(thread_pool), - thread_pool_owned_(thread_pool_owned), - secure_(creds != nullptr) { - if (creds) { - server_ = - grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); - } else { - server_ = grpc_server_create(cq_.cq(), nullptr); - } -} - -Server::Server() { - // Should not be called. - GPR_ASSERT(false); -} - -Server::~Server() { - std::unique_lock lock(mu_); - if (started_ && !shutdown_) { - lock.unlock(); - Shutdown(); - } else { - lock.unlock(); - } - grpc_server_destroy(server_); - if (thread_pool_owned_) { - delete thread_pool_; - } -} - -bool Server::RegisterService(RpcService* service) { - for (int i = 0; i < service->GetMethodCount(); ++i) { - RpcServiceMethod* method = service->GetMethod(i); - void* tag = - grpc_server_register_method(server_, method->name(), nullptr, cq_.cq()); - if (!tag) { - gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", - method->name()); - return false; - } - sync_methods_.emplace_back(method, tag); - } - return true; -} - -bool Server::RegisterAsyncService(AsynchronousService* service) { - GPR_ASSERT(service->dispatch_impl_ == nullptr && - "Can only register an asynchronous service against one server."); - service->dispatch_impl_ = this; - service->request_args_ = new void* [service->method_count_]; - for (size_t i = 0; i < service->method_count_; ++i) { - void* tag = - grpc_server_register_method(server_, service->method_names_[i], nullptr, - service->completion_queue()->cq()); - if (!tag) { - gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", - service->method_names_[i]); - return false; - } - service->request_args_[i] = tag; - } - return true; -} - -int Server::AddPort(const grpc::string& addr) { - GPR_ASSERT(!started_); - if (secure_) { - return grpc_server_add_secure_http2_port(server_, addr.c_str()); - } else { - return grpc_server_add_http2_port(server_, addr.c_str()); - } -} - class Server::SyncRequest final : public CompletionQueueTag { public: SyncRequest(RpcServiceMethod* method, void* tag) @@ -243,6 +165,84 @@ class Server::SyncRequest final : public CompletionQueueTag { grpc_completion_queue* cq_; }; +Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, + ServerCredentials* creds) + : started_(false), + shutdown_(false), + num_running_cb_(0), + thread_pool_(thread_pool), + thread_pool_owned_(thread_pool_owned), + secure_(creds != nullptr) { + if (creds) { + server_ = + grpc_secure_server_create(creds->GetRawCreds(), cq_.cq(), nullptr); + } else { + server_ = grpc_server_create(cq_.cq(), nullptr); + } +} + +Server::Server() { + // Should not be called. + GPR_ASSERT(false); +} + +Server::~Server() { + std::unique_lock lock(mu_); + if (started_ && !shutdown_) { + lock.unlock(); + Shutdown(); + } else { + lock.unlock(); + } + grpc_server_destroy(server_); + if (thread_pool_owned_) { + delete thread_pool_; + } +} + +bool Server::RegisterService(RpcService* service) { + for (int i = 0; i < service->GetMethodCount(); ++i) { + RpcServiceMethod* method = service->GetMethod(i); + void* tag = + grpc_server_register_method(server_, method->name(), nullptr, cq_.cq()); + if (!tag) { + gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", + method->name()); + return false; + } + sync_methods_.emplace_back(method, tag); + } + return true; +} + +bool Server::RegisterAsyncService(AsynchronousService* service) { + GPR_ASSERT(service->dispatch_impl_ == nullptr && + "Can only register an asynchronous service against one server."); + service->dispatch_impl_ = this; + service->request_args_ = new void* [service->method_count_]; + for (size_t i = 0; i < service->method_count_; ++i) { + void* tag = + grpc_server_register_method(server_, service->method_names_[i], nullptr, + service->completion_queue()->cq()); + if (!tag) { + gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", + service->method_names_[i]); + return false; + } + service->request_args_[i] = tag; + } + return true; +} + +int Server::AddPort(const grpc::string& addr) { + GPR_ASSERT(!started_); + if (secure_) { + return grpc_server_add_secure_http2_port(server_, addr.c_str()); + } else { + return grpc_server_add_http2_port(server_, addr.c_str()); + } +} + bool Server::Start() { GPR_ASSERT(!started_); started_ = true; From c1231eb543d0805cf91b9628a2dfd059990fd079 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 22:15:14 -0800 Subject: [PATCH 189/232] Include typecasts so that int and size_t are not compared (since their signs don't match) --- test/cpp/client/channel_arguments_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/cpp/client/channel_arguments_test.cc b/test/cpp/client/channel_arguments_test.cc index d98b38ab68f..01c56cb795f 100644 --- a/test/cpp/client/channel_arguments_test.cc +++ b/test/cpp/client/channel_arguments_test.cc @@ -52,14 +52,14 @@ TEST_F(ChannelArgumentsTest, SetInt) { ChannelArguments channel_args; // Empty arguments. SetChannelArgs(channel_args, &args); - EXPECT_EQ(0, args.num_args); + EXPECT_EQ(static_cast(0), args.num_args); grpc::string key("key0"); channel_args.SetInt(key, 0); // Clear key early to make sure channel_args takes a copy key = ""; SetChannelArgs(channel_args, &args); - EXPECT_EQ(1, args.num_args); + EXPECT_EQ(static_cast(1), args.num_args); EXPECT_EQ(GRPC_ARG_INTEGER, args.args[0].type); EXPECT_STREQ("key0", args.args[0].key); EXPECT_EQ(0, args.args[0].value.integer); @@ -68,7 +68,7 @@ TEST_F(ChannelArgumentsTest, SetInt) { channel_args.SetInt(key, 1); key = ""; SetChannelArgs(channel_args, &args); - EXPECT_EQ(2, args.num_args); + EXPECT_EQ(static_cast(2), args.num_args); // We do not enforce order on the arguments. for (size_t i = 0; i < args.num_args; i++) { EXPECT_EQ(GRPC_ARG_INTEGER, args.args[i].type); @@ -85,7 +85,7 @@ TEST_F(ChannelArgumentsTest, SetString) { ChannelArguments channel_args; // Empty arguments. SetChannelArgs(channel_args, &args); - EXPECT_EQ(0, args.num_args); + EXPECT_EQ(static_cast(0), args.num_args); grpc::string key("key0"); grpc::string val("val0"); @@ -94,7 +94,7 @@ TEST_F(ChannelArgumentsTest, SetString) { key = ""; val = ""; SetChannelArgs(channel_args, &args); - EXPECT_EQ(1, args.num_args); + EXPECT_EQ(static_cast(1), args.num_args); EXPECT_EQ(GRPC_ARG_STRING, args.args[0].type); EXPECT_STREQ("key0", args.args[0].key); EXPECT_STREQ("val0", args.args[0].value.string); @@ -103,7 +103,7 @@ TEST_F(ChannelArgumentsTest, SetString) { val = "val1"; channel_args.SetString(key, val); SetChannelArgs(channel_args, &args); - EXPECT_EQ(2, args.num_args); + EXPECT_EQ(static_cast(2), args.num_args); // We do not enforce order on the arguments. for (size_t i = 0; i < args.num_args; i++) { EXPECT_EQ(GRPC_ARG_STRING, args.args[i].type); From d5577aac67b5bdf7603730b3238ece76003589f7 Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 22:26:48 -0800 Subject: [PATCH 190/232] More typecasts to avoid sign-comparison problems on EXPECT_EQ --- test/cpp/end2end/async_end2end_test.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index fe312896614..58df9476671 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -354,7 +354,7 @@ TEST_F(AsyncEnd2endTest, ClientInitialMetadataRpc) { auto client_initial_metadata = srv_ctx.client_metadata(); EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); - EXPECT_EQ(2, client_initial_metadata.size()); + EXPECT_EQ(static_cast(2), client_initial_metadata.size()); client_ok(1); send_response.set_message(recv_request.message()); @@ -404,7 +404,7 @@ TEST_F(AsyncEnd2endTest, ServerInitialMetadataRpc) { auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); EXPECT_EQ(meta1.second, server_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, server_initial_metadata.find(meta2.first)->second); - EXPECT_EQ(2, server_initial_metadata.size()); + EXPECT_EQ(static_cast(2), server_initial_metadata.size()); send_response.set_message(recv_request.message()); response_writer.Finish(send_response, Status::OK, tag(5)); @@ -460,7 +460,7 @@ TEST_F(AsyncEnd2endTest, ServerTrailingMetadataRpc) { auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); EXPECT_EQ(meta1.second, server_trailing_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, server_trailing_metadata.find(meta2.first)->second); - EXPECT_EQ(2, server_trailing_metadata.size()); + EXPECT_EQ(static_cast(2), server_trailing_metadata.size()); } TEST_F(AsyncEnd2endTest, MetadataRpc) { @@ -500,7 +500,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { auto client_initial_metadata = srv_ctx.client_metadata(); EXPECT_EQ(meta1.second, client_initial_metadata.find(meta1.first)->second); EXPECT_EQ(meta2.second, client_initial_metadata.find(meta2.first)->second); - EXPECT_EQ(2, client_initial_metadata.size()); + EXPECT_EQ(static_cast(2), client_initial_metadata.size()); client_ok(1); srv_ctx.AddInitialMetadata(meta3.first, meta3.second); @@ -512,7 +512,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { auto server_initial_metadata = cli_ctx.GetServerInitialMetadata(); EXPECT_EQ(meta3.second, server_initial_metadata.find(meta3.first)->second); EXPECT_EQ(meta4.second, server_initial_metadata.find(meta4.first)->second); - EXPECT_EQ(2, server_initial_metadata.size()); + EXPECT_EQ(static_cast(2), server_initial_metadata.size()); send_response.set_message(recv_request.message()); srv_ctx.AddTrailingMetadata(meta5.first, meta5.second); @@ -529,7 +529,7 @@ TEST_F(AsyncEnd2endTest, MetadataRpc) { auto server_trailing_metadata = cli_ctx.GetServerTrailingMetadata(); EXPECT_EQ(meta5.second, server_trailing_metadata.find(meta5.first)->second); EXPECT_EQ(meta6.second, server_trailing_metadata.find(meta6.first)->second); - EXPECT_EQ(2, server_trailing_metadata.size()); + EXPECT_EQ(static_cast(2), server_trailing_metadata.size()); } } // namespace } // namespace testing From 1fbaad110fb927f7bc074e004e9dd0c6c58673c1 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 19 Feb 2015 07:32:33 +0000 Subject: [PATCH 191/232] Rename base/interfaces_test to base/interfaces_test_case. With this change the Python codebase now conforms to an "if it ends with _test.py then it is an executable test" rule. --- .../base/{interfaces_test.py => interfaces_test_case.py} | 0 .../src/grpc/framework/base/packets/implementations_test.py | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/python/src/grpc/framework/base/{interfaces_test.py => interfaces_test_case.py} (100%) diff --git a/src/python/src/grpc/framework/base/interfaces_test.py b/src/python/src/grpc/framework/base/interfaces_test_case.py similarity index 100% rename from src/python/src/grpc/framework/base/interfaces_test.py rename to src/python/src/grpc/framework/base/interfaces_test_case.py diff --git a/src/python/src/grpc/framework/base/packets/implementations_test.py b/src/python/src/grpc/framework/base/packets/implementations_test.py index 628f4b39094..e5855700c72 100644 --- a/src/python/src/grpc/framework/base/packets/implementations_test.py +++ b/src/python/src/grpc/framework/base/packets/implementations_test.py @@ -31,7 +31,7 @@ import unittest -from grpc.framework.base import interfaces_test +from grpc.framework.base import interfaces_test_case from grpc.framework.base import util from grpc.framework.base.packets import implementations from grpc.framework.foundation import logging_pool @@ -42,7 +42,7 @@ MAXIMUM_TIMEOUT = 60 class ImplementationsTest( - interfaces_test.FrontAndBackTest, unittest.TestCase): + interfaces_test_case.FrontAndBackTest, unittest.TestCase): def setUp(self): self.memory_transmission_pool = logging_pool.pool(POOL_MAX_WORKERS) @@ -53,7 +53,7 @@ class ImplementationsTest( self.back_transmission_pool = logging_pool.pool(POOL_MAX_WORKERS) self.back_utility_pool = logging_pool.pool(POOL_MAX_WORKERS) self.test_pool = logging_pool.pool(POOL_MAX_WORKERS) - self.test_servicer = interfaces_test.TestServicer(self.test_pool) + self.test_servicer = interfaces_test_case.TestServicer(self.test_pool) self.front = implementations.front( self.front_work_pool, self.front_transmission_pool, self.front_utility_pool) From a5baf18983b7966f1757063e0f635dac6e9e226b Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Wed, 18 Feb 2015 23:40:00 -0800 Subject: [PATCH 192/232] One-line fix for namespace bug --- src/compiler/cpp_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index b73b000a1cb..f10824e6b07 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -386,7 +386,7 @@ void PrintSourceClientMethod(google::protobuf::io::Printer *printer, "const $Request$& request, " "::grpc::CompletionQueue* cq, void* tag) {\n"); printer->Print(*vars, - " return new ClientAsyncResponseReader< $Response$>(" + " return new ::grpc::ClientAsyncResponseReader< $Response$>(" "channel(), cq, " "::grpc::RpcMethod($Service$_method_names[$Idx$]), " "context, request, tag);\n" From 3e2ebff8335ecf4db11a10f4cf415f7b29ebe2e0 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Thu, 19 Feb 2015 10:02:01 +0000 Subject: [PATCH 193/232] Python early_adopter changes in anticipation of interop client. --- src/python/interop/interop/methods.py | 79 ++++++--- src/python/interop/interop/server.py | 17 +- .../src/grpc/early_adopter/_face_utilities.py | 107 ++++++++----- .../src/grpc/early_adopter/implementations.py | 10 +- .../src/grpc/early_adopter/interfaces.py | 41 +++-- .../src/grpc/early_adopter/utilities.py | 150 ++++++++++++------ 6 files changed, 261 insertions(+), 143 deletions(-) diff --git a/src/python/interop/interop/methods.py b/src/python/interop/interop/methods.py index 854dbec8cc3..26c1869f93e 100644 --- a/src/python/interop/interop/methods.py +++ b/src/python/interop/interop/methods.py @@ -37,9 +37,11 @@ from interop import messages_pb2 def _empty_call(request): return empty_pb2.Empty() -EMPTY_CALL = utilities.unary_unary_rpc_method( - _empty_call, empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString, +_CLIENT_EMPTY_CALL = utilities.unary_unary_client_rpc_method( empty_pb2.Empty.SerializeToString, empty_pb2.Empty.FromString) +_SERVER_EMPTY_CALL = utilities.unary_unary_server_rpc_method( + _empty_call, empty_pb2.Empty.FromString, + empty_pb2.Empty.SerializeToString) def _unary_call(request): @@ -48,11 +50,12 @@ def _unary_call(request): type=messages_pb2.COMPRESSABLE, body=b'\x00' * request.response_size)) -UNARY_CALL = utilities.unary_unary_rpc_method( - _unary_call, messages_pb2.SimpleRequest.SerializeToString, - messages_pb2.SimpleRequest.FromString, - messages_pb2.SimpleResponse.SerializeToString, +_CLIENT_UNARY_CALL = utilities.unary_unary_client_rpc_method( + messages_pb2.SimpleRequest.SerializeToString, messages_pb2.SimpleResponse.FromString) +_SERVER_UNARY_CALL = utilities.unary_unary_server_rpc_method( + _unary_call, messages_pb2.SimpleRequest.FromString, + messages_pb2.SimpleResponse.SerializeToString) def _streaming_output_call(request): @@ -62,12 +65,13 @@ def _streaming_output_call(request): type=request.response_type, body=b'\x00' * response_parameters.size)) -STREAMING_OUTPUT_CALL = utilities.unary_stream_rpc_method( - _streaming_output_call, +_CLIENT_STREAMING_OUTPUT_CALL = utilities.unary_stream_client_rpc_method( messages_pb2.StreamingOutputCallRequest.SerializeToString, - messages_pb2.StreamingOutputCallRequest.FromString, - messages_pb2.StreamingOutputCallResponse.SerializeToString, messages_pb2.StreamingOutputCallResponse.FromString) +_SERVER_STREAMING_OUTPUT_CALL = utilities.unary_stream_server_rpc_method( + _streaming_output_call, + messages_pb2.StreamingOutputCallRequest.FromString, + messages_pb2.StreamingOutputCallResponse.SerializeToString) def _streaming_input_call(request_iterator): @@ -78,12 +82,13 @@ def _streaming_input_call(request_iterator): return messages_pb2.StreamingInputCallResponse( aggregated_payload_size=aggregate_size) -STREAMING_INPUT_CALL = utilities.stream_unary_rpc_method( - _streaming_input_call, +_CLIENT_STREAMING_INPUT_CALL = utilities.stream_unary_client_rpc_method( messages_pb2.StreamingInputCallRequest.SerializeToString, - messages_pb2.StreamingInputCallRequest.FromString, - messages_pb2.StreamingInputCallResponse.SerializeToString, messages_pb2.StreamingInputCallResponse.FromString) +_SERVER_STREAMING_INPUT_CALL = utilities.stream_unary_server_rpc_method( + _streaming_input_call, + messages_pb2.StreamingInputCallRequest.FromString, + messages_pb2.StreamingInputCallResponse.SerializeToString) def _full_duplex_call(request_iterator): @@ -93,17 +98,47 @@ def _full_duplex_call(request_iterator): type=request.payload.type, body=b'\x00' * request.response_parameters[0].size)) -FULL_DUPLEX_CALL = utilities.stream_stream_rpc_method( - _full_duplex_call, +_CLIENT_FULL_DUPLEX_CALL = utilities.stream_stream_client_rpc_method( messages_pb2.StreamingOutputCallRequest.SerializeToString, - messages_pb2.StreamingOutputCallRequest.FromString, - messages_pb2.StreamingOutputCallResponse.SerializeToString, messages_pb2.StreamingOutputCallResponse.FromString) +_SERVER_FULL_DUPLEX_CALL = utilities.stream_stream_server_rpc_method( + _full_duplex_call, + messages_pb2.StreamingOutputCallRequest.FromString, + messages_pb2.StreamingOutputCallResponse.SerializeToString) # NOTE(nathaniel): Apparently this is the same as the full-duplex call? -HALF_DUPLEX_CALL = utilities.stream_stream_rpc_method( - _full_duplex_call, +_CLIENT_HALF_DUPLEX_CALL = utilities.stream_stream_client_rpc_method( messages_pb2.StreamingOutputCallRequest.SerializeToString, - messages_pb2.StreamingOutputCallRequest.FromString, - messages_pb2.StreamingOutputCallResponse.SerializeToString, messages_pb2.StreamingOutputCallResponse.FromString) +_SERVER_HALF_DUPLEX_CALL = utilities.stream_stream_server_rpc_method( + _full_duplex_call, + messages_pb2.StreamingOutputCallRequest.FromString, + messages_pb2.StreamingOutputCallResponse.SerializeToString) + + +_SERVICE_NAME = '/grpc.testing.TestService' + +EMPTY_CALL_METHOD_NAME = _SERVICE_NAME + '/EmptyCall' +UNARY_CALL_METHOD_NAME = _SERVICE_NAME + '/UnaryCall' +STREAMING_OUTPUT_CALL_METHOD_NAME = _SERVICE_NAME + '/StreamingOutputCall' +STREAMING_INPUT_CALL_METHOD_NAME = _SERVICE_NAME + '/StreamingInputCall' +FULL_DUPLEX_CALL_METHOD_NAME = _SERVICE_NAME + '/FullDuplexCall' +HALF_DUPLEX_CALL_METHOD_NAME = _SERVICE_NAME + '/HalfDuplexCall' + +CLIENT_METHODS = { + EMPTY_CALL_METHOD_NAME: _CLIENT_EMPTY_CALL, + UNARY_CALL_METHOD_NAME: _CLIENT_UNARY_CALL, + STREAMING_OUTPUT_CALL_METHOD_NAME: _CLIENT_STREAMING_OUTPUT_CALL, + STREAMING_INPUT_CALL_METHOD_NAME: _CLIENT_STREAMING_INPUT_CALL, + FULL_DUPLEX_CALL_METHOD_NAME: _CLIENT_FULL_DUPLEX_CALL, + HALF_DUPLEX_CALL_METHOD_NAME: _CLIENT_HALF_DUPLEX_CALL, +} + +SERVER_METHODS = { + EMPTY_CALL_METHOD_NAME: _SERVER_EMPTY_CALL, + UNARY_CALL_METHOD_NAME: _SERVER_UNARY_CALL, + STREAMING_OUTPUT_CALL_METHOD_NAME: _SERVER_STREAMING_OUTPUT_CALL, + STREAMING_INPUT_CALL_METHOD_NAME: _SERVER_STREAMING_INPUT_CALL, + FULL_DUPLEX_CALL_METHOD_NAME: _SERVER_FULL_DUPLEX_CALL, + HALF_DUPLEX_CALL_METHOD_NAME: _SERVER_HALF_DUPLEX_CALL, +} diff --git a/src/python/interop/interop/server.py b/src/python/interop/interop/server.py index 0035e062a4e..785d482fe59 100644 --- a/src/python/interop/interop/server.py +++ b/src/python/interop/interop/server.py @@ -43,19 +43,6 @@ _ONE_DAY_IN_SECONDS = 60 * 60 * 24 _PRIVATE_KEY_RESOURCE_PATH = 'credentials/server1.key' _CERTIFICATE_CHAIN_RESOURCE_PATH = 'credentials/server1.pem' -_METHODS = { - '/grpc.testing.TestService/EmptyCall': methods.EMPTY_CALL, - '/grpc.testing.TestService/UnaryCall': methods.UNARY_CALL, - '/grpc.testing.TestService/StreamingOutputCall': - methods.STREAMING_OUTPUT_CALL, - '/grpc.testing.TestService/StreamingInputCall': - methods.STREAMING_INPUT_CALL, - '/grpc.testing.TestService/FullDuplexCall': - methods.FULL_DUPLEX_CALL, - '/grpc.testing.TestService/HalfDuplexCall': - methods.HALF_DUPLEX_CALL, -} - def serve(): parser = argparse.ArgumentParser() @@ -72,10 +59,10 @@ def serve(): certificate_chain = pkg_resources.resource_string( __name__, _CERTIFICATE_CHAIN_RESOURCE_PATH) server = implementations.secure_server( - _METHODS, args.port, private_key, certificate_chain) + methods.SERVER_METHODS, args.port, private_key, certificate_chain) else: server = implementations.insecure_server( - _METHODS, args.port) + methods.SERVER_METHODS, args.port) server.start() logging.info('Server serving.') diff --git a/src/python/src/grpc/early_adopter/_face_utilities.py b/src/python/src/grpc/early_adopter/_face_utilities.py index 714f2bb79cb..3e37b08752b 100644 --- a/src/python/src/grpc/early_adopter/_face_utilities.py +++ b/src/python/src/grpc/early_adopter/_face_utilities.py @@ -37,8 +37,8 @@ from grpc.early_adopter import interfaces class _InlineUnaryUnaryMethod(face_interfaces.InlineValueInValueOutMethod): - def __init__(self, unary_unary_rpc_method): - self._method = unary_unary_rpc_method + def __init__(self, unary_unary_server_rpc_method): + self._method = unary_unary_server_rpc_method def service(self, request, context): """See face_interfaces.InlineValueInValueOutMethod.service for spec.""" @@ -47,8 +47,8 @@ class _InlineUnaryUnaryMethod(face_interfaces.InlineValueInValueOutMethod): class _InlineUnaryStreamMethod(face_interfaces.InlineValueInStreamOutMethod): - def __init__(self, unary_stream_rpc_method): - self._method = unary_stream_rpc_method + def __init__(self, unary_stream_server_rpc_method): + self._method = unary_stream_server_rpc_method def service(self, request, context): """See face_interfaces.InlineValueInStreamOutMethod.service for spec.""" @@ -57,8 +57,8 @@ class _InlineUnaryStreamMethod(face_interfaces.InlineValueInStreamOutMethod): class _InlineStreamUnaryMethod(face_interfaces.InlineStreamInValueOutMethod): - def __init__(self, stream_unary_rpc_method): - self._method = stream_unary_rpc_method + def __init__(self, stream_unary_server_rpc_method): + self._method = stream_unary_server_rpc_method def service(self, request_iterator, context): """See face_interfaces.InlineStreamInValueOutMethod.service for spec.""" @@ -67,61 +67,99 @@ class _InlineStreamUnaryMethod(face_interfaces.InlineStreamInValueOutMethod): class _InlineStreamStreamMethod(face_interfaces.InlineStreamInStreamOutMethod): - def __init__(self, stream_stream_rpc_method): - self._method = stream_stream_rpc_method + def __init__(self, stream_stream_server_rpc_method): + self._method = stream_stream_server_rpc_method def service(self, request_iterator, context): """See face_interfaces.InlineStreamInStreamOutMethod.service for spec.""" return self._method.service_stream_stream(request_iterator) -class Breakdown(object): +class ClientBreakdown(object): + """An intermediate representation of invocation-side views of RPC methods. + + Attributes: + request_serializers: A dictionary from RPC method name to callable + behavior to be used serializing request values for the RPC. + response_deserializers: A dictionary from RPC method name to callable + behavior to be used deserializing response values for the RPC. + """ + __metaclass__ = abc.ABCMeta + + +class _EasyClientBreakdown( + ClientBreakdown, + collections.namedtuple( + '_EasyClientBreakdown', + ('request_serializers', 'response_deserializers'))): + pass + + +class ServerBreakdown(object): """An intermediate representation of implementations of RPC methods. Attributes: - unary_unary_methods: - unary_stream_methods: - stream_unary_methods: - stream_stream_methods: - request_serializers: - request_deserializers: - response_serializers: - response_deserializers: + unary_unary_methods: A dictionary from RPC method name to callable + behavior implementing the RPC method for unary-unary RPC methods. + unary_stream_methods: A dictionary from RPC method name to callable + behavior implementing the RPC method for unary-stream RPC methods. + stream_unary_methods: A dictionary from RPC method name to callable + behavior implementing the RPC method for stream-unary RPC methods. + stream_stream_methods: A dictionary from RPC method name to callable + behavior implementing the RPC method for stream-stream RPC methods. + request_deserializers: A dictionary from RPC method name to callable + behavior to be used deserializing request values for the RPC. + response_serializers: A dictionary from RPC method name to callable + behavior to be used serializing response values for the RPC. """ __metaclass__ = abc.ABCMeta -class _EasyBreakdown( - Breakdown, +class _EasyServerBreakdown( + ServerBreakdown, collections.namedtuple( - '_EasyBreakdown', - ['unary_unary_methods', 'unary_stream_methods', 'stream_unary_methods', - 'stream_stream_methods', 'request_serializers', - 'request_deserializers', 'response_serializers', - 'response_deserializers'])): + '_EasyServerBreakdown', + ('unary_unary_methods', 'unary_stream_methods', 'stream_unary_methods', + 'stream_stream_methods', 'request_deserializers', + 'response_serializers'))): pass -def break_down(methods): - """Breaks down RPC methods. +def client_break_down(methods): + """Derives a ClientBreakdown from several interfaces.ClientRpcMethods. + + Args: + methods: A dictionary from RPC mthod name to + interfaces.ClientRpcMethod object describing the RPCs. + + Returns: + A ClientBreakdown corresponding to the given methods. + """ + request_serializers = {} + response_deserializers = {} + for name, method in methods.iteritems(): + request_serializers[name] = method.serialize_request + response_deserializers[name] = method.deserialize_response + return _EasyClientBreakdown(request_serializers, response_deserializers) + + +def server_break_down(methods): + """Derives a ServerBreakdown from several interfaces.ServerRpcMethods. Args: methods: A dictionary from RPC mthod name to - interfaces.RpcMethod object describing the RPCs. + interfaces.ServerRpcMethod object describing the RPCs. Returns: - A Breakdown corresponding to the given methods. + A ServerBreakdown corresponding to the given methods. """ unary_unary = {} unary_stream = {} stream_unary = {} stream_stream = {} - request_serializers = {} request_deserializers = {} response_serializers = {} - response_deserializers = {} - for name, method in methods.iteritems(): cardinality = method.cardinality() if cardinality is interfaces.Cardinality.UNARY_UNARY: @@ -132,12 +170,9 @@ def break_down(methods): stream_unary[name] = _InlineStreamUnaryMethod(method) elif cardinality is interfaces.Cardinality.STREAM_STREAM: stream_stream[name] = _InlineStreamStreamMethod(method) - request_serializers[name] = method.serialize_request request_deserializers[name] = method.deserialize_request response_serializers[name] = method.serialize_response - response_deserializers[name] = method.deserialize_response - return _EasyBreakdown( + return _EasyServerBreakdown( unary_unary, unary_stream, stream_unary, stream_stream, - request_serializers, request_deserializers, response_serializers, - response_deserializers) + request_deserializers, response_serializers) diff --git a/src/python/src/grpc/early_adopter/implementations.py b/src/python/src/grpc/early_adopter/implementations.py index cd9dd5a57d6..c549317d15d 100644 --- a/src/python/src/grpc/early_adopter/implementations.py +++ b/src/python/src/grpc/early_adopter/implementations.py @@ -92,7 +92,7 @@ class _Server(interfaces.Server): def _build_server(methods, port, private_key, certificate_chain): - breakdown = _face_utilities.break_down(methods) + breakdown = _face_utilities.server_break_down(methods) return _Server(breakdown, port, private_key, certificate_chain) @@ -101,8 +101,8 @@ def insecure_server(methods, port): Args: methods: A dictionary from RPC method name to - interfaces.RpcMethod object describing the RPCs to be - serviced by the created server. + interfaces.ServerRpcMethod object describing the RPCs to + be serviced by the created server. port: The port on which to serve. Returns: @@ -117,8 +117,8 @@ def secure_server(methods, port, private_key, certificate_chain): Args: methods: A dictionary from RPC method name to - interfaces.RpcMethod object describing the RPCs to be - serviced by the created server. + interfaces.ServerRpcMethod object describing the RPCs to + be serviced by the created server. port: The port on which to serve. private_key: A pem-encoded private key. certificate_chain: A pem-encoded certificate chain. diff --git a/src/python/src/grpc/early_adopter/interfaces.py b/src/python/src/grpc/early_adopter/interfaces.py index 8d9a3121333..0ec371f8e88 100644 --- a/src/python/src/grpc/early_adopter/interfaces.py +++ b/src/python/src/grpc/early_adopter/interfaces.py @@ -44,7 +44,7 @@ class Cardinality(enum.Enum): class RpcMethod(object): - """A sum type for the implementation of an RPC method.""" + """A type for the common aspects of RPC method specifications.""" __metaclass__ = abc.ABCMeta @abc.abstractmethod @@ -59,6 +59,11 @@ class RpcMethod(object): """ raise NotImplementedError() + +class ClientRpcMethod(RpcMethod): + """Invocation-side description of an RPC method.""" + __metaclass__ = abc.ABCMeta + @abc.abstractmethod def serialize_request(self, request): """Serializes a request value. @@ -72,6 +77,25 @@ class RpcMethod(object): """ raise NotImplementedError() + @abc.abstractmethod + def deserialize_response(self, serialized_response): + """Deserializes a response value. + + Args: + serialized_response: A bytestring that is the + serialization of a response value appropriate for this + RpcMethod. + + Returns: + A response value corresponding to the given bytestring. + """ + raise NotImplementedError() + + +class ServerRpcMethod(RpcMethod): + """Service-side description of an RPC method.""" + __metaclass__ = abc.ABCMeta + @abc.abstractmethod def deserialize_request(self, serialized_request): """Deserializes a request value. @@ -99,20 +123,6 @@ class RpcMethod(object): """ raise NotImplementedError() - @abc.abstractmethod - def deserialize_response(self, serialized_response): - """Deserializes a response value. - - Args: - serialized_response: A bytestring that is the - serialization of a response value appropriate for this - RpcMethod. - - Returns: - A response value corresponding to the given bytestring. - """ - raise NotImplementedError() - @abc.abstractmethod def service_unary_unary(self, request): """Carries out this RPC. @@ -182,7 +192,6 @@ class Server(object): """A GRPC Server.""" __metaclass__ = abc.ABCMeta - @abc.abstractmethod def start(self): """Instructs this server to commence service of RPCs.""" diff --git a/src/python/src/grpc/early_adopter/utilities.py b/src/python/src/grpc/early_adopter/utilities.py index a4ee253d830..9277d3f6ad4 100644 --- a/src/python/src/grpc/early_adopter/utilities.py +++ b/src/python/src/grpc/early_adopter/utilities.py @@ -32,7 +32,7 @@ from grpc.early_adopter import interfaces -class _RpcMethod(interfaces.RpcMethod): +class _RpcMethod(interfaces.ClientRpcMethod, interfaces.ServerRpcMethod): def __init__( self, cardinality, unary_unary, unary_stream, stream_unary, @@ -85,129 +85,181 @@ class _RpcMethod(interfaces.RpcMethod): return self._stream_stream(request_iterator) -def unary_unary_rpc_method( - behavior, request_serializer, request_deserializer, response_serializer, - response_deserializer): - """Constructs an interfaces.RpcMethod for the given behavior. +def unary_unary_client_rpc_method(request_serializer, response_deserializer): + """Constructs an interfaces.ClientRpcMethod for a unary-unary RPC method. + + Args: + request_serializer: A callable that when called on a request + value returns a bytestring corresponding to that value. + response_deserializer: A callable that when called on a + bytestring returns the response value corresponding to + that bytestring. + + Returns: + An interfaces.ClientRpcMethod constructed from the given + arguments representing a unary-request/unary-response RPC + method. + """ + return _RpcMethod( + interfaces.Cardinality.UNARY_UNARY, None, None, None, None, + request_serializer, None, None, response_deserializer) + + +def unary_stream_client_rpc_method(request_serializer, response_deserializer): + """Constructs an interfaces.ClientRpcMethod for a unary-stream RPC method. + + Args: + request_serializer: A callable that when called on a request + value returns a bytestring corresponding to that value. + response_deserializer: A callable that when called on a + bytestring returns the response value corresponding to + that bytestring. + + Returns: + An interfaces.ClientRpcMethod constructed from the given + arguments representing a unary-request/streaming-response + RPC method. + """ + return _RpcMethod( + interfaces.Cardinality.UNARY_STREAM, None, None, None, None, + request_serializer, None, None, response_deserializer) + + +def stream_unary_client_rpc_method(request_serializer, response_deserializer): + """Constructs an interfaces.ClientRpcMethod for a stream-unary RPC method. + + Args: + request_serializer: A callable that when called on a request + value returns a bytestring corresponding to that value. + response_deserializer: A callable that when called on a + bytestring returns the response value corresponding to + that bytestring. + + Returns: + An interfaces.ClientRpcMethod constructed from the given + arguments representing a streaming-request/unary-response + RPC method. + """ + return _RpcMethod( + interfaces.Cardinality.STREAM_UNARY, None, None, None, None, + request_serializer, None, None, response_deserializer) + + +def stream_stream_client_rpc_method(request_serializer, response_deserializer): + """Constructs an interfaces.ClientRpcMethod for a stream-stream RPC method. + + Args: + request_serializer: A callable that when called on a request + value returns a bytestring corresponding to that value. + response_deserializer: A callable that when called on a + bytestring returns the response value corresponding to + that bytestring. + + Returns: + An interfaces.ClientRpcMethod constructed from the given + arguments representing a + streaming-request/streaming-response RPC method. + """ + return _RpcMethod( + interfaces.Cardinality.STREAM_STREAM, None, None, None, None, + request_serializer, None, None, response_deserializer) + + +def unary_unary_server_rpc_method( + behavior, request_deserializer, response_serializer): + """Constructs an interfaces.ServerRpcMethod for the given behavior. Args: behavior: A callable that implements a unary-unary RPC method that accepts a single request and returns a single response. - request_serializer: A callable that when called on a request - value returns a bytestring corresponding to that value. request_deserializer: A callable that when called on a bytestring returns the request value corresponding to that bytestring. response_serializer: A callable that when called on a response value returns the bytestring corresponding to that value. - response_deserializer: A callable that when called on a - bytestring returns the response value corresponding to - that bytestring. Returns: - An interfaces.RpcMethod constructed from the given + An interfaces.ServerRpcMethod constructed from the given arguments representing a unary-request/unary-response RPC method. """ return _RpcMethod( interfaces.Cardinality.UNARY_UNARY, behavior, None, None, None, - request_serializer, request_deserializer, response_serializer, - response_deserializer) + None, request_deserializer, response_serializer, None) -def unary_stream_rpc_method( - behavior, request_serializer, request_deserializer, response_serializer, - response_deserializer): - """Constructs an interfaces.RpcMethod for the given behavior. +def unary_stream_server_rpc_method( + behavior, request_deserializer, response_serializer): + """Constructs an interfaces.ServerRpcMethod for the given behavior. Args: behavior: A callable that implements a unary-stream RPC method that accepts a single request and returns an iterator of zero or more responses. - request_serializer: A callable that when called on a request - value returns a bytestring corresponding to that value. request_deserializer: A callable that when called on a bytestring returns the request value corresponding to that bytestring. response_serializer: A callable that when called on a response value returns the bytestring corresponding to that value. - response_deserializer: A callable that when called on a - bytestring returns the response value corresponding to - that bytestring. Returns: - An interfaces.RpcMethod constructed from the given + An interfaces.ServerRpcMethod constructed from the given arguments representing a unary-request/streaming-response RPC method. """ return _RpcMethod( interfaces.Cardinality.UNARY_STREAM, None, behavior, None, None, - request_serializer, request_deserializer, response_serializer, - response_deserializer) + None, request_deserializer, response_serializer, None) -def stream_unary_rpc_method( - behavior, request_serializer, request_deserializer, response_serializer, - response_deserializer): - """Constructs an interfaces.RpcMethod for the given behavior. +def stream_unary_server_rpc_method( + behavior, request_deserializer, response_serializer): + """Constructs an interfaces.ServerRpcMethod for the given behavior. Args: behavior: A callable that implements a stream-unary RPC method that accepts an iterator of zero or more requests and returns a single response. - request_serializer: A callable that when called on a request - value returns a bytestring corresponding to that value. request_deserializer: A callable that when called on a bytestring returns the request value corresponding to that bytestring. response_serializer: A callable that when called on a response value returns the bytestring corresponding to that value. - response_deserializer: A callable that when called on a - bytestring returns the response value corresponding to - that bytestring. Returns: - An interfaces.RpcMethod constructed from the given + An interfaces.ServerRpcMethod constructed from the given arguments representing a streaming-request/unary-response RPC method. """ return _RpcMethod( interfaces.Cardinality.STREAM_UNARY, None, None, behavior, None, - request_serializer, request_deserializer, response_serializer, - response_deserializer) + None, request_deserializer, response_serializer, None) -def stream_stream_rpc_method( - behavior, request_serializer, request_deserializer, response_serializer, - response_deserializer): - """Constructs an interfaces.RpcMethod for the given behavior. +def stream_stream_server_rpc_method( + behavior, request_deserializer, response_serializer): + """Constructs an interfaces.ServerRpcMethod for the given behavior. Args: behavior: A callable that implements a stream-stream RPC method that accepts an iterator of zero or more requests and returns an iterator of zero or more responses. - request_serializer: A callable that when called on a request - value returns a bytestring corresponding to that value. request_deserializer: A callable that when called on a bytestring returns the request value corresponding to that bytestring. response_serializer: A callable that when called on a response value returns the bytestring corresponding to that value. - response_deserializer: A callable that when called on a - bytestring returns the response value corresponding to - that bytestring. Returns: - An interfaces.RpcMethod constructed from the given + An interfaces.ServerRpcMethod constructed from the given arguments representing a streaming-request/streaming-response RPC method. """ return _RpcMethod( interfaces.Cardinality.STREAM_STREAM, None, None, None, behavior, - request_serializer, request_deserializer, response_serializer, - response_deserializer) + None, request_deserializer, response_serializer, None) From b4472d88106bf799eab0cb3deb34cbf4f42c34fb Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 19 Feb 2015 08:44:56 -0800 Subject: [PATCH 194/232] fixed readme --- tools/dockerfile/grpc_base/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dockerfile/grpc_base/README.md b/tools/dockerfile/grpc_base/README.md index e3b5f2ef373..5c81b02425d 100644 --- a/tools/dockerfile/grpc_base/README.md +++ b/tools/dockerfile/grpc_base/README.md @@ -2,7 +2,8 @@ Base GRPC Dockerfile ==================== Dockerfile for creating the base gRPC development Docker instance. -For now, this assumes that the development will be done on GCE instances, with source code on Git-on-Borg. +For now, this assumes that the development will be done on GCE instances, +with source code on GitHub. As of 2015/02/02, it includes - git From 3086862d201427f2ed33955e32f4d273bfc522f2 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 19 Feb 2015 09:22:33 -0800 Subject: [PATCH 195/232] Changed namespace from Google.GRPC to Grpc, sorted using statements, minor refactorings --- src/csharp/GrpcApi/MathExamples.cs | 4 +- src/csharp/GrpcApi/MathGrpc.cs | 16 ++++---- src/csharp/GrpcApi/MathServiceImpl.cs | 6 +-- src/csharp/GrpcApi/TestServiceGrpc.cs | 23 ++++++----- .../GrpcApiTests/MathClientServerTests.cs | 8 ++-- src/csharp/GrpcCore/Call.cs | 4 +- src/csharp/GrpcCore/Calls.cs | 4 +- src/csharp/GrpcCore/Channel.cs | 4 +- .../GrpcCore/ClientStreamingAsyncResult.cs | 2 +- src/csharp/GrpcCore/GrpcEnvironment.cs | 4 +- src/csharp/GrpcCore/Internal/AsyncCall.cs | 14 +++---- .../BatchContextSafeHandleNotOwned.cs | 4 +- .../GrpcCore/Internal/CallSafeHandle.cs | 6 +-- .../GrpcCore/Internal/ChannelSafeHandle.cs | 2 +- .../Internal/ClientStreamingInputObserver.cs | 4 +- .../Internal/CompletionQueueSafeHandle.cs | 2 +- src/csharp/GrpcCore/Internal/Enums.cs | 2 +- .../GrpcCore/Internal/GrpcThreadPool.cs | 6 +-- .../Internal/SafeHandleZeroIsInvalid.cs | 2 +- .../GrpcCore/Internal/ServerSafeHandle.cs | 6 +-- .../Internal/ServerStreamingOutputObserver.cs | 6 +-- src/csharp/GrpcCore/Internal/Timespec.cs | 2 +- src/csharp/GrpcCore/Marshaller.cs | 2 +- src/csharp/GrpcCore/Method.cs | 2 +- src/csharp/GrpcCore/RpcException.cs | 2 +- src/csharp/GrpcCore/Server.cs | 10 ++--- src/csharp/GrpcCore/ServerCallHandler.cs | 6 +-- src/csharp/GrpcCore/ServerCalls.cs | 2 +- .../GrpcCore/ServerServiceDefinition.cs | 2 +- src/csharp/GrpcCore/Status.cs | 2 +- src/csharp/GrpcCore/StatusCode.cs | 40 +++++++++---------- .../GrpcCore/Utils/RecordingObserver.cs | 4 +- src/csharp/GrpcCore/Utils/RecordingQueue.cs | 2 +- src/csharp/GrpcCoreTests/ClientServerTest.cs | 14 +++---- .../GrpcCoreTests/GrpcEnvironmentTest.cs | 6 +-- src/csharp/GrpcCoreTests/ServerTest.cs | 10 ++--- src/csharp/GrpcCoreTests/TestResult.xml | 6 +-- src/csharp/GrpcCoreTests/TimespecTest.cs | 6 +-- src/csharp/InteropClient/Client.cs | 8 ++-- src/csharp/InteropClient/InteropClient.csproj | 9 ++--- src/csharp/MathClient/MathClient.cs | 2 +- 41 files changed, 132 insertions(+), 134 deletions(-) diff --git a/src/csharp/GrpcApi/MathExamples.cs b/src/csharp/GrpcApi/MathExamples.cs index 2202c52a277..97c91b1b1b5 100644 --- a/src/csharp/GrpcApi/MathExamples.cs +++ b/src/csharp/GrpcApi/MathExamples.cs @@ -32,10 +32,10 @@ #endregion using System; -using System.Threading.Tasks; using System.Collections.Generic; using System.Reactive.Linq; -using Google.GRPC.Core.Utils; +using System.Threading.Tasks; +using Grpc.Core.Utils; namespace math { diff --git a/src/csharp/GrpcApi/MathGrpc.cs b/src/csharp/GrpcApi/MathGrpc.cs index 44e704e4969..f938a245439 100644 --- a/src/csharp/GrpcApi/MathGrpc.cs +++ b/src/csharp/GrpcApi/MathGrpc.cs @@ -32,11 +32,11 @@ #endregion using System; -using System.Threading; -using System.Threading.Tasks; using System.Collections.Generic; using System.Reactive.Linq; -using Google.GRPC.Core; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; namespace math { @@ -99,31 +99,31 @@ namespace math public DivReply Div(DivArgs request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(divMethod, channel); + var call = new Grpc.Core.Call(divMethod, channel); return Calls.BlockingUnaryCall(call, request, token); } public Task DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(divMethod, channel); + var call = new Grpc.Core.Call(divMethod, channel); return Calls.AsyncUnaryCall(call, request, token); } public void Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(fibMethod, channel); + var call = new Grpc.Core.Call(fibMethod, channel); Calls.AsyncServerStreamingCall(call, request, responseObserver, token); } public ClientStreamingAsyncResult Sum(CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(sumMethod, channel); + var call = new Grpc.Core.Call(sumMethod, channel); return Calls.AsyncClientStreamingCall(call, token); } public IObserver DivMany(IObserver responseObserver, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(divManyMethod, channel); + var call = new Grpc.Core.Call(divManyMethod, channel); return Calls.DuplexStreamingCall(call, responseObserver, token); } } diff --git a/src/csharp/GrpcApi/MathServiceImpl.cs b/src/csharp/GrpcApi/MathServiceImpl.cs index 1a2f98f8b26..462fab4454f 100644 --- a/src/csharp/GrpcApi/MathServiceImpl.cs +++ b/src/csharp/GrpcApi/MathServiceImpl.cs @@ -32,11 +32,11 @@ #endregion using System; -using System.Threading; -using System.Threading.Tasks; using System.Collections.Generic; using System.Reactive.Linq; -using Google.GRPC.Core.Utils; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core.Utils; namespace math { diff --git a/src/csharp/GrpcApi/TestServiceGrpc.cs b/src/csharp/GrpcApi/TestServiceGrpc.cs index 64d5c095633..15700e40ac5 100644 --- a/src/csharp/GrpcApi/TestServiceGrpc.cs +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -30,12 +30,13 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endregion + using System; -using System.Threading; -using System.Threading.Tasks; using System.Collections.Generic; using System.Reactive.Linq; -using Google.GRPC.Core; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; namespace grpc.testing { @@ -119,49 +120,49 @@ namespace grpc.testing public Empty EmptyCall(Empty request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(emptyCallMethod, channel); + var call = new Grpc.Core.Call(emptyCallMethod, channel); return Calls.BlockingUnaryCall(call, request, token); } public Task EmptyCallAsync(Empty request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(emptyCallMethod, channel); + var call = new Grpc.Core.Call(emptyCallMethod, channel); return Calls.AsyncUnaryCall(call, request, token); } public SimpleResponse UnaryCall(SimpleRequest request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(unaryCallMethod, channel); + var call = new Grpc.Core.Call(unaryCallMethod, channel); return Calls.BlockingUnaryCall(call, request, token); } public Task UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(unaryCallMethod, channel); + var call = new Grpc.Core.Call(unaryCallMethod, channel); return Calls.AsyncUnaryCall(call, request, token); } public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(streamingOutputCallMethod, channel); + var call = new Grpc.Core.Call(streamingOutputCallMethod, channel); Calls.AsyncServerStreamingCall(call, request, responseObserver, token); } public ClientStreamingAsyncResult StreamingInputCall(CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(streamingInputCallMethod, channel); + var call = new Grpc.Core.Call(streamingInputCallMethod, channel); return Calls.AsyncClientStreamingCall(call, token); } public IObserver FullDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(fullDuplexCallMethod, channel); + var call = new Grpc.Core.Call(fullDuplexCallMethod, channel); return Calls.DuplexStreamingCall(call, responseObserver, token); } public IObserver HalfDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)) { - var call = new Google.GRPC.Core.Call(halfDuplexCallMethod, channel); + var call = new Grpc.Core.Call(halfDuplexCallMethod, channel); return Calls.DuplexStreamingCall(call, responseObserver, token); } } diff --git a/src/csharp/GrpcApiTests/MathClientServerTests.cs b/src/csharp/GrpcApiTests/MathClientServerTests.cs index 9056142097b..767340d6f2b 100644 --- a/src/csharp/GrpcApiTests/MathClientServerTests.cs +++ b/src/csharp/GrpcApiTests/MathClientServerTests.cs @@ -32,12 +32,12 @@ #endregion using System; -using NUnit.Framework; -using Google.GRPC.Core; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Google.GRPC.Core.Utils; -using System.Collections.Generic; +using Grpc.Core; +using Grpc.Core.Utils; +using NUnit.Framework; namespace math.Tests { diff --git a/src/csharp/GrpcCore/Call.cs b/src/csharp/GrpcCore/Call.cs index 93a7507b2fa..72dca688952 100644 --- a/src/csharp/GrpcCore/Call.cs +++ b/src/csharp/GrpcCore/Call.cs @@ -32,9 +32,9 @@ #endregion using System; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { public class Call { diff --git a/src/csharp/GrpcCore/Calls.cs b/src/csharp/GrpcCore/Calls.cs index e5ddd879d68..b67332676ac 100644 --- a/src/csharp/GrpcCore/Calls.cs +++ b/src/csharp/GrpcCore/Calls.cs @@ -34,9 +34,9 @@ using System; using System.Threading; using System.Threading.Tasks; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { // NOTE: this class is work-in-progress diff --git a/src/csharp/GrpcCore/Channel.cs b/src/csharp/GrpcCore/Channel.cs index d1f795541cc..942651cf393 100644 --- a/src/csharp/GrpcCore/Channel.cs +++ b/src/csharp/GrpcCore/Channel.cs @@ -35,9 +35,9 @@ using System; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { public class Channel : IDisposable { diff --git a/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs b/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs index f82fe5f26ce..44580a11542 100644 --- a/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs +++ b/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs @@ -34,7 +34,7 @@ using System; using System.Threading.Tasks; -namespace Google.GRPC.Core +namespace Grpc.Core { /// /// Return type for client streaming async method. diff --git a/src/csharp/GrpcCore/GrpcEnvironment.cs b/src/csharp/GrpcCore/GrpcEnvironment.cs index 55a6cac8f69..0e3a0a581cd 100644 --- a/src/csharp/GrpcCore/GrpcEnvironment.cs +++ b/src/csharp/GrpcCore/GrpcEnvironment.cs @@ -32,10 +32,10 @@ #endregion using System; -using Google.GRPC.Core.Internal; using System.Runtime.InteropServices; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { /// /// Encapsulates initialization and shutdown of gRPC library. diff --git a/src/csharp/GrpcCore/Internal/AsyncCall.cs b/src/csharp/GrpcCore/Internal/AsyncCall.cs index ce0ba30d53d..5e96092e270 100644 --- a/src/csharp/GrpcCore/Internal/AsyncCall.cs +++ b/src/csharp/GrpcCore/Internal/AsyncCall.cs @@ -32,14 +32,14 @@ #endregion using System; -using System.Runtime.InteropServices; using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using System.Runtime.CompilerServices; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// Handles native call lifecycle and provides convenience methods. @@ -381,7 +381,7 @@ namespace Google.GRPC.Core.Internal private void CompleteStreamObserver(Status status) { - if (status.StatusCode != StatusCode.GRPC_STATUS_OK) + if (status.StatusCode != StatusCode.OK) { // TODO: wrap to handle exceptions; readObserver.OnError(new RpcException(status)); @@ -413,13 +413,13 @@ namespace Google.GRPC.Core.Internal if (error != GRPCOpError.GRPC_OP_OK) { tcs.SetException(new RpcException( - new Status(StatusCode.GRPC_STATUS_INTERNAL, "Internal error occured.") + new Status(StatusCode.Internal, "Internal error occured.") )); return; } var status = ctx.GetReceivedStatus(); - if (status.StatusCode != StatusCode.GRPC_STATUS_OK) + if (status.StatusCode != StatusCode.OK) { tcs.SetException(new RpcException(status)); return; diff --git a/src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs b/src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs index ddfd94a3b56..75cd30e1a2d 100644 --- a/src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs +++ b/src/csharp/GrpcCore/Internal/BatchContextSafeHandleNotOwned.cs @@ -33,9 +33,9 @@ using System; using System.Runtime.InteropServices; -using Google.GRPC.Core; +using Grpc.Core; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// Not owned version of diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index 55d66a62ca7..659a383b4bd 100644 --- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs @@ -32,11 +32,11 @@ #endregion using System; -using System.Runtime.InteropServices; using System.Diagnostics; -using Google.GRPC.Core; +using System.Runtime.InteropServices; +using Grpc.Core; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { //TODO: rename the delegate internal delegate void CompletionCallbackDelegate(GRPCOpError error, IntPtr batchContextPtr); diff --git a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs index 379c83d5375..f15ead35724 100644 --- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs @@ -36,7 +36,7 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// grpc_channel from diff --git a/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs b/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs index 4d10a9bdf96..fb59e86e2d7 100644 --- a/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs +++ b/src/csharp/GrpcCore/Internal/ClientStreamingInputObserver.cs @@ -32,9 +32,9 @@ #endregion using System; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { internal class ClientStreamingInputObserver : IObserver { diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs index 5ea436df197..3f01fdbfd05 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -35,7 +35,7 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// grpc_completion_queue from diff --git a/src/csharp/GrpcCore/Internal/Enums.cs b/src/csharp/GrpcCore/Internal/Enums.cs index d38896ec843..f363050b07e 100644 --- a/src/csharp/GrpcCore/Internal/Enums.cs +++ b/src/csharp/GrpcCore/Internal/Enums.cs @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// from grpc/grpc.h diff --git a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs index 634a0b2d721..9e69fe2f430 100644 --- a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs +++ b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs @@ -32,13 +32,13 @@ #endregion using System; -using Google.GRPC.Core.Internal; +using System.Collections.Generic; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using System.Collections.Generic; +using Grpc.Core.Internal; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// Pool of threads polling on the same completion queue. diff --git a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs index 59f08d4ca89..aa6fce2e969 100644 --- a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs +++ b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// Safe handle to wrap native objects. diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs index 047bde1addf..de9bbaf7c12 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -32,11 +32,11 @@ #endregion using System; -using System.Runtime.InteropServices; -using System.Diagnostics; using System.Collections.Concurrent; +using System.Diagnostics; +using System.Runtime.InteropServices; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { // TODO: we need to make sure that the delegates are not collected before invoked. internal delegate void ServerShutdownCallbackDelegate(IntPtr eventPtr); diff --git a/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs b/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs index e9cb65cb3b0..08d99214754 100644 --- a/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs +++ b/src/csharp/GrpcCore/Internal/ServerStreamingOutputObserver.cs @@ -32,9 +32,9 @@ #endregion using System; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// Observer that writes all arriving messages to a call abstraction (in blocking fashion) @@ -52,7 +52,7 @@ namespace Google.GRPC.Core.Internal public void OnCompleted() { // TODO: how bad is the Wait here? - call.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_OK, "")).Wait(); + call.SendStatusFromServerAsync(new Status(StatusCode.OK, "")).Wait(); } public void OnError(Exception error) diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs index 38b75180dc5..b191ecde94c 100644 --- a/src/csharp/GrpcCore/Internal/Timespec.cs +++ b/src/csharp/GrpcCore/Internal/Timespec.cs @@ -35,7 +35,7 @@ using System; using System.Runtime.InteropServices; using System.Threading; -namespace Google.GRPC.Core.Internal +namespace Grpc.Core.Internal { /// /// gpr_timespec from grpc/support/time.h diff --git a/src/csharp/GrpcCore/Marshaller.cs b/src/csharp/GrpcCore/Marshaller.cs index f031354fd2d..602e0eb8240 100644 --- a/src/csharp/GrpcCore/Marshaller.cs +++ b/src/csharp/GrpcCore/Marshaller.cs @@ -33,7 +33,7 @@ using System; -namespace Google.GRPC.Core +namespace Grpc.Core { /// /// For serializing and deserializing messages. diff --git a/src/csharp/GrpcCore/Method.cs b/src/csharp/GrpcCore/Method.cs index 64a4f71396d..c94aa8161fe 100644 --- a/src/csharp/GrpcCore/Method.cs +++ b/src/csharp/GrpcCore/Method.cs @@ -33,7 +33,7 @@ using System; -namespace Google.GRPC.Core +namespace Grpc.Core { public enum MethodType { diff --git a/src/csharp/GrpcCore/RpcException.cs b/src/csharp/GrpcCore/RpcException.cs index 9ec1d2f2f33..5a9d0039bc9 100644 --- a/src/csharp/GrpcCore/RpcException.cs +++ b/src/csharp/GrpcCore/RpcException.cs @@ -33,7 +33,7 @@ using System; -namespace Google.GRPC.Core +namespace Grpc.Core { public class RpcException : Exception { diff --git a/src/csharp/GrpcCore/Server.cs b/src/csharp/GrpcCore/Server.cs index 91842d81821..002592a3d88 100644 --- a/src/csharp/GrpcCore/Server.cs +++ b/src/csharp/GrpcCore/Server.cs @@ -32,14 +32,14 @@ #endregion using System; -using System.Runtime.InteropServices; -using System.Diagnostics; -using System.Threading.Tasks; using System.Collections.Concurrent; using System.Collections.Generic; -using Google.GRPC.Core.Internal; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { /// /// Server is implemented only to be able to do diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index 48d1eaa3359..1296947f34d 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -32,9 +32,9 @@ #endregion using System; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; -namespace Google.GRPC.Core +namespace Grpc.Core { internal interface IServerCallHandler { @@ -111,7 +111,7 @@ namespace Google.GRPC.Core var finishedTask = asyncCall.ServerSideStreamingRequestCallAsync(new NullObserver()); - asyncCall.SendStatusFromServerAsync(new Status(StatusCode.GRPC_STATUS_UNIMPLEMENTED, "No such method.")).Wait(); + asyncCall.SendStatusFromServerAsync(new Status(StatusCode.Unimplemented, "No such method.")).Wait(); finishedTask.Wait(); } diff --git a/src/csharp/GrpcCore/ServerCalls.cs b/src/csharp/GrpcCore/ServerCalls.cs index 273029cab60..bed77796de1 100644 --- a/src/csharp/GrpcCore/ServerCalls.cs +++ b/src/csharp/GrpcCore/ServerCalls.cs @@ -33,7 +33,7 @@ using System; -namespace Google.GRPC.Core +namespace Grpc.Core { // TODO: perhaps add also serverSideStreaming and clientSideStreaming diff --git a/src/csharp/GrpcCore/ServerServiceDefinition.cs b/src/csharp/GrpcCore/ServerServiceDefinition.cs index 1eb17837e44..231c3760620 100644 --- a/src/csharp/GrpcCore/ServerServiceDefinition.cs +++ b/src/csharp/GrpcCore/ServerServiceDefinition.cs @@ -34,7 +34,7 @@ using System; using System.Collections.Generic; -namespace Google.GRPC.Core +namespace Grpc.Core { public class ServerServiceDefinition { diff --git a/src/csharp/GrpcCore/Status.cs b/src/csharp/GrpcCore/Status.cs index 6430e6b7ab7..5ea1df7b481 100644 --- a/src/csharp/GrpcCore/Status.cs +++ b/src/csharp/GrpcCore/Status.cs @@ -34,7 +34,7 @@ using System; using System.Runtime.InteropServices; -namespace Google.GRPC.Core +namespace Grpc.Core { /// /// Represents RPC result. diff --git a/src/csharp/GrpcCore/StatusCode.cs b/src/csharp/GrpcCore/StatusCode.cs index ba99f9b5e0b..1fbf9c1b687 100644 --- a/src/csharp/GrpcCore/StatusCode.cs +++ b/src/csharp/GrpcCore/StatusCode.cs @@ -33,22 +33,22 @@ using System; -namespace Google.GRPC.Core +namespace Grpc.Core { // TODO: element names should changed to comply with C# naming conventions. /// - /// grpc_status_code from grpc/status.h + /// based on grpc_status_code from grpc/status.h /// public enum StatusCode { /* Not an error; returned on success HTTP Mapping: 200 OK */ - GRPC_STATUS_OK = 0, + OK = 0, /* The operation was cancelled (typically by the caller). HTTP Mapping: 499 Client Closed Request */ - GRPC_STATUS_CANCELLED = 1, + Cancelled = 1, /* Unknown error. An example of where this error may be returned is if a Status value received from another address space belongs to an error-space that is not known in this address space. Also @@ -56,14 +56,14 @@ namespace Google.GRPC.Core may be converted to this error. HTTP Mapping: 500 Internal Server Error */ - GRPC_STATUS_UNKNOWN = 2, + Unknown = 2, /* Client specified an invalid argument. Note that this differs from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). HTTP Mapping: 400 Bad Request */ - GRPC_STATUS_INVALID_ARGUMENT = 3, + InvalidArgument = 3, /* Deadline expired before operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a @@ -71,16 +71,16 @@ namespace Google.GRPC.Core enough for the deadline to expire. HTTP Mapping: 504 Gateway Timeout */ - GRPC_STATUS_DEADLINE_EXCEEDED = 4, + DeadlineExceeded = 4, /* Some requested entity (e.g., file or directory) was not found. HTTP Mapping: 404 Not Found */ - GRPC_STATUS_NOT_FOUND = 5, + NotFound = 5, /* Some entity that we attempted to create (e.g., file or directory) already exists. HTTP Mapping: 409 Conflict */ - GRPC_STATUS_ALREADY_EXISTS = 6, + AlreadyExists = 6, /* The caller does not have permission to execute the specified operation. PERMISSION_DENIED must not be used for rejections caused by exhausting some resource (use RESOURCE_EXHAUSTED @@ -89,17 +89,17 @@ namespace Google.GRPC.Core instead for those errors). HTTP Mapping: 403 Forbidden */ - GRPC_STATUS_PERMISSION_DENIED = 7, + PermissionDenied = 7, /* The request does not have valid authentication credentials for the operation. HTTP Mapping: 401 Unauthorized */ - GRPC_STATUS_UNAUTHENTICATED = 16, + Unauthenticated = 16, /* Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. HTTP Mapping: 429 Too Many Requests */ - GRPC_STATUS_RESOURCE_EXHAUSTED = 8, + ResourceExhausted = 8, /* Operation was rejected because the system is not in a state required for the operation's execution. For example, directory to be deleted may be non-empty, an rmdir operation is applied to @@ -126,7 +126,7 @@ namespace Google.GRPC.Core the request contains Etag related headers. So if the server does see Etag related headers in the request, it may choose to return 412 instead of 400 for this error code. */ - GRPC_STATUS_FAILED_PRECONDITION = 9, + FailedPrecondition = 9, /* The operation was aborted, typically due to a concurrency issue like sequencer check failures, transaction aborts, etc. @@ -134,7 +134,7 @@ namespace Google.GRPC.Core ABORTED, and UNAVAILABLE. HTTP Mapping: 409 Conflict */ - GRPC_STATUS_ABORTED = 10, + Aborted = 10, /* Operation was attempted past the valid range. E.g., seeking or reading past end of file. @@ -152,17 +152,17 @@ namespace Google.GRPC.Core they are done. HTTP Mapping: 400 Bad Request */ - GRPC_STATUS_OUT_OF_RANGE = 11, + OutOfRange = 11, /* Operation is not implemented or not supported/enabled in this service. HTTP Mapping: 501 Not Implemented */ - GRPC_STATUS_UNIMPLEMENTED = 12, + Unimplemented = 12, /* Internal errors. Means some invariants expected by underlying system has been broken. If you see one of these errors, something is very broken. HTTP Mapping: 500 Internal Server Error */ - GRPC_STATUS_INTERNAL = 13, + Internal = 13, /* The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. @@ -171,13 +171,11 @@ namespace Google.GRPC.Core ABORTED, and UNAVAILABLE. HTTP Mapping: 503 Service Unavailable */ - GRPC_STATUS_UNAVAILABLE = 14, + Unavailable = 14, /* Unrecoverable data loss or corruption. HTTP Mapping: 500 Internal Server Error */ - GRPC_STATUS_DATA_LOSS = 15, - /* Force users to include a default branch: */ - GRPC_STATUS__DO_NOT_USE = -1 + DataLoss = 15 } } diff --git a/src/csharp/GrpcCore/Utils/RecordingObserver.cs b/src/csharp/GrpcCore/Utils/RecordingObserver.cs index 0c784e1d356..99d2725b70e 100644 --- a/src/csharp/GrpcCore/Utils/RecordingObserver.cs +++ b/src/csharp/GrpcCore/Utils/RecordingObserver.cs @@ -32,10 +32,10 @@ #endregion using System; -using System.Threading.Tasks; using System.Collections.Generic; +using System.Threading.Tasks; -namespace Google.GRPC.Core.Utils +namespace Grpc.Core.Utils { public class RecordingObserver : IObserver { diff --git a/src/csharp/GrpcCore/Utils/RecordingQueue.cs b/src/csharp/GrpcCore/Utils/RecordingQueue.cs index f8940d7584c..63992da6a95 100644 --- a/src/csharp/GrpcCore/Utils/RecordingQueue.cs +++ b/src/csharp/GrpcCore/Utils/RecordingQueue.cs @@ -36,7 +36,7 @@ using System.Threading.Tasks; using System.Collections.Generic; using System.Collections.Concurrent; -namespace Google.GRPC.Core.Utils +namespace Grpc.Core.Utils { // TODO: replace this by something that implements IAsyncEnumerator. /// diff --git a/src/csharp/GrpcCoreTests/ClientServerTest.cs b/src/csharp/GrpcCoreTests/ClientServerTest.cs index ba43e4f6a07..7e564a2fba5 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -32,15 +32,15 @@ #endregion using System; -using NUnit.Framework; -using Google.GRPC.Core; -using Google.GRPC.Core.Internal; -using System.Threading; using System.Diagnostics; +using System.Threading; using System.Threading.Tasks; -using Google.GRPC.Core.Utils; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Utils; +using NUnit.Framework; -namespace Google.GRPC.Core.Tests +namespace Grpc.Core.Tests { public class ClientServerTest { @@ -133,7 +133,7 @@ namespace Google.GRPC.Core.Tests Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); Assert.Fail(); } catch(RpcException e) { - Assert.AreEqual(StatusCode.GRPC_STATUS_UNIMPLEMENTED, e.Status.StatusCode); + Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode); } } diff --git a/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs b/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs index 8656b1bf016..8d3aef946a6 100644 --- a/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs +++ b/src/csharp/GrpcCoreTests/GrpcEnvironmentTest.cs @@ -32,11 +32,11 @@ #endregion using System; -using NUnit.Framework; -using Google.GRPC.Core; using System.Threading; +using Grpc.Core; +using NUnit.Framework; -namespace Google.GRPC.Core.Tests +namespace Grpc.Core.Tests { public class GrpcEnvironmentTest { diff --git a/src/csharp/GrpcCoreTests/ServerTest.cs b/src/csharp/GrpcCoreTests/ServerTest.cs index 43414a4cc49..dd30366f6a1 100644 --- a/src/csharp/GrpcCoreTests/ServerTest.cs +++ b/src/csharp/GrpcCoreTests/ServerTest.cs @@ -32,12 +32,12 @@ #endregion using System; +using Grpc.Core; +using Grpc.Core.Internal; +using Grpc.Core.Utils; using NUnit.Framework; -using Google.GRPC.Core.Internal; -using Google.GRPC.Core; -using Google.GRPC.Core.Utils; -namespace Google.GRPC.Core.Tests +namespace Grpc.Core.Tests { public class ServerTest { @@ -47,7 +47,7 @@ namespace Google.GRPC.Core.Tests GrpcEnvironment.Initialize(); Server server = new Server(); - int port = server.AddPort("localhost:0"); + server.AddPort("localhost:0"); server.Start(); server.ShutdownAsync().Wait(); diff --git a/src/csharp/GrpcCoreTests/TestResult.xml b/src/csharp/GrpcCoreTests/TestResult.xml index a5a6abd7b95..13da80739ce 100644 --- a/src/csharp/GrpcCoreTests/TestResult.xml +++ b/src/csharp/GrpcCoreTests/TestResult.xml @@ -15,17 +15,17 @@ - + - + - + diff --git a/src/csharp/GrpcCoreTests/TimespecTest.cs b/src/csharp/GrpcCoreTests/TimespecTest.cs index 21698242191..0ca84ec44bf 100644 --- a/src/csharp/GrpcCoreTests/TimespecTest.cs +++ b/src/csharp/GrpcCoreTests/TimespecTest.cs @@ -32,11 +32,11 @@ #endregion using System; -using NUnit.Framework; using System.Runtime.InteropServices; -using Google.GRPC.Core.Internal; +using Grpc.Core.Internal; +using NUnit.Framework; -namespace Google.GRPC.Core.Internal.Tests +namespace Grpc.Core.Internal.Tests { public class TimespecTest { diff --git a/src/csharp/InteropClient/Client.cs b/src/csharp/InteropClient/Client.cs index 945afe0642f..fdec6efd2ef 100644 --- a/src/csharp/InteropClient/Client.cs +++ b/src/csharp/InteropClient/Client.cs @@ -33,14 +33,14 @@ using System; using System.Collections.Generic; -using NUnit.Framework; using System.Text.RegularExpressions; -using Google.GRPC.Core; -using Google.GRPC.Core.Utils; using Google.ProtocolBuffers; +using Grpc.Core; +using Grpc.Core.Utils; +using NUnit.Framework; using grpc.testing; -namespace Google.GRPC.Interop +namespace Grpc.Interop { class Client { diff --git a/src/csharp/InteropClient/InteropClient.csproj b/src/csharp/InteropClient/InteropClient.csproj index a450f3a2feb..29590f49508 100644 --- a/src/csharp/InteropClient/InteropClient.csproj +++ b/src/csharp/InteropClient/InteropClient.csproj @@ -9,7 +9,7 @@ Exe InteropClient InteropClient - Google.GRPC.Interop.Client + Grpc.Interop.Client v4.5 @@ -33,14 +33,13 @@ x86 - - False - ..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + ..\packages\Google.ProtocolBuffers.2.4.1.521\lib\net40\Google.ProtocolBuffers.dll + diff --git a/src/csharp/MathClient/MathClient.cs b/src/csharp/MathClient/MathClient.cs index eb9b7b105b8..95a4678bb8f 100644 --- a/src/csharp/MathClient/MathClient.cs +++ b/src/csharp/MathClient/MathClient.cs @@ -33,8 +33,8 @@ using System; using System.Runtime.InteropServices; -using Google.GRPC.Core; using System.Threading; +using Grpc.Core; namespace math { From 50b91d001811df0c6cdda17137ce706d9bcb5458 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Wed, 18 Feb 2015 09:59:56 -0800 Subject: [PATCH 196/232] Removes unnecesary check from the interop teste --- src/ruby/bin/interop/interop_client.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ruby/bin/interop/interop_client.rb b/src/ruby/bin/interop/interop_client.rb index ef31f68f83b..50a14e3a961 100755 --- a/src/ruby/bin/interop/interop_client.rb +++ b/src/ruby/bin/interop/interop_client.rb @@ -211,10 +211,8 @@ class NamedTests def compute_engine_creds resp = perform_large_unary(fill_username: true, fill_oauth_scope: true) - assert(@args.oauth_scope.include?(resp.oauth_scope), - 'service_account_creds: incorrect oauth_scope') assert_equal(@args.default_service_account, resp.username, - 'service_account_creds: incorrect username') + 'compute_engine_creds: incorrect username') p 'OK: compute_engine_creds' end From df89cf83914667f39fb973e9e8fbb27caa57c4c9 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 19 Feb 2015 09:38:19 -0800 Subject: [PATCH 197/232] Updated Copyright information and assembly versions for C# --- src/csharp/GrpcApi/Properties/AssemblyInfo.cs | 4 ++-- src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs | 4 ++-- src/csharp/GrpcCore/Properties/AssemblyInfo.cs | 4 ++-- src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs | 4 ++-- src/csharp/InteropClient/Properties/AssemblyInfo.cs | 4 ++-- src/csharp/MathClient/Properties/AssemblyInfo.cs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/csharp/GrpcApi/Properties/AssemblyInfo.cs b/src/csharp/GrpcApi/Properties/AssemblyInfo.cs index e0a8e4357fc..96f142dae9a 100644 --- a/src/csharp/GrpcApi/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcApi/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] -[assembly: AssemblyCopyright ("jtattermusch")] +[assembly: AssemblyCopyright ("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("1.0.*")] +[assembly: AssemblyVersion ("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs b/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs index 5594e92e72b..ac3cfca52e1 100644 --- a/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcApiTests/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("jtattermusch")] +[assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/src/csharp/GrpcCore/Properties/AssemblyInfo.cs b/src/csharp/GrpcCore/Properties/AssemblyInfo.cs index 0907b868336..ed3a7af8f40 100644 --- a/src/csharp/GrpcCore/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcCore/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] -[assembly: AssemblyCopyright ("jtattermusch")] +[assembly: AssemblyCopyright ("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("1.0.*")] +[assembly: AssemblyVersion ("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs b/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs index a93d843889f..07f35556dfe 100644 --- a/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs +++ b/src/csharp/GrpcCoreTests/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("jtattermusch")] +[assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/src/csharp/InteropClient/Properties/AssemblyInfo.cs b/src/csharp/InteropClient/Properties/AssemblyInfo.cs index 00b4bd58955..3a13173ac77 100644 --- a/src/csharp/InteropClient/Properties/AssemblyInfo.cs +++ b/src/csharp/InteropClient/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("jtattermusch")] +[assembly: AssemblyCopyright("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] diff --git a/src/csharp/MathClient/Properties/AssemblyInfo.cs b/src/csharp/MathClient/Properties/AssemblyInfo.cs index aa614943acb..d24412f4978 100644 --- a/src/csharp/MathClient/Properties/AssemblyInfo.cs +++ b/src/csharp/MathClient/Properties/AssemblyInfo.cs @@ -8,13 +8,13 @@ using System.Runtime.CompilerServices; [assembly: AssemblyConfiguration ("")] [assembly: AssemblyCompany ("")] [assembly: AssemblyProduct ("")] -[assembly: AssemblyCopyright ("jtattermusch")] +[assembly: AssemblyCopyright ("Google Inc. All rights reserved.")] [assembly: AssemblyTrademark ("")] [assembly: AssemblyCulture ("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion ("1.0.*")] +[assembly: AssemblyVersion ("0.9.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] From c33efe4ad58a9d0fc2e60f19f59ba8c095020844 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 19 Feb 2015 09:39:49 -0800 Subject: [PATCH 198/232] Fixes the grpc.gemspec, clarifies the installation instructions --- src/ruby/README.md | 25 +++++++++++++------------ src/ruby/grpc.gemspec | 8 ++++---- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/ruby/README.md b/src/ruby/README.md index 7ece7e27065..d9e33f87fae 100755 --- a/src/ruby/README.md +++ b/src/ruby/README.md @@ -1,7 +1,7 @@ gRPC Ruby ========= -A Ruby implementation of gRPC, Google's RPC library. +A Ruby implementation of gRPC. INSTALLATION PREREQUISITES @@ -10,29 +10,30 @@ INSTALLATION PREREQUISITES This requires Ruby 2.x, as the rpc api surface uses keyword args. -INSTALLING ----------- +QUICK - INSTALL +--------------- -- Install the gRPC core library - TODO: describe this, once the core distribution mechanism is defined. +- Clone this repository. +- Follow the instructions in the [INSTALL](../../INSTALL) to install grpc C core library. +- Use bundler to install +```sh +$ # from this directory +$ gem install bundler && bundle install ``` -$ gem install grpc -``` - Installing from source ---------------------- - Build or Install the gRPC core E.g, from the root of the grpc [git repo](https://github.com/google/grpc) -``` +```sh $ cd ../.. $ make && sudo make install ``` - Install Ruby 2.x. Consider doing this with [RVM](http://rvm.io), it's a nice way of controlling the exact ruby version that's used. -``` +```sh $ command curl -sSL https://rvm.io/mpapis.asc | gpg --import - $ \curl -sSL https://get.rvm.io | bash -s stable --ruby $ @@ -46,7 +47,7 @@ $ gem install bundler ``` - Finally, install grpc ruby locally. -``` +```sh $ cd $ bundle install $ rake # compiles the extension, runs the unit tests, see rake -T for other options @@ -69,6 +70,6 @@ Directory structure is the layout for [ruby extensions](http://guides.rubygems.o stub = Math::Math::Stub.new('my.test.math.server.com:8080') req = Math::DivArgs.new(dividend: 7, divisor: 3) logger.info("div(7/3): req=#{req.inspect}") -resp = stub.div(req, INFINITE_FUTURE) +resp = stub.div(req) logger.info("Answer: #{resp.inspect}") ``` diff --git a/src/ruby/grpc.gemspec b/src/ruby/grpc.gemspec index c479cc96167..bc59c234e5a 100755 --- a/src/ruby/grpc.gemspec +++ b/src/ruby/grpc.gemspec @@ -5,12 +5,12 @@ require 'grpc/version' Gem::Specification.new do |s| s.name = 'grpc' - s.version = Google::RPC::VERSION + s.version = GRPC::VERSION s.authors = ['gRPC Authors'] - s.email = 'tbetbetbe@gmail.com' + s.email = 'temiola@google.com' s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby' - s.summary = 'Google RPC system in Ruby' - s.description = 'Send RPCs from Ruby using Google\'s RPC system' + s.summary = 'GRPC system in Ruby' + s.description = 'Send RPCs from Ruby using GRPC' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") From caf7b78703bdb15e4e98103416fa23f5b7d52677 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 19 Feb 2015 09:46:20 -0800 Subject: [PATCH 199/232] nit in README --- src/csharp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/README.md b/src/csharp/README.md index f56ddabda5a..fdc6f680416 100755 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -1,7 +1,7 @@ gRPC C# ======= -A C# implementation of gRPC, Google's RPC library. +A C# implementation of gRPC. EXPERIMENTAL ONLY ----------------- From 850290ff7cd2776de48522ec8e0914171d97d60d Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 19 Feb 2015 09:59:44 -0800 Subject: [PATCH 200/232] Fix a bug in Makefile where cpp_plugin name hadn't been updated yet where it was used. --- Makefile | 20 ++++++++++---------- templates/Makefile.template | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 68dd0048978..fc11670d7ab 100644 --- a/Makefile +++ b/Makefile @@ -1808,7 +1808,7 @@ else $(GENDIR)/examples/pubsub/empty.pb.cc: examples/pubsub/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1817,7 +1817,7 @@ else $(GENDIR)/examples/pubsub/label.pb.cc: examples/pubsub/label.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1826,7 +1826,7 @@ else $(GENDIR)/examples/pubsub/pubsub.pb.cc: examples/pubsub/pubsub.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1835,7 +1835,7 @@ else $(GENDIR)/test/cpp/interop/empty.pb.cc: test/cpp/interop/empty.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1844,7 +1844,7 @@ else $(GENDIR)/test/cpp/interop/messages.pb.cc: test/cpp/interop/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1853,7 +1853,7 @@ else $(GENDIR)/test/cpp/interop/test.pb.cc: test/cpp/interop/test.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1862,7 +1862,7 @@ else $(GENDIR)/test/cpp/qps/qpstest.pb.cc: test/cpp/qps/qpstest.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1871,7 +1871,7 @@ else $(GENDIR)/test/cpp/util/echo.pb.cc: test/cpp/util/echo.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1880,7 +1880,7 @@ else $(GENDIR)/test/cpp/util/echo_duplicate.pb.cc: test/cpp/util/echo_duplicate.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif ifeq ($(NO_PROTOC),true) @@ -1889,7 +1889,7 @@ else $(GENDIR)/test/cpp/util/messages.pb.cc: test/cpp/util/messages.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif diff --git a/templates/Makefile.template b/templates/Makefile.template index 79ec95dd138..b302623cd94 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -692,7 +692,7 @@ else $(GENDIR)/${p}.pb.cc: ${p}.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS) $(E) "[PROTOC] Generating protobuf CC file from $<" $(Q) mkdir -p `dirname $@` - $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/cpp_plugin $< + $(Q) $(PROTOC) --cpp_out=$(GENDIR) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $< endif % endfor From 0e24d5b70f954d9799af181aba42c01022309ebb Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 19 Feb 2015 10:04:04 -0800 Subject: [PATCH 201/232] Fixes case, other minor corrections --- src/ruby/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ruby/README.md b/src/ruby/README.md index d9e33f87fae..42f307aa5d5 100755 --- a/src/ruby/README.md +++ b/src/ruby/README.md @@ -7,14 +7,14 @@ A Ruby implementation of gRPC. INSTALLATION PREREQUISITES -------------------------- -This requires Ruby 2.x, as the rpc api surface uses keyword args. +This requires Ruby 2.x, as the RPC API surface uses keyword args. QUICK - INSTALL --------------- - Clone this repository. -- Follow the instructions in the [INSTALL](../../INSTALL) to install grpc C core library. +- Follow the instructions in [INSTALL](../../INSTALL) to install the gRPC C core. - Use bundler to install ```sh $ # from this directory @@ -24,8 +24,8 @@ $ gem install bundler && bundle install Installing from source ---------------------- -- Build or Install the gRPC core -E.g, from the root of the grpc [git repo](https://github.com/google/grpc) +- Build the gRPC C core +E.g, from the root of the gRPC [git repo](https://github.com/google/grpc) ```sh $ cd ../.. $ make && sudo make install @@ -46,7 +46,7 @@ $ # and that the rvm command is installed $ gem install bundler ``` -- Finally, install grpc ruby locally. +- Finally, install the gRPC gem locally. ```sh $ cd $ bundle install @@ -61,7 +61,7 @@ Directory structure is the layout for [ruby extensions](http://guides.rubygems.o - ext: the gRPC ruby extension - lib: - the entrypoint grpc ruby library to be used in a 'require' statement + the entrypoint gRPC ruby library to be used in a 'require' statement - spec: Rspec unittest - bin: From 512da888c46d14b53e909bde99aa23ef42a3ff33 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 10:54:48 -0800 Subject: [PATCH 202/232] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 2b049d206bd..d4140c54837 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,9 @@ of shared C core library [src/core] (src/core). Java source code is in [grpc-java] (http://github.com/grpc/grpc-java) repository. Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. +#Documentation + +You can find more detailed documentation of grpc in [grpc-common repository](http://github.com/grpc/grpc-common). #Overview From c284c545614160efc7ab010fbdc137656209a5b8 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:06:58 -0800 Subject: [PATCH 203/232] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index d4140c54837..42e1c5a5e00 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ of shared C core library [src/core] (src/core). * NodeJS source code: [src/node] (src/node) * PHP source code: [src/php] (src/php) * C# source code: [src/csharp] (src/csharp) + * Objective-C source code: [src/objective-c] (src/objective-c) Java source code is in [grpc-java] (http://github.com/grpc/grpc-java) repository. Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. @@ -26,6 +27,19 @@ Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. You can find more detailed documentation of grpc in [grpc-common repository](http://github.com/grpc/grpc-common). +#Current Status of libraries + +Libraries in different languages are in different state of development. We are seeking contributions for all of these libraries. + + * shared C core library [src/core] (src/core) : Early adopter ready - Alpha. + * C++ Library: [src/cpp] (src/cpp) : Early adopter ready - Alpha. + * Python Library: [src/python] (src/python) : Early adopter ready - Alpha. + * Ruby Library: [src/ruby] (src/ruby) : Early adopter ready - Alpha. + * NodeJS Library: [src/node] (src/node) : Early adopter ready - Alpha. + * PHP Library: [src/php] (src/php) : Pre-Alpha. + * C# Library: [src/csharp] (src/csharp) : Pre-Alpha. + * Objective-C Library: [src/objective-c] (src/objective-c): Pre-Alpha. + #Overview From 4040e656c011470e1ccb2fe595bfc8a22769203c Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:26:16 -0800 Subject: [PATCH 204/232] Create README.md --- src/core/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/core/README.md diff --git a/src/core/README.md b/src/core/README.md new file mode 100644 index 00000000000..407dc4f7019 --- /dev/null +++ b/src/core/README.md @@ -0,0 +1,9 @@ +#Overview + +This directory contains source code for shared C library. Libraries in other languages in this repository (C++, Ruby, +Python, PHP, NodeJS, Objective-C) are layered on top of this library. + +#Status + +Alpha : Ready for early adopters + From 80949e36d3a54129bdfe2460ad5604b4cdd892f3 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:27:07 -0800 Subject: [PATCH 205/232] Create README.md --- src/cpp/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/cpp/README.md diff --git a/src/cpp/README.md b/src/cpp/README.md new file mode 100644 index 00000000000..a2eb9a08c81 --- /dev/null +++ b/src/cpp/README.md @@ -0,0 +1,9 @@ + +#Overview + +This directory contains source code for C++ implementation of gRPC. + +#Status + +Alpha : Ready for early adopters + From 1b360d3ac7104bb19f322f7f244f6575b3189fb2 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:28:07 -0800 Subject: [PATCH 206/232] Update README.md --- src/csharp/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/csharp/README.md b/src/csharp/README.md index a16f1e719e1..c4e2f674ad6 100755 --- a/src/csharp/README.md +++ b/src/csharp/README.md @@ -3,7 +3,7 @@ gRPC C# A C# implementation of gRPC, Google's RPC library. -EXPERIMENTAL ONLY +Status ----------------- **This gRPC C# implementation is work-in-progress and is not expected to work yet.** From 06aef235e956f8d8d751afd21ee67c07a8c39832 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:28:57 -0800 Subject: [PATCH 207/232] Update README.md --- src/node/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node/README.md b/src/node/README.md index c342b7ca575..8880213e9a9 100644 --- a/src/node/README.md +++ b/src/node/README.md @@ -1,5 +1,9 @@ # Node.js gRPC Library +## Status + +Alpha : Ready for early adopters + ## Installation First, clone this repository (NPM package coming soon). Then follow the instructions in the `INSTALL` file in the root of the repository to install the C core library that this package depends on. From db80aff06f91f35359724ebd1759320b95484530 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 19 Feb 2015 11:29:12 -0800 Subject: [PATCH 208/232] Remove cpu.h which is no longer a thing --- build.json | 1 - 1 file changed, 1 deletion(-) diff --git a/build.json b/build.json index c7c640d2c21..1e11a4daade 100644 --- a/build.json +++ b/build.json @@ -239,7 +239,6 @@ "include/grpc/support/useful.h" ], "headers": [ - "src/core/support/cpu.h", "src/core/support/env.h", "src/core/support/file.h", "src/core/support/murmur_hash.h", From 300748ea7da1e2aa8166c34908a7799dcea0665e Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:30:40 -0800 Subject: [PATCH 209/232] Update README.md --- src/php/README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/php/README.md b/src/php/README.md index 620c68fd7b5..e47dafcc081 100755 --- a/src/php/README.md +++ b/src/php/README.md @@ -1,4 +1,12 @@ -# PHP wrapper for the GRPC interfaces. + +#Overview + +This directory contains source code for PHP implementation of gRPC layered on shared C library. + +#Status + +Pre-Alpha : Not ready for usage yet. + ## LAYOUT From 691dbcc7f96bebbbacbdfb27dd2e95fc0f0cc7d4 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:31:20 -0800 Subject: [PATCH 210/232] Update README.md --- src/php/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/README.md b/src/php/README.md index e47dafcc081..40c79e0dd40 100755 --- a/src/php/README.md +++ b/src/php/README.md @@ -5,7 +5,7 @@ This directory contains source code for PHP implementation of gRPC layered on sh #Status -Pre-Alpha : Not ready for usage yet. +Pre-Alpha : This gRPC PHP implementation is work-in-progress and is not expected to work yet. ## LAYOUT From fca87034a341820094188e2cfd532f0b4f15f361 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:34:43 -0800 Subject: [PATCH 211/232] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 42e1c5a5e00..268d4f4dbfb 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. #Documentation -You can find more detailed documentation of grpc in [grpc-common repository](http://github.com/grpc/grpc-common). +You can find more detailed documentation about grpc in [grpc-common repository](http://github.com/grpc/grpc-common). #Current Status of libraries From ad82155cd5e57fd604cfe717cc0dbf75af1d3317 Mon Sep 17 00:00:00 2001 From: Jayant Kolhe Date: Thu, 19 Feb 2015 11:44:49 -0800 Subject: [PATCH 212/232] Update README.md --- src/ruby/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ruby/README.md b/src/ruby/README.md index 7ece7e27065..9b157d1ce7f 100755 --- a/src/ruby/README.md +++ b/src/ruby/README.md @@ -3,6 +3,10 @@ gRPC Ruby A Ruby implementation of gRPC, Google's RPC library. +Status +------- + +Alpha : Ready for early adopters INSTALLATION PREREQUISITES -------------------------- From a143af389ee552f96163505ef56644a757de57c6 Mon Sep 17 00:00:00 2001 From: Mugur Marculescu Date: Thu, 19 Feb 2015 11:49:55 -0800 Subject: [PATCH 213/232] Small change to documentation text. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 268d4f4dbfb..19851767536 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Go source code is in [grpc-go] (http://github.com/grpc/grpc-go) repository. #Documentation -You can find more detailed documentation about grpc in [grpc-common repository](http://github.com/grpc/grpc-common). +You can find more detailed documentation and examples in the [grpc-common repository](http://github.com/grpc/grpc-common). #Current Status of libraries From 50556477d491da6c42d4f258f6e27ef2177ff568 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 19 Feb 2015 12:37:35 -0800 Subject: [PATCH 214/232] add missing header --- Makefile | 1 + build.json | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 68dd0048978..b581a56a4e3 100644 --- a/Makefile +++ b/Makefile @@ -3069,6 +3069,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/server_context.h \ include/grpc++/server_credentials.h \ include/grpc++/status.h \ + include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) diff --git a/build.json b/build.json index c7c640d2c21..413863fc883 100644 --- a/build.json +++ b/build.json @@ -416,6 +416,7 @@ "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", "include/grpc++/status.h", + "include/grpc++/status_code_enum.h", "include/grpc++/stream.h" ], "headers": [ From 1a986969d75eb19a42b4be4cdd4d085533f9b1da Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 19 Feb 2015 12:40:46 -0800 Subject: [PATCH 215/232] add more missing headers --- Makefile | 2 ++ build.json | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b581a56a4e3..08527e4c3a0 100644 --- a/Makefile +++ b/Makefile @@ -3064,6 +3064,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/impl/internal_stub.h \ include/grpc++/impl/rpc_method.h \ include/grpc++/impl/rpc_service_method.h \ + include/grpc++/impl/service_type.h \ include/grpc++/server.h \ include/grpc++/server_builder.h \ include/grpc++/server_context.h \ @@ -3071,6 +3072,7 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/status.h \ include/grpc++/status_code_enum.h \ include/grpc++/stream.h \ + include/grpc++/thread_pool_interface.h \ LIBGRPC++_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) diff --git a/build.json b/build.json index 413863fc883..d06bf7a2060 100644 --- a/build.json +++ b/build.json @@ -411,13 +411,15 @@ "include/grpc++/impl/internal_stub.h", "include/grpc++/impl/rpc_method.h", "include/grpc++/impl/rpc_service_method.h", + "include/grpc++/impl/service_type.h", "include/grpc++/server.h", "include/grpc++/server_builder.h", "include/grpc++/server_context.h", "include/grpc++/server_credentials.h", "include/grpc++/status.h", "include/grpc++/status_code_enum.h", - "include/grpc++/stream.h" + "include/grpc++/stream.h", + "include/grpc++/thread_pool_interface.h" ], "headers": [ "src/cpp/client/channel.h", From 9ea2e3aecd1845125f0a97a7cc53617f5df3d4ff Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Feb 2015 13:36:56 -0800 Subject: [PATCH 216/232] Added files to the node package --- src/node/package.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/node/package.json b/src/node/package.json index 821641ce19b..642d80e26f0 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -17,5 +17,15 @@ "minimist": "^1.1.0", "googleauth": "google/google-auth-library-nodejs" }, + "files": [ + "README.md", + "index.js", + "binding.gyp", + "examples", + "ext", + "interop", + "src", + "test" + ], "main": "index.js" } From f8a9b1c191c752a2e45bac6700d7192dad240e7c Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Feb 2015 13:46:30 -0800 Subject: [PATCH 217/232] Added lint script --- src/node/.jshintrc | 28 ++++++++++++++++++++++++++++ src/node/package.json | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/node/.jshintrc diff --git a/src/node/.jshintrc b/src/node/.jshintrc new file mode 100644 index 00000000000..1d930c34ca1 --- /dev/null +++ b/src/node/.jshintrc @@ -0,0 +1,28 @@ +{ + "bitwise": true, + "curly": true, + "eqeqeq": true, + "esnext": true, + "freeze": true, + "immed": true, + "indent": 2, + "latedef": "nofunc", + "maxlen": 100, + "newcap": true, + "node": true, + "noarg": true, + "quotmark": "single", + "strict": true, + "trailing": true, + "undef": true, + "unused": true, + "globals": { + /* Mocha-provided globals */ + "describe": false, + "it": false, + "before": false, + "beforeEach": false, + "after": false, + "afterEach": false + } +} \ No newline at end of file diff --git a/src/node/package.json b/src/node/package.json index 821641ce19b..1d4c3f6e6a2 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -3,10 +3,12 @@ "version": "0.2.0", "description": "gRPC Library for Node", "scripts": { + "lint": "jshint src test examples interop index.js", "test": "./node_modules/mocha/bin/mocha" }, "dependencies": { "bindings": "^1.2.1", + "jshint": "^2.5.5", "nan": "~1.3.0", "protobufjs": "murgatroid99/ProtoBuf.js", "underscore": "^1.7.0", From dca966d39ca15d125bcbc25853ce066410adfeb9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Feb 2015 14:37:18 -0800 Subject: [PATCH 218/232] Fixed lint errors --- src/node/.jshintrc | 6 ++--- src/node/examples/math_server.js | 5 ++--- src/node/examples/perf_test.js | 33 +++++++++++++++------------- src/node/examples/stock_server.js | 2 ++ src/node/index.js | 2 ++ src/node/interop/interop_client.js | 7 ++++-- src/node/interop/interop_server.js | 2 ++ src/node/package.json | 2 +- src/node/src/client.js | 23 +++++++++++-------- src/node/src/common.js | 2 ++ src/node/src/server.js | 12 +++++----- src/node/test/call_test.js | 2 ++ src/node/test/channel_test.js | 2 ++ src/node/test/constant_test.js | 2 ++ src/node/test/end_to_end_test.js | 4 +++- src/node/test/interop_sanity_test.js | 2 ++ src/node/test/math_client_test.js | 4 +++- src/node/test/surface_test.js | 4 ++-- 18 files changed, 74 insertions(+), 42 deletions(-) diff --git a/src/node/.jshintrc b/src/node/.jshintrc index 1d930c34ca1..8237e0d2b64 100644 --- a/src/node/.jshintrc +++ b/src/node/.jshintrc @@ -7,7 +7,7 @@ "immed": true, "indent": 2, "latedef": "nofunc", - "maxlen": 100, + "maxlen": 80, "newcap": true, "node": true, "noarg": true, @@ -15,7 +15,7 @@ "strict": true, "trailing": true, "undef": true, - "unused": true, + "unused": "vars", "globals": { /* Mocha-provided globals */ "describe": false, @@ -25,4 +25,4 @@ "after": false, "afterEach": false } -} \ No newline at end of file +} diff --git a/src/node/examples/math_server.js b/src/node/examples/math_server.js index 89bc0de3ba0..ae548c89e40 100644 --- a/src/node/examples/math_server.js +++ b/src/node/examples/math_server.js @@ -31,9 +31,8 @@ * */ -var _ = require('underscore'); -var ProtoBuf = require('protobufjs'); -var fs = require('fs'); +'use strict'; + var util = require('util'); var Transform = require('stream').Transform; diff --git a/src/node/examples/perf_test.js b/src/node/examples/perf_test.js index c5e28727369..31083e09872 100644 --- a/src/node/examples/perf_test.js +++ b/src/node/examples/perf_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var grpc = require('..'); var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing; var _ = require('underscore'); @@ -44,7 +46,6 @@ function runTest(iterations, callback) { function runIterations(finish) { var start = process.hrtime(); var intervals = []; - var pending = iterations; function next(i) { if (i >= iterations) { testServer.server.shutdown(); @@ -69,28 +70,30 @@ function runTest(iterations, callback) { function warmUp(num) { var pending = num; + function startCall() { + client.emptyCall({}, function(err, resp) { + pending--; + if (pending === 0) { + runIterations(callback); + } + }); + } for (var i = 0; i < num; i++) { - (function(i) { - client.emptyCall({}, function(err, resp) { - pending--; - if (pending === 0) { - runIterations(callback); - } - }); - })(i); + startCall(); } } warmUp(100); } -function percentile(arr, percentile) { - if (percentile > 99) { - percentile = 99; +function percentile(arr, pct) { + if (pct > 99) { + pct = 99; } - if (percentile < 0) { - percentile = 0; + if (pct < 0) { + pct = 0; } - return arr[(arr.length * percentile / 100)|0]; + var index = Math.floor(arr.length * pct / 100); + return arr[index]; } if (require.main === module) { diff --git a/src/node/examples/stock_server.js b/src/node/examples/stock_server.js index b226a715732..e475c9cb4cc 100644 --- a/src/node/examples/stock_server.js +++ b/src/node/examples/stock_server.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var _ = require('underscore'); var grpc = require('..'); var examples = grpc.load(__dirname + '/stock.proto').examples; diff --git a/src/node/index.js b/src/node/index.js index 1bef2072dde..4b5302e4382 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var _ = require('underscore'); var ProtoBuf = require('protobufjs'); diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index fc2fdf4dc9d..eaf254bcfef 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var fs = require('fs'); var path = require('path'); var grpc = require('..'); @@ -41,7 +43,8 @@ var assert = require('assert'); var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo'; var AUTH_SCOPE_RESPONSE = 'xapi.zoo'; -var AUTH_USER = '155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk@developer.gserviceaccount.com'; +var AUTH_USER = ('155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk' + + '@developer.gserviceaccount.com'); /** * Create a buffer filled with size zeroes @@ -318,7 +321,7 @@ var test_cases = { /** * Execute a single test case. * @param {string} address The address of the server to connect to, in the - * format "hostname:port" + * format 'hostname:port' * @param {string} host_overrirde The hostname of the server to use as an SSL * override * @param {string} test_case The name of the test case to run diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js index c97d2344550..125ede17464 100644 --- a/src/node/interop/interop_server.js +++ b/src/node/interop/interop_server.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var fs = require('fs'); var path = require('path'); var _ = require('underscore'); diff --git a/src/node/package.json b/src/node/package.json index 1d4c3f6e6a2..7aa0083e699 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -4,7 +4,7 @@ "description": "gRPC Library for Node", "scripts": { "lint": "jshint src test examples interop index.js", - "test": "./node_modules/mocha/bin/mocha" + "test": "./node_modules/mocha/bin/mocha && npm run-script lint" }, "dependencies": { "bindings": "^1.2.1", diff --git a/src/node/src/client.js b/src/node/src/client.js index 19c3144c7d9..aaa7be79c9d 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var _ = require('underscore'); var capitalize = require('underscore.string/capitalize'); @@ -77,6 +79,7 @@ function ClientWritableStream(call, serialize) { * @param {function(Error=)} callback Called when the write is complete */ function _write(chunk, encoding, callback) { + /* jshint validthis: true */ var batch = {}; batch[grpc.opType.SEND_MESSAGE] = this.serialize(chunk); this.call.startBatch(batch, function(err, event) { @@ -85,7 +88,7 @@ function _write(chunk, encoding, callback) { } callback(); }); -}; +} ClientWritableStream.prototype._write = _write; @@ -111,6 +114,7 @@ function ClientReadableStream(call, deserialize) { * @param {*} size Ignored because we use objectMode=true */ function _read(size) { + /* jshint validthis: true */ var self = this; /** * Callback to be called when a READ event is received. Pushes the data onto @@ -126,7 +130,7 @@ function _read(size) { return; } var data = event.read; - if (self.push(self.deserialize(data)) && data != null) { + if (self.push(self.deserialize(data)) && data !== null) { var read_batch = {}; read_batch[grpc.opType.RECV_MESSAGE] = true; self.call.startBatch(read_batch, readCallback); @@ -144,7 +148,7 @@ function _read(size) { self.call.startBatch(read_batch, readCallback); } } -}; +} ClientReadableStream.prototype._read = _read; @@ -163,10 +167,6 @@ function ClientDuplexStream(call, serialize, deserialize) { Duplex.call(this, {objectMode: true}); this.serialize = common.wrapIgnoreNull(serialize); this.deserialize = common.wrapIgnoreNull(deserialize); - var self = this; - var finished = false; - // Indicates that a read is currently pending - var reading = false; this.call = call; this.on('finish', function() { var batch = {}; @@ -182,6 +182,7 @@ ClientDuplexStream.prototype._write = _write; * Cancel the ongoing call */ function cancel() { + /* jshint validthis: true */ this.call.cancel(); } @@ -213,6 +214,7 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { * @return {EventEmitter} An event emitter for stream related events */ function makeUnaryRequest(argument, callback, metadata, deadline) { + /* jshint validthis: true */ if (deadline === undefined) { deadline = Infinity; } @@ -242,7 +244,7 @@ function makeUnaryRequestFunction(method, serialize, deserialize) { callback(err); return; } - if (response.status.code != grpc.status.OK) { + if (response.status.code !== grpc.status.OK) { callback(response.status); return; } @@ -278,6 +280,7 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) { * @return {EventEmitter} An event emitter for stream related events */ function makeClientStreamRequest(callback, metadata, deadline) { + /* jshint validthis: true */ if (deadline === undefined) { deadline = Infinity; } @@ -310,7 +313,7 @@ function makeClientStreamRequestFunction(method, serialize, deserialize) { callback(err); return; } - if (response.status.code != grpc.status.OK) { + if (response.status.code !== grpc.status.OK) { callback(response.status); return; } @@ -345,6 +348,7 @@ function makeServerStreamRequestFunction(method, serialize, deserialize) { * @return {EventEmitter} An event emitter for stream related events */ function makeServerStreamRequest(argument, metadata, deadline) { + /* jshint validthis: true */ if (deadline === undefined) { deadline = Infinity; } @@ -404,6 +408,7 @@ function makeBidiStreamRequestFunction(method, serialize, deserialize) { * @return {EventEmitter} An event emitter for stream related events */ function makeBidiStreamRequest(metadata, deadline) { + /* jshint validthis: true */ if (deadline === undefined) { deadline = Infinity; } diff --git a/src/node/src/common.js b/src/node/src/common.js index 848c96742d9..eec8f0f9878 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var _ = require('underscore'); var capitalize = require('underscore.string/capitalize'); diff --git a/src/node/src/server.js b/src/node/src/server.js index 48c349ef99d..91dde022518 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var _ = require('underscore'); var capitalize = require('underscore.string/capitalize'); @@ -217,6 +219,7 @@ function ServerWritableStream(call, serialize) { * complete */ function _write(chunk, encoding, callback) { + /* jshint validthis: true */ var batch = {}; batch[grpc.opType.SEND_MESSAGE] = this.serialize(chunk); this.call.startBatch(batch, function(err, value) { @@ -251,6 +254,7 @@ function ServerReadableStream(call, deserialize) { * @param {number} size Ignored */ function _read(size) { + /* jshint validthis: true */ var self = this; /** * Callback to be called when a READ event is received. Pushes the data onto @@ -267,7 +271,7 @@ function _read(size) { return; } var data = event.read; - if (self.push(self.deserialize(data)) && data != null) { + if (self.push(self.deserialize(data)) && data !== null) { var read_batch = {}; read_batch[grpc.opType.RECV_MESSAGE] = true; self.call.startBatch(read_batch, readCallback); @@ -424,7 +428,6 @@ function Server(getMetadata, options) { var handlers = this.handlers; var server = new grpc.Server(options); this._server = server; - var started = false; /** * Start the server and begin handling requests * @this Server @@ -456,8 +459,7 @@ function Server(getMetadata, options) { return; } server.requestCall(handleNewCall); - var handler = undefined; - var deadline = details.deadline; + var handler; if (handlers.hasOwnProperty(method)) { handler = handlers[method]; } else { @@ -465,7 +467,7 @@ function Server(getMetadata, options) { batch[grpc.opType.SEND_INITIAL_METADATA] = {}; batch[grpc.opType.SEND_STATUS_FROM_SERVER] = { code: grpc.status.UNIMPLEMENTED, - details: "This method is not available on this server.", + details: 'This method is not available on this server.', metadata: {} }; batch[grpc.opType.RECV_CLOSE_ON_SERVER] = true; diff --git a/src/node/test/call_test.js b/src/node/test/call_test.js index c1a7e95fa09..7b2b36ae371 100644 --- a/src/node/test/call_test.js +++ b/src/node/test/call_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var assert = require('assert'); var grpc = require('bindings')('grpc.node'); diff --git a/src/node/test/channel_test.js b/src/node/test/channel_test.js index 449a8cc4c36..33200c99ee2 100644 --- a/src/node/test/channel_test.js +++ b/src/node/test/channel_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var assert = require('assert'); var grpc = require('bindings')('grpc.node'); diff --git a/src/node/test/constant_test.js b/src/node/test/constant_test.js index 4a403868c7c..ecc98ec4438 100644 --- a/src/node/test/constant_test.js +++ b/src/node/test/constant_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var assert = require('assert'); var grpc = require('bindings')('grpc.node'); diff --git a/src/node/test/end_to_end_test.js b/src/node/test/end_to_end_test.js index 8e99d6f1628..1cc19286917 100644 --- a/src/node/test/end_to_end_test.js +++ b/src/node/test/end_to_end_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var assert = require('assert'); var grpc = require('bindings')('grpc.node'); @@ -227,7 +229,7 @@ describe('end-to-end', function() { response_batch[grpc.opType.RECV_CLOSE_ON_SERVER] = true; server_call.startBatch(response_batch, function(err, response) { assert(response['send status']); - assert(!response['cancelled']); + assert(!response.cancelled); done(); }); }); diff --git a/src/node/test/interop_sanity_test.js b/src/node/test/interop_sanity_test.js index d1bdd1660f0..8dc933eac56 100644 --- a/src/node/test/interop_sanity_test.js +++ b/src/node/test/interop_sanity_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var interop_server = require('../interop/interop_server.js'); var interop_client = require('../interop/interop_client.js'); diff --git a/src/node/test/math_client_test.js b/src/node/test/math_client_test.js index fd946e0325d..d83f64116f7 100644 --- a/src/node/test/math_client_test.js +++ b/src/node/test/math_client_test.js @@ -31,6 +31,8 @@ * */ +'use strict'; + var assert = require('assert'); var grpc = require('..'); @@ -59,7 +61,7 @@ describe('Math client', function() { }); it('should handle a single request', function(done) { var arg = {dividend: 7, divisor: 4}; - var call = math_client.div(arg, function handleDivResult(err, value) { + math_client.div(arg, function handleDivResult(err, value) { assert.ifError(err); assert.equal(value.quotient, 1); assert.equal(value.remainder, 3); diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index d6694724e54..91d8197bee1 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -31,9 +31,9 @@ * */ -var assert = require('assert'); +'use strict'; -var surface_server = require('../src/server.js'); +var assert = require('assert'); var surface_client = require('../src/client.js'); From 788b766dba30bc33c6bcee596c8804ee003de337 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 19 Feb 2015 15:09:05 -0800 Subject: [PATCH 219/232] Fix internal include path --- src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m index 7c64850d7e8..4cf52673e26 100644 --- a/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m +++ b/src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m @@ -1,6 +1,6 @@ #import "GRPCDelegateWrapper.h" -#import +#import @interface GRPCDelegateWrapper () // These are atomic so that cancellation can nillify them from any thread. From f8e297a3c0e2a8ad9babf02fad06f293b92fc0d0 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Thu, 19 Feb 2015 15:39:32 -0800 Subject: [PATCH 220/232] Added protoc plugin for Python GRPC. --- Makefile | 102 ++++-- build.json | 36 +- src/compiler/python_generator.cc | 332 +++++++++++++++++++ src/compiler/python_generator.h | 51 +++ src/compiler/python_plugin.cc | 87 +++++ vsprojects/vs2013/gpr.vcxproj | 1 - vsprojects/vs2013/gpr.vcxproj.filters | 3 - vsprojects/vs2013/gpr_shared.vcxproj | 1 - vsprojects/vs2013/gpr_shared.vcxproj.filters | 3 - 9 files changed, 563 insertions(+), 53 deletions(-) create mode 100644 src/compiler/python_generator.cc create mode 100644 src/compiler/python_generator.h create mode 100644 src/compiler/python_plugin.cc diff --git a/Makefile b/Makefile index 91c94c8071e..e1dedb59129 100644 --- a/Makefile +++ b/Makefile @@ -332,7 +332,7 @@ endif .SECONDARY = %.pb.h %.pb.cc -PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin +PROTOC_PLUGINS = $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(BINDIR)/$(CONFIG)/grpc_python_plugin ifeq ($(DEP_MISSING),) all: static shared plugins dep_error: @@ -499,6 +499,8 @@ transport_metadata_test: $(BINDIR)/$(CONFIG)/transport_metadata_test async_end2end_test: $(BINDIR)/$(CONFIG)/async_end2end_test channel_arguments_test: $(BINDIR)/$(CONFIG)/channel_arguments_test grpc_cpp_plugin: $(BINDIR)/$(CONFIG)/grpc_cpp_plugin +grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin +grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin credentials_test: $(BINDIR)/$(CONFIG)/credentials_test end2end_test: $(BINDIR)/$(CONFIG)/end2end_test interop_client: $(BINDIR)/$(CONFIG)/interop_client @@ -508,7 +510,6 @@ pubsub_publisher_test: $(BINDIR)/$(CONFIG)/pubsub_publisher_test pubsub_subscriber_test: $(BINDIR)/$(CONFIG)/pubsub_subscriber_test qps_client: $(BINDIR)/$(CONFIG)/qps_client qps_server: $(BINDIR)/$(CONFIG)/qps_server -grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin status_test: $(BINDIR)/$(CONFIG)/status_test thread_pool_test: $(BINDIR)/$(CONFIG)/thread_pool_test chttp2_fake_security_cancel_after_accept_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test @@ -2047,6 +2048,7 @@ else $(E) "[INSTALL] Installing grpc protoc plugins" $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_cpp_plugin $(prefix)/bin/grpc_cpp_plugin $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_ruby_plugin $(prefix)/bin/grpc_ruby_plugin + $(Q) $(INSTALL) $(BINDIR)/$(CONFIG)/grpc_python_plugin $(prefix)/bin/grpc_python_plugin endif clean: @@ -7413,6 +7415,70 @@ ifneq ($(NO_DEPS),true) endif +GRPC_RUBY_PLUGIN_SRC = \ + src/compiler/ruby_generator.cc \ + src/compiler/ruby_plugin.cc \ + +GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC)))) + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) + $(E) "[HOSTLD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin + +endif + +$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: +$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: + +deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) + +ifneq ($(NO_DEPS),true) +-include $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) +endif + + +GRPC_PYTHON_PLUGIN_SRC = \ + src/compiler/python_generator.cc \ + src/compiler/python_plugin.cc \ + +GRPC_PYTHON_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_PYTHON_PLUGIN_SRC)))) + + +ifeq ($(NO_PROTOBUF),true) + +# You can't build the protoc plugins if you don't have protobuf 3.0.0+. + +$(BINDIR)/$(CONFIG)/grpc_python_plugin: protobuf_dep_error + +else + +$(BINDIR)/$(CONFIG)/grpc_python_plugin: $(PROTOBUF_DEP) $(GRPC_PYTHON_PLUGIN_OBJS) + $(E) "[HOSTLD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_PYTHON_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_python_plugin + +endif + +$(OBJDIR)/$(CONFIG)/src/compiler/python_generator.o: +$(OBJDIR)/$(CONFIG)/src/compiler/python_plugin.o: + +deps_grpc_python_plugin: $(GRPC_PYTHON_PLUGIN_OBJS:.o=.dep) + +ifneq ($(NO_DEPS),true) +-include $(GRPC_PYTHON_PLUGIN_OBJS:.o=.dep) +endif + + CREDENTIALS_TEST_SRC = \ test/cpp/client/credentials_test.cc \ @@ -7708,38 +7774,6 @@ endif endif -GRPC_RUBY_PLUGIN_SRC = \ - src/compiler/ruby_generator.cc \ - src/compiler/ruby_plugin.cc \ - -GRPC_RUBY_PLUGIN_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPC_RUBY_PLUGIN_SRC)))) - - -ifeq ($(NO_PROTOBUF),true) - -# You can't build the protoc plugins if you don't have protobuf 3.0.0+. - -$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: protobuf_dep_error - -else - -$(BINDIR)/$(CONFIG)/grpc_ruby_plugin: $(PROTOBUF_DEP) $(GRPC_RUBY_PLUGIN_OBJS) - $(E) "[HOSTLD] Linking $@" - $(Q) mkdir -p `dirname $@` - $(Q) $(HOST_LDXX) $(HOST_LDFLAGS) $(GRPC_RUBY_PLUGIN_OBJS) $(HOST_LDLIBSXX) $(HOST_LDLIBS_PROTOC) $(HOST_LDLIBS) $(HOST_LDLIBS_PROTOC) -o $(BINDIR)/$(CONFIG)/grpc_ruby_plugin - -endif - -$(OBJDIR)/$(CONFIG)/src/compiler/ruby_generator.o: -$(OBJDIR)/$(CONFIG)/src/compiler/ruby_plugin.o: - -deps_grpc_ruby_plugin: $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) - -ifneq ($(NO_DEPS),true) --include $(GRPC_RUBY_PLUGIN_OBJS:.o=.dep) -endif - - STATUS_TEST_SRC = \ test/cpp/util/status_test.cc \ diff --git a/build.json b/build.json index 0f9e827422c..8fdca5a2550 100644 --- a/build.json +++ b/build.json @@ -1591,6 +1591,31 @@ "deps": [], "secure": false }, + { + "name": "grpc_ruby_plugin", + "build": "protoc", + "language": "c++", + "src": [ + "src/compiler/ruby_generator.cc", + "src/compiler/ruby_plugin.cc" + ], + "deps": [], + "secure": false + }, + { + "name": "grpc_python_plugin", + "build": "protoc", + "language": "c++", + "headers": [ + "src/compiler/python_generator.h" + ], + "src": [ + "src/compiler/python_generator.cc", + "src/compiler/python_plugin.cc" + ], + "deps": [], + "secure": false + }, { "name": "credentials_test", "build": "test", @@ -1748,17 +1773,6 @@ "gpr" ] }, - { - "name": "grpc_ruby_plugin", - "build": "protoc", - "language": "c++", - "src": [ - "src/compiler/ruby_generator.cc", - "src/compiler/ruby_plugin.cc" - ], - "deps": [], - "secure": false - }, { "name": "status_test", "build": "test", diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc new file mode 100644 index 00000000000..48d90624d62 --- /dev/null +++ b/src/compiler/python_generator.cc @@ -0,0 +1,332 @@ +/* + * + * 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 "src/compiler/python_generator.h" +#include +#include +#include +#include + +using google::protobuf::FileDescriptor; +using google::protobuf::ServiceDescriptor; +using google::protobuf::MethodDescriptor; +using google::protobuf::io::Printer; +using google::protobuf::io::StringOutputStream; +using std::initializer_list; +using std::map; +using std::string; + +namespace grpc_python_generator { +namespace { +////////////////////////////////// +// BEGIN FORMATTING BOILERPLATE // +////////////////////////////////// + +// Converts an initializer list of the form { key0, value0, key1, value1, ... } +// into a map of key* to value*. Is merely a readability helper for later code. +map ListToDict(const initializer_list& values) { + assert(values.size() % 2 == 0); + map value_map; + auto value_iter = values.begin(); + for (unsigned i = 0; i < values.size()/2; ++i) { + string key = *value_iter; + ++value_iter; + string value = *value_iter; + value_map[key] = value; + ++value_iter; + } + return value_map; +} + +// Provides RAII indentation handling. Use as: +// { +// IndentScope raii_my_indent_var_name_here(my_py_printer); +// // constructor indented my_py_printer +// ... +// // destructor called at end of scope, un-indenting my_py_printer +// } +class IndentScope { + public: + explicit IndentScope(Printer* printer) : printer_(printer) { + printer_->Indent(); + } + + ~IndentScope() { + printer_->Outdent(); + } + + private: + Printer* printer_; +}; + +//////////////////////////////// +// END FORMATTING BOILERPLATE // +//////////////////////////////// + +void PrintService(const ServiceDescriptor* service, + Printer* out) { + string doc = ""; + map dict = ListToDict({ + "Service", service->name(), + "Documentation", doc, + }); + out->Print(dict, "class $Service$Service(object):\n"); + { + IndentScope raii_class_indent(out); + out->Print(dict, "\"\"\"$Documentation$\"\"\"\n"); + out->Print("def __init__(self):\n"); + { + IndentScope raii_method_indent(out); + out->Print("pass\n"); + } + } +} + +void PrintServicer(const ServiceDescriptor* service, + Printer* out) { + string doc = ""; + map dict = ListToDict({ + "Service", service->name(), + "Documentation", doc, + }); + out->Print(dict, "class $Service$Servicer(object):\n"); + { + IndentScope raii_class_indent(out); + out->Print(dict, "\"\"\"$Documentation$\"\"\"\n"); + for (int i = 0; i < service->method_count(); ++i) { + auto meth = service->method(i); + out->Print("def $Method$(self, arg):\n", "Method", meth->name()); + { + IndentScope raii_method_indent(out); + out->Print("raise NotImplementedError()\n"); + } + } + } +} + +void PrintStub(const ServiceDescriptor* service, + Printer* out) { + string doc = ""; + map dict = ListToDict({ + "Service", service->name(), + "Documentation", doc, + }); + out->Print(dict, "class $Service$Stub(object):\n"); + { + IndentScope raii_class_indent(out); + out->Print(dict, "\"\"\"$Documentation$\"\"\"\n"); + for (int i = 0; i < service->method_count(); ++i) { + const MethodDescriptor* meth = service->method(i); + auto methdict = ListToDict({"Method", meth->name()}); + out->Print(methdict, "def $Method$(self, arg):\n"); + { + IndentScope raii_method_indent(out); + out->Print("raise NotImplementedError()\n"); + } + out->Print(methdict, "$Method$.async = None\n"); + } + } +} + +void PrintStubImpl(const ServiceDescriptor* service, + Printer* out) { + map dict = ListToDict({ + "Service", service->name(), + }); + out->Print(dict, "class _$Service$Stub($Service$Stub):\n"); + { + IndentScope raii_class_indent(out); + out->Print("def __init__(self, face_stub, default_timeout):\n"); + { + IndentScope raii_method_indent(out); + out->Print("self._face_stub = face_stub\n" + "self._default_timeout = default_timeout\n" + "stub_self = self\n"); + + for (int i = 0; i < service->method_count(); ++i) { + const MethodDescriptor* meth = service->method(i); + bool server_streaming = meth->server_streaming(); + bool client_streaming = meth->client_streaming(); + std::string blocking_call, future_call; + if (server_streaming) { + if (client_streaming) { + blocking_call = "stub_self._face_stub.inline_stream_in_stream_out"; + future_call = blocking_call; + } else { + blocking_call = "stub_self._face_stub.inline_value_in_stream_out"; + future_call = blocking_call; + } + } else { + if (client_streaming) { + blocking_call = "stub_self._face_stub.blocking_stream_in_value_out"; + future_call = "stub_self._face_stub.future_stream_in_value_out"; + } else { + blocking_call = "stub_self._face_stub.blocking_value_in_value_out"; + future_call = "stub_self._face_stub.future_value_in_value_out"; + } + } + // TODO(atash): use the solution described at + // http://stackoverflow.com/a/2982 to bind 'async' attribute + // functions to def'd functions instead of using callable attributes. + auto methdict = ListToDict({ + "Method", meth->name(), + "BlockingCall", blocking_call, + "FutureCall", future_call + }); + out->Print(methdict, "class $Method$(object):\n"); + { + IndentScope raii_callable_indent(out); + out->Print("def __call__(self, arg):\n"); + { + IndentScope raii_callable_call_indent(out); + out->Print(methdict, + "return $BlockingCall$(\"$Method$\", arg, " + "stub_self._default_timeout)\n"); + } + out->Print("def async(self, arg):\n"); + { + IndentScope raii_callable_async_indent(out); + out->Print(methdict, + "return $FutureCall$(\"$Method$\", arg, " + "stub_self._default_timeout)\n"); + } + } + out->Print(methdict, "self.$Method$ = $Method$()\n"); + } + } + } +} + +void PrintStubGenerators(const ServiceDescriptor* service, Printer* out) { + map dict = ListToDict({ + "Service", service->name(), + }); + // Write out a generator of linked pairs of Server/Stub + out->Print(dict, "def mock_$Service$(servicer, default_timeout):\n"); + { + IndentScope raii_mock_indent(out); + out->Print("value_in_value_out = {}\n" + "value_in_stream_out = {}\n" + "stream_in_value_out = {}\n" + "stream_in_stream_out = {}\n"); + for (int i = 0; i < service->method_count(); ++i) { + const MethodDescriptor* meth = service->method(i); + std::string super_interface, meth_dict; + bool server_streaming = meth->server_streaming(); + bool client_streaming = meth->client_streaming(); + if (server_streaming) { + if (client_streaming) { + super_interface = "InlineStreamInStreamOutMethod"; + meth_dict = "stream_in_stream_out"; + } else { + super_interface = "InlineValueInStreamOutMethod"; + meth_dict = "value_in_stream_out"; + } + } else { + if (client_streaming) { + super_interface = "InlineStreamInValueOutMethod"; + meth_dict = "stream_in_value_out"; + } else { + super_interface = "InlineValueInValueOutMethod"; + meth_dict = "value_in_value_out"; + } + } + map methdict = ListToDict({ + "Method", meth->name(), + "SuperInterface", super_interface, + "MethodDict", meth_dict + }); + out->Print( + methdict, "class $Method$(_face_interfaces.$SuperInterface$):\n"); + { + IndentScope raii_inline_class_indent(out); + out->Print("def service(self, request, context):\n"); + { + IndentScope raii_inline_class_fn_indent(out); + out->Print(methdict, "return servicer.$Method$(request)\n"); + } + } + out->Print(methdict, "$MethodDict$['$Method$'] = $Method$()\n"); + } + out->Print( + "face_linked_pair = _face_testing.server_and_stub(default_timeout," + "inline_value_in_value_out_methods=value_in_value_out," + "inline_value_in_stream_out_methods=value_in_stream_out," + "inline_stream_in_value_out_methods=stream_in_value_out," + "inline_stream_in_stream_out_methods=stream_in_stream_out)\n"); + out->Print("class LinkedPair(object):\n"); + { + IndentScope raii_linked_pair(out); + out->Print("def __init__(self, server, stub):\n"); + { + IndentScope raii_linked_pair_init(out); + out->Print("self.server = server\n" + "self.stub = stub\n"); + } + } + out->Print( + dict, + "stub = _$Service$Stub(face_linked_pair.stub, default_timeout)\n"); + out->Print("return LinkedPair(None, stub)\n"); + } +} + +} // namespace + +string GetServices(const FileDescriptor* file) { + string output; + StringOutputStream output_stream(&output); + Printer out(&output_stream, '$'); + out.Print("import abc\n"); + out.Print("import google3\n"); + out.Print("from grpc.framework.face import demonstration as _face_testing\n"); + out.Print("from grpc.framework.face import interfaces as _face_interfaces\n"); + + for (int i = 0; i < file->service_count(); ++i) { + auto service = file->service(i); + PrintService(service, &out); + PrintServicer(service, &out); + PrintStub(service, &out); + PrintStubImpl(service, &out); + PrintStubGenerators(service, &out); + } + return output; +} + +} // namespace grpc_python_generator diff --git a/src/compiler/python_generator.h b/src/compiler/python_generator.h new file mode 100644 index 00000000000..673ef7b23b3 --- /dev/null +++ b/src/compiler/python_generator.h @@ -0,0 +1,51 @@ +/* + * + * 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. + * + */ + +#ifndef __GRPC_COMPILER_PYTHON_GENERATOR_H__ +#define __GRPC_COMPILER_PYTHON_GENERATOR_H__ + +#include + +namespace google { +namespace protobuf { +class FileDescriptor; +} // namespace protobuf +} // namespace google + +namespace grpc_python_generator { + +std::string GetServices(const google::protobuf::FileDescriptor* file); + +} // namespace grpc_python_generator + +#endif // __GRPC_COMPILER_PYTHON_GENERATOR_H__ diff --git a/src/compiler/python_plugin.cc b/src/compiler/python_plugin.cc new file mode 100644 index 00000000000..ebe3660619b --- /dev/null +++ b/src/compiler/python_plugin.cc @@ -0,0 +1,87 @@ +/* + * + * 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. + * + */ + +// Generates a Python gRPC service interface out of Protobuf IDL. + +#include +#include + +#include "src/compiler/python_generator.h" +#include +#include +#include +#include +#include + +using google::protobuf::FileDescriptor; +using google::protobuf::compiler::CodeGenerator; +using google::protobuf::compiler::GeneratorContext; +using google::protobuf::compiler::PluginMain; +using google::protobuf::io::CodedOutputStream; +using google::protobuf::io::ZeroCopyOutputStream; +using std::string; + +class PythonGrpcGenerator : public CodeGenerator { + public: + PythonGrpcGenerator() {} + ~PythonGrpcGenerator() override {} + + bool Generate(const FileDescriptor* file, + const string& parameter, + GeneratorContext* context, + string* error) const override { + // Get output file name. + string file_name; + static const int proto_suffix_length = 6; // length of ".proto" + if (file->name().size() > proto_suffix_length && + file->name().find_last_of(".proto") == file->name().size() - 1) { + file_name = file->name().substr( + 0, file->name().size() - proto_suffix_length) + "_pb2.py"; + } else { + *error = "Invalid proto file name. Proto file must end with .proto"; + return false; + } + + std::unique_ptr output( + context->OpenForInsert(file_name, "module_scope")); + CodedOutputStream coded_out(output.get()); + string code = grpc_python_generator::GetServices(file); + coded_out.WriteRaw(code.data(), code.size()); + return true; + } +}; + +int main(int argc, char* argv[]) { + PythonGrpcGenerator generator; + return PluginMain(argc, argv, &generator); +} diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index f6516b89537..3d970079a42 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -101,7 +101,6 @@ - diff --git a/vsprojects/vs2013/gpr.vcxproj.filters b/vsprojects/vs2013/gpr.vcxproj.filters index 1e908a5ba51..9b78c3a390a 100644 --- a/vsprojects/vs2013/gpr.vcxproj.filters +++ b/vsprojects/vs2013/gpr.vcxproj.filters @@ -167,9 +167,6 @@ - - src\core\support - src\core\support diff --git a/vsprojects/vs2013/gpr_shared.vcxproj b/vsprojects/vs2013/gpr_shared.vcxproj index b9131e381c1..892490e3248 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj +++ b/vsprojects/vs2013/gpr_shared.vcxproj @@ -101,7 +101,6 @@ - diff --git a/vsprojects/vs2013/gpr_shared.vcxproj.filters b/vsprojects/vs2013/gpr_shared.vcxproj.filters index 1e908a5ba51..9b78c3a390a 100644 --- a/vsprojects/vs2013/gpr_shared.vcxproj.filters +++ b/vsprojects/vs2013/gpr_shared.vcxproj.filters @@ -167,9 +167,6 @@ - - src\core\support - src\core\support From cc2b42aa96e33dfd5fdc10400858f898246dd94f Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 20 Feb 2015 00:42:21 +0100 Subject: [PATCH 221/232] Running ldconfig shouldn't fail; so we can run fakeroot make install properly. --- Makefile | 8 ++++---- templates/Makefile.template | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 91c94c8071e..90cd4ffa64f 100644 --- a/Makefile +++ b/Makefile @@ -1986,7 +1986,7 @@ endif endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif @@ -2005,7 +2005,7 @@ endif endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif @@ -2024,7 +2024,7 @@ endif endif ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif @@ -2035,7 +2035,7 @@ ifneq ($(PROTOBUF_DEP),) $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif endif diff --git a/templates/Makefile.template b/templates/Makefile.template index b302623cd94..dead8b8d66e 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -780,7 +780,7 @@ endif % endfor ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif @@ -800,7 +800,7 @@ ifneq ($(PROTOBUF_DEP),) $(Q) $(MAKE) -C third_party/protobuf install prefix=$(prefix) ifneq ($(SYSTEM),MINGW32) ifneq ($(SYSTEM),Darwin) - $(Q) ldconfig + $(Q) ldconfig || true endif endif endif From d81b6e331210feb3319c6536a55f67f250a44b1b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Feb 2015 16:12:02 -0800 Subject: [PATCH 222/232] Removed reference to non-existent header --- src/node/ext/node_grpc.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 965186e0cc6..9f5095839cb 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -38,7 +38,6 @@ #include "call.h" #include "channel.h" -#include "event.h" #include "server.h" #include "completion_queue_async_worker.h" #include "credentials.h" From 777a08964cbb32a3f4baa104603e1cd239dc5d7a Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 19 Feb 2015 16:33:21 -0800 Subject: [PATCH 223/232] Explicitly use nodejs to run tests --- src/node/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/package.json b/src/node/package.json index bbd89be77d7..a71577fb966 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -3,8 +3,8 @@ "version": "0.2.0", "description": "gRPC Library for Node", "scripts": { - "lint": "jshint src test examples interop index.js", - "test": "./node_modules/mocha/bin/mocha && npm run-script lint" + "lint": "nodejs ./node_modules/jshint/bin/jshint src test examples interop index.js", + "test": "nodejs ./node_modules/mocha/bin/mocha && npm run-script lint" }, "dependencies": { "bindings": "^1.2.1", From dbbdda52478731d085239580e0beceacfe3dcd43 Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 19 Feb 2015 17:02:54 -0800 Subject: [PATCH 224/232] EXPECT_EQ Mac issue... --- examples/pubsub/publisher_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pubsub/publisher_test.cc b/examples/pubsub/publisher_test.cc index 40b122bc746..b7bea5b1bd2 100644 --- a/examples/pubsub/publisher_test.cc +++ b/examples/pubsub/publisher_test.cc @@ -138,7 +138,7 @@ TEST_F(PublisherTest, TestPublisher) { std::vector topics; EXPECT_TRUE(publisher_->ListTopics(kProjectId, &topics).IsOk()); - EXPECT_EQ(topics.size(), 1); + EXPECT_EQ(topics.size(), static_cast(1)); EXPECT_EQ(topics[0], kTopic); } From 081f9562630e515c23d47b593c186652300240d3 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Thu, 19 Feb 2015 17:12:57 -0800 Subject: [PATCH 225/232] Removed unused/wrong generated Python code imports from Python codegen. --- src/compiler/python_generator.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 48d90624d62..cdd3d8a98a5 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -313,8 +313,6 @@ string GetServices(const FileDescriptor* file) { string output; StringOutputStream output_stream(&output); Printer out(&output_stream, '$'); - out.Print("import abc\n"); - out.Print("import google3\n"); out.Print("from grpc.framework.face import demonstration as _face_testing\n"); out.Print("from grpc.framework.face import interfaces as _face_interfaces\n"); From ba6082080ccdf8b6f80b9f106b4148cf57cfd864 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 20 Feb 2015 02:48:03 +0100 Subject: [PATCH 226/232] Fixing gflags' include path. --- examples/pubsub/main.cc | 2 +- test/cpp/interop/client.cc | 2 +- test/cpp/interop/server.cc | 2 +- test/cpp/qps/client.cc | 2 +- test/cpp/qps/server.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index d7526855459..fb252e6c4e6 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index ab69e1eefd3..47f2d34a4dd 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index f4b9f046504..8566ad5bef4 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include #include "test/core/end2end/data/ssl_test_data.h" diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc index 8369ef6562b..8a33ab2ca3f 100644 --- a/test/cpp/qps/client.cc +++ b/test/cpp/qps/client.cc @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include "test/core/util/grpc_profiler.h" diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index 6a30d5d8d46..dcef8f20abd 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include #include From 7e80efcb3dec903912b3b240cfdc870d76801891 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 20 Feb 2015 03:13:38 +0100 Subject: [PATCH 227/232] Making the usage of gflags uniform across distributions. --- examples/pubsub/main.cc | 9 ++++++++- test/cpp/interop/client.cc | 9 ++++++++- test/cpp/interop/server.cc | 9 ++++++++- test/cpp/qps/client.cc | 9 ++++++++- test/cpp/qps/server.cc | 9 ++++++++- 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/examples/pubsub/main.cc b/examples/pubsub/main.cc index fb252e6c4e6..39fb8aea15c 100644 --- a/examples/pubsub/main.cc +++ b/examples/pubsub/main.cc @@ -60,6 +60,13 @@ DEFINE_string(oauth_scope, "https://www.googleapis.com/auth/cloud-platform", "Scope for OAuth tokens."); +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + namespace { const char kTopic[] = "testtopics"; @@ -81,7 +88,7 @@ grpc::string GetServiceAccountJsonKey() { int main(int argc, char** argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); gpr_log(GPR_INFO, "Start PUBSUB client"); std::ostringstream ss; diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 47f2d34a4dd..78f2063c45b 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -92,6 +92,13 @@ using grpc::testing::StreamingOutputCallRequest; using grpc::testing::StreamingOutputCallResponse; using grpc::testing::TestService; +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + namespace { // The same value is defined by the Java client. const std::vector request_stream_sizes = {27182, 8, 1828, 45904}; @@ -386,7 +393,7 @@ void DoPingPong() { int main(int argc, char** argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); if (FLAGS_test_case == "empty_unary") { DoEmpty(); diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc index 8566ad5bef4..4869d4df529 100644 --- a/test/cpp/interop/server.cc +++ b/test/cpp/interop/server.cc @@ -73,6 +73,13 @@ using grpc::testing::StreamingOutputCallResponse; using grpc::testing::TestService; using grpc::Status; +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + bool SetPayload(PayloadType type, int size, Payload* payload) { PayloadType response_type = type; // TODO(yangg): Support UNCOMPRESSABLE payload. @@ -217,7 +224,7 @@ void RunServer() { int main(int argc, char** argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); GPR_ASSERT(FLAGS_port != 0); RunServer(); diff --git a/test/cpp/qps/client.cc b/test/cpp/qps/client.cc index 8a33ab2ca3f..666f25054ab 100644 --- a/test/cpp/qps/client.cc +++ b/test/cpp/qps/client.cc @@ -80,6 +80,13 @@ using grpc::testing::SimpleResponse; using grpc::testing::StatsRequest; using grpc::testing::TestService; +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + static double now() { gpr_timespec tv = gpr_now(); return 1e9 * tv.tv_sec + tv.tv_nsec; @@ -221,7 +228,7 @@ void RunTest(const int client_threads, const int client_channels, int main(int argc, char **argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); GPR_ASSERT(FLAGS_server_port); diff --git a/test/cpp/qps/server.cc b/test/cpp/qps/server.cc index dcef8f20abd..8e136349a15 100644 --- a/test/cpp/qps/server.cc +++ b/test/cpp/qps/server.cc @@ -68,6 +68,13 @@ using grpc::testing::StatsRequest; using grpc::testing::TestService; using grpc::Status; +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google { } +namespace gflags { } +using namespace google; +using namespace gflags; + static bool got_sigint = false; static void sigint_handler(int x) { got_sigint = 1; } @@ -149,7 +156,7 @@ static void RunServer() { int main(int argc, char** argv) { grpc_init(); - google::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); signal(SIGINT, sigint_handler); From 54f9a65f1ee7bf05b17a5727ad3c0795c4b032e5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 19 Feb 2015 21:41:20 -0800 Subject: [PATCH 228/232] 32 bit compilation fixes for core --- src/core/transport/chttp2/frame_data.c | 2 +- src/core/transport/chttp2_transport.c | 2 +- src/core/tsi/ssl_transport_security.c | 2 +- test/core/iomgr/tcp_posix_test.c | 2 +- test/core/statistics/hash_table_test.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index 95c27ad286a..a1ae9ed2e65 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -135,7 +135,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( case GRPC_CHTTP2_DATA_FRAME: if (cur == end) { return GRPC_CHTTP2_PARSE_OK; - } else if (end - cur == p->frame_size) { + } else if ((gpr_uint32)(end - cur) == p->frame_size) { state->need_flush_reads = 1; grpc_sopb_add_slice(&p->incoming_sopb, gpr_slice_sub(slice, cur - beg, end - beg)); diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 5b2d0a5e5b7..982417ec8a4 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1631,7 +1631,7 @@ static int process_read(transport *t, gpr_slice slice) { /* fallthrough */ case DTS_FRAME: GPR_ASSERT(cur < end); - if (end - cur == t->incoming_frame_size) { + if ((gpr_uint32)(end - cur) == t->incoming_frame_size) { if (!parse_frame_slice( t, gpr_slice_sub_no_ref(slice, cur - beg, end - beg), 1)) { return 0; diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 2e59275ff80..92fcb96dd23 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -1084,7 +1084,7 @@ static int server_handshaker_factory_alpn_callback( tsi_ssl_server_handshaker_factory* factory = (tsi_ssl_server_handshaker_factory*)arg; const unsigned char* client_current = in; - while ((client_current - in) < inlen) { + while ((unsigned int)(client_current - in) < inlen) { unsigned char client_current_len = *(client_current++); const unsigned char* server_current = factory->alpn_protocol_list; while ((server_current >= factory->alpn_protocol_list) && diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 044802b8025..0f81ba77344 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -250,7 +250,7 @@ struct write_socket_state { static gpr_slice *allocate_blocks(ssize_t num_bytes, ssize_t slice_size, size_t *num_blocks, int *current_data) { - ssize_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0); + size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0); gpr_slice *slices = gpr_malloc(sizeof(gpr_slice) * nslices); ssize_t num_bytes_left = num_bytes; unsigned i, j; diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index 9b7a712c18c..2752d6d89d5 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -97,7 +97,7 @@ static void test_table_with_int_key(void) { for (i = 0; i < 20; ++i) { census_ht_key key; key.val = i; - census_ht_insert(ht, key, (void*)i); + census_ht_insert(ht, key, (void*)(gpr_intptr)i); GPR_ASSERT(census_ht_get_size(ht) == i + 1); } for (i = 0; i < 20; i++) { @@ -105,7 +105,7 @@ static void test_table_with_int_key(void) { census_ht_key key; key.val = i; val = census_ht_find(ht, key); - GPR_ASSERT(val == (void*)i); + GPR_ASSERT(val == (void*)(gpr_intptr)i); } elements = census_ht_get_all_elements(ht, &num_elements); GPR_ASSERT(elements != NULL); From d0c0a9d68c1d5f4f7ca561ad02da17f10011e788 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Thu, 19 Feb 2015 22:06:45 -0800 Subject: [PATCH 229/232] Adding a constant for a well known place where the SSL roots are installed. --- include/grpc/grpc_security.h | 7 +++-- src/core/security/security_context.c | 5 ++++ src/core/security/ssl_roots.h | 40 ++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 src/core/security/ssl_roots.h diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index f03ac8004da..a1fade47646 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -73,8 +73,11 @@ typedef struct { /* Creates an SSL credentials object. - pem_roots_cert is the NULL-terminated string containing the PEM encoding - of the server root certificates. If this parameter is NULL, the default - roots will be used. + of the server root certificates. If this parameter is NULL, the + implementation will first try to dereference the file pointed by the + GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails, + will try to dereference the GRPC_SSL_ROOTS_WELL_KNOWN_PATH defined in + ssl_roots.h (which value is patched during the grpc Install process). - pem_key_cert_pair is a pointer on the object containing client's private key and certificate chain. This parameter can be NULL if the client does not have such a key/cert pair. */ diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index f9fb2407cf9..e09a569c763 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -39,6 +39,7 @@ #include "src/core/channel/http_client_filter.h" #include "src/core/security/credentials.h" #include "src/core/security/secure_endpoint.h" +#include "src/core/security/ssl_roots.h" #include "src/core/support/env.h" #include "src/core/support/file.h" #include "src/core/support/string.h" @@ -403,6 +404,10 @@ static void init_default_pem_root_certs(void) { } else { default_pem_root_certs = gpr_load_file(default_root_certs_path, NULL); gpr_free(default_root_certs_path); + if (GPR_SLICE_IS_EMPTY(default_pem_root_certs)) { + default_pem_root_certs = + gpr_load_file(GRPC_SSL_ROOTS_WELL_KNOWN_PATH, NULL); + } } } diff --git a/src/core/security/ssl_roots.h b/src/core/security/ssl_roots.h new file mode 100644 index 00000000000..49a5e69e01c --- /dev/null +++ b/src/core/security/ssl_roots.h @@ -0,0 +1,40 @@ +/* + * + * 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. + * + */ + +#ifndef __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ +#define __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ + +/* WARNING: this value is patched at install time. */ +#define GRPC_SSL_ROOTS_WELL_KNOWN_PATH "/etc/grpc/roots.pem" + +#endif /* __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ */ From e567fa93256fdb7004524b0689eb185633160d77 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 20 Feb 2015 07:10:21 +0100 Subject: [PATCH 230/232] Some 32 bits platforms don't like buildint asm for openssl. --- Makefile | 8 ++------ templates/Makefile.template | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 384204cd466..0a53adda970 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,6 @@ CXX_tsan = clang++ LD_tsan = clang LDXX_tsan = clang++ CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer -OPENSSL_CONFIG_tsan = no-asm LDFLAGS_tsan = -fsanitize=thread DEFINES_tsan = NDEBUG @@ -97,7 +96,6 @@ CXX_asan = clang++ LD_asan = clang LDXX_asan = clang++ CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer -OPENSSL_CONFIG_asan = no-asm LDFLAGS_asan = -fsanitize=address DEFINES_asan = NDEBUG @@ -109,7 +107,6 @@ LD_msan = clang LDXX_msan = clang++-libc++ CPPFLAGS_msan = -O1 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 OPENSSL_CFLAGS_msan = -DPURIFY -OPENSSL_CONFIG_msan = no-asm LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 DEFINES_msan = NDEBUG @@ -121,7 +118,6 @@ LD_ubsan = clang LDXX_ubsan = clang++ CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer OPENSSL_CFLAGS_ubsan = -DPURIFY -OPENSSL_CONFIG_ubsan = no-asm LDFLAGS_ubsan = -fsanitize=undefined DEFINES_ubsan = NDEBUG @@ -867,9 +863,9 @@ $(LIBDIR)/$(CONFIG)/zlib/libz.a: $(LIBDIR)/$(CONFIG)/openssl/libssl.a: $(E) "[MAKE] Building openssl for $(SYSTEM)" ifeq ($(SYSTEM),Darwin) - $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc $(OPENSSL_CONFIG_$(CONFIG))) + $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc) else - $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config $(OPENSSL_CONFIG_$(CONFIG))) + $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG))) endif $(Q)$(MAKE) -C third_party/openssl clean $(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl diff --git a/templates/Makefile.template b/templates/Makefile.template index dead8b8d66e..f1f1badc16b 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -103,7 +103,6 @@ CXX_tsan = clang++ LD_tsan = clang LDXX_tsan = clang++ CPPFLAGS_tsan = -O1 -fsanitize=thread -fno-omit-frame-pointer -OPENSSL_CONFIG_tsan = no-asm LDFLAGS_tsan = -fsanitize=thread DEFINES_tsan = NDEBUG @@ -114,7 +113,6 @@ CXX_asan = clang++ LD_asan = clang LDXX_asan = clang++ CPPFLAGS_asan = -O1 -fsanitize=address -fno-omit-frame-pointer -OPENSSL_CONFIG_asan = no-asm LDFLAGS_asan = -fsanitize=address DEFINES_asan = NDEBUG @@ -126,7 +124,6 @@ LD_msan = clang LDXX_msan = clang++-libc++ CPPFLAGS_msan = -O1 -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 OPENSSL_CFLAGS_msan = -DPURIFY -OPENSSL_CONFIG_msan = no-asm LDFLAGS_msan = -fsanitize=memory -DGTEST_HAS_TR1_TUPLE=0 -DGTEST_USE_OWN_TR1_TUPLE=1 DEFINES_msan = NDEBUG @@ -138,7 +135,6 @@ LD_ubsan = clang LDXX_ubsan = clang++ CPPFLAGS_ubsan = -O1 -fsanitize=undefined -fno-omit-frame-pointer OPENSSL_CFLAGS_ubsan = -DPURIFY -OPENSSL_CONFIG_ubsan = no-asm LDFLAGS_ubsan = -fsanitize=undefined DEFINES_ubsan = NDEBUG @@ -469,9 +465,9 @@ $(LIBDIR)/$(CONFIG)/zlib/libz.a: $(LIBDIR)/$(CONFIG)/openssl/libssl.a: $(E) "[MAKE] Building openssl for $(SYSTEM)" ifeq ($(SYSTEM),Darwin) - $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc $(OPENSSL_CONFIG_$(CONFIG))) + $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./Configure darwin64-x86_64-cc) else - $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config $(OPENSSL_CONFIG_$(CONFIG))) + $(Q)(cd third_party/openssl ; CC="$(CC) -fPIC -fvisibility=hidden $(CPPFLAGS_$(CONFIG)) $(OPENSSL_CFLAGS_$(CONFIG))" ./config no-asm $(OPENSSL_CONFIG_$(CONFIG))) endif $(Q)$(MAKE) -C third_party/openssl clean $(Q)$(MAKE) -C third_party/openssl build_crypto build_ssl From 2c29920e73ff76cf4cd25cd012efb2c79cc88e50 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 19 Feb 2015 23:10:10 -0800 Subject: [PATCH 231/232] Revert "Adding a constant for a well known place where the SSL roots are installed." --- include/grpc/grpc_security.h | 7 ++--- src/core/security/security_context.c | 5 ---- src/core/security/ssl_roots.h | 40 ---------------------------- 3 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 src/core/security/ssl_roots.h diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index a1fade47646..f03ac8004da 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -73,11 +73,8 @@ typedef struct { /* Creates an SSL credentials object. - pem_roots_cert is the NULL-terminated string containing the PEM encoding - of the server root certificates. If this parameter is NULL, the - implementation will first try to dereference the file pointed by the - GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails, - will try to dereference the GRPC_SSL_ROOTS_WELL_KNOWN_PATH defined in - ssl_roots.h (which value is patched during the grpc Install process). + of the server root certificates. If this parameter is NULL, the default + roots will be used. - pem_key_cert_pair is a pointer on the object containing client's private key and certificate chain. This parameter can be NULL if the client does not have such a key/cert pair. */ diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index e09a569c763..f9fb2407cf9 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -39,7 +39,6 @@ #include "src/core/channel/http_client_filter.h" #include "src/core/security/credentials.h" #include "src/core/security/secure_endpoint.h" -#include "src/core/security/ssl_roots.h" #include "src/core/support/env.h" #include "src/core/support/file.h" #include "src/core/support/string.h" @@ -404,10 +403,6 @@ static void init_default_pem_root_certs(void) { } else { default_pem_root_certs = gpr_load_file(default_root_certs_path, NULL); gpr_free(default_root_certs_path); - if (GPR_SLICE_IS_EMPTY(default_pem_root_certs)) { - default_pem_root_certs = - gpr_load_file(GRPC_SSL_ROOTS_WELL_KNOWN_PATH, NULL); - } } } diff --git a/src/core/security/ssl_roots.h b/src/core/security/ssl_roots.h deleted file mode 100644 index 49a5e69e01c..00000000000 --- a/src/core/security/ssl_roots.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * 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. - * - */ - -#ifndef __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ -#define __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ - -/* WARNING: this value is patched at install time. */ -#define GRPC_SSL_ROOTS_WELL_KNOWN_PATH "/etc/grpc/roots.pem" - -#endif /* __GRPC_INTERNAL_SECURITY_SSL_ROOTS_H__ */ From c04c573fb3ef294362d193b84249498eb4c8ef91 Mon Sep 17 00:00:00 2001 From: Thomas Wouters Date: Thu, 19 Feb 2015 13:37:08 -0800 Subject: [PATCH 232/232] Clean up Python C API use in src/python/src/grpc/_adapter/*.c. Specifically: - Use METH_O and METH_NOARGS where appropriate, modifying the C functions appropriately. METH_O is for functions that take a single PyObject, and it's passed directly instead of 'args'. METH_NOARGS is for functions that take no arguments, and they get called with just one argument ('self'.) - In PyArg_ParseTuple*() calls, specify the callable's name for more descriptive exception messages. - For tp_init functions (which always take keyword arguments) introduce keyword argument parsing (using the C local variables as keywords, although I don't know if they're the best names to use.) This is mostly as a way to show how keyword arguments are done in C. An alternative method is to use _PyArg_NoKeywords(kwds) (see https://hg.python.org/cpython/file/70a55b2dee71/Python/getargs.c#l1820, but unfortunately it's not part of the official API,) or check manually that the dict is empty. - Check the return value of Python API functions that can return an error indicator (NULL or -1.) PyFloat_AsDouble is also one of these, but we don't check the return type (we would have to compare the result to 1.0 with ==, which is not a thing you should do) so just call PyErr_Occurred unconditionally. - Change Py_BuildValue() calls with just "O" formats into PyTuple_Pack calls. It requires less runtime checking. - Replace Py_BuildValue()/PyObject_CallObject pairs with PyObject_CallFunctionObjArgs (since all of them have just PyObject* arguments.) If the Py_BuildValue formats had included other types, PyObject_CallFunction() would have been easier, but no need in these cases. - Replace Py_BuildValue("f", ...) with PyFloat_FromDouble(...). Less runtime checking and parsing necessary, and more obvious in what it does. - In the PyType structs, replace "PyObject_HEAD_INIT(NULL) 0" with "PyVarObject_HEAD_INIT(NULL, 0)". Anything with an ob_size struct member is a PyVarObject, although the distinction isn't all that import; it's just a more convenient macro. - Assign tp_new in the PyType structs directly, like all other struct members, rather than right before the PyType_Ready() call. - Remove PyErr_SetString() calls in places that already have a (meaningful) exception set. - Add a PyErr_Format() for an error return that wasn't setting an exception (PyObject_TypeCheck() doesn't set an exception.) - Remove NULL assignments to struct members in the error paths of the tp_init functions. PyObject structs are always zeroed after allocation, guaranteed. (If there's a way for them to already contain an object you'd use Py_CLEAR() to clear them, but that can't happen in these cases.) - Remove a few unnecessary parentheses. --- src/python/src/grpc/_adapter/_c.c | 9 +- src/python/src/grpc/_adapter/_call.c | 59 ++++---- src/python/src/grpc/_adapter/_channel.c | 12 +- .../src/grpc/_adapter/_completion_queue.c | 132 ++++++++++-------- src/python/src/grpc/_adapter/_server.c | 36 ++--- .../src/grpc/_adapter/_server_credentials.c | 21 ++- 6 files changed, 145 insertions(+), 124 deletions(-) diff --git a/src/python/src/grpc/_adapter/_c.c b/src/python/src/grpc/_adapter/_c.c index 13eb93fe5ab..55b9d0512c9 100644 --- a/src/python/src/grpc/_adapter/_c.c +++ b/src/python/src/grpc/_adapter/_c.c @@ -40,19 +40,20 @@ #include "grpc/_adapter/_server.h" #include "grpc/_adapter/_server_credentials.h" -static PyObject *init(PyObject *self, PyObject *args) { +static PyObject *init(PyObject *self) { grpc_init(); Py_RETURN_NONE; } -static PyObject *shutdown(PyObject *self, PyObject *args) { +static PyObject *shutdown(PyObject *self) { grpc_shutdown(); Py_RETURN_NONE; } static PyMethodDef _c_methods[] = { - {"init", init, METH_VARARGS, "Initialize the module's static state."}, - {"shut_down", shutdown, METH_VARARGS, + {"init", (PyCFunction)init, METH_NOARGS, + "Initialize the module's static state."}, + {"shut_down", (PyCFunction)shutdown, METH_NOARGS, "Shut down the module's static state."}, {NULL}, }; diff --git a/src/python/src/grpc/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c index 7e62c1b7a3d..325d3d5bbd6 100644 --- a/src/python/src/grpc/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -46,10 +46,11 @@ static int pygrpc_call_init(Call *self, PyObject *args, PyObject *kwds) { const char *method; const char *host; const double deadline; + static char *kwlist[] = {"channel", "method", "host", "deadline", NULL}; - if (!PyArg_ParseTuple(args, "O!ssd", &pygrpc_ChannelType, &channel, &method, - &host, &deadline)) { - self->c_call = NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!ssd:Call", kwlist, + &pygrpc_ChannelType, &channel, &method, + &host, &deadline)) { return -1; } @@ -77,7 +78,7 @@ static const PyObject *pygrpc_call_invoke(Call *self, PyObject *args) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "O!OO", &pygrpc_CompletionQueueType, + if (!(PyArg_ParseTuple(args, "O!OO:invoke", &pygrpc_CompletionQueueType, &completion_queue, &metadata_tag, &finish_tag))) { return NULL; } @@ -103,7 +104,7 @@ static const PyObject *pygrpc_call_write(Call *self, PyObject *args) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "s#O", &bytes, &length, &tag))) { + if (!(PyArg_ParseTuple(args, "s#O:write", &bytes, &length, &tag))) { return NULL; } @@ -123,15 +124,10 @@ static const PyObject *pygrpc_call_write(Call *self, PyObject *args) { return result; } -static const PyObject *pygrpc_call_complete(Call *self, PyObject *args) { - const PyObject *tag; +static const PyObject *pygrpc_call_complete(Call *self, PyObject *tag) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "O", &tag))) { - return NULL; - } - call_error = grpc_call_writes_done_old(self->c_call, (void *)tag); result = pygrpc_translate_call_error(call_error); @@ -147,7 +143,7 @@ static const PyObject *pygrpc_call_accept(Call *self, PyObject *args) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "O!O", &pygrpc_CompletionQueueType, + if (!(PyArg_ParseTuple(args, "O!O:accept", &pygrpc_CompletionQueueType, &completion_queue, &tag))) { return NULL; } @@ -164,21 +160,16 @@ static const PyObject *pygrpc_call_accept(Call *self, PyObject *args) { return result; } -static const PyObject *pygrpc_call_premetadata(Call *self, PyObject *args) { +static const PyObject *pygrpc_call_premetadata(Call *self) { /* TODO(b/18702680): Actually support metadata. */ return pygrpc_translate_call_error( grpc_call_server_end_initial_metadata_old(self->c_call, 0)); } -static const PyObject *pygrpc_call_read(Call *self, PyObject *args) { - const PyObject *tag; +static const PyObject *pygrpc_call_read(Call *self, PyObject *tag) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "O", &tag))) { - return NULL; - } - call_error = grpc_call_start_read_old(self->c_call, (void *)tag); result = pygrpc_translate_call_error(call_error); @@ -198,16 +189,30 @@ static const PyObject *pygrpc_call_status(Call *self, PyObject *args) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "OO", &status, &tag))) { + if (!(PyArg_ParseTuple(args, "OO:status", &status, &tag))) { return NULL; } code = PyObject_GetAttrString(status, "code"); + if (code == NULL) { + return NULL; + } details = PyObject_GetAttrString(status, "details"); + if (details == NULL) { + Py_DECREF(code); + return NULL; + } c_code = PyInt_AsLong(code); - c_message = PyBytes_AsString(details); Py_DECREF(code); + if (c_code == -1 && PyErr_Occurred()) { + Py_DECREF(details); + return NULL; + } + c_message = PyBytes_AsString(details); Py_DECREF(details); + if (c_message == NULL) { + return NULL; + } call_error = grpc_call_start_write_status_old(self->c_call, c_code, c_message, (void *)tag); @@ -228,12 +233,12 @@ static PyMethodDef methods[] = { "Invoke this call."}, {"write", (PyCFunction)pygrpc_call_write, METH_VARARGS, "Write bytes to this call."}, - {"complete", (PyCFunction)pygrpc_call_complete, METH_VARARGS, + {"complete", (PyCFunction)pygrpc_call_complete, METH_O, "Complete writes to this call."}, {"accept", (PyCFunction)pygrpc_call_accept, METH_VARARGS, "Accept an RPC."}, {"premetadata", (PyCFunction)pygrpc_call_premetadata, METH_VARARGS, "Indicate the end of leading metadata in the response."}, - {"read", (PyCFunction)pygrpc_call_read, METH_VARARGS, + {"read", (PyCFunction)pygrpc_call_read, METH_O, "Read bytes from this call."}, {"status", (PyCFunction)pygrpc_call_status, METH_VARARGS, "Report this call's status."}, @@ -242,7 +247,7 @@ static PyMethodDef methods[] = { {NULL}}; PyTypeObject pygrpc_CallType = { - PyObject_HEAD_INIT(NULL)0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_grpc.Call", /*tp_name*/ sizeof(Call), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -278,16 +283,16 @@ PyTypeObject pygrpc_CallType = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pygrpc_call_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; int pygrpc_add_call(PyObject *module) { - pygrpc_CallType.tp_new = PyType_GenericNew; if (PyType_Ready(&pygrpc_CallType) < 0) { - PyErr_SetString(PyExc_RuntimeError, "Error defining pygrpc_CallType!"); return -1; } if (PyModule_AddObject(module, "Call", (PyObject *)&pygrpc_CallType) == -1) { - PyErr_SetString(PyExc_ImportError, "Couldn't add Call type to module!"); + return -1; } return 0; } diff --git a/src/python/src/grpc/_adapter/_channel.c b/src/python/src/grpc/_adapter/_channel.c index 6962722ed25..3ba943e4b2d 100644 --- a/src/python/src/grpc/_adapter/_channel.c +++ b/src/python/src/grpc/_adapter/_channel.c @@ -38,9 +38,10 @@ static int pygrpc_channel_init(Channel *self, PyObject *args, PyObject *kwds) { const char *hostport; + static char *kwlist[] = {"hostport", NULL}; - if (!(PyArg_ParseTuple(args, "s", &hostport))) { - self->c_channel = NULL; + if (!(PyArg_ParseTupleAndKeywords(args, kwds, "s:Channel", kwlist, + &hostport))) { return -1; } @@ -56,7 +57,7 @@ static void pygrpc_channel_dealloc(Channel *self) { } PyTypeObject pygrpc_ChannelType = { - PyObject_HEAD_INIT(NULL)0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_grpc.Channel", /*tp_name*/ sizeof(Channel), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -92,17 +93,16 @@ PyTypeObject pygrpc_ChannelType = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pygrpc_channel_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; int pygrpc_add_channel(PyObject *module) { - pygrpc_ChannelType.tp_new = PyType_GenericNew; if (PyType_Ready(&pygrpc_ChannelType) < 0) { - PyErr_SetString(PyExc_RuntimeError, "Error defining pygrpc_ChannelType!"); return -1; } if (PyModule_AddObject(module, "Channel", (PyObject *)&pygrpc_ChannelType) == -1) { - PyErr_SetString(PyExc_ImportError, "Couldn't add Channel type to module!"); return -1; } return 0; diff --git a/src/python/src/grpc/_adapter/_completion_queue.c b/src/python/src/grpc/_adapter/_completion_queue.c index 1d593d0d140..b56ca1926e5 100644 --- a/src/python/src/grpc/_adapter/_completion_queue.c +++ b/src/python/src/grpc/_adapter/_completion_queue.c @@ -70,7 +70,7 @@ static PyObject *metadata_event_kind; static PyObject *finish_event_kind; static PyObject *pygrpc_as_py_time(gpr_timespec *timespec) { - return Py_BuildValue("f", + return PyFloat_FromDouble( timespec->tv_sec + ((double)timespec->tv_nsec) / 1.0E9); } @@ -116,67 +116,82 @@ static PyObject *pygrpc_status_code(grpc_status_code c_status_code) { } static PyObject *pygrpc_stop_event_args(grpc_event *c_event) { - return Py_BuildValue("(OOOOOOO)", stop_event_kind, Py_None, Py_None, Py_None, - Py_None, Py_None, Py_None); + return PyTuple_Pack(7, stop_event_kind, Py_None, Py_None, Py_None, + Py_None, Py_None, Py_None); } static PyObject *pygrpc_write_event_args(grpc_event *c_event) { PyObject *write_accepted = c_event->data.write_accepted == GRPC_OP_OK ? Py_True : Py_False; - return Py_BuildValue("(OOOOOOO)", write_event_kind, (PyObject *)c_event->tag, - write_accepted, Py_None, Py_None, Py_None, Py_None); + return PyTuple_Pack(7, write_event_kind, (PyObject *)c_event->tag, + write_accepted, Py_None, Py_None, Py_None, Py_None); } static PyObject *pygrpc_complete_event_args(grpc_event *c_event) { PyObject *complete_accepted = c_event->data.finish_accepted == GRPC_OP_OK ? Py_True : Py_False; - return Py_BuildValue("(OOOOOOO)", complete_event_kind, - (PyObject *)c_event->tag, Py_None, complete_accepted, - Py_None, Py_None, Py_None); + return PyTuple_Pack(7, complete_event_kind, (PyObject *)c_event->tag, + Py_None, complete_accepted, Py_None, Py_None, Py_None); } static PyObject *pygrpc_service_event_args(grpc_event *c_event) { if (c_event->data.server_rpc_new.method == NULL) { - return Py_BuildValue("(OOOOOOO)", service_event_kind, c_event->tag, - Py_None, Py_None, Py_None, Py_None, Py_None); + return PyTuple_Pack(7, service_event_kind, c_event->tag, + Py_None, Py_None, Py_None, Py_None, Py_None); } else { - PyObject *method = PyBytes_FromString(c_event->data.server_rpc_new.method); - PyObject *host = PyBytes_FromString(c_event->data.server_rpc_new.host); - PyObject *service_deadline = + PyObject *method = NULL; + PyObject *host = NULL; + PyObject *service_deadline = NULL; + Call *call = NULL; + PyObject *service_acceptance = NULL; + PyObject *event_args = NULL; + + method = PyBytes_FromString(c_event->data.server_rpc_new.method); + if (method == NULL) { + goto error; + } + host = PyBytes_FromString(c_event->data.server_rpc_new.host); + if (host == NULL) { + goto error; + } + service_deadline = pygrpc_as_py_time(&c_event->data.server_rpc_new.deadline); - - Call *call; - PyObject *service_acceptance_args; - PyObject *service_acceptance; - PyObject *event_args; + if (service_deadline == NULL) { + goto error; + } call = PyObject_New(Call, &pygrpc_CallType); + if (call == NULL) { + goto error; + } call->c_call = c_event->call; - service_acceptance_args = - Py_BuildValue("(OOOO)", call, method, host, service_deadline); - Py_DECREF(call); - Py_DECREF(method); - Py_DECREF(host); - Py_DECREF(service_deadline); - service_acceptance = - PyObject_CallObject(service_acceptance_class, service_acceptance_args); - Py_DECREF(service_acceptance_args); + PyObject_CallFunctionObjArgs(service_acceptance_class, call, method, + host, service_deadline, NULL); + if (service_acceptance == NULL) { + goto error; + } + + event_args = PyTuple_Pack(7, service_event_kind, + (PyObject *)c_event->tag, Py_None, Py_None, + service_acceptance, Py_None, Py_None); - event_args = Py_BuildValue("(OOOOOOO)", service_event_kind, - (PyObject *)c_event->tag, Py_None, Py_None, - service_acceptance, Py_None, Py_None); Py_DECREF(service_acceptance); +error: + Py_XDECREF(call); + Py_XDECREF(method); + Py_XDECREF(host); + Py_XDECREF(service_deadline); + return event_args; } } static PyObject *pygrpc_read_event_args(grpc_event *c_event) { if (c_event->data.read == NULL) { - return Py_BuildValue("(OOOOOOO)", read_event_kind, - (PyObject *)c_event->tag, Py_None, Py_None, Py_None, - Py_None, Py_None); + return PyTuple_Pack(7, read_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, Py_None, Py_None); } else { size_t length; size_t offset; @@ -198,9 +213,11 @@ static PyObject *pygrpc_read_event_args(grpc_event *c_event) { grpc_byte_buffer_reader_destroy(reader); bytes = PyBytes_FromStringAndSize(c_bytes, length); gpr_free(c_bytes); - event_args = - Py_BuildValue("(OOOOOOO)", read_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, bytes, Py_None); + if (bytes == NULL) { + return NULL; + } + event_args = PyTuple_Pack(7, read_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, bytes, Py_None); Py_DECREF(bytes); return event_args; } @@ -208,15 +225,13 @@ static PyObject *pygrpc_read_event_args(grpc_event *c_event) { static PyObject *pygrpc_metadata_event_args(grpc_event *c_event) { /* TODO(nathaniel): Actual transmission of metadata. */ - return Py_BuildValue("(OOOOOOO)", metadata_event_kind, - (PyObject *)c_event->tag, Py_None, Py_None, Py_None, - Py_None, Py_None); + return PyTuple_Pack(7, metadata_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, Py_None, Py_None); } static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { PyObject *code; PyObject *details; - PyObject *status_args; PyObject *status; PyObject *event_args; @@ -230,19 +245,26 @@ static PyObject *pygrpc_finished_event_args(grpc_event *c_event) { } else { details = PyBytes_FromString(c_event->data.finished.details); } - status_args = Py_BuildValue("(OO)", code, details); + if (details == NULL) { + return NULL; + } + status = PyObject_CallFunctionObjArgs(status_class, code, details, NULL); Py_DECREF(details); - status = PyObject_CallObject(status_class, status_args); - Py_DECREF(status_args); - event_args = - Py_BuildValue("(OOOOOOO)", finish_event_kind, (PyObject *)c_event->tag, - Py_None, Py_None, Py_None, Py_None, status); + if (status == NULL) { + return NULL; + } + event_args = PyTuple_Pack(7, finish_event_kind, (PyObject *)c_event->tag, + Py_None, Py_None, Py_None, Py_None, status); Py_DECREF(status); return event_args; } static int pygrpc_completion_queue_init(CompletionQueue *self, PyObject *args, PyObject *kwds) { + static char *kwlist[] = {NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwds, ":CompletionQueue", kwlist)) { + return -1; + } self->c_completion_queue = grpc_completion_queue_create(); return 0; } @@ -262,7 +284,7 @@ static PyObject *pygrpc_completion_queue_get(CompletionQueue *self, PyObject *event_args; PyObject *event; - if (!(PyArg_ParseTuple(args, "O", &deadline))) { + if (!(PyArg_ParseTuple(args, "O:get", &deadline))) { return NULL; } @@ -270,6 +292,9 @@ static PyObject *pygrpc_completion_queue_get(CompletionQueue *self, deadline_timespec = gpr_inf_future; } else { double_deadline = PyFloat_AsDouble(deadline); + if (PyErr_Occurred()) { + return NULL; + } deadline_timespec = gpr_time_from_nanos((long)(double_deadline * 1.0E9)); } @@ -339,7 +364,7 @@ static PyMethodDef methods[] = { {NULL}}; PyTypeObject pygrpc_CompletionQueueType = { - PyObject_HEAD_INIT(NULL)0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_gprc.CompletionQueue", /*tp_name*/ sizeof(CompletionQueue), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -375,6 +400,8 @@ PyTypeObject pygrpc_CompletionQueueType = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pygrpc_completion_queue_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; static int pygrpc_get_status_codes(PyObject *datatypes_module) { @@ -503,7 +530,6 @@ int pygrpc_add_completion_queue(PyObject *module) { char *datatypes_module_path = "grpc._adapter._datatypes"; PyObject *datatypes_module = PyImport_ImportModule(datatypes_module_path); if (datatypes_module == NULL) { - PyErr_SetString(PyExc_ImportError, datatypes_module_path); return -1; } status_class = PyObject_GetAttrString(datatypes_module, "Status"); @@ -512,29 +538,21 @@ int pygrpc_add_completion_queue(PyObject *module) { event_class = PyObject_GetAttrString(datatypes_module, "Event"); if (status_class == NULL || service_acceptance_class == NULL || event_class == NULL) { - PyErr_SetString(PyExc_ImportError, "Missing classes in _datatypes module!"); return -1; } if (pygrpc_get_status_codes(datatypes_module) == -1) { - PyErr_SetString(PyExc_ImportError, "Status codes import broken!"); return -1; } if (pygrpc_get_event_kinds(event_class) == -1) { - PyErr_SetString(PyExc_ImportError, "Event kinds import broken!"); return -1; } Py_DECREF(datatypes_module); - pygrpc_CompletionQueueType.tp_new = PyType_GenericNew; if (PyType_Ready(&pygrpc_CompletionQueueType) < 0) { - PyErr_SetString(PyExc_RuntimeError, - "Error defining pygrpc_CompletionQueueType!"); return -1; } if (PyModule_AddObject(module, "CompletionQueue", (PyObject *)&pygrpc_CompletionQueueType) == -1) { - PyErr_SetString(PyExc_ImportError, - "Couldn't add CompletionQueue type to module!"); return -1; } return 0; diff --git a/src/python/src/grpc/_adapter/_server.c b/src/python/src/grpc/_adapter/_server.c index d4bf5fb8f64..ae7ae5b5d23 100644 --- a/src/python/src/grpc/_adapter/_server.c +++ b/src/python/src/grpc/_adapter/_server.c @@ -43,9 +43,11 @@ static int pygrpc_server_init(Server *self, PyObject *args, PyObject *kwds) { const PyObject *completion_queue; PyObject *server_credentials; - if (!(PyArg_ParseTuple(args, "O!O", &pygrpc_CompletionQueueType, - &completion_queue, &server_credentials))) { - self->c_server = NULL; + static char *kwlist[] = {"completion_queue", "server_credentials", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O:Server", kwlist, + &pygrpc_CompletionQueueType, + &completion_queue, &server_credentials)) { return -1; } if (server_credentials == Py_None) { @@ -59,7 +61,9 @@ static int pygrpc_server_init(Server *self, PyObject *args, PyObject *kwds) { ((CompletionQueue *)completion_queue)->c_completion_queue, NULL); return 0; } else { - self->c_server = NULL; + PyErr_Format(PyExc_TypeError, + "server_credentials must be _grpc.ServerCredentials, not %s", + Py_TYPE(server_credentials)->tp_name); return -1; } } @@ -74,7 +78,9 @@ static void pygrpc_server_dealloc(Server *self) { static PyObject *pygrpc_server_add_http2_addr(Server *self, PyObject *args) { const char *addr; int port; - PyArg_ParseTuple(args, "s", &addr); + if (!PyArg_ParseTuple(args, "s:add_http2_addr", &addr)) { + return NULL; + } port = grpc_server_add_http2_port(self->c_server, addr); if (port == 0) { @@ -89,7 +95,9 @@ static PyObject *pygrpc_server_add_secure_http2_addr(Server *self, PyObject *args) { const char *addr; int port; - PyArg_ParseTuple(args, "s", &addr); + if (!PyArg_ParseTuple(args, "s:add_secure_http2_addr", &addr)) { + return NULL; + } port = grpc_server_add_secure_http2_port(self->c_server, addr); if (port == 0) { PyErr_SetString(PyExc_RuntimeError, "Couldn't add port to server!"); @@ -104,15 +112,10 @@ static PyObject *pygrpc_server_start(Server *self) { Py_RETURN_NONE; } -static const PyObject *pygrpc_server_service(Server *self, PyObject *args) { - const PyObject *tag; +static const PyObject *pygrpc_server_service(Server *self, PyObject *tag) { grpc_call_error call_error; const PyObject *result; - if (!(PyArg_ParseTuple(args, "O", &tag))) { - return NULL; - } - call_error = grpc_server_request_call_old(self->c_server, (void *)tag); result = pygrpc_translate_call_error(call_error); @@ -135,13 +138,13 @@ static PyMethodDef methods[] = { METH_VARARGS, "Add a secure HTTP2 address."}, {"start", (PyCFunction)pygrpc_server_start, METH_NOARGS, "Starts the server."}, - {"service", (PyCFunction)pygrpc_server_service, METH_VARARGS, + {"service", (PyCFunction)pygrpc_server_service, METH_O, "Services a call."}, {"stop", (PyCFunction)pygrpc_server_stop, METH_NOARGS, "Stops the server."}, {NULL}}; static PyTypeObject pygrpc_ServerType = { - PyObject_HEAD_INIT(NULL)0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_gprc.Server", /*tp_name*/ sizeof(Server), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -177,17 +180,16 @@ static PyTypeObject pygrpc_ServerType = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pygrpc_server_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; int pygrpc_add_server(PyObject *module) { - pygrpc_ServerType.tp_new = PyType_GenericNew; if (PyType_Ready(&pygrpc_ServerType) < 0) { - PyErr_SetString(PyExc_RuntimeError, "Error defining pygrpc_ServerType!"); return -1; } if (PyModule_AddObject(module, "Server", (PyObject *)&pygrpc_ServerType) == -1) { - PyErr_SetString(PyExc_ImportError, "Couldn't add Server type to module!"); return -1; } return 0; diff --git a/src/python/src/grpc/_adapter/_server_credentials.c b/src/python/src/grpc/_adapter/_server_credentials.c index ae85fd3eb75..06e6b94974a 100644 --- a/src/python/src/grpc/_adapter/_server_credentials.c +++ b/src/python/src/grpc/_adapter/_server_credentials.c @@ -47,21 +47,20 @@ static int pygrpc_server_credentials_init(ServerCredentials *self, PyObject *iterator; int i; PyObject *pair; + static char *kwlist[] = {"root_credentials", "pair_sequence", NULL}; - if (!(PyArg_ParseTuple(args, "zO", &root_certificates, &pair_sequence))) { - self->c_server_credentials = NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "zO:ServerCredentials", kwlist, + &root_certificates, &pair_sequence)) { return -1; } pair_count = PySequence_Length(pair_sequence); if (pair_count == -1) { - self->c_server_credentials = NULL; return -1; } iterator = PyObject_GetIter(pair_sequence); if (iterator == NULL) { - self->c_server_credentials = NULL; return -1; } pairs = gpr_malloc(pair_count * sizeof(grpc_ssl_pem_key_cert_pair)); @@ -72,8 +71,8 @@ static int pygrpc_server_credentials_init(ServerCredentials *self, error = 1; break; } - if (!(PyArg_ParseTuple(pair, "ss", &pairs[i].private_key, - &pairs[i].cert_chain))) { + if (!PyArg_ParseTuple(pair, "ss", &pairs[i].private_key, + &pairs[i].cert_chain)) { error = 1; Py_DECREF(pair); break; @@ -83,7 +82,6 @@ static int pygrpc_server_credentials_init(ServerCredentials *self, Py_DECREF(iterator); if (error) { - self->c_server_credentials = NULL; gpr_free(pairs); return -1; } else { @@ -102,7 +100,7 @@ static void pygrpc_server_credentials_dealloc(ServerCredentials *self) { } PyTypeObject pygrpc_ServerCredentialsType = { - PyObject_HEAD_INIT(NULL)0, /*ob_size*/ + PyVarObject_HEAD_INIT(NULL, 0) "_grpc.ServerCredencials", /*tp_name*/ sizeof(ServerCredentials), /*tp_basicsize*/ 0, /*tp_itemsize*/ @@ -138,19 +136,16 @@ PyTypeObject pygrpc_ServerCredentialsType = { 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)pygrpc_server_credentials_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; int pygrpc_add_server_credentials(PyObject *module) { - pygrpc_ServerCredentialsType.tp_new = PyType_GenericNew; if (PyType_Ready(&pygrpc_ServerCredentialsType) < 0) { - PyErr_SetString(PyExc_RuntimeError, - "Error defining pygrpc_ServerCredentialsType!"); return -1; } if (PyModule_AddObject(module, "ServerCredentials", (PyObject *)&pygrpc_ServerCredentialsType) == -1) { - PyErr_SetString(PyExc_ImportError, - "Couldn't add ServerCredentials type to module!"); return -1; } return 0;