From 6135107e4a899ec934f11abbb6bf4a804b5dee8f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 6 Feb 2015 17:17:24 -0800 Subject: [PATCH 001/173] 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 72f6253f8e8ee..4e8c1071c031f 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 f06da9b04feb5..a1a858ae2e049 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/173] 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 68110e47020f5..7d35f79af098a 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 0000000000000..704cd47daecc0 --- /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 9ed35422b85fe..4f1e1911e6a2b 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 4e8c1071c031f..a60d27f43821a 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 5fa371ba626cc..3931d9a1bcef1 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 b8982f4d93de2..5c538431f5454 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 8724f97e8be49..cd537f9e8c34d 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 3f39364bda208..2bc1001935ce7 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 67d18bf4c890f..84014b3cea726 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 0000000000000..f415f7e72ff25 --- /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 a1a858ae2e049..72edfeb14e4fe 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 a43e07dc5f9bf..ec8ec2c330ba4 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/173] 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 704cd47daecc0..8cddf78a6beda 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 4f1e1911e6a2b..452c785733943 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 a60d27f43821a..4bc707e5536b7 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 5c538431f5454..dce07b6959241 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 2bc1001935ce7..b5132129033d4 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 84014b3cea726..6cf222883c285 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 f415f7e72ff25..6ae6c6cdb8d7f 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 72edfeb14e4fe..383b66c519d2b 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/173] Add call.cc --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index ab66b6f652ec7..29f8d7c24f9e7 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/173] 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 8cddf78a6beda..fe9175625d7ac 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/173] 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 fe9175625d7ac..8d9412c9b6a49 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 52913fbf0f9b6..1b4b463d35983 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 6ae6c6cdb8d7f..9f8d9364b18b5 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/173] 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 383b66c519d2b..a68c807dd22f5 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/173] 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 dce07b6959241..d0abd586ad1ac 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 cd537f9e8c34d..1814bfa4f7f08 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 a68c807dd22f5..55adb5bea51b7 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/173] 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 1814bfa4f7f08..37cde1af9a97a 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/173] 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 620de5e67fb46..3077e0af66c29 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 0000000000000..6e50c43493c81 --- /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 cf274520107a4..f9a40b302d31b 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 37cde1af9a97a..ecae429af50d1 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 add22cc3d8685..66e2055af099f 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/173] 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 d0abd586ad1ac..fee70f4fdcf28 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/173] 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 3931d9a1bcef1..ae86683f0b956 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 f9a40b302d31b..8b4c81bc87334 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 1abdf702e212a..ac1b9ddc50544 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 66e2055af099f..8d8276ca00260 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/173] 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 ac1b9ddc50544..4965f1870873d 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 c53f7a7517a3f..8a28c8770407a 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/173] 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 fee70f4fdcf28..4d4581d00f0d3 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/173] 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 982cd3b43e197..5c44d70fadb2b 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 aea0a33bad75a..1504c027deb16 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 ad82174894b57..c8375e65b6226 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/173] 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 fe2c5d936782b..0000000000000 --- 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 c038286ac136e..0000000000000 --- 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 8d9412c9b6a49..5aa96d33b9649 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 4bc707e5536b7..8033fd12058d9 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 a84119800b77f..0000000000000 --- 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 5c44d70fadb2b..982cd3b43e197 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 55adb5bea51b7..31c1fb9286991 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 86faa07b31733..0000000000000 --- 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 4965f1870873d..18c063bb381a5 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/173] 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 6d382ca3db210..1ab1fdaefcda3 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 7d35f79af098a..e3fc12cc66b2e 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 452c785733943..79466c9fda07c 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 75fec356dd47d..bb16e64c96935 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 3077e0af66c29..0fb4f79b595ed 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 ae86683f0b956..670ffa781544f 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 47fd6cf1c8591..9fd3ab1689f38 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 4d4581d00f0d3..30af678c69d68 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 18c063bb381a5..1f48e83b880a0 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 ec8ec2c330ba4..15efd1892dc05 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 c7b2b2e46dcfe..e2ad78a6f2b6a 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 f18b6c00bceff..0000000000000 --- 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 a277061acecb2..0000000000000 --- 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/173] 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 1ab1fdaefcda3..4918fbc19af06 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 e3fc12cc66b2e..3bedddfcd1fef 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 6e50c43493c81..0684f322d8d7c 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 ecae429af50d1..908b38f88e15d 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 8d8276ca00260..d6bcb9313aa54 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 e4f344dbb935f..0000000000000 --- 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 8def589841b32..0000000000000 --- 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/173] 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 4d4581d00f0d3..cd416f853b3b1 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/173] 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 4918fbc19af06..faa94d5a105d4 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 3bedddfcd1fef..bd4fcb9fd1374 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 9fd3ab1689f38..4af9fd6aaac61 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 b5132129033d4..24bd7adaad488 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 31c1fb9286991..d7d616407e0ef 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 1f48e83b880a0..5d44ab2ba42e8 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 bf02de8b805c5..0000000000000 --- 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 15efd1892dc05..0000000000000 --- 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/173] 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 34604191e53b4..22dc44efe409d 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 9955eb306f051..0000000000000 --- 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/173] Cleanup --- Makefile | 36 +----------------------------------- build.json | 16 ---------------- 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/Makefile b/Makefile index faa94d5a105d4..02fd48728bf48 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 bd4fcb9fd1374..f42c77c96c651 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/173] 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 34737ae6ed9d5..db3e3784da7be 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 4dea77ea8118d..94a04aed37d78 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 0fa76f0e02326..29bbe4d931d18 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 8a6be57929458..a8399779b96dd 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 c35d9ebdd87c4..4e1d2cab0e6b9 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 197dc3b2bac7f..2ab3f50bb28e9 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/173] 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 fda8909a02580..736e6da319d5a 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 94a04aed37d78..52deb0f32dae0 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/173] 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 f8ec2c65220f2..9025f7c21f851 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/173] 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 5aa96d33b9649..94215bfa98623 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 79466c9fda07c..c128a08a9f97e 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 8033fd12058d9..641d599c7ea95 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 22dc44efe409d..ca32d60810dd5 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 24bd7adaad488..a1539e4711d7a 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 6cf222883c285..894f87698cedf 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 9f8d9364b18b5..d3a9de3620eea 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 d7d616407e0ef..cbeda81a0bcbd 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/173] 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 02fd48728bf48..3a61f79fb3931 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 f42c77c96c651..fdb32ebf717cb 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 c128a08a9f97e..3631ea4d5d3ab 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 641d599c7ea95..c976bd5b45417 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 0000000000000..091430b884da5 --- /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 908b38f88e15d..bced4df39b52c 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 0000000000000..e652750e22a01 --- /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/173] 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 94215bfa98623..de789febe6eaf 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 ca32d60810dd5..631183ea55c63 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/173] 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 631183ea55c63..c30825a7a5768 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/173] 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 bced4df39b52c..d04c2efcc49b4 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/173] 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 3a61f79fb3931..f2884fd8e5e40 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 fdb32ebf717cb..602d7752a1c2e 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 c30825a7a5768..57ca86ad706e9 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 a1539e4711d7a..da94739ea0d29 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 e652750e22a01..8598592068563 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 d3a9de3620eea..0315ffb6bdd9d 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/173] 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 7b33a4d86198d..4ccb5a4dd593e 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 ee8e8588c705a..cc7094a0ce278 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 05014c631c7b9..55e434433d382 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 ee0f96a5803f4..0415949dacda9 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/173] 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 0415949dacda9..972ac28cd2677 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/173] 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 de789febe6eaf..91f3f5844399a 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 0315ffb6bdd9d..37e374bad3175 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/173] 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 972ac28cd2677..81eaf4fc940e0 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/173] 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 972ac28cd2677..8455ccf5c9855 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/173] 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 0000000000000..fc80ad1c867bf --- /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 4ccb5a4dd593e..7733f8bb2aede 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 81eaf4fc940e0..b28a52bcbdd25 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 eb26ff14f00bd..ab7c683e45227 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 fa5df5f52604e..cb477144d3f62 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 ad01fe7081361..0d4822ec91b40 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 6b60c4da65163..fe3f05fa954a6 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 5878058c982bf..86ee405964bfe 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 7e7bec0160c09..8e5b1014f54b8 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 2c23f37e0c3d6..67b1577014275 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 99d1a2638648f..5c9109f9629f9 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 0f046ae2d2375..280bf98c167f9 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/173] 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 5d44ab2ba42e8..44c5276b54a08 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/173] 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 670ffa781544f..eefd4457f9527 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 44c5276b54a08..f5bbfdc6f733c 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/173] 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 91f3f5844399a..edc6555b0c494 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 37e374bad3175..1aa79d4615007 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/173] 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 edc6555b0c494..139604a531b1a 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 1aa79d4615007..2ff6007f71d25 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/173] 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 2ff6007f71d25..8dfe583653d5b 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/173] 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 8dfe583653d5b..5a6656900ed55 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/173] 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 622181b15b690..ea0ce66fbe396 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 e6993acd6e8d9..77a737031ad20 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 c976bd5b45417..7f0677b4e5ffa 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 edc6555b0c494..11e193eec1670 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 eefd4457f9527..b02c4130d9c8e 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 4af9fd6aaac61..a58e63aff241f 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 f5bbfdc6f733c..02fb383394a70 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 467cc80e055eb..0edadd870904f 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 c6016b7635750..0000000000000 --- 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/173] 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 7f0677b4e5ffa..3e68cf37760af 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 d5a865df05ae2..e8492e0e9543a 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 5a6656900ed55..2b47eb74c3ab8 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 02fb383394a70..6d014a55f3640 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/173] 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 d5a865df05ae2..141b16ab5bfc5 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 b28a52bcbdd25..93994e6bdda80 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 5a6656900ed55..59630a82dac26 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/173] 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 a58e63aff241f..790dd7116b49c 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 cbeda81a0bcbd..f69ddc3b7e004 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 0edadd870904f..7e0bc4de36ac5 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/173] 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 59630a82dac26..b2cd55fe24599 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/173] 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 b02c4130d9c8e..daa3f0a6617a8 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 7733f8bb2aede..561bc9a5a9515 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 93994e6bdda80..c5f49a091ece9 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 6d014a55f3640..5f59a382c563a 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/173] 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 0cf6bdc647e7e..a6e8ccc67c473 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 141b16ab5bfc5..d0cb9024ba629 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 7bda2d07c317a..5c2772f5dfba2 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 8598592068563..73be3cff8c132 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 b2cd55fe24599..f97240d067c4d 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/173] 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 c5f49a091ece9..3f1c2add55ec2 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/173] 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 5f59a382c563a..049c3e36b2625 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/173] 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 3631ea4d5d3ab..b0366faabb90c 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 d0cb9024ba629..bc1a3d847d215 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 daa3f0a6617a8..98f3f1719755d 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 f97240d067c4d..4d465e0a6f4fd 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 049c3e36b2625..8974850b8ceaf 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/173] 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 141b16ab5bfc5..40939e458fae7 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 b2cd55fe24599..22fad2f4398a8 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/173] 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 8fed305ac643b..5922e2581a989 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 57ca86ad706e9..85a7261fb92cf 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 73be3cff8c132..682539861243c 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 607958df89f83..765baa06caec3 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/173] 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 765baa06caec3..61488553374d5 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/173] 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 52deb0f32dae0..2aaecb4e119c7 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/173] 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 790dd7116b49c..6fa01f5f19656 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 8974850b8ceaf..4392739367593 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 7e0bc4de36ac5..2bf4104d76696 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/173] 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 ea579cf4a520b..7d78bfa0cc1ea 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/173] 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 3f1c2add55ec2..3f76138d1cea4 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/173] 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 a6e8ccc67c473..91293d112316a 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 85a7261fb92cf..2791468490dcc 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 5c2772f5dfba2..afacc81c168bf 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 61488553374d5..a954525b7d89a 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/173] 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 5922e2581a989..9ac92a00dd9f4 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 61488553374d5..84791aa0a4646 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 4392739367593..2ee858154861c 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/173] 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 3f76138d1cea4..80b248ee84eaf 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 2ee858154861c..1c95ab21bd6a0 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/173] 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 0b3d4eab7c6e2..b9131e381c12a 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 20e4e07c49d7a..1e908a5ba51fb 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 b1890cf6e735a..71b4a0cbabe9c 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 fed8fb10bfb69..75ecc7a822d5c 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/173] 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 ffbc599d57362..6b1d99f739a26 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/173] 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 9ac92a00dd9f4..f4b07625bee8d 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 682539861243c..30bf2d0fc2187 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 6b1d99f739a26..d90ef0311e4ae 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 1c95ab21bd6a0..be3d225630278 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/173] 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 91293d112316a..0a81f6a366648 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 f4b07625bee8d..a1ef9268f0c63 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 0fb4f79b595ed..c201676065e98 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 6fa01f5f19656..a30f6cb51d095 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 2791468490dcc..4a804c7c9029c 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 7d78bfa0cc1ea..65d11f16c756b 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 30bf2d0fc2187..bc0e83733a266 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 d90ef0311e4ae..a20d4a0d9a62b 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 be3d225630278..17b0543bcd3a9 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 2bf4104d76696..06eeb39297511 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/173] 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 65d11f16c756b..37cdb9d2e5dee 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/173] 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 4a804c7c9029c..a59ccd8c051e4 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 411dbabfd3261..a8fdeed87f941 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/173] Run build cleaner --- Makefile | 10 +++++----- build.json | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 24a1141178e53..21bb9683001dc 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 4895c793bd037..0b46bc2109bbf 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/173] 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 fc740fec925c7..dab819c51bab0 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 75ecc7a822d5c..8c174d9159a21 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 71b4a0cbabe9c..7ef520b7b608a 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 75ecc7a822d5c..8c174d9159a21 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 c5130eee5e789..8b3b853cce728 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 50f319066f145..6fac8464227f0 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/173] 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 6527fef846f97..17f37d6719f9b 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 695ddbca7d624..a71e3a773685e 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 d8624a3003720..f7394a25b0302 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 6a6c792b2653e..be4beb537a62c 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 76e298d8027f2..637a9ffe1cf6e 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 693f81ef96d37..fff83dcbf0b42 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 3924991a787ab..2b520046bb5b4 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 851d0cb865579..ac248f9be0e5c 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 9b6230db15d7d..ab03479586843 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/173] 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 561bc9a5a9515..f6c7da4654ab3 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/173] 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 a1ef9268f0c63..5fafd0e89046d 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 a59ccd8c051e4..6da1be4e9fea9 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 a20d4a0d9a62b..aae69084eb480 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/173] 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 6da1be4e9fea9..be518c61ed616 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/173] 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 a30f6cb51d095..6cc3716291c02 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 be518c61ed616..6265310c5a823 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 17b0543bcd3a9..630b16ba0b28c 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 06eeb39297511..1823dfc81b05e 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/173] 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 d04c2efcc49b4..e29cfadcefba1 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/173] 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 f6c7da4654ab3..bd766b55b3e31 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 2558a1eb9f9dd..11f9b05663dc9 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 091f0aab1a644..e362dd1e6ce8d 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 480c8827943ca..19056ba23e861 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 80b248ee84eaf..22588194ea3b3 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 50574d66a404c..c8861f420d840 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 5ba7d47efd97a..3b6abb7d032a8 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 17b0543bcd3a9..938a549d4fafd 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 e906f302cf63f..ae6994ef07187 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/173] 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 0a81f6a366648..f74de8fad4ff9 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 5fafd0e89046d..a1ef9268f0c63 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 6265310c5a823..74e7539aa4756 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/173] 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 ea5d3651546e0..90a2863b0ce52 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/173] 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 74e7539aa4756..52a764bfc4efb 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/173] 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 0684f322d8d7c..30654553adeaa 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 98f3f1719755d..77aac75076ed5 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 8b4c81bc87334..a550a53afb5b5 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 e29cfadcefba1..4a31ff949e8a9 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 90a2863b0ce52..20dd135a86f93 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 d6bcb9313aa54..dd23e929b1569 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/173] 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 6cc3716291c02..e976e118147cf 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 52a764bfc4efb..6dc05bc9a6bf2 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/173] 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 6dc05bc9a6bf2..53c070ab2bbc7 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/173] 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 53c070ab2bbc7..4c54737a5592e 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/173] 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 4a31ff949e8a9..6ef2128afd238 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/173] 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 30654553adeaa..19432522dfd93 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 77aac75076ed5..8050ef8c9d6f3 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 6dc05bc9a6bf2..c013afb1413ab 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 4a31ff949e8a9..d1a7bd2b88c9b 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 20dd135a86f93..b4620868b8a85 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/173] 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 2f37cc4075eb3..4bc540cb5775e 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/173] 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 19432522dfd93..cac2be30abab1 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 e976e118147cf..fcca85594a1f4 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 b4620868b8a85..7d198347999e3 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 1823dfc81b05e..9e02ac5a3c5c9 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/173] 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 2f37cc4075eb3..23387e78ab3a3 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/173] 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 82adcdb5e2d31..7ef520b7b608a 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 8acd1e88b282a..8c174d9159a21 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/173] 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 4bc540cb5775e..1821d6663567a 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 aa9be6db87daa..1ab4c29451ca4 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 bc0e83733a266..1221630a35c7e 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/173] 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 a1ef9268f0c63..853f19e9b31c9 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 22588194ea3b3..169fb1a78132f 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 aae69084eb480..d706ec45e51ac 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 7d198347999e3..294eeae585088 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 2aaecb4e119c7..4fda5808bdb21 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/173] 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 f74de8fad4ff9..5ff60a5399bfa 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 1221630a35c7e..99030a2d476ec 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/173] 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 5ff60a5399bfa..ab5965f55a98e 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 3e68cf37760af..80874cd1e6961 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 853f19e9b31c9..7aa22ee7c25b0 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 99030a2d476ec..69f0b77d7b86b 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/173] 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 cac2be30abab1..fde5962107a21 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 fcca85594a1f4..64091a4505ddb 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 9e02ac5a3c5c9..21a61af3a0482 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/173] 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 5342145842e78..7753a174f86e1 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 0b46bc2109bbf..53e132a9759ac 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 fde5962107a21..221664befe267 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 fd33deea4dcda..359a272e7b717 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 1ab4c29451ca4..a34aa4e568ea1 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 0000000000000..52fb80e8db32e --- /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 7d02dca2d10db..b69faad26ca5c 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/173] 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 d706ec45e51ac..3f9b4852b95ef 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/173] 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 69f0b77d7b86b..b6bd81d93fca2 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/173] 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 359a272e7b717..6f2441ff92607 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/173] 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 169fb1a78132f..4ae6f5d9559aa 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/173] 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 7aa22ee7c25b0..af1c710098fd8 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 6f2441ff92607..ecc28f62160f9 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 69f0b77d7b86b..d68d7a9242f60 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 3f9b4852b95ef..fe8859de94480 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/173] 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 52fb80e8db32e..25f8111ca80c5 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/173] 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 25f8111ca80c5..62c7e40ed2ad8 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/173] 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 64091a4505ddb..423ebf2337737 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 ecc28f62160f9..6ee550bd644d9 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 a34aa4e568ea1..2a9895e43c4e0 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 62c7e40ed2ad8..b85aabf09e11b 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/173] 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 2a9895e43c4e0..60dc02d7af9cd 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/173] 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 b85aabf09e11b..35c068549aab1 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/173] 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 423ebf2337737..31b09ee7a87e7 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/173] 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 4fda5808bdb21..974717f6e2e52 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 29bbe4d931d18..57a503f84f983 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/173] 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 ab5965f55a98e..3912e52eceacb 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 423ebf2337737..ec7b8062f9983 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 afacc81c168bf..64a829630d106 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 35c068549aab1..fbf9bcb11799f 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 1a61b17afd89aba4c7954a06a70bbaa3f17d6627 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 11:53:47 -0800 Subject: [PATCH 111/173] Copyright checker Update LICENSE text to 2015, implement a checker that validates whether a 2014 or 2015 version of the license is on each {.c,.cc,.h} file. Fix the ones that are missing it. --- LICENSE | 2 +- src/core/support/cpu_windows.c | 62 +++++++++++++-------------- src/core/surface/call_details.c | 33 ++++++++++++++ src/core/surface/metadata_array.c | 33 ++++++++++++++ src/php/ext/grpc/byte_buffer.c | 33 ++++++++++++++ src/php/ext/grpc/byte_buffer.h | 33 ++++++++++++++ src/php/ext/grpc/call.c | 33 ++++++++++++++ src/php/ext/grpc/call.h | 33 ++++++++++++++ src/php/ext/grpc/channel.c | 33 ++++++++++++++ src/php/ext/grpc/channel.h | 33 ++++++++++++++ src/php/ext/grpc/completion_queue.c | 33 ++++++++++++++ src/php/ext/grpc/completion_queue.h | 33 ++++++++++++++ src/php/ext/grpc/credentials.c | 33 ++++++++++++++ src/php/ext/grpc/credentials.h | 33 ++++++++++++++ src/php/ext/grpc/event.c | 33 ++++++++++++++ src/php/ext/grpc/event.h | 33 ++++++++++++++ src/php/ext/grpc/php_grpc.c | 33 ++++++++++++++ src/php/ext/grpc/php_grpc.h | 33 ++++++++++++++ src/php/ext/grpc/server.c | 33 ++++++++++++++ src/php/ext/grpc/server.h | 33 ++++++++++++++ src/php/ext/grpc/server_credentials.c | 33 ++++++++++++++ src/php/ext/grpc/server_credentials.h | 33 ++++++++++++++ src/php/ext/grpc/timeval.c | 33 ++++++++++++++ src/php/ext/grpc/timeval.h | 33 ++++++++++++++ test/build/openssl-alpn.c | 33 ++++++++++++++ test/build/perftools.c | 33 ++++++++++++++ test/build/protobuf.cc | 33 ++++++++++++++ test/build/zlib.c | 33 ++++++++++++++ tools/distrib/check_copyright.py | 49 +++++++++++++++++++++ 29 files changed, 939 insertions(+), 32 deletions(-) create mode 100755 tools/distrib/check_copyright.py diff --git a/LICENSE b/LICENSE index f4988b4507993..0209b570e10da 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c index c533f9d554b20..9a460cc484455 100644 --- a/src/core/support/cpu_windows.c +++ b/src/core/support/cpu_windows.c @@ -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 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 diff --git a/src/core/surface/call_details.c b/src/core/surface/call_details.c index 51c05da640f33..67862d7afe188 100644 --- a/src/core/surface/call_details.c +++ b/src/core/surface/call_details.c @@ -1,3 +1,36 @@ +/* + * + * 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 diff --git a/src/core/surface/metadata_array.c b/src/core/surface/metadata_array.c index 7a230037d591a..4010977497598 100644 --- a/src/core/surface/metadata_array.c +++ b/src/core/surface/metadata_array.c @@ -1,3 +1,36 @@ +/* + * + * 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 diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c index 29d6fa03579d7..1ced1bf3f033e 100644 --- a/src/php/ext/grpc/byte_buffer.c +++ b/src/php/ext/grpc/byte_buffer.c @@ -1,3 +1,36 @@ +/* + * + * 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. + * + */ + #ifdef HAVE_CONFIG_H #include "config.h" #endif diff --git a/src/php/ext/grpc/byte_buffer.h b/src/php/ext/grpc/byte_buffer.h index b83f734caf337..7a40638591f33 100644 --- a/src/php/ext/grpc/byte_buffer.h +++ b/src/php/ext/grpc/byte_buffer.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_ #define NET_GRPC_PHP_GRPC_BYTE_BUFFER_H_ diff --git a/src/php/ext/grpc/call.c b/src/php/ext/grpc/call.c index 3bc9ce2bead48..df0635dc72725 100644 --- a/src/php/ext/grpc/call.c +++ b/src/php/ext/grpc/call.c @@ -1,3 +1,36 @@ +/* + * + * 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 "call.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/call.h b/src/php/ext/grpc/call.h index ba1f1e797fbac..827e9a27a874c 100644 --- a/src/php/ext/grpc/call.h +++ b/src/php/ext/grpc/call.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_CALL_H_ #define NET_GRPC_PHP_GRPC_CALL_H_ diff --git a/src/php/ext/grpc/channel.c b/src/php/ext/grpc/channel.c index 2ab229f5e6700..d6296f94130ee 100644 --- a/src/php/ext/grpc/channel.c +++ b/src/php/ext/grpc/channel.c @@ -1,3 +1,36 @@ +/* + * + * 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 "channel.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/channel.h b/src/php/ext/grpc/channel.h index e36f13022561e..f426a25cafcbf 100755 --- a/src/php/ext/grpc/channel.h +++ b/src/php/ext/grpc/channel.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_CHANNEL_H_ #define NET_GRPC_PHP_GRPC_CHANNEL_H_ diff --git a/src/php/ext/grpc/completion_queue.c b/src/php/ext/grpc/completion_queue.c index 3a93bfcff7648..30c871b078319 100644 --- a/src/php/ext/grpc/completion_queue.c +++ b/src/php/ext/grpc/completion_queue.c @@ -1,3 +1,36 @@ +/* + * + * 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 "completion_queue.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/completion_queue.h b/src/php/ext/grpc/completion_queue.h index 6bf5b1612454c..6ce1df7c8cddf 100755 --- a/src/php/ext/grpc/completion_queue.h +++ b/src/php/ext/grpc/completion_queue.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ #define NET_GRPC_PHP_GRPC_COMPLETION_QUEUE_H_ diff --git a/src/php/ext/grpc/credentials.c b/src/php/ext/grpc/credentials.c index 46c825a48fa7a..f25e042dd7f9c 100644 --- a/src/php/ext/grpc/credentials.c +++ b/src/php/ext/grpc/credentials.c @@ -1,3 +1,36 @@ +/* + * + * 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 "credentials.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/credentials.h b/src/php/ext/grpc/credentials.h index ba2aa898e7244..3ff75af9dbe51 100755 --- a/src/php/ext/grpc/credentials.h +++ b/src/php/ext/grpc/credentials.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_CREDENTIALS_H_ #define NET_GRPC_PHP_GRPC_CREDENTIALS_H_ diff --git a/src/php/ext/grpc/event.c b/src/php/ext/grpc/event.c index b4069f72f0089..8d398450a4d75 100644 --- a/src/php/ext/grpc/event.c +++ b/src/php/ext/grpc/event.c @@ -1,3 +1,36 @@ +/* + * + * 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 "event.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/event.h b/src/php/ext/grpc/event.h index f00c1cc902237..ef5846aee1db2 100755 --- a/src/php/ext/grpc/event.h +++ b/src/php/ext/grpc/event.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_EVENT_H_ #define NET_GRPC_PHP_GRPC_EVENT_H_ diff --git a/src/php/ext/grpc/php_grpc.c b/src/php/ext/grpc/php_grpc.c index 492ac067398a7..67e366c385dc0 100644 --- a/src/php/ext/grpc/php_grpc.c +++ b/src/php/ext/grpc/php_grpc.c @@ -1,3 +1,36 @@ +/* + * + * 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 "call.h" #include "channel.h" #include "server.h" diff --git a/src/php/ext/grpc/php_grpc.h b/src/php/ext/grpc/php_grpc.h index 53cc5dcf6e372..1d4834c50fa32 100644 --- a/src/php/ext/grpc/php_grpc.h +++ b/src/php/ext/grpc/php_grpc.h @@ -1,3 +1,36 @@ +/* + * + * 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 PHP_GRPC_H #define PHP_GRPC_H diff --git a/src/php/ext/grpc/server.c b/src/php/ext/grpc/server.c index 47ea38db0c90b..32cc19775c0c7 100644 --- a/src/php/ext/grpc/server.c +++ b/src/php/ext/grpc/server.c @@ -1,3 +1,36 @@ +/* + * + * 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 "call.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/server.h b/src/php/ext/grpc/server.h index 61ed82538ca87..ecef4c642998b 100755 --- a/src/php/ext/grpc/server.h +++ b/src/php/ext/grpc/server.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_SERVER_H_ #define NET_GRPC_PHP_GRPC_SERVER_H_ diff --git a/src/php/ext/grpc/server_credentials.c b/src/php/ext/grpc/server_credentials.c index 3d43d6a78c704..8aaa86ce947ed 100644 --- a/src/php/ext/grpc/server_credentials.c +++ b/src/php/ext/grpc/server_credentials.c @@ -1,3 +1,36 @@ +/* + * + * 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 "server_credentials.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/server_credentials.h b/src/php/ext/grpc/server_credentials.h index 0a5c78590228c..ce2a4da138c73 100755 --- a/src/php/ext/grpc/server_credentials.h +++ b/src/php/ext/grpc/server_credentials.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_SERVER_CREDENTIALS_H_ #define NET_GRPC_PHP_GRPC_SERVER_CREDENTIALS_H_ diff --git a/src/php/ext/grpc/timeval.c b/src/php/ext/grpc/timeval.c index cbbbf3791562a..5b0142cbe47d4 100644 --- a/src/php/ext/grpc/timeval.c +++ b/src/php/ext/grpc/timeval.c @@ -1,3 +1,36 @@ +/* + * + * 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 "timeval.h" #ifdef HAVE_CONFIG_H diff --git a/src/php/ext/grpc/timeval.h b/src/php/ext/grpc/timeval.h index cfdb0c713f2e8..0e215fc88480b 100755 --- a/src/php/ext/grpc/timeval.h +++ b/src/php/ext/grpc/timeval.h @@ -1,3 +1,36 @@ +/* + * + * 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 NET_GRPC_PHP_GRPC_TIMEVAL_H_ #define NET_GRPC_PHP_GRPC_TIMEVAL_H_ diff --git a/test/build/openssl-alpn.c b/test/build/openssl-alpn.c index f7365770f70d7..f19ecb784b802 100644 --- a/test/build/openssl-alpn.c +++ b/test/build/openssl-alpn.c @@ -1,3 +1,36 @@ +/* + * + * 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. + * + */ + /* This is just a compilation test, to see if we have a version of OpenSSL with ALPN support installed. */ diff --git a/test/build/perftools.c b/test/build/perftools.c index 03548b4c7ef19..a26065eb5ba8a 100644 --- a/test/build/perftools.c +++ b/test/build/perftools.c @@ -1,3 +1,36 @@ +/* + * + * 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 int main() { diff --git a/test/build/protobuf.cc b/test/build/protobuf.cc index 59ead111a66bb..bac33ad7279fb 100644 --- a/test/build/protobuf.cc +++ b/test/build/protobuf.cc @@ -1,3 +1,36 @@ +/* + * + * 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 diff --git a/test/build/zlib.c b/test/build/zlib.c index 75bce9ad16d2c..074bd8771714c 100644 --- a/test/build/zlib.c +++ b/test/build/zlib.c @@ -1,3 +1,36 @@ +/* + * + * 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. + * + */ + /* This is just a compilation test, to see if we have zlib installed. */ #include diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py new file mode 100755 index 0000000000000..1a478532171a5 --- /dev/null +++ b/tools/distrib/check_copyright.py @@ -0,0 +1,49 @@ +#!/usr/bin/python2.7 +import os +import sys +import subprocess + +# find our home +ROOT = os.path.abspath( + os.path.join(os.path.dirname(sys.argv[0]), '../..')) +os.chdir(ROOT) + +# open the license text +with open('LICENSE') as f: + LICENSE = f.read().splitlines() + +# license format by file extension +# key is the file extension, value is a format string +# that given a line of license text, returns what should +# be in the file +LICENSE_FMT = { + '.c': ' * %s', + '.cc': ' * %s', + '.h': ' * %s', +} + +# pregenerate the actual text that we should have +LICENSE_TEXT = dict( + (k, '\n'.join((v % line).rstrip() for line in LICENSE)) + for k, v in LICENSE_FMT.iteritems()) + +OLD_LICENSE_TEXT = dict( + (k, v.replace('2015', '2014')) for k, v in LICENSE_TEXT.iteritems()) + +# scan files, validate the text +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: continue + license = LICENSE_TEXT[ext] + old_license = OLD_LICENSE_TEXT[ext] + with open(filename) as f: + text = '\n'.join(line.rstrip() for line in f.read().splitlines()) + if license in text: + pass + elif old_license in text: + pass + #print 'old license in: %s' % filename + else: + print 'no license in: %s' % filename + From c2c792113eaef0093b7cb933d9bff844661d673f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:00:01 -0800 Subject: [PATCH 112/173] Add copyrights to Python code --- src/python/src/__init__.py | 30 +++++++++++++++++ src/python/src/_adapter/__init__.py | 30 +++++++++++++++++ ...blocking_invocation_inline_service_test.py | 29 +++++++++++++++++ src/python/src/_framework/__init__.py | 30 +++++++++++++++++ src/python/src/_framework/base/__init__.py | 30 +++++++++++++++++ .../src/_framework/base/packets/__init__.py | 30 +++++++++++++++++ src/python/src/_framework/common/__init__.py | 30 +++++++++++++++++ src/python/src/_framework/face/__init__.py | 30 +++++++++++++++++ .../src/_framework/face/testing/__init__.py | 30 +++++++++++++++++ .../src/_framework/foundation/__init__.py | 30 +++++++++++++++++ src/python/src/_junkdrawer/__init__.py | 30 +++++++++++++++++ test/core/end2end/gen_build_json.py | 29 +++++++++++++++++ tools/buildgen/build-cleaner.py | 29 +++++++++++++++++ tools/buildgen/bunch.py | 29 +++++++++++++++++ tools/buildgen/mako_renderer.py | 29 +++++++++++++++++ tools/buildgen/plugins/expand_filegroups.py | 29 +++++++++++++++++ tools/buildgen/plugins/generate_vsprojects.py | 29 +++++++++++++++++ tools/buildgen/plugins/list_protos.py | 29 +++++++++++++++++ tools/distrib/check_copyright.py | 32 +++++++++++++++++++ tools/run_tests/jobset.py | 29 +++++++++++++++++ tools/run_tests/run_tests.py | 32 ++++++++++++++++++- tools/run_tests/watch_dirs.py | 29 +++++++++++++++++ 22 files changed, 653 insertions(+), 1 deletion(-) diff --git a/src/python/src/__init__.py b/src/python/src/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/__init__.py +++ b/src/python/src/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_adapter/__init__.py b/src/python/src/_adapter/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_adapter/__init__.py +++ b/src/python/src/_adapter/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_adapter/_blocking_invocation_inline_service_test.py b/src/python/src/_adapter/_blocking_invocation_inline_service_test.py index 873ce9a5a46b7..ec95cfd38c364 100644 --- a/src/python/src/_adapter/_blocking_invocation_inline_service_test.py +++ b/src/python/src/_adapter/_blocking_invocation_inline_service_test.py @@ -1,3 +1,32 @@ +# 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. + """One of the tests of the Face layer of RPC Framework.""" import unittest diff --git a/src/python/src/_framework/__init__.py b/src/python/src/_framework/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/__init__.py +++ b/src/python/src/_framework/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/base/__init__.py b/src/python/src/_framework/base/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/base/__init__.py +++ b/src/python/src/_framework/base/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/base/packets/__init__.py b/src/python/src/_framework/base/packets/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/base/packets/__init__.py +++ b/src/python/src/_framework/base/packets/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/common/__init__.py b/src/python/src/_framework/common/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/common/__init__.py +++ b/src/python/src/_framework/common/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/face/__init__.py b/src/python/src/_framework/face/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/face/__init__.py +++ b/src/python/src/_framework/face/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/face/testing/__init__.py b/src/python/src/_framework/face/testing/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/face/testing/__init__.py +++ b/src/python/src/_framework/face/testing/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_framework/foundation/__init__.py b/src/python/src/_framework/foundation/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_framework/foundation/__init__.py +++ b/src/python/src/_framework/foundation/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/_junkdrawer/__init__.py b/src/python/src/_junkdrawer/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/_junkdrawer/__init__.py +++ b/src/python/src/_junkdrawer/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index fd7012608e6e2..0e3ea41c16ea4 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -1,4 +1,33 @@ #!/usr/bin/python2.7 +# 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 the appropriate build.json data for all the end2end tests.""" diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 6477ad202fac0..478ff4c58dc27 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -1,4 +1,33 @@ #!/usr/bin/python +# 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. + # produces cleaner build.json files import collections diff --git a/tools/buildgen/bunch.py b/tools/buildgen/bunch.py index e859d53388bb9..0db8792523300 100755 --- a/tools/buildgen/bunch.py +++ b/tools/buildgen/bunch.py @@ -1,3 +1,32 @@ +# 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. + """Allows dot-accessible dictionaries.""" diff --git a/tools/buildgen/mako_renderer.py b/tools/buildgen/mako_renderer.py index 18f6eeaba6c9e..f0dc818c0c0e6 100755 --- a/tools/buildgen/mako_renderer.py +++ b/tools/buildgen/mako_renderer.py @@ -1,4 +1,33 @@ #!/usr/bin/python2.7 +# 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. + """Simple Mako renderer. diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index 108debefd55fb..f63072cc5c344 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -1,3 +1,32 @@ +# 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. + """Buildgen expand filegroups plugin. This takes the list of libs from our json dictionary, diff --git a/tools/buildgen/plugins/generate_vsprojects.py b/tools/buildgen/plugins/generate_vsprojects.py index 982e6812e6172..6cbd74df6679b 100755 --- a/tools/buildgen/plugins/generate_vsprojects.py +++ b/tools/buildgen/plugins/generate_vsprojects.py @@ -1,3 +1,32 @@ +# 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. + """Buildgen vsprojects plugin. This parses the list of libraries, and generates globals "vsprojects" diff --git a/tools/buildgen/plugins/list_protos.py b/tools/buildgen/plugins/list_protos.py index c5a09dd4d0bf3..f12d7260bd1c5 100755 --- a/tools/buildgen/plugins/list_protos.py +++ b/tools/buildgen/plugins/list_protos.py @@ -1,3 +1,32 @@ +# 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. + """Buildgen .proto files list plugin. This parses the list of targets from the json build file, and creates diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 1a478532171a5..7d1045f1e5cf2 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -1,4 +1,35 @@ #!/usr/bin/python2.7 + +# 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 os import sys import subprocess @@ -20,6 +51,7 @@ '.c': ' * %s', '.cc': ' * %s', '.h': ' * %s', + '.py': '# %s', } # pregenerate the actual text that we should have diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index 19ae52ef3b837..df83b30516bce 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -1,3 +1,32 @@ +# 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. + """Run a group of subprocesses and then finish.""" import hashlib diff --git a/tools/run_tests/run_tests.py b/tools/run_tests/run_tests.py index 0f3222b78cd32..72a4b0cd122b8 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -1,4 +1,33 @@ #!/usr/bin/python2.7 +# 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. + """Run tests in parallel.""" import argparse @@ -136,6 +165,7 @@ def build_steps(self): nargs='+', default=_DEFAULT) argp.add_argument('-n', '--runs_per_test', default=1, type=int) +argp.add_argument('-j', '--jobs', default=1000, type=int) argp.add_argument('-f', '--forever', default=False, action='store_const', @@ -225,7 +255,7 @@ def _build_and_run(check_cancelled, newline_on_success, cache): itertools.repeat(one_run, runs_per_test)) if not jobset.run(all_runs, check_cancelled, newline_on_success=newline_on_success, - maxjobs=min(c.maxjobs for c in run_configs), + maxjobs=min(args.jobs, min(c.maxjobs for c in run_configs)), cache=cache): return 2 diff --git a/tools/run_tests/watch_dirs.py b/tools/run_tests/watch_dirs.py index f83192e5f805d..21ef23e158079 100755 --- a/tools/run_tests/watch_dirs.py +++ b/tools/run_tests/watch_dirs.py @@ -1,3 +1,32 @@ +# 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. + """Helper to watch a (set) of directories for modifications.""" import os From 52b2bec43c28c2121a431889b86dbe5879c1a237 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:01:08 -0800 Subject: [PATCH 113/173] Add ruby --- tools/distrib/check_copyright.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 7d1045f1e5cf2..571686b087134 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -52,6 +52,7 @@ '.cc': ' * %s', '.h': ' * %s', '.py': '# %s', + '.rb': '# %s', } # pregenerate the actual text that we should have From 2e498aa24d88f4c289f124ad8f629050e8e24528 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:09:31 -0800 Subject: [PATCH 114/173] Add PHP Copyright --- .../lib/Grpc/AbstractSurfaceActiveCall.php | 36 ++++++++++++++++++- src/php/lib/Grpc/ActiveCall.php | 34 +++++++++++++++++- src/php/lib/Grpc/BaseStub.php | 32 +++++++++++++++++ .../Grpc/BidiStreamingSurfaceActiveCall.php | 34 +++++++++++++++++- .../Grpc/ClientStreamingSurfaceActiveCall.php | 32 +++++++++++++++++ .../Grpc/ServerStreamingSurfaceActiveCall.php | 32 +++++++++++++++++ src/php/lib/Grpc/SimpleSurfaceActiveCall.php | 32 +++++++++++++++++ src/php/lib/autoload.php | 34 +++++++++++++++++- .../generated_code/GeneratedCodeTest.php | 34 +++++++++++++++++- src/php/tests/interop/interop_client.php | 34 +++++++++++++++++- src/php/tests/unit_tests/CallTest.php | 32 +++++++++++++++++ .../tests/unit_tests/CompletionQueueTest.php | 34 +++++++++++++++++- src/php/tests/unit_tests/EndToEndTest.php | 34 +++++++++++++++++- .../tests/unit_tests/SecureEndToEndTest.php | 34 +++++++++++++++++- src/php/tests/unit_tests/TimevalTest.php | 34 +++++++++++++++++- tools/distrib/check_copyright.py | 3 +- 16 files changed, 494 insertions(+), 11 deletions(-) diff --git a/src/php/lib/Grpc/AbstractSurfaceActiveCall.php b/src/php/lib/Grpc/AbstractSurfaceActiveCall.php index 83e4719c9a861..9d0af090ceb0f 100755 --- a/src/php/lib/Grpc/AbstractSurfaceActiveCall.php +++ b/src/php/lib/Grpc/AbstractSurfaceActiveCall.php @@ -1,4 +1,38 @@ active_call->getStatus(); } -} \ No newline at end of file +} diff --git a/src/php/lib/Grpc/ActiveCall.php b/src/php/lib/Grpc/ActiveCall.php index 847cfee1ec2b0..f0d0d55582502 100755 --- a/src/php/lib/Grpc/ActiveCall.php +++ b/src/php/lib/Grpc/ActiveCall.php @@ -1,4 +1,36 @@ data; } -} \ No newline at end of file +} diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php index ff293c0709cab..fde055a3b327a 100755 --- a/src/php/lib/Grpc/BaseStub.php +++ b/src/php/lib/Grpc/BaseStub.php @@ -1,4 +1,36 @@ _getStatus(); } -} \ No newline at end of file +} diff --git a/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php b/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php index fa643e50a8eb0..d33f09fbe4e36 100755 --- a/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php +++ b/src/php/lib/Grpc/ClientStreamingSurfaceActiveCall.php @@ -1,4 +1,36 @@ getStatus(); $this->assertSame(\Grpc\STATUS_OK, $status->code); } -} \ No newline at end of file +} diff --git a/src/php/tests/interop/interop_client.php b/src/php/tests/interop/interop_client.php index 5266e9a9faca6..5a09fc7d78c79 100755 --- a/src/php/tests/interop/interop_client.php +++ b/src/php/tests/interop/interop_client.php @@ -1,4 +1,36 @@ pluck(0, Grpc\Timeval::zero()); $this->assertNull($event); } -} \ No newline at end of file +} diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index 05104c0e1211a..0cbc506c8e4c2 100755 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -1,4 +1,36 @@ client_queue = new Grpc\CompletionQueue(); @@ -159,4 +191,4 @@ public function testClientServerFullRequestResponse() { unset($call); unset($server_call); } -} \ No newline at end of file +} diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index 5e95b11b44e5a..b19ac80ddd425 100755 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -1,4 +1,36 @@ client_queue = new Grpc\CompletionQueue(); @@ -170,4 +202,4 @@ public function testClientServerFullRequestResponse() { unset($call); unset($server_call); } -} \ No newline at end of file +} diff --git a/src/php/tests/unit_tests/TimevalTest.php b/src/php/tests/unit_tests/TimevalTest.php index 067254b55bf2b..d20069afa11eb 100755 --- a/src/php/tests/unit_tests/TimevalTest.php +++ b/src/php/tests/unit_tests/TimevalTest.php @@ -1,4 +1,36 @@ assertLessThan(0, Grpc\Timeval::compare($zero, $now)); $this->assertLessThan(0, Grpc\Timeval::compare($now, $future)); } -} \ No newline at end of file +} diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 571686b087134..5308fe844558b 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -51,6 +51,7 @@ '.c': ' * %s', '.cc': ' * %s', '.h': ' * %s', + '.php': ' * %s', '.py': '# %s', '.rb': '# %s', } @@ -77,6 +78,6 @@ elif old_license in text: pass #print 'old license in: %s' % filename - else: + elif 'DO NOT EDIT' not in text: print 'no license in: %s' % filename From 834288138d89327492931aae512dda9afaf8879f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:13:57 -0800 Subject: [PATCH 115/173] Add shell script copyrights --- src/php/bin/interop_client.sh | 29 ++++++++++++++++++ src/php/bin/run_gen_code_test.sh | 29 ++++++++++++++++++ src/php/bin/run_tests.sh | 29 ++++++++++++++++++ tools/buildgen/generate_projects.sh | 29 ++++++++++++++++++ tools/distrib/check_copyright.py | 1 + tools/gce_setup/builder.sh | 29 ++++++++++++++++++ tools/gce_setup/cloud_prod_runner.sh | 29 ++++++++++++++++++ tools/gce_setup/compute_extras.sh | 29 ++++++++++++++++++ tools/gce_setup/grpc_docker.sh | 29 ++++++++++++++++++ tools/gce_setup/interop_test_runner.sh | 29 ++++++++++++++++++ tools/gce_setup/new_grpc_docker_builder.sh | 29 ++++++++++++++++++ .../new_grpc_docker_builder_on_startup.sh | 30 +++++++++++++++++++ tools/gce_setup/shared_startup_funcs.sh | 28 +++++++++++++++++ tools/run_tests/build_node.sh | 29 ++++++++++++++++++ tools/run_tests/build_php.sh | 28 +++++++++++++++++ tools/run_tests/build_python.sh | 28 +++++++++++++++++ tools/run_tests/run_lcov.sh | 28 +++++++++++++++++ tools/run_tests/run_node.sh | 28 +++++++++++++++++ tools/run_tests/run_python.sh | 28 +++++++++++++++++ 19 files changed, 518 insertions(+) diff --git a/src/php/bin/interop_client.sh b/src/php/bin/interop_client.sh index e934c8db97864..2e2b12fd44402 100755 --- a/src/php/bin/interop_client.sh +++ b/src/php/bin/interop_client.sh @@ -1,4 +1,33 @@ #!/bin/sh +# 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. + set +e cd $(dirname $0) diff --git a/src/php/bin/run_gen_code_test.sh b/src/php/bin/run_gen_code_test.sh index ff1a618fa39ca..f035a9ba7f068 100755 --- a/src/php/bin/run_gen_code_test.sh +++ b/src/php/bin/run_gen_code_test.sh @@ -1,4 +1,33 @@ # Runs the generated code test against the ruby server +# 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. + 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 \ diff --git a/src/php/bin/run_tests.sh b/src/php/bin/run_tests.sh index 28282c3e37c39..b9946834e93b0 100755 --- a/src/php/bin/run_tests.sh +++ b/src/php/bin/run_tests.sh @@ -1,4 +1,33 @@ #!/bin/sh +# 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. + # Loads the local shared library, and runs all of the test cases in tests/ # against it set -e diff --git a/tools/buildgen/generate_projects.sh b/tools/buildgen/generate_projects.sh index 2e0636fcbed13..9903f0e7835a1 100755 --- a/tools/buildgen/generate_projects.sh +++ b/tools/buildgen/generate_projects.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + set -e diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 5308fe844558b..259ee66e1264d 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -54,6 +54,7 @@ '.php': ' * %s', '.py': '# %s', '.rb': '# %s', + '.sh': '# %s', } # pregenerate the actual text that we should have diff --git a/tools/gce_setup/builder.sh b/tools/gce_setup/builder.sh index 49b3c436feecc..9fd1e1c61e6db 100755 --- a/tools/gce_setup/builder.sh +++ b/tools/gce_setup/builder.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + main() { # restart builder vm and wait for images to sync to it diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index 200f859ede568..ffb5b85822972 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + main() { source grpc_docker.sh diff --git a/tools/gce_setup/compute_extras.sh b/tools/gce_setup/compute_extras.sh index e0def1a7434b0..4dab4c093e976 100755 --- a/tools/gce_setup/compute_extras.sh +++ b/tools/gce_setup/compute_extras.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + # Bash funcs shared that combine common gcutil actions into single commands diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 1c38582cb8100..37e24949f671f 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + # # Contains funcs that help maintain GRPC's Docker images. # diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index 456ad4b4722e9..acdb2e9d2225a 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + thisfile=$(readlink -ne "${BASH_SOURCE[0]}") current_time=$(date "+%Y-%m-%d-%H-%M-%S") result_file_name=interop_result.$current_time.html diff --git a/tools/gce_setup/new_grpc_docker_builder.sh b/tools/gce_setup/new_grpc_docker_builder.sh index ea36cc5606b88..70a2f1254025c 100755 --- a/tools/gce_setup/new_grpc_docker_builder.sh +++ b/tools/gce_setup/new_grpc_docker_builder.sh @@ -1,4 +1,33 @@ #!/bin/bash +# 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. + # Triggers the build of a GCE 'grpc-docker' instance. # 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 cfd05415a0ede..a084fe08d6a08 100755 --- a/tools/gce_setup/new_grpc_docker_builder_on_startup.sh +++ b/tools/gce_setup/new_grpc_docker_builder_on_startup.sh @@ -1,4 +1,34 @@ #!/bin/bash + +# 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. + # Startup script that initializes a grpc-dev GCE machine. # # A grpc-docker GCE machine is based on docker container image. diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index a6f73d16367ef..13bf3124fa3b6 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. # Contains common funcs shared by instance startup scripts. # # The funcs assume that the code is being run on a GCE instance during instance diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh index 4b092982b29a3..85feacfb86c9d 100755 --- a/tools/run_tests/build_node.sh +++ b/tools/run_tests/build_node.sh @@ -1,5 +1,34 @@ #!/bin/bash +# 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. + set -ex CONFIG=${CONFIG:-opt} diff --git a/tools/run_tests/build_php.sh b/tools/run_tests/build_php.sh index 0a8d0c7492386..d32969f39ca27 100755 --- a/tools/run_tests/build_php.sh +++ b/tools/run_tests/build_php.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. set -ex diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh index b45b9d6106ede..b9290bf7e3da6 100755 --- a/tools/run_tests/build_python.sh +++ b/tools/run_tests/build_python.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. set -ex diff --git a/tools/run_tests/run_lcov.sh b/tools/run_tests/run_lcov.sh index 068213a3d2993..7696536141d6c 100755 --- a/tools/run_tests/run_lcov.sh +++ b/tools/run_tests/run_lcov.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. set -ex diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh index 005629594908c..525b34a7095ed 100755 --- a/tools/run_tests/run_node.sh +++ b/tools/run_tests/run_node.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. set -ex diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index 7d3ee73a0e4ec..73b0bd1a129ae 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -1,4 +1,32 @@ #!/bin/bash +# 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. set -ex From 3b93548b1c1c93adf060ccd5bc69618bc2550c94 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:15:48 -0800 Subject: [PATCH 116/173] Add Makefile copyright --- Makefile | 29 +++++++++++++++++++++++++++++ templates/Makefile.template | 29 +++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/Makefile b/Makefile index c7f7e9302dc7a..1fba70ec296b2 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,35 @@ # GRPC global makefile # This currently builds C and C++ code. +# 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. + # Basic platform detection diff --git a/templates/Makefile.template b/templates/Makefile.template index 992b90693288f..22f2873c1c098 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -1,5 +1,34 @@ # GRPC global makefile # This currently builds C and C++ code. + +# 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 re import os From ad1fd3a49e0b3b83cc3d7b606645a6a1f99e10af Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:23:04 -0800 Subject: [PATCH 117/173] Add proto copyrights --- examples/pubsub/empty.proto | 29 ++++++++++++++++++++++++ examples/pubsub/label.proto | 29 ++++++++++++++++++++++++ examples/pubsub/pubsub.proto | 30 +++++++++++++++++++++++++ src/csharp/GrpcApi/proto/empty.proto | 30 +++++++++++++++++++++++++ src/csharp/GrpcApi/proto/math.proto | 30 +++++++++++++++++++++++++ src/csharp/GrpcApi/proto/messages.proto | 30 +++++++++++++++++++++++++ src/csharp/GrpcApi/proto/test.proto | 30 +++++++++++++++++++++++++ src/node/examples/math.proto | 30 +++++++++++++++++++++++++ src/node/interop/empty.proto | 30 +++++++++++++++++++++++++ src/node/interop/messages.proto | 30 +++++++++++++++++++++++++ src/node/interop/test.proto | 30 +++++++++++++++++++++++++ src/ruby/bin/math.proto | 30 +++++++++++++++++++++++++ test/cpp/interop/empty.proto | 30 +++++++++++++++++++++++++ test/cpp/interop/messages.proto | 30 +++++++++++++++++++++++++ test/cpp/interop/test.proto | 30 +++++++++++++++++++++++++ test/cpp/qps/qpstest.proto | 30 +++++++++++++++++++++++++ test/cpp/util/echo.proto | 30 +++++++++++++++++++++++++ test/cpp/util/echo_duplicate.proto | 30 +++++++++++++++++++++++++ test/cpp/util/messages.proto | 30 +++++++++++++++++++++++++ tools/distrib/check_copyright.py | 1 + 20 files changed, 569 insertions(+) diff --git a/examples/pubsub/empty.proto b/examples/pubsub/empty.proto index 86aaa846a2451..c34738fb4a79c 100644 --- a/examples/pubsub/empty.proto +++ b/examples/pubsub/empty.proto @@ -1,5 +1,34 @@ // This file will be moved to a new location. +// 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. + syntax = "proto2"; package proto2; diff --git a/examples/pubsub/label.proto b/examples/pubsub/label.proto index 6ac786f07882b..08350b8ba22b4 100644 --- a/examples/pubsub/label.proto +++ b/examples/pubsub/label.proto @@ -1,5 +1,34 @@ // This file will be moved to a new location. +// 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. + // Labels provide a way to associate user-defined metadata with various // objects. Labels may be used to organize objects into non-hierarchical // groups; think metadata tags attached to mp3s. diff --git a/examples/pubsub/pubsub.proto b/examples/pubsub/pubsub.proto index c330f0cdac731..793cdae9e6f08 100644 --- a/examples/pubsub/pubsub.proto +++ b/examples/pubsub/pubsub.proto @@ -1,5 +1,35 @@ // This file will be moved to a new location. +// 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. + + // Specification of the Pubsub API. syntax = "proto2"; diff --git a/src/csharp/GrpcApi/proto/empty.proto b/src/csharp/GrpcApi/proto/empty.proto index c88b5318cd3dd..c3bb940075baf 100644 --- a/src/csharp/GrpcApi/proto/empty.proto +++ b/src/csharp/GrpcApi/proto/empty.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; package grpc.testing; diff --git a/src/csharp/GrpcApi/proto/math.proto b/src/csharp/GrpcApi/proto/math.proto index e98b99e002a14..074efadf8935a 100644 --- a/src/csharp/GrpcApi/proto/math.proto +++ b/src/csharp/GrpcApi/proto/math.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; package math; diff --git a/src/csharp/GrpcApi/proto/messages.proto b/src/csharp/GrpcApi/proto/messages.proto index 1d95154cf496c..e3814da406e70 100644 --- a/src/csharp/GrpcApi/proto/messages.proto +++ b/src/csharp/GrpcApi/proto/messages.proto @@ -1,3 +1,33 @@ + +// 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. + // Message definitions to be used by integration test service definitions. syntax = "proto2"; diff --git a/src/csharp/GrpcApi/proto/test.proto b/src/csharp/GrpcApi/proto/test.proto index 8380ebb31de74..cce0889bbadda 100644 --- a/src/csharp/GrpcApi/proto/test.proto +++ b/src/csharp/GrpcApi/proto/test.proto @@ -1,3 +1,33 @@ + +// 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. + // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. syntax = "proto2"; diff --git a/src/node/examples/math.proto b/src/node/examples/math.proto index c49787ad54d04..2cf6a036aa4ce 100644 --- a/src/node/examples/math.proto +++ b/src/node/examples/math.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto3"; package math; diff --git a/src/node/interop/empty.proto b/src/node/interop/empty.proto index c9920a22eec08..98fc3a3907050 100644 --- a/src/node/interop/empty.proto +++ b/src/node/interop/empty.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; package grpc.testing; diff --git a/src/node/interop/messages.proto b/src/node/interop/messages.proto index 29db0dd8b1aa0..f53d99ab5b62d 100644 --- a/src/node/interop/messages.proto +++ b/src/node/interop/messages.proto @@ -1,3 +1,33 @@ + +// 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. + // Message definitions to be used by integration test service definitions. syntax = "proto2"; diff --git a/src/node/interop/test.proto b/src/node/interop/test.proto index 8380ebb31de74..cce0889bbadda 100644 --- a/src/node/interop/test.proto +++ b/src/node/interop/test.proto @@ -1,3 +1,33 @@ + +// 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. + // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. syntax = "proto2"; diff --git a/src/ruby/bin/math.proto b/src/ruby/bin/math.proto index c49787ad54d04..2cf6a036aa4ce 100755 --- a/src/ruby/bin/math.proto +++ b/src/ruby/bin/math.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto3"; package math; diff --git a/test/cpp/interop/empty.proto b/test/cpp/interop/empty.proto index c9920a22eec08..98fc3a3907050 100644 --- a/test/cpp/interop/empty.proto +++ b/test/cpp/interop/empty.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; package grpc.testing; diff --git a/test/cpp/interop/messages.proto b/test/cpp/interop/messages.proto index 1d95154cf496c..e3814da406e70 100644 --- a/test/cpp/interop/messages.proto +++ b/test/cpp/interop/messages.proto @@ -1,3 +1,33 @@ + +// 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. + // Message definitions to be used by integration test service definitions. syntax = "proto2"; diff --git a/test/cpp/interop/test.proto b/test/cpp/interop/test.proto index e358f3bea5b1c..fb934ee4db5e0 100644 --- a/test/cpp/interop/test.proto +++ b/test/cpp/interop/test.proto @@ -1,3 +1,33 @@ + +// 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. + // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. syntax = "proto2"; diff --git a/test/cpp/qps/qpstest.proto b/test/cpp/qps/qpstest.proto index 8acbe19b19adc..ffe7ecae56aa5 100644 --- a/test/cpp/qps/qpstest.proto +++ b/test/cpp/qps/qpstest.proto @@ -1,3 +1,33 @@ + +// 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. + // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. syntax = "proto2"; diff --git a/test/cpp/util/echo.proto b/test/cpp/util/echo.proto index bd5357fe19752..01369c540f9cd 100644 --- a/test/cpp/util/echo.proto +++ b/test/cpp/util/echo.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; import "test/cpp/util/messages.proto"; diff --git a/test/cpp/util/echo_duplicate.proto b/test/cpp/util/echo_duplicate.proto index c9266833e22e3..b0b07269cf6dd 100644 --- a/test/cpp/util/echo_duplicate.proto +++ b/test/cpp/util/echo_duplicate.proto @@ -1,3 +1,33 @@ + +// 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. + // This is a partial copy of echo.proto with a different package name. syntax = "proto2"; diff --git a/test/cpp/util/messages.proto b/test/cpp/util/messages.proto index d541821b655a2..3e4b38b839f5c 100644 --- a/test/cpp/util/messages.proto +++ b/test/cpp/util/messages.proto @@ -1,3 +1,33 @@ + +// 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. + syntax = "proto2"; package grpc.cpp.test.util; diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 259ee66e1264d..19e227a805324 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -55,6 +55,7 @@ '.py': '# %s', '.rb': '# %s', '.sh': '# %s', + '.proto': '// %s', } # pregenerate the actual text that we should have From e87ec957986e4763286d8f22e35b05dca92ca457 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:23:57 -0800 Subject: [PATCH 118/173] Add javascript checks --- tools/distrib/check_copyright.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 19e227a805324..8a61626d15a46 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -56,6 +56,7 @@ '.rb': '# %s', '.sh': '# %s', '.proto': '// %s', + '.js': ' * %s', } # pregenerate the actual text that we should have From f222a4afe96381cc9289af1859a4e28b2d7f54f0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 16 Feb 2015 12:28:10 -0800 Subject: [PATCH 119/173] Add C# checks --- src/csharp/GrpcApi/TestServiceGrpc.cs | 34 ++++++++++++++++++++++++++- tools/distrib/check_copyright.py | 7 ++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/csharp/GrpcApi/TestServiceGrpc.cs b/src/csharp/GrpcApi/TestServiceGrpc.cs index e836d60492926..067b21c252c64 100644 --- a/src/csharp/GrpcApi/TestServiceGrpc.cs +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -1,3 +1,35 @@ +#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.Threading; using System.Threading.Tasks; @@ -167,4 +199,4 @@ public static ITestServiceClient NewStub(Channel channel) return new TestServiceClientStub(channel); } } -} \ No newline at end of file +} diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 8a61626d15a46..ac54a2e9a445b 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -57,6 +57,7 @@ '.sh': '# %s', '.proto': '// %s', '.js': ' * %s', + '.cs': '// %s', } # pregenerate the actual text that we should have @@ -71,7 +72,9 @@ 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: continue + if ext not in LICENSE_TEXT: + #print 'pass: %s' % filename + continue license = LICENSE_TEXT[ext] old_license = OLD_LICENSE_TEXT[ext] with open(filename) as f: @@ -81,6 +84,6 @@ elif old_license in text: pass #print 'old license in: %s' % filename - elif 'DO NOT EDIT' not in text: + elif 'DO NOT EDIT' not in text and 'AssemblyInfo.cs' not in filename: print 'no license in: %s' % filename From 73b7018ebdf546684fc916dcf87d21dd82d0b4c5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 07:36:09 -0800 Subject: [PATCH 120/173] 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 119bd4c54eef5..5e4d806cff08e 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 20c585ae73265..9b1009fc109f3 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 121/173] 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 3912e52eceacb..2813e13abea06 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 80874cd1e6961..665f29318f7bf 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 1b4b463d35983..663e40247d86c 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 af1c710098fd8..64f0f890c5f42 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 091430b884da5..22a8a04c8235b 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 c201676065e98..bf62871b7d12b 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 8050ef8c9d6f3..410c762375cb2 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 6ee550bd644d9..be5b29589fd3f 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 da94739ea0d29..440423dba9684 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 894f87698cedf..c31adab723329 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 d68d7a9242f60..51bcfdada6ca9 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 fe8859de94480..df800d940dd83 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 f69ddc3b7e004..4419b4b2f1488 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 886e794137f62..096eb7aa0e077 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 122/173] 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 51bcfdada6ca9..284af33b4352a 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 123/173] 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 2813e13abea06..4594cbaeb6f01 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 440423dba9684..c4794d717d002 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 124/173] 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 c4794d717d002..95b7aabc1d698 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 125/173] 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 95b7aabc1d698..b2fc0c97ee9d8 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 126/173] 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 df800d940dd83..9ec93bc626274 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 294eeae585088..35ced54aa78ff 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 127/173] 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 9ec93bc626274..0922a6e4603a2 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 1fe7b9d66a34d774e8a26ff7409b8739c4c2db58 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 11:57:02 -0800 Subject: [PATCH 128/173] Fix a race in transport. I removed the condition variable here a little while ago to remove a thundering herd. Unfortunately it introduces a race if we are calling back an application defined object whilst destroying. Reintroduce the cv, and guard it's usage closely to avoid the herd (additionally, it's not needed for stream deletion, so we keep it out of that). --- src/core/transport/chttp2_transport.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 8b1fb78917257..5921c3806ec32 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -184,11 +184,13 @@ struct transport { gpr_uint8 is_client; gpr_mu mu; + gpr_cv cv; /* basic state management - what are we doing at the moment? */ gpr_uint8 reading; gpr_uint8 writing; gpr_uint8 calling_back; + gpr_uint8 destroying; error_state error_state; /* stream indexing */ @@ -362,6 +364,7 @@ static void unref_transport(transport *t) { gpr_mu_unlock(&t->mu); gpr_mu_destroy(&t->mu); + gpr_cv_destroy(&t->cv); /* callback remaining pings: they're not allowed to call into the transpot, and maybe they hold resources that need to be freed */ @@ -397,6 +400,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, /* one ref is for destroy, the other for when ep becomes NULL */ gpr_ref_init(&t->refs, 2); gpr_mu_init(&t->mu); + gpr_cv_init(&t->cv); t->metadata_context = mdctx; t->str_grpc_timeout = grpc_mdstr_from_string(t->metadata_context, "grpc-timeout"); @@ -405,6 +409,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, t->error_state = ERROR_STATE_NONE; t->next_stream_id = is_client ? 1 : 2; t->last_incoming_stream_id = 0; + t->destroying = 0; t->is_client = is_client; t->outgoing_window = DEFAULT_WINDOW; t->incoming_window = DEFAULT_WINDOW; @@ -487,6 +492,7 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup, t->cb = sr.callbacks; t->cb_user_data = sr.user_data; t->calling_back = 0; + if (t->destroying) gpr_cv_signal(&t->cv); unlock(t); unref_transport(t); } @@ -495,6 +501,10 @@ static void destroy_transport(grpc_transport *gt) { transport *t = (transport *)gt; gpr_mu_lock(&t->mu); + t->destroying = 1; + while (t->calling_back) { + gpr_cv_wait(&t->cv, &t->mu, gpr_inf_future); + } t->cb = NULL; gpr_mu_unlock(&t->mu); @@ -754,6 +764,7 @@ static void unlock(transport *t) { if (perform_callbacks || call_closed || num_goaways) { lock(t); t->calling_back = 0; + if (t->destroying) gpr_cv_signal(&t->cv); unlock(t); unref_transport(t); } From 467d7bd414238427c051a44316d64d267c068ea3 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Tue, 17 Feb 2015 12:08:43 -0800 Subject: [PATCH 129/173] 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 0922a6e4603a2..70daa6a3b0425 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 35ced54aa78ff..ee9a1daa8e9cf 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 130/173] 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 70daa6a3b0425..f1142cf8e568a 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 131/173] 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 665f29318f7bf..c5267f8563ce3 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 aa31da4ffe0703292a9d76b0c543a0fb7e60f0a1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 16:33:35 -0800 Subject: [PATCH 132/173] UDS Fix Remove existing UDS listeners IFF they are a socket before trying to create a new socket. --- src/core/iomgr/tcp_server_posix.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 6a9616371885d..9e5076efc717d 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -42,17 +42,18 @@ #include "src/core/iomgr/tcp_server.h" -#include +#include #include +#include #include #include #include +#include +#include +#include #include #include -#include #include -#include -#include #include "src/core/iomgr/pollset_posix.h" #include "src/core/iomgr/resolve_address.h" @@ -83,6 +84,14 @@ typedef struct { int addr_len; } server_port; +static void unlink_if_unix_domain_socket(const struct sockaddr_un *un) { + struct stat st; + + if (stat(un->sun_path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { + unlink(un->sun_path); + } +} + /* the overall server */ struct grpc_tcp_server { grpc_tcp_server_cb cb; @@ -130,7 +139,7 @@ void grpc_tcp_server_destroy(grpc_tcp_server *s) { for (i = 0; i < s->nports; i++) { server_port *sp = &s->ports[i]; if (sp->addr.sockaddr.sa_family == AF_UNIX) { - unlink(sp->addr.un.sun_path); + unlink_if_unix_domain_socket(&sp->addr.un); } grpc_fd_orphan(sp->emfd, NULL, NULL); } @@ -301,6 +310,10 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr, socklen_t sockname_len; int port; + if (((struct sockaddr *)addr)->sa_family == AF_UNIX) { + unlink_if_unix_domain_socket(addr); + } + /* Check if this is a wildcard port, and if so, try to keep the port the same as some previously created listener. */ if (grpc_sockaddr_get_port(addr) == 0) { From aea2fc053d415b2650753509f65855cb92552ca9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 16:54:53 -0800 Subject: [PATCH 133/173] Fix shutdown semantics. Document what they should be, ensure they're triggered, and fix what was broken. --- include/grpc/grpc.h | 10 +++-- src/core/surface/server.c | 37 +++++++++++++------ .../early_server_shutdown_finishes_tags.c | 2 +- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9807de9f4bc2f..cf84ac1c63701 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -564,15 +564,19 @@ void grpc_server_start(grpc_server *server); /* Begin shutting down a server. After completion, no new calls or connections will be admitted. - Existing calls will be allowed to complete. */ + Existing calls will be allowed to complete. + Shutdown is idempotent. */ void grpc_server_shutdown(grpc_server *server); /* As per grpc_server_shutdown, but send a GRPC_SERVER_SHUTDOWN event when - there are no more calls being serviced. */ + there are no more calls being serviced. + Shutdown is idempotent, and all tags will be notified at once if multiple + grpc_server_shutdown_and_notify calls are made. */ void grpc_server_shutdown_and_notify(grpc_server *server, void *tag); /* Destroy a server. - Forcefully cancels all existing calls. */ + Forcefully cancels all existing calls. + Implies grpc_server_shutdown() if one was not previously performed. */ void grpc_server_destroy(grpc_server *server); #ifdef __cplusplus diff --git a/src/core/surface/server.c b/src/core/surface/server.c index ee0f96a5803f4..456c7826a2807 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -98,8 +98,8 @@ struct grpc_server { size_t requested_call_capacity; gpr_uint8 shutdown; - gpr_uint8 have_shutdown_tag; - void *shutdown_tag; + size_t num_shutdown_tags; + void **shutdown_tags; call_data *lists[CALL_LIST_COUNT]; channel_data root_channel_data; @@ -206,6 +206,7 @@ static void server_unref(grpc_server *server) { gpr_mu_destroy(&server->mu); gpr_free(server->channel_filters); gpr_free(server->requested_calls); + gpr_free(server->shutdown_tags); gpr_free(server); } } @@ -407,15 +408,17 @@ 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++) { call_list_remove(chand->server, elem->call_data, i); } - 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); + if (chand->server->shutdown && chand->server->lists[ALL_CALLS] == NULL) { + for (i = 0; i < chand->server->num_shutdown_tags; i++) { + grpc_cq_end_server_shutdown(chand->server->cq, + chand->server->shutdown_tags[i]); + } } gpr_mu_unlock(&chand->server->mu); @@ -572,6 +575,13 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, /* lock, and gather up some stuff to do */ gpr_mu_lock(&server->mu); + if (have_shutdown_tag) { + grpc_cq_begin_op(server->cq, NULL, GRPC_SERVER_SHUTDOWN); + server->shutdown_tags = + gpr_realloc(server->shutdown_tags, + sizeof(void *) * (server->num_shutdown_tags + 1)); + server->shutdown_tags[server->num_shutdown_tags++] = shutdown_tag; + } if (server->shutdown) { gpr_mu_unlock(&server->mu); return; @@ -597,12 +607,9 @@ void shutdown_internal(grpc_server *server, gpr_uint8 have_shutdown_tag, server->requested_call_count = 0; server->shutdown = 1; - 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); + if (server->lists[ALL_CALLS] == NULL) { + for (i = 0; i < server->num_shutdown_tags; i++) { + grpc_cq_end_server_shutdown(server->cq, server->shutdown_tags[i]); } } gpr_mu_unlock(&server->mu); @@ -653,6 +660,12 @@ void grpc_server_shutdown_and_notify(grpc_server *server, void *tag) { void grpc_server_destroy(grpc_server *server) { channel_data *c; gpr_mu_lock(&server->mu); + if (!server->shutdown) { + gpr_mu_unlock(&server->mu); + grpc_server_shutdown(server); + gpr_mu_lock(&server->mu); + } + for (c = server->root_channel_data.next; c != &server->root_channel_data; c = c->next) { shutdown_channel(c); 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 123c8bc415357..51486cc169986 100644 --- a/test/core/end2end/tests/early_server_shutdown_finishes_tags.c +++ b/test/core/end2end/tests/early_server_shutdown_finishes_tags.c @@ -79,7 +79,7 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; - grpc_server_shutdown(f->server); + /* don't shutdown, just destroy, to tickle this code edge */ grpc_server_destroy(f->server); f->server = NULL; } From 29f2b219a8631ed788708a326190aa3a611911e0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 17:01:24 -0800 Subject: [PATCH 134/173] 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 9807de9f4bc2f..077b432e881b2 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 135/173] 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 9807de9f4bc2f..2bd7415e28198 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 409e6c804bc487c4a50451fd22ac90abc7293172 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 17:46:35 -0800 Subject: [PATCH 136/173] 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 f73b12c417feb..8586915026c1a 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 322c268f377fa..1340c355e2621 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 5d72307668277..af5ef25e143d3 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 965e9eef409d5..3dbe0b332845e 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 7c98e66c33d12..e63656425d9db 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 6c1210e812dad..93155455dcb9d 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 47776a991a14b..e406336d17ecd 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 c563662c2d42f..a8155b5f13af0 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 87a5d0a299cda..44b2d03e6fd76 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 fada3639d5828..efa30a2a56523 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 72c9dd2ec0031..38a90c13e798a 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 a406e9e9f17f0..591a352878674 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 8feefb047cca7..c8e2bb5c4ae2f 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 d5e8930fca6c5..664b94fd261d9 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 88eb62ab738c6..55a429c959550 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 329ef15c68a54..8e452b64051f8 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 e68843e12b1ef..b2877e98e4e21 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 92047efd18758..d9c6362f8a4c8 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 4f6c67ea5e3b6..f825297225f67 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 2a2e1fbc82269..2be627727abea 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 7e7911f70dd4889a3a0c79e42691458e024d460c Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 18:28:23 -0800 Subject: [PATCH 137/173] 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 758ac0c2d1662..21253848a7d3a 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -41,4 +41,4 @@ 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 9004bef46e5d8..5cb1e1a4dcfaa 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 35b5cbfe2de1f..14b81a9e034f9 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 9a333589c2142..27df86b4b6dfe 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 6876dcb02eb4b..3f3414cfda77d 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 70a92bfed771d..c2356b7004eb3 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 6c2b6e91c24ae..5a4f129dce00e 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 099d57151c090..8350690fdf310 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 7e13de19ca5bd..1a4ed58fa3f75 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 876397a6e70ea..6d8bdeb3cc3d5 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 40c5ec118e3c7..dd40eba57f029 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -33,372 +33,370 @@ 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 ff37617ccfad3..f0b85a0fa2064 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -48,188 +48,186 @@ def underscore 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 6442f23e895b5..cf280feae64f6 100644 --- a/src/ruby/lib/grpc/logconfig.rb +++ b/src/ruby/lib/grpc/logconfig.rb @@ -35,6 +35,6 @@ 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 dd526e583a6e3..0107bc4ada0af 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 9e0b4660fa544..c43214d086103 100644 --- a/src/ruby/spec/auth/compute_engine_spec.rb +++ b/src/ruby/spec/auth/compute_engine_spec.rb @@ -36,9 +36,9 @@ 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 cbc6a73ac20c2..2f14a1ae05326 100644 --- a/src/ruby/spec/auth/service_account_spec.rb +++ b/src/ruby/spec/auth/service_account_spec.rb @@ -38,7 +38,7 @@ 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 @@ 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 138/173] 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 200f859ede568..2abbc8d3cc64e 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 1c38582cb8100..eecb37a6ee1d7 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 9ddbac75aa52d..060e07034c717 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 c25a3b35bd8e41c4ccf140930b4497ea707b0d6e Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 18 Feb 2015 02:46:17 +0000 Subject: [PATCH 139/173] Python source reorganization. A top-level "grpc" package is added and RPC Framework is made public. --- src/python/interop/interop/methods.py | 2 +- src/python/interop/interop/server.py | 2 +- src/python/src/{ => grpc}/__init__.py | 0 .../src/{ => grpc}/_adapter/__init__.py | 0 ...blocking_invocation_inline_service_test.py | 4 +- src/python/src/{ => grpc}/_adapter/_c.c | 10 ++-- src/python/src/{ => grpc}/_adapter/_c_test.py | 4 +- src/python/src/{ => grpc}/_adapter/_call.c | 8 ++-- src/python/src/{ => grpc}/_adapter/_call.h | 0 src/python/src/{ => grpc}/_adapter/_channel.c | 2 +- src/python/src/{ => grpc}/_adapter/_channel.h | 0 src/python/src/{ => grpc}/_adapter/_common.py | 0 .../{ => grpc}/_adapter/_completion_queue.c | 6 +-- .../{ => grpc}/_adapter/_completion_queue.h | 0 .../src/{ => grpc}/_adapter/_datatypes.py | 0 src/python/src/{ => grpc}/_adapter/_error.c | 2 +- src/python/src/{ => grpc}/_adapter/_error.h | 0 ...vocation_synchronous_event_service_test.py | 4 +- .../{ => grpc}/_adapter/_face_test_case.py | 18 ++++---- ...ocation_asynchronous_event_service_test.py | 4 +- .../src/{ => grpc}/_adapter/_links_test.py | 14 +++--- .../_adapter/_lonely_rear_link_test.py | 10 ++-- src/python/src/{ => grpc}/_adapter/_low.py | 4 +- .../src/{ => grpc}/_adapter/_low_test.py | 2 +- .../{ => grpc}/_adapter/_proto_scenarios.py | 2 +- src/python/src/{ => grpc}/_adapter/_server.c | 8 ++-- src/python/src/{ => grpc}/_adapter/_server.h | 0 .../{ => grpc}/_adapter/_server_credentials.c | 2 +- .../{ => grpc}/_adapter/_server_credentials.h | 0 .../src/{ => grpc}/_adapter/_test_links.py | 2 +- src/python/src/{ => grpc}/_adapter/fore.py | 12 ++--- src/python/src/{ => grpc}/_adapter/rear.py | 10 ++-- .../_junkdrawer}/__init__.py | 0 .../src/{ => grpc}/_junkdrawer/math_pb2.py | 0 .../src/{ => grpc}/_junkdrawer/stock_pb2.py | 0 .../base => grpc/early_adopter}/__init__.py | 0 .../early_adopter}/_face_utilities.py | 4 +- .../early_adopter}/implementations.py | 12 ++--- .../early_adopter}/interfaces.py | 0 .../early_adopter}/utilities.py | 2 +- .../packets => grpc/framework}/__init__.py | 0 .../framework/base}/__init__.py | 0 .../framework}/base/exceptions.py | 0 .../framework}/base/interfaces.py | 2 +- .../framework}/base/interfaces_test.py | 10 ++-- .../framework/base/packets}/__init__.py | 0 .../framework}/base/packets/_cancellation.py | 4 +- .../framework}/base/packets/_constants.py | 0 .../framework}/base/packets/_context.py | 6 +-- .../framework}/base/packets/_emission.py | 4 +- .../framework}/base/packets/_ends.py | 26 +++++------ .../framework}/base/packets/_expiration.py | 6 +-- .../framework}/base/packets/_ingestion.py | 16 +++---- .../framework}/base/packets/_interfaces.py | 6 +-- .../framework}/base/packets/_reception.py | 4 +- .../framework}/base/packets/_termination.py | 10 ++-- .../framework}/base/packets/_transmission.py | 10 ++-- .../base/packets/implementations.py | 4 +- .../base/packets/implementations_test.py | 8 ++-- .../framework}/base/packets/in_memory.py | 6 +-- .../framework}/base/packets/interfaces.py | 4 +- .../framework}/base/packets/null.py | 2 +- .../framework}/base/packets/packets.py | 2 +- .../framework}/base/util.py | 2 +- .../framework/common}/__init__.py | 0 .../framework}/common/cardinality.py | 0 .../framework/face}/__init__.py | 0 .../framework}/face/_calls.py | 12 ++--- .../framework}/face/_control.py | 10 ++-- .../framework}/face/_service.py | 16 +++---- .../framework}/face/_test_case.py | 8 ++-- ...blocking_invocation_inline_service_test.py | 4 +- .../framework}/face/demonstration.py | 8 ++-- ...vocation_synchronous_event_service_test.py | 4 +- .../framework}/face/exceptions.py | 0 ...ocation_asynchronous_event_service_test.py | 4 +- .../framework}/face/implementations.py | 12 ++--- .../framework}/face/interfaces.py | 6 +-- .../framework/face/testing}/__init__.py | 0 .../framework}/face/testing/base_util.py | 10 ++-- ...ing_invocation_inline_service_test_case.py | 12 ++--- .../framework}/face/testing/callback.py | 2 +- .../framework}/face/testing/control.py | 0 .../framework}/face/testing/coverage.py | 0 .../framework}/face/testing/digest.py | 14 +++--- ...ion_synchronous_event_service_test_case.py | 14 +++--- ...on_asynchronous_event_service_test_case.py | 16 +++---- .../framework}/face/testing/interfaces.py | 2 +- .../framework}/face/testing/serial.py | 0 .../framework}/face/testing/service.py | 4 +- .../framework}/face/testing/stock_service.py | 12 ++--- .../framework}/face/testing/test_case.py | 4 +- .../framework/foundation}/__init__.py | 0 .../framework}/foundation/_later_test.py | 2 +- .../foundation/_logging_pool_test.py | 2 +- .../framework}/foundation/_timer_future.py | 2 +- .../framework}/foundation/abandonment.py | 0 .../framework}/foundation/callable_util.py | 0 .../framework}/foundation/future.py | 0 .../framework}/foundation/later.py | 2 +- .../framework}/foundation/logging_pool.py | 0 .../framework}/foundation/stream.py | 0 .../framework}/foundation/stream_testing.py | 2 +- .../framework}/foundation/stream_util.py | 2 +- src/python/src/setup.py | 46 ++++++++++--------- tools/dockerfile/grpc_python/Dockerfile | 26 +++++------ tools/run_tests/run_python.sh | 26 +++++------ 107 files changed, 284 insertions(+), 282 deletions(-) rename src/python/src/{ => grpc}/__init__.py (100%) rename src/python/src/{ => grpc}/_adapter/__init__.py (100%) rename src/python/src/{ => grpc}/_adapter/_blocking_invocation_inline_service_test.py (67%) rename src/python/src/{ => grpc}/_adapter/_c.c (92%) rename src/python/src/{ => grpc}/_adapter/_c_test.py (98%) rename src/python/src/{ => grpc}/_adapter/_call.c (98%) rename src/python/src/{ => grpc}/_adapter/_call.h (100%) rename src/python/src/{ => grpc}/_adapter/_channel.c (99%) rename src/python/src/{ => grpc}/_adapter/_channel.h (100%) rename src/python/src/{ => grpc}/_adapter/_common.py (100%) rename src/python/src/{ => grpc}/_adapter/_completion_queue.c (99%) rename src/python/src/{ => grpc}/_adapter/_completion_queue.h (100%) rename src/python/src/{ => grpc}/_adapter/_datatypes.py (100%) rename src/python/src/{ => grpc}/_adapter/_error.c (98%) rename src/python/src/{ => grpc}/_adapter/_error.h (100%) rename src/python/src/{ => grpc}/_adapter/_event_invocation_synchronous_event_service_test.py (92%) rename src/python/src/{ => grpc}/_adapter/_face_test_case.py (91%) rename src/python/src/{ => grpc}/_adapter/_future_invocation_asynchronous_event_service_test.py (92%) rename src/python/src/{ => grpc}/_adapter/_links_test.py (97%) rename src/python/src/{ => grpc}/_adapter/_lonely_rear_link_test.py (94%) rename src/python/src/{ => grpc}/_adapter/_low.py (96%) rename src/python/src/{ => grpc}/_adapter/_low_test.py (99%) rename src/python/src/{ => grpc}/_adapter/_proto_scenarios.py (99%) rename src/python/src/{ => grpc}/_adapter/_server.c (97%) rename src/python/src/{ => grpc}/_adapter/_server.h (100%) rename src/python/src/{ => grpc}/_adapter/_server_credentials.c (99%) rename src/python/src/{ => grpc}/_adapter/_server_credentials.h (100%) rename src/python/src/{ => grpc}/_adapter/_test_links.py (98%) rename src/python/src/{ => grpc}/_adapter/fore.py (97%) rename src/python/src/{ => grpc}/_adapter/rear.py (98%) rename src/python/src/{_framework => grpc/_junkdrawer}/__init__.py (100%) rename src/python/src/{ => grpc}/_junkdrawer/math_pb2.py (100%) rename src/python/src/{ => grpc}/_junkdrawer/stock_pb2.py (100%) rename src/python/src/{_framework/base => grpc/early_adopter}/__init__.py (100%) rename src/python/src/{grpc_early_adopter => grpc/early_adopter}/_face_utilities.py (97%) rename src/python/src/{grpc_early_adopter => grpc/early_adopter}/implementations.py (93%) rename src/python/src/{grpc_early_adopter => grpc/early_adopter}/interfaces.py (100%) rename src/python/src/{grpc_early_adopter => grpc/early_adopter}/utilities.py (99%) rename src/python/src/{_framework/base/packets => grpc/framework}/__init__.py (100%) rename src/python/src/{_framework/common => grpc/framework/base}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/base/exceptions.py (100%) rename src/python/src/{_framework => grpc/framework}/base/interfaces.py (98%) rename src/python/src/{_framework => grpc/framework}/base/interfaces_test.py (98%) rename src/python/src/{_framework/face => grpc/framework/base/packets}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/base/packets/_cancellation.py (96%) rename src/python/src/{_framework => grpc/framework}/base/packets/_constants.py (100%) rename src/python/src/{_framework => grpc/framework}/base/packets/_context.py (94%) rename src/python/src/{_framework => grpc/framework}/base/packets/_emission.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/_ends.py (95%) rename src/python/src/{_framework => grpc/framework}/base/packets/_expiration.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/_ingestion.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/_interfaces.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/_reception.py (99%) rename src/python/src/{_framework => grpc/framework}/base/packets/_termination.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/_transmission.py (98%) rename src/python/src/{_framework => grpc/framework}/base/packets/implementations.py (96%) rename src/python/src/{_framework => grpc/framework}/base/packets/implementations_test.py (94%) rename src/python/src/{_framework => grpc/framework}/base/packets/in_memory.py (96%) rename src/python/src/{_framework => grpc/framework}/base/packets/interfaces.py (96%) rename src/python/src/{_framework => grpc/framework}/base/packets/null.py (97%) rename src/python/src/{_framework => grpc/framework}/base/packets/packets.py (98%) rename src/python/src/{_framework => grpc/framework}/base/util.py (98%) rename src/python/src/{_framework/face/testing => grpc/framework/common}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/common/cardinality.py (100%) rename src/python/src/{_framework/foundation => grpc/framework/face}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/face/_calls.py (98%) rename src/python/src/{_framework => grpc/framework}/face/_control.py (96%) rename src/python/src/{_framework => grpc/framework}/face/_service.py (93%) rename src/python/src/{_framework => grpc/framework}/face/_test_case.py (94%) rename src/python/src/{_framework => grpc/framework}/face/blocking_invocation_inline_service_test.py (92%) rename src/python/src/{_framework => grpc/framework}/face/demonstration.py (95%) rename src/python/src/{_framework => grpc/framework}/face/event_invocation_synchronous_event_service_test.py (92%) rename src/python/src/{_framework => grpc/framework}/face/exceptions.py (100%) rename src/python/src/{_framework => grpc/framework}/face/future_invocation_asynchronous_event_service_test.py (92%) rename src/python/src/{_framework => grpc/framework}/face/implementations.py (96%) rename src/python/src/{_framework => grpc/framework}/face/interfaces.py (98%) rename src/python/src/{_junkdrawer => grpc/framework/face/testing}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/face/testing/base_util.py (92%) rename src/python/src/{_framework => grpc/framework}/face/testing/blocking_invocation_inline_service_test_case.py (96%) rename src/python/src/{_framework => grpc/framework}/face/testing/callback.py (98%) rename src/python/src/{_framework => grpc/framework}/face/testing/control.py (100%) rename src/python/src/{_framework => grpc/framework}/face/testing/coverage.py (100%) rename src/python/src/{_framework => grpc/framework}/face/testing/digest.py (96%) rename src/python/src/{_framework => grpc/framework}/face/testing/event_invocation_synchronous_event_service_test_case.py (97%) rename src/python/src/{_framework => grpc/framework}/face/testing/future_invocation_asynchronous_event_service_test_case.py (97%) rename src/python/src/{_framework => grpc/framework}/face/testing/interfaces.py (97%) rename src/python/src/{_framework => grpc/framework}/face/testing/serial.py (100%) rename src/python/src/{_framework => grpc/framework}/face/testing/service.py (98%) rename src/python/src/{_framework => grpc/framework}/face/testing/stock_service.py (97%) rename src/python/src/{_framework => grpc/framework}/face/testing/test_case.py (96%) rename src/python/src/{grpc_early_adopter => grpc/framework/foundation}/__init__.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/_later_test.py (99%) rename src/python/src/{_framework => grpc/framework}/foundation/_logging_pool_test.py (97%) rename src/python/src/{_framework => grpc/framework}/foundation/_timer_future.py (99%) rename src/python/src/{_framework => grpc/framework}/foundation/abandonment.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/callable_util.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/future.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/later.py (97%) rename src/python/src/{_framework => grpc/framework}/foundation/logging_pool.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/stream.py (100%) rename src/python/src/{_framework => grpc/framework}/foundation/stream_testing.py (98%) rename src/python/src/{_framework => grpc/framework}/foundation/stream_util.py (99%) diff --git a/src/python/interop/interop/methods.py b/src/python/interop/interop/methods.py index e5ce5902ca773..854dbec8cc396 100644 --- a/src/python/interop/interop/methods.py +++ b/src/python/interop/interop/methods.py @@ -29,7 +29,7 @@ """Implementations of interoperability test methods.""" -from grpc_early_adopter import utilities +from grpc.early_adopter import utilities from interop import empty_pb2 from interop import messages_pb2 diff --git a/src/python/interop/interop/server.py b/src/python/interop/interop/server.py index 404c87dd0a935..0035e062a4eee 100644 --- a/src/python/interop/interop/server.py +++ b/src/python/interop/interop/server.py @@ -34,7 +34,7 @@ import pkg_resources import time -from grpc_early_adopter import implementations +from grpc.early_adopter import implementations from interop import methods diff --git a/src/python/src/__init__.py b/src/python/src/grpc/__init__.py similarity index 100% rename from src/python/src/__init__.py rename to src/python/src/grpc/__init__.py diff --git a/src/python/src/_adapter/__init__.py b/src/python/src/grpc/_adapter/__init__.py similarity index 100% rename from src/python/src/_adapter/__init__.py rename to src/python/src/grpc/_adapter/__init__.py diff --git a/src/python/src/_adapter/_blocking_invocation_inline_service_test.py b/src/python/src/grpc/_adapter/_blocking_invocation_inline_service_test.py similarity index 67% rename from src/python/src/_adapter/_blocking_invocation_inline_service_test.py rename to src/python/src/grpc/_adapter/_blocking_invocation_inline_service_test.py index 873ce9a5a46b7..761e5cf683989 100644 --- a/src/python/src/_adapter/_blocking_invocation_inline_service_test.py +++ b/src/python/src/grpc/_adapter/_blocking_invocation_inline_service_test.py @@ -2,8 +2,8 @@ import unittest -from _adapter import _face_test_case -from _framework.face.testing import blocking_invocation_inline_service_test_case as test_case +from grpc._adapter import _face_test_case +from grpc.framework.face.testing import blocking_invocation_inline_service_test_case as test_case class BlockingInvocationInlineServiceTest( diff --git a/src/python/src/_adapter/_c.c b/src/python/src/grpc/_adapter/_c.c similarity index 92% rename from src/python/src/_adapter/_c.c rename to src/python/src/grpc/_adapter/_c.c index 6fb7fa29faf8f..13eb93fe5ab17 100644 --- a/src/python/src/_adapter/_c.c +++ b/src/python/src/grpc/_adapter/_c.c @@ -34,11 +34,11 @@ #include #include -#include "_adapter/_completion_queue.h" -#include "_adapter/_channel.h" -#include "_adapter/_call.h" -#include "_adapter/_server.h" -#include "_adapter/_server_credentials.h" +#include "grpc/_adapter/_completion_queue.h" +#include "grpc/_adapter/_channel.h" +#include "grpc/_adapter/_call.h" +#include "grpc/_adapter/_server.h" +#include "grpc/_adapter/_server_credentials.h" static PyObject *init(PyObject *self, PyObject *args) { grpc_init(); diff --git a/src/python/src/_adapter/_c_test.py b/src/python/src/grpc/_adapter/_c_test.py similarity index 98% rename from src/python/src/_adapter/_c_test.py rename to src/python/src/grpc/_adapter/_c_test.py index 210ac1fff7863..d421692ec9c22 100644 --- a/src/python/src/_adapter/_c_test.py +++ b/src/python/src/grpc/_adapter/_c_test.py @@ -33,8 +33,8 @@ import time import unittest -from _adapter import _c -from _adapter import _datatypes +from grpc._adapter import _c +from grpc._adapter import _datatypes _TIMEOUT = 3 _FUTURE = time.time() + 60 * 60 * 24 diff --git a/src/python/src/_adapter/_call.c b/src/python/src/grpc/_adapter/_call.c similarity index 98% rename from src/python/src/_adapter/_call.c rename to src/python/src/grpc/_adapter/_call.c index 3bc35be0ef0ff..a2cc590d28be3 100644 --- a/src/python/src/_adapter/_call.c +++ b/src/python/src/grpc/_adapter/_call.c @@ -31,15 +31,15 @@ * */ -#include "_adapter/_call.h" +#include "grpc/_adapter/_call.h" #include #include #include -#include "_adapter/_channel.h" -#include "_adapter/_completion_queue.h" -#include "_adapter/_error.h" +#include "grpc/_adapter/_channel.h" +#include "grpc/_adapter/_completion_queue.h" +#include "grpc/_adapter/_error.h" static int pygrpc_call_init(Call *self, PyObject *args, PyObject *kwds) { const PyObject *channel; diff --git a/src/python/src/_adapter/_call.h b/src/python/src/grpc/_adapter/_call.h similarity index 100% rename from src/python/src/_adapter/_call.h rename to src/python/src/grpc/_adapter/_call.h diff --git a/src/python/src/_adapter/_channel.c b/src/python/src/grpc/_adapter/_channel.c similarity index 99% rename from src/python/src/_adapter/_channel.c rename to src/python/src/grpc/_adapter/_channel.c index d41ebd4479e27..6962722ed2536 100644 --- a/src/python/src/_adapter/_channel.c +++ b/src/python/src/grpc/_adapter/_channel.c @@ -31,7 +31,7 @@ * */ -#include "_adapter/_channel.h" +#include "grpc/_adapter/_channel.h" #include #include diff --git a/src/python/src/_adapter/_channel.h b/src/python/src/grpc/_adapter/_channel.h similarity index 100% rename from src/python/src/_adapter/_channel.h rename to src/python/src/grpc/_adapter/_channel.h diff --git a/src/python/src/_adapter/_common.py b/src/python/src/grpc/_adapter/_common.py similarity index 100% rename from src/python/src/_adapter/_common.py rename to src/python/src/grpc/_adapter/_common.py diff --git a/src/python/src/_adapter/_completion_queue.c b/src/python/src/grpc/_adapter/_completion_queue.c similarity index 99% rename from src/python/src/_adapter/_completion_queue.c rename to src/python/src/grpc/_adapter/_completion_queue.c index 7c951d24a0024..1d593d0d14014 100644 --- a/src/python/src/_adapter/_completion_queue.c +++ b/src/python/src/grpc/_adapter/_completion_queue.c @@ -31,13 +31,13 @@ * */ -#include "_adapter/_completion_queue.h" +#include "grpc/_adapter/_completion_queue.h" #include #include #include -#include "_adapter/_call.h" +#include "grpc/_adapter/_call.h" static PyObject *status_class; static PyObject *service_acceptance_class; @@ -500,7 +500,7 @@ static int pygrpc_get_event_kinds(PyObject *event_class) { } int pygrpc_add_completion_queue(PyObject *module) { - char *datatypes_module_path = "_adapter._datatypes"; + 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); diff --git a/src/python/src/_adapter/_completion_queue.h b/src/python/src/grpc/_adapter/_completion_queue.h similarity index 100% rename from src/python/src/_adapter/_completion_queue.h rename to src/python/src/grpc/_adapter/_completion_queue.h diff --git a/src/python/src/_adapter/_datatypes.py b/src/python/src/grpc/_adapter/_datatypes.py similarity index 100% rename from src/python/src/_adapter/_datatypes.py rename to src/python/src/grpc/_adapter/_datatypes.py diff --git a/src/python/src/_adapter/_error.c b/src/python/src/grpc/_adapter/_error.c similarity index 98% rename from src/python/src/_adapter/_error.c rename to src/python/src/grpc/_adapter/_error.c index 8c04f4bcea7a2..a8a1dbc1bbfa3 100644 --- a/src/python/src/_adapter/_error.c +++ b/src/python/src/grpc/_adapter/_error.c @@ -31,7 +31,7 @@ * */ -#include "_adapter/_error.h" +#include "grpc/_adapter/_error.h" #include #include diff --git a/src/python/src/_adapter/_error.h b/src/python/src/grpc/_adapter/_error.h similarity index 100% rename from src/python/src/_adapter/_error.h rename to src/python/src/grpc/_adapter/_error.h diff --git a/src/python/src/_adapter/_event_invocation_synchronous_event_service_test.py b/src/python/src/grpc/_adapter/_event_invocation_synchronous_event_service_test.py similarity index 92% rename from src/python/src/_adapter/_event_invocation_synchronous_event_service_test.py rename to src/python/src/grpc/_adapter/_event_invocation_synchronous_event_service_test.py index 69d91ec7da7fd..b9a13ce69fd9b 100644 --- a/src/python/src/_adapter/_event_invocation_synchronous_event_service_test.py +++ b/src/python/src/grpc/_adapter/_event_invocation_synchronous_event_service_test.py @@ -31,8 +31,8 @@ import unittest -from _adapter import _face_test_case -from _framework.face.testing import event_invocation_synchronous_event_service_test_case as test_case +from grpc._adapter import _face_test_case +from grpc.framework.face.testing import event_invocation_synchronous_event_service_test_case as test_case class EventInvocationSynchronousEventServiceTest( diff --git a/src/python/src/_adapter/_face_test_case.py b/src/python/src/grpc/_adapter/_face_test_case.py similarity index 91% rename from src/python/src/_adapter/_face_test_case.py rename to src/python/src/grpc/_adapter/_face_test_case.py index 2c6e6286b57d3..da73366f446f6 100644 --- a/src/python/src/_adapter/_face_test_case.py +++ b/src/python/src/grpc/_adapter/_face_test_case.py @@ -31,15 +31,15 @@ import unittest -from _adapter import fore -from _adapter import rear -from _framework.base import util -from _framework.base.packets import implementations as tickets_implementations -from _framework.face import implementations as face_implementations -from _framework.face.testing import coverage -from _framework.face.testing import serial -from _framework.face.testing import test_case -from _framework.foundation import logging_pool +from grpc._adapter import fore +from grpc._adapter import rear +from grpc.framework.base import util +from grpc.framework.base.packets import implementations as tickets_implementations +from grpc.framework.face import implementations as face_implementations +from grpc.framework.face.testing import coverage +from grpc.framework.face.testing import serial +from grpc.framework.face.testing import test_case +from grpc.framework.foundation import logging_pool _TIMEOUT = 3 _MAXIMUM_TIMEOUT = 90 diff --git a/src/python/src/_adapter/_future_invocation_asynchronous_event_service_test.py b/src/python/src/grpc/_adapter/_future_invocation_asynchronous_event_service_test.py similarity index 92% rename from src/python/src/_adapter/_future_invocation_asynchronous_event_service_test.py rename to src/python/src/grpc/_adapter/_future_invocation_asynchronous_event_service_test.py index 3db39dd15401b..7d6a4ffc17af6 100644 --- a/src/python/src/_adapter/_future_invocation_asynchronous_event_service_test.py +++ b/src/python/src/grpc/_adapter/_future_invocation_asynchronous_event_service_test.py @@ -31,8 +31,8 @@ import unittest -from _adapter import _face_test_case -from _framework.face.testing import future_invocation_asynchronous_event_service_test_case as test_case +from grpc._adapter import _face_test_case +from grpc.framework.face.testing import future_invocation_asynchronous_event_service_test_case as test_case class FutureInvocationAsynchronousEventServiceTest( diff --git a/src/python/src/_adapter/_links_test.py b/src/python/src/grpc/_adapter/_links_test.py similarity index 97% rename from src/python/src/_adapter/_links_test.py rename to src/python/src/grpc/_adapter/_links_test.py index d8bbb271270e9..ba7660bb92042 100644 --- a/src/python/src/_adapter/_links_test.py +++ b/src/python/src/grpc/_adapter/_links_test.py @@ -32,13 +32,13 @@ import threading import unittest -from _adapter import _proto_scenarios -from _adapter import _test_links -from _adapter import fore -from _adapter import rear -from _framework.base import interfaces -from _framework.base.packets import packets as tickets -from _framework.foundation import logging_pool +from grpc._adapter import _proto_scenarios +from grpc._adapter import _test_links +from grpc._adapter import fore +from grpc._adapter import rear +from grpc.framework.base import interfaces +from grpc.framework.base.packets import packets as tickets +from grpc.framework.foundation import logging_pool _IDENTITY = lambda x: x _TIMEOUT = 2 diff --git a/src/python/src/_adapter/_lonely_rear_link_test.py b/src/python/src/grpc/_adapter/_lonely_rear_link_test.py similarity index 94% rename from src/python/src/_adapter/_lonely_rear_link_test.py rename to src/python/src/grpc/_adapter/_lonely_rear_link_test.py index 7ccdb0b53078e..fd502a1c817e2 100644 --- a/src/python/src/_adapter/_lonely_rear_link_test.py +++ b/src/python/src/grpc/_adapter/_lonely_rear_link_test.py @@ -31,11 +31,11 @@ import unittest -from _adapter import _test_links -from _adapter import rear -from _framework.base import interfaces -from _framework.base.packets import packets -from _framework.foundation import logging_pool +from grpc._adapter import _test_links +from grpc._adapter import rear +from grpc.framework.base import interfaces +from grpc.framework.base.packets import packets +from grpc.framework.foundation import logging_pool _IDENTITY = lambda x: x _TIMEOUT = 2 diff --git a/src/python/src/_adapter/_low.py b/src/python/src/grpc/_adapter/_low.py similarity index 96% rename from src/python/src/_adapter/_low.py rename to src/python/src/grpc/_adapter/_low.py index 09105eafa0cc0..2ef2eb879c125 100644 --- a/src/python/src/_adapter/_low.py +++ b/src/python/src/grpc/_adapter/_low.py @@ -32,8 +32,8 @@ import atexit import gc -from _adapter import _c -from _adapter import _datatypes +from grpc._adapter import _c +from grpc._adapter import _datatypes def _shut_down(): # force garbage collection before shutting down grpc, to ensure all grpc diff --git a/src/python/src/_adapter/_low_test.py b/src/python/src/grpc/_adapter/_low_test.py similarity index 99% rename from src/python/src/_adapter/_low_test.py rename to src/python/src/grpc/_adapter/_low_test.py index 899ccf53c8ab5..898c62c00263e 100644 --- a/src/python/src/_adapter/_low_test.py +++ b/src/python/src/grpc/_adapter/_low_test.py @@ -32,7 +32,7 @@ import time import unittest -from _adapter import _low +from grpc._adapter import _low _STREAM_LENGTH = 300 _TIMEOUT = 5 diff --git a/src/python/src/_adapter/_proto_scenarios.py b/src/python/src/grpc/_adapter/_proto_scenarios.py similarity index 99% rename from src/python/src/_adapter/_proto_scenarios.py rename to src/python/src/grpc/_adapter/_proto_scenarios.py index c452fb523ae14..60a622ba8b889 100644 --- a/src/python/src/_adapter/_proto_scenarios.py +++ b/src/python/src/grpc/_adapter/_proto_scenarios.py @@ -32,7 +32,7 @@ import abc import threading -from _junkdrawer import math_pb2 +from grpc._junkdrawer import math_pb2 class ProtoScenario(object): diff --git a/src/python/src/_adapter/_server.c b/src/python/src/grpc/_adapter/_server.c similarity index 97% rename from src/python/src/_adapter/_server.c rename to src/python/src/grpc/_adapter/_server.c index 2f8cc99e44dc0..d4bf5fb8f6450 100644 --- a/src/python/src/_adapter/_server.c +++ b/src/python/src/grpc/_adapter/_server.c @@ -31,14 +31,14 @@ * */ -#include "_adapter/_server.h" +#include "grpc/_adapter/_server.h" #include #include -#include "_adapter/_completion_queue.h" -#include "_adapter/_error.h" -#include "_adapter/_server_credentials.h" +#include "grpc/_adapter/_completion_queue.h" +#include "grpc/_adapter/_error.h" +#include "grpc/_adapter/_server_credentials.h" static int pygrpc_server_init(Server *self, PyObject *args, PyObject *kwds) { const PyObject *completion_queue; diff --git a/src/python/src/_adapter/_server.h b/src/python/src/grpc/_adapter/_server.h similarity index 100% rename from src/python/src/_adapter/_server.h rename to src/python/src/grpc/_adapter/_server.h diff --git a/src/python/src/_adapter/_server_credentials.c b/src/python/src/grpc/_adapter/_server_credentials.c similarity index 99% rename from src/python/src/_adapter/_server_credentials.c rename to src/python/src/grpc/_adapter/_server_credentials.c index 390266ae8978e..ae85fd3eb752c 100644 --- a/src/python/src/_adapter/_server_credentials.c +++ b/src/python/src/grpc/_adapter/_server_credentials.c @@ -31,7 +31,7 @@ * */ -#include "_adapter/_server_credentials.h" +#include "grpc/_adapter/_server_credentials.h" #include #include diff --git a/src/python/src/_adapter/_server_credentials.h b/src/python/src/grpc/_adapter/_server_credentials.h similarity index 100% rename from src/python/src/_adapter/_server_credentials.h rename to src/python/src/grpc/_adapter/_server_credentials.h diff --git a/src/python/src/_adapter/_test_links.py b/src/python/src/grpc/_adapter/_test_links.py similarity index 98% rename from src/python/src/_adapter/_test_links.py rename to src/python/src/grpc/_adapter/_test_links.py index 77d1b00f36664..ac0d6e20b69ec 100644 --- a/src/python/src/_adapter/_test_links.py +++ b/src/python/src/grpc/_adapter/_test_links.py @@ -31,7 +31,7 @@ import threading -from _framework.base.packets import interfaces +from grpc.framework.base.packets import interfaces class ForeLink(interfaces.ForeLink): diff --git a/src/python/src/_adapter/fore.py b/src/python/src/grpc/_adapter/fore.py similarity index 97% rename from src/python/src/_adapter/fore.py rename to src/python/src/grpc/_adapter/fore.py index 28aede1fd9d8e..f72b2fd5a5f2f 100644 --- a/src/python/src/_adapter/fore.py +++ b/src/python/src/grpc/_adapter/fore.py @@ -34,12 +34,12 @@ import threading import time -from _adapter import _common -from _adapter import _low -from _framework.base import interfaces -from _framework.base.packets import interfaces as ticket_interfaces -from _framework.base.packets import null -from _framework.base.packets import packets as tickets +from grpc._adapter import _common +from grpc._adapter import _low +from grpc.framework.base import interfaces +from grpc.framework.base.packets import interfaces as ticket_interfaces +from grpc.framework.base.packets import null +from grpc.framework.base.packets import packets as tickets @enum.unique diff --git a/src/python/src/_adapter/rear.py b/src/python/src/grpc/_adapter/rear.py similarity index 98% rename from src/python/src/_adapter/rear.py rename to src/python/src/grpc/_adapter/rear.py index 5e0975ab4e3f3..c47c0aa020905 100644 --- a/src/python/src/_adapter/rear.py +++ b/src/python/src/grpc/_adapter/rear.py @@ -34,11 +34,11 @@ import threading import time -from _adapter import _common -from _adapter import _low -from _framework.base.packets import interfaces as ticket_interfaces -from _framework.base.packets import null -from _framework.base.packets import packets as tickets +from grpc._adapter import _common +from grpc._adapter import _low +from grpc.framework.base.packets import interfaces as ticket_interfaces +from grpc.framework.base.packets import null +from grpc.framework.base.packets import packets as tickets _INVOCATION_EVENT_KINDS = ( _low.Event.Kind.METADATA_ACCEPTED, diff --git a/src/python/src/_framework/__init__.py b/src/python/src/grpc/_junkdrawer/__init__.py similarity index 100% rename from src/python/src/_framework/__init__.py rename to src/python/src/grpc/_junkdrawer/__init__.py diff --git a/src/python/src/_junkdrawer/math_pb2.py b/src/python/src/grpc/_junkdrawer/math_pb2.py similarity index 100% rename from src/python/src/_junkdrawer/math_pb2.py rename to src/python/src/grpc/_junkdrawer/math_pb2.py diff --git a/src/python/src/_junkdrawer/stock_pb2.py b/src/python/src/grpc/_junkdrawer/stock_pb2.py similarity index 100% rename from src/python/src/_junkdrawer/stock_pb2.py rename to src/python/src/grpc/_junkdrawer/stock_pb2.py diff --git a/src/python/src/_framework/base/__init__.py b/src/python/src/grpc/early_adopter/__init__.py similarity index 100% rename from src/python/src/_framework/base/__init__.py rename to src/python/src/grpc/early_adopter/__init__.py diff --git a/src/python/src/grpc_early_adopter/_face_utilities.py b/src/python/src/grpc/early_adopter/_face_utilities.py similarity index 97% rename from src/python/src/grpc_early_adopter/_face_utilities.py rename to src/python/src/grpc/early_adopter/_face_utilities.py index 8b10be729b279..714f2bb79cbd3 100644 --- a/src/python/src/grpc_early_adopter/_face_utilities.py +++ b/src/python/src/grpc/early_adopter/_face_utilities.py @@ -30,9 +30,9 @@ import abc import collections -from _framework.face import interfaces as face_interfaces +from grpc.framework.face import interfaces as face_interfaces -from grpc_early_adopter import interfaces +from grpc.early_adopter import interfaces class _InlineUnaryUnaryMethod(face_interfaces.InlineValueInValueOutMethod): diff --git a/src/python/src/grpc_early_adopter/implementations.py b/src/python/src/grpc/early_adopter/implementations.py similarity index 93% rename from src/python/src/grpc_early_adopter/implementations.py rename to src/python/src/grpc/early_adopter/implementations.py index 8a2f7fde616f2..cd9dd5a57d6c1 100644 --- a/src/python/src/grpc_early_adopter/implementations.py +++ b/src/python/src/grpc/early_adopter/implementations.py @@ -31,12 +31,12 @@ import threading -from _adapter import fore -from _framework.base.packets import implementations as _tickets_implementations -from _framework.face import implementations as _face_implementations -from _framework.foundation import logging_pool -from grpc_early_adopter import _face_utilities -from grpc_early_adopter import interfaces +from grpc._adapter import fore +from grpc.framework.base.packets import implementations as _tickets_implementations +from grpc.framework.face import implementations as _face_implementations +from grpc.framework.foundation import logging_pool +from grpc.early_adopter import _face_utilities +from grpc.early_adopter import interfaces _MEGA_TIMEOUT = 60 * 60 * 24 _THREAD_POOL_SIZE = 80 diff --git a/src/python/src/grpc_early_adopter/interfaces.py b/src/python/src/grpc/early_adopter/interfaces.py similarity index 100% rename from src/python/src/grpc_early_adopter/interfaces.py rename to src/python/src/grpc/early_adopter/interfaces.py diff --git a/src/python/src/grpc_early_adopter/utilities.py b/src/python/src/grpc/early_adopter/utilities.py similarity index 99% rename from src/python/src/grpc_early_adopter/utilities.py rename to src/python/src/grpc/early_adopter/utilities.py index 333ed3a9db4e0..a4ee253d83064 100644 --- a/src/python/src/grpc_early_adopter/utilities.py +++ b/src/python/src/grpc/early_adopter/utilities.py @@ -29,7 +29,7 @@ """Utilities for use with GRPC.""" -from grpc_early_adopter import interfaces +from grpc.early_adopter import interfaces class _RpcMethod(interfaces.RpcMethod): diff --git a/src/python/src/_framework/base/packets/__init__.py b/src/python/src/grpc/framework/__init__.py similarity index 100% rename from src/python/src/_framework/base/packets/__init__.py rename to src/python/src/grpc/framework/__init__.py diff --git a/src/python/src/_framework/common/__init__.py b/src/python/src/grpc/framework/base/__init__.py similarity index 100% rename from src/python/src/_framework/common/__init__.py rename to src/python/src/grpc/framework/base/__init__.py diff --git a/src/python/src/_framework/base/exceptions.py b/src/python/src/grpc/framework/base/exceptions.py similarity index 100% rename from src/python/src/_framework/base/exceptions.py rename to src/python/src/grpc/framework/base/exceptions.py diff --git a/src/python/src/_framework/base/interfaces.py b/src/python/src/grpc/framework/base/interfaces.py similarity index 98% rename from src/python/src/_framework/base/interfaces.py rename to src/python/src/grpc/framework/base/interfaces.py index 70030e564d622..ed43b253fe5e1 100644 --- a/src/python/src/_framework/base/interfaces.py +++ b/src/python/src/grpc/framework/base/interfaces.py @@ -33,7 +33,7 @@ import enum # stream is referenced from specification in this module. -from _framework.foundation import stream # pylint: disable=unused-import +from grpc.framework.foundation import stream # pylint: disable=unused-import @enum.unique diff --git a/src/python/src/_framework/base/interfaces_test.py b/src/python/src/grpc/framework/base/interfaces_test.py similarity index 98% rename from src/python/src/_framework/base/interfaces_test.py rename to src/python/src/grpc/framework/base/interfaces_test.py index 8e26d884ec47c..b86011c449efe 100644 --- a/src/python/src/_framework/base/interfaces_test.py +++ b/src/python/src/grpc/framework/base/interfaces_test.py @@ -32,11 +32,11 @@ import threading import time -from _framework.base import interfaces -from _framework.base import util -from _framework.foundation import stream -from _framework.foundation import stream_testing -from _framework.foundation import stream_util +from grpc.framework.base import interfaces +from grpc.framework.base import util +from grpc.framework.foundation import stream +from grpc.framework.foundation import stream_testing +from grpc.framework.foundation import stream_util TICK = 0.1 SMALL_TIMEOUT = TICK * 50 diff --git a/src/python/src/_framework/face/__init__.py b/src/python/src/grpc/framework/base/packets/__init__.py similarity index 100% rename from src/python/src/_framework/face/__init__.py rename to src/python/src/grpc/framework/base/packets/__init__.py diff --git a/src/python/src/_framework/base/packets/_cancellation.py b/src/python/src/grpc/framework/base/packets/_cancellation.py similarity index 96% rename from src/python/src/_framework/base/packets/_cancellation.py rename to src/python/src/grpc/framework/base/packets/_cancellation.py index 49172d1b974e7..2373c78842d81 100644 --- a/src/python/src/_framework/base/packets/_cancellation.py +++ b/src/python/src/grpc/framework/base/packets/_cancellation.py @@ -29,8 +29,8 @@ """State and behavior for operation cancellation.""" -from _framework.base.packets import _interfaces -from _framework.base.packets import packets +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets class CancellationManager(_interfaces.CancellationManager): diff --git a/src/python/src/_framework/base/packets/_constants.py b/src/python/src/grpc/framework/base/packets/_constants.py similarity index 100% rename from src/python/src/_framework/base/packets/_constants.py rename to src/python/src/grpc/framework/base/packets/_constants.py diff --git a/src/python/src/_framework/base/packets/_context.py b/src/python/src/grpc/framework/base/packets/_context.py similarity index 94% rename from src/python/src/_framework/base/packets/_context.py rename to src/python/src/grpc/framework/base/packets/_context.py index be390364b0a53..e09d4a60c9119 100644 --- a/src/python/src/_framework/base/packets/_context.py +++ b/src/python/src/grpc/framework/base/packets/_context.py @@ -32,9 +32,9 @@ import time # _interfaces and packets are referenced from specification in this module. -from _framework.base import interfaces as base_interfaces -from _framework.base.packets import _interfaces # pylint: disable=unused-import -from _framework.base.packets import packets # pylint: disable=unused-import +from grpc.framework.base import interfaces as base_interfaces +from grpc.framework.base.packets import _interfaces # pylint: disable=unused-import +from grpc.framework.base.packets import packets # pylint: disable=unused-import class OperationContext(base_interfaces.OperationContext): diff --git a/src/python/src/_framework/base/packets/_emission.py b/src/python/src/grpc/framework/base/packets/_emission.py similarity index 97% rename from src/python/src/_framework/base/packets/_emission.py rename to src/python/src/grpc/framework/base/packets/_emission.py index b4be5eb0ff96a..9446b8665dbf5 100644 --- a/src/python/src/_framework/base/packets/_emission.py +++ b/src/python/src/grpc/framework/base/packets/_emission.py @@ -30,8 +30,8 @@ """State and behavior for handling emitted values.""" # packets is referenced from specifications in this module. -from _framework.base.packets import _interfaces -from _framework.base.packets import packets # pylint: disable=unused-import +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets # pylint: disable=unused-import class _EmissionManager(_interfaces.EmissionManager): diff --git a/src/python/src/_framework/base/packets/_ends.py b/src/python/src/grpc/framework/base/packets/_ends.py similarity index 95% rename from src/python/src/_framework/base/packets/_ends.py rename to src/python/src/grpc/framework/base/packets/_ends.py index b1d16451e2a64..15bf3bf330b73 100644 --- a/src/python/src/_framework/base/packets/_ends.py +++ b/src/python/src/grpc/framework/base/packets/_ends.py @@ -34,19 +34,19 @@ import uuid # _interfaces and packets are referenced from specification in this module. -from _framework.base import interfaces as base_interfaces -from _framework.base.packets import _cancellation -from _framework.base.packets import _context -from _framework.base.packets import _emission -from _framework.base.packets import _expiration -from _framework.base.packets import _ingestion -from _framework.base.packets import _interfaces # pylint: disable=unused-import -from _framework.base.packets import _reception -from _framework.base.packets import _termination -from _framework.base.packets import _transmission -from _framework.base.packets import interfaces -from _framework.base.packets import packets # pylint: disable=unused-import -from _framework.foundation import callable_util +from grpc.framework.base import interfaces as base_interfaces +from grpc.framework.base.packets import _cancellation +from grpc.framework.base.packets import _context +from grpc.framework.base.packets import _emission +from grpc.framework.base.packets import _expiration +from grpc.framework.base.packets import _ingestion +from grpc.framework.base.packets import _interfaces # pylint: disable=unused-import +from grpc.framework.base.packets import _reception +from grpc.framework.base.packets import _termination +from grpc.framework.base.packets import _transmission +from grpc.framework.base.packets import interfaces +from grpc.framework.base.packets import packets # pylint: disable=unused-import +from grpc.framework.foundation import callable_util _IDLE_ACTION_EXCEPTION_LOG_MESSAGE = 'Exception calling idle action!' diff --git a/src/python/src/_framework/base/packets/_expiration.py b/src/python/src/grpc/framework/base/packets/_expiration.py similarity index 97% rename from src/python/src/_framework/base/packets/_expiration.py rename to src/python/src/grpc/framework/base/packets/_expiration.py index 772e15f08c82c..f58db28aa2546 100644 --- a/src/python/src/_framework/base/packets/_expiration.py +++ b/src/python/src/grpc/framework/base/packets/_expiration.py @@ -31,9 +31,9 @@ import time -from _framework.base.packets import _interfaces -from _framework.base.packets import packets -from _framework.foundation import later +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets +from grpc.framework.foundation import later class _ExpirationManager(_interfaces.ExpirationManager): diff --git a/src/python/src/_framework/base/packets/_ingestion.py b/src/python/src/grpc/framework/base/packets/_ingestion.py similarity index 97% rename from src/python/src/_framework/base/packets/_ingestion.py rename to src/python/src/grpc/framework/base/packets/_ingestion.py index 91f5a35359ff3..a750195ccba76 100644 --- a/src/python/src/_framework/base/packets/_ingestion.py +++ b/src/python/src/grpc/framework/base/packets/_ingestion.py @@ -32,14 +32,14 @@ import abc import collections -from _framework.base import exceptions -from _framework.base import interfaces -from _framework.base.packets import _constants -from _framework.base.packets import _interfaces -from _framework.base.packets import packets -from _framework.foundation import abandonment -from _framework.foundation import callable_util -from _framework.foundation import stream +from grpc.framework.base import exceptions +from grpc.framework.base import interfaces +from grpc.framework.base.packets import _constants +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets +from grpc.framework.foundation import abandonment +from grpc.framework.foundation import callable_util +from grpc.framework.foundation import stream _CREATE_CONSUMER_EXCEPTION_LOG_MESSAGE = 'Exception initializing ingestion!' _CONSUME_EXCEPTION_LOG_MESSAGE = 'Exception during ingestion!' diff --git a/src/python/src/_framework/base/packets/_interfaces.py b/src/python/src/grpc/framework/base/packets/_interfaces.py similarity index 97% rename from src/python/src/_framework/base/packets/_interfaces.py rename to src/python/src/grpc/framework/base/packets/_interfaces.py index d1bda95bf7492..70d9572391043 100644 --- a/src/python/src/_framework/base/packets/_interfaces.py +++ b/src/python/src/grpc/framework/base/packets/_interfaces.py @@ -32,9 +32,9 @@ import abc # base_interfaces and packets are referenced from specification in this module. -from _framework.base import interfaces as base_interfaces # pylint: disable=unused-import -from _framework.base.packets import packets # pylint: disable=unused-import -from _framework.foundation import stream +from grpc.framework.base import interfaces as base_interfaces # pylint: disable=unused-import +from grpc.framework.base.packets import packets # pylint: disable=unused-import +from grpc.framework.foundation import stream class TerminationManager(object): diff --git a/src/python/src/_framework/base/packets/_reception.py b/src/python/src/grpc/framework/base/packets/_reception.py similarity index 99% rename from src/python/src/_framework/base/packets/_reception.py rename to src/python/src/grpc/framework/base/packets/_reception.py index a2a3823d28cca..6e2c9c0a4e73c 100644 --- a/src/python/src/_framework/base/packets/_reception.py +++ b/src/python/src/grpc/framework/base/packets/_reception.py @@ -31,8 +31,8 @@ import abc -from _framework.base.packets import _interfaces -from _framework.base.packets import packets +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets class _Receiver(object): diff --git a/src/python/src/_framework/base/packets/_termination.py b/src/python/src/grpc/framework/base/packets/_termination.py similarity index 97% rename from src/python/src/_framework/base/packets/_termination.py rename to src/python/src/grpc/framework/base/packets/_termination.py index ae3ba1c16f39a..5c10da7aa8c94 100644 --- a/src/python/src/_framework/base/packets/_termination.py +++ b/src/python/src/grpc/framework/base/packets/_termination.py @@ -31,11 +31,11 @@ import enum -from _framework.base import interfaces -from _framework.base.packets import _constants -from _framework.base.packets import _interfaces -from _framework.base.packets import packets -from _framework.foundation import callable_util +from grpc.framework.base import interfaces +from grpc.framework.base.packets import _constants +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets +from grpc.framework.foundation import callable_util _CALLBACK_EXCEPTION_LOG_MESSAGE = 'Exception calling termination callback!' diff --git a/src/python/src/_framework/base/packets/_transmission.py b/src/python/src/grpc/framework/base/packets/_transmission.py similarity index 98% rename from src/python/src/_framework/base/packets/_transmission.py rename to src/python/src/grpc/framework/base/packets/_transmission.py index 24fe6e6164f8c..ac7f4509db901 100644 --- a/src/python/src/_framework/base/packets/_transmission.py +++ b/src/python/src/grpc/framework/base/packets/_transmission.py @@ -31,11 +31,11 @@ import abc -from _framework.base import interfaces -from _framework.base.packets import _constants -from _framework.base.packets import _interfaces -from _framework.base.packets import packets -from _framework.foundation import callable_util +from grpc.framework.base import interfaces +from grpc.framework.base.packets import _constants +from grpc.framework.base.packets import _interfaces +from grpc.framework.base.packets import packets +from grpc.framework.foundation import callable_util _TRANSMISSION_EXCEPTION_LOG_MESSAGE = 'Exception during transmission!' diff --git a/src/python/src/_framework/base/packets/implementations.py b/src/python/src/grpc/framework/base/packets/implementations.py similarity index 96% rename from src/python/src/_framework/base/packets/implementations.py rename to src/python/src/grpc/framework/base/packets/implementations.py index 2f07054d4d2ae..28688bcc0f98d 100644 --- a/src/python/src/_framework/base/packets/implementations.py +++ b/src/python/src/grpc/framework/base/packets/implementations.py @@ -30,8 +30,8 @@ """Entry points into the packet-exchange-based implementation the base layer.""" # interfaces is referenced from specification in this module. -from _framework.base.packets import _ends -from _framework.base.packets import interfaces # pylint: disable=unused-import +from grpc.framework.base.packets import _ends +from grpc.framework.base.packets import interfaces # pylint: disable=unused-import def front(work_pool, transmission_pool, utility_pool): diff --git a/src/python/src/_framework/base/packets/implementations_test.py b/src/python/src/grpc/framework/base/packets/implementations_test.py similarity index 94% rename from src/python/src/_framework/base/packets/implementations_test.py rename to src/python/src/grpc/framework/base/packets/implementations_test.py index 8bb53531760cd..628f4b39094dc 100644 --- a/src/python/src/_framework/base/packets/implementations_test.py +++ b/src/python/src/grpc/framework/base/packets/implementations_test.py @@ -31,10 +31,10 @@ import unittest -from _framework.base import interfaces_test -from _framework.base import util -from _framework.base.packets import implementations -from _framework.foundation import logging_pool +from grpc.framework.base import interfaces_test +from grpc.framework.base import util +from grpc.framework.base.packets import implementations +from grpc.framework.foundation import logging_pool POOL_MAX_WORKERS = 100 DEFAULT_TIMEOUT = 30 diff --git a/src/python/src/_framework/base/packets/in_memory.py b/src/python/src/grpc/framework/base/packets/in_memory.py similarity index 96% rename from src/python/src/_framework/base/packets/in_memory.py rename to src/python/src/grpc/framework/base/packets/in_memory.py index 17daf3acf7b28..453fd3b38aaa6 100644 --- a/src/python/src/_framework/base/packets/in_memory.py +++ b/src/python/src/grpc/framework/base/packets/in_memory.py @@ -31,9 +31,9 @@ import threading -from _framework.base.packets import _constants -from _framework.base.packets import interfaces -from _framework.foundation import callable_util +from grpc.framework.base.packets import _constants +from grpc.framework.base.packets import interfaces +from grpc.framework.foundation import callable_util class _Serializer(object): diff --git a/src/python/src/_framework/base/packets/interfaces.py b/src/python/src/grpc/framework/base/packets/interfaces.py similarity index 96% rename from src/python/src/_framework/base/packets/interfaces.py rename to src/python/src/grpc/framework/base/packets/interfaces.py index 99f9e8777261e..7c48956ba59a2 100644 --- a/src/python/src/_framework/base/packets/interfaces.py +++ b/src/python/src/grpc/framework/base/packets/interfaces.py @@ -32,8 +32,8 @@ import abc # packets is referenced from specifications in this module. -from _framework.base import interfaces -from _framework.base.packets import packets # pylint: disable=unused-import +from grpc.framework.base import interfaces +from grpc.framework.base.packets import packets # pylint: disable=unused-import class ForeLink(object): diff --git a/src/python/src/_framework/base/packets/null.py b/src/python/src/grpc/framework/base/packets/null.py similarity index 97% rename from src/python/src/_framework/base/packets/null.py rename to src/python/src/grpc/framework/base/packets/null.py index 9b40a005052ab..5a2121243bf3e 100644 --- a/src/python/src/_framework/base/packets/null.py +++ b/src/python/src/grpc/framework/base/packets/null.py @@ -29,7 +29,7 @@ """Null links that ignore tickets passed to them.""" -from _framework.base.packets import interfaces +from grpc.framework.base.packets import interfaces class _NullForeLink(interfaces.ForeLink): diff --git a/src/python/src/_framework/base/packets/packets.py b/src/python/src/grpc/framework/base/packets/packets.py similarity index 98% rename from src/python/src/_framework/base/packets/packets.py rename to src/python/src/grpc/framework/base/packets/packets.py index f7503bdcd6515..9e2d4080b8c1c 100644 --- a/src/python/src/_framework/base/packets/packets.py +++ b/src/python/src/grpc/framework/base/packets/packets.py @@ -33,7 +33,7 @@ import enum # interfaces is referenced from specifications in this module. -from _framework.base import interfaces # pylint: disable=unused-import +from grpc.framework.base import interfaces # pylint: disable=unused-import @enum.unique diff --git a/src/python/src/_framework/base/util.py b/src/python/src/grpc/framework/base/util.py similarity index 98% rename from src/python/src/_framework/base/util.py rename to src/python/src/grpc/framework/base/util.py index 35ce0443fcbf8..c832c826cfd05 100644 --- a/src/python/src/_framework/base/util.py +++ b/src/python/src/grpc/framework/base/util.py @@ -32,7 +32,7 @@ import collections import threading -from _framework.base import interfaces +from grpc.framework.base import interfaces class _ServicedSubscription( diff --git a/src/python/src/_framework/face/testing/__init__.py b/src/python/src/grpc/framework/common/__init__.py similarity index 100% rename from src/python/src/_framework/face/testing/__init__.py rename to src/python/src/grpc/framework/common/__init__.py diff --git a/src/python/src/_framework/common/cardinality.py b/src/python/src/grpc/framework/common/cardinality.py similarity index 100% rename from src/python/src/_framework/common/cardinality.py rename to src/python/src/grpc/framework/common/cardinality.py diff --git a/src/python/src/_framework/foundation/__init__.py b/src/python/src/grpc/framework/face/__init__.py similarity index 100% rename from src/python/src/_framework/foundation/__init__.py rename to src/python/src/grpc/framework/face/__init__.py diff --git a/src/python/src/_framework/face/_calls.py b/src/python/src/grpc/framework/face/_calls.py similarity index 98% rename from src/python/src/_framework/face/_calls.py rename to src/python/src/grpc/framework/face/_calls.py index a7d8be5e4327c..75a550e3c7d73 100644 --- a/src/python/src/_framework/face/_calls.py +++ b/src/python/src/grpc/framework/face/_calls.py @@ -32,12 +32,12 @@ import sys import threading -from _framework.base import interfaces as base_interfaces -from _framework.base import util as base_util -from _framework.face import _control -from _framework.face import interfaces -from _framework.foundation import callable_util -from _framework.foundation import future +from grpc.framework.base import interfaces as base_interfaces +from grpc.framework.base import util as base_util +from grpc.framework.face import _control +from grpc.framework.face import interfaces +from grpc.framework.foundation import callable_util +from grpc.framework.foundation import future _ITERATOR_EXCEPTION_LOG_MESSAGE = 'Exception iterating over requests!' _DONE_CALLBACK_LOG_MESSAGE = 'Exception calling Future "done" callback!' diff --git a/src/python/src/_framework/face/_control.py b/src/python/src/grpc/framework/face/_control.py similarity index 96% rename from src/python/src/_framework/face/_control.py rename to src/python/src/grpc/framework/face/_control.py index 9f1bf6d5fdbea..e918907b74946 100644 --- a/src/python/src/_framework/face/_control.py +++ b/src/python/src/grpc/framework/face/_control.py @@ -31,11 +31,11 @@ import threading -from _framework.base import interfaces as base_interfaces -from _framework.face import exceptions -from _framework.face import interfaces -from _framework.foundation import abandonment -from _framework.foundation import stream +from grpc.framework.base import interfaces as base_interfaces +from grpc.framework.face import exceptions +from grpc.framework.face import interfaces +from grpc.framework.foundation import abandonment +from grpc.framework.foundation import stream INTERNAL_ERROR_LOG_MESSAGE = ':-( RPC Framework (Face) Internal Error! :-(' diff --git a/src/python/src/_framework/face/_service.py b/src/python/src/grpc/framework/face/_service.py similarity index 93% rename from src/python/src/_framework/face/_service.py rename to src/python/src/grpc/framework/face/_service.py index d758c2f1480cf..26bde129687a5 100644 --- a/src/python/src/_framework/face/_service.py +++ b/src/python/src/grpc/framework/face/_service.py @@ -31,14 +31,14 @@ # base_interfaces and interfaces are referenced from specification in this # module. -from _framework.base import interfaces as base_interfaces # pylint: disable=unused-import -from _framework.face import _control -from _framework.face import exceptions -from _framework.face import interfaces # pylint: disable=unused-import -from _framework.foundation import abandonment -from _framework.foundation import callable_util -from _framework.foundation import stream -from _framework.foundation import stream_util +from grpc.framework.base import interfaces as base_interfaces # pylint: disable=unused-import +from grpc.framework.face import _control +from grpc.framework.face import exceptions +from grpc.framework.face import interfaces # pylint: disable=unused-import +from grpc.framework.foundation import abandonment +from grpc.framework.foundation import callable_util +from grpc.framework.foundation import stream +from grpc.framework.foundation import stream_util class _ValueInStreamOutConsumer(stream.Consumer): diff --git a/src/python/src/_framework/face/_test_case.py b/src/python/src/grpc/framework/face/_test_case.py similarity index 94% rename from src/python/src/_framework/face/_test_case.py rename to src/python/src/grpc/framework/face/_test_case.py index 50b55c389f378..a4e17c464ce75 100644 --- a/src/python/src/_framework/face/_test_case.py +++ b/src/python/src/grpc/framework/face/_test_case.py @@ -29,10 +29,10 @@ """Common lifecycle code for in-memory-ticket-exchange Face-layer tests.""" -from _framework.face import implementations -from _framework.face.testing import base_util -from _framework.face.testing import test_case -from _framework.foundation import logging_pool +from grpc.framework.face import implementations +from grpc.framework.face.testing import base_util +from grpc.framework.face.testing import test_case +from grpc.framework.foundation import logging_pool _TIMEOUT = 3 _MAXIMUM_POOL_SIZE = 100 diff --git a/src/python/src/_framework/face/blocking_invocation_inline_service_test.py b/src/python/src/grpc/framework/face/blocking_invocation_inline_service_test.py similarity index 92% rename from src/python/src/_framework/face/blocking_invocation_inline_service_test.py rename to src/python/src/grpc/framework/face/blocking_invocation_inline_service_test.py index 96563c94eebd1..636cd701ff1b9 100644 --- a/src/python/src/_framework/face/blocking_invocation_inline_service_test.py +++ b/src/python/src/grpc/framework/face/blocking_invocation_inline_service_test.py @@ -31,8 +31,8 @@ import unittest -from _framework.face import _test_case -from _framework.face.testing import blocking_invocation_inline_service_test_case as test_case +from grpc.framework.face import _test_case +from grpc.framework.face.testing import blocking_invocation_inline_service_test_case as test_case class BlockingInvocationInlineServiceTest( diff --git a/src/python/src/_framework/face/demonstration.py b/src/python/src/grpc/framework/face/demonstration.py similarity index 95% rename from src/python/src/_framework/face/demonstration.py rename to src/python/src/grpc/framework/face/demonstration.py index 501ec6b3f8324..d922f6e5ef05c 100644 --- a/src/python/src/_framework/face/demonstration.py +++ b/src/python/src/grpc/framework/face/demonstration.py @@ -29,10 +29,10 @@ """Demonstration-suitable implementation of the face layer of RPC Framework.""" -from _framework.base import util as _base_util -from _framework.base.packets import implementations as _tickets_implementations -from _framework.face import implementations -from _framework.foundation import logging_pool +from grpc.framework.base import util as _base_util +from grpc.framework.base.packets import implementations as _tickets_implementations +from grpc.framework.face import implementations +from grpc.framework.foundation import logging_pool _POOL_SIZE_LIMIT = 20 diff --git a/src/python/src/_framework/face/event_invocation_synchronous_event_service_test.py b/src/python/src/grpc/framework/face/event_invocation_synchronous_event_service_test.py similarity index 92% rename from src/python/src/_framework/face/event_invocation_synchronous_event_service_test.py rename to src/python/src/grpc/framework/face/event_invocation_synchronous_event_service_test.py index 48e05b2478e31..25f3e297b5c5e 100644 --- a/src/python/src/_framework/face/event_invocation_synchronous_event_service_test.py +++ b/src/python/src/grpc/framework/face/event_invocation_synchronous_event_service_test.py @@ -31,8 +31,8 @@ import unittest -from _framework.face import _test_case -from _framework.face.testing import event_invocation_synchronous_event_service_test_case as test_case +from grpc.framework.face import _test_case +from grpc.framework.face.testing import event_invocation_synchronous_event_service_test_case as test_case class EventInvocationSynchronousEventServiceTest( diff --git a/src/python/src/_framework/face/exceptions.py b/src/python/src/grpc/framework/face/exceptions.py similarity index 100% rename from src/python/src/_framework/face/exceptions.py rename to src/python/src/grpc/framework/face/exceptions.py diff --git a/src/python/src/_framework/face/future_invocation_asynchronous_event_service_test.py b/src/python/src/grpc/framework/face/future_invocation_asynchronous_event_service_test.py similarity index 92% rename from src/python/src/_framework/face/future_invocation_asynchronous_event_service_test.py rename to src/python/src/grpc/framework/face/future_invocation_asynchronous_event_service_test.py index 96f5fe85d3dcb..38229ea9f4a47 100644 --- a/src/python/src/_framework/face/future_invocation_asynchronous_event_service_test.py +++ b/src/python/src/grpc/framework/face/future_invocation_asynchronous_event_service_test.py @@ -31,8 +31,8 @@ import unittest -from _framework.face import _test_case -from _framework.face.testing import future_invocation_asynchronous_event_service_test_case as test_case +from grpc.framework.face import _test_case +from grpc.framework.face.testing import future_invocation_asynchronous_event_service_test_case as test_case class FutureInvocationAsynchronousEventServiceTest( diff --git a/src/python/src/_framework/face/implementations.py b/src/python/src/grpc/framework/face/implementations.py similarity index 96% rename from src/python/src/_framework/face/implementations.py rename to src/python/src/grpc/framework/face/implementations.py index 94362e20071b5..c499b907207cb 100644 --- a/src/python/src/_framework/face/implementations.py +++ b/src/python/src/grpc/framework/face/implementations.py @@ -29,12 +29,12 @@ """Entry points into the Face layer of RPC Framework.""" -from _framework.base import exceptions as _base_exceptions -from _framework.base import interfaces as base_interfaces -from _framework.face import _calls -from _framework.face import _service -from _framework.face import exceptions -from _framework.face import interfaces +from grpc.framework.base import exceptions as _base_exceptions +from grpc.framework.base import interfaces as base_interfaces +from grpc.framework.face import _calls +from grpc.framework.face import _service +from grpc.framework.face import exceptions +from grpc.framework.face import interfaces class _BaseServicer(base_interfaces.Servicer): diff --git a/src/python/src/_framework/face/interfaces.py b/src/python/src/grpc/framework/face/interfaces.py similarity index 98% rename from src/python/src/_framework/face/interfaces.py rename to src/python/src/grpc/framework/face/interfaces.py index 248045436946c..548e9ce4dbe97 100644 --- a/src/python/src/_framework/face/interfaces.py +++ b/src/python/src/grpc/framework/face/interfaces.py @@ -34,9 +34,9 @@ # exceptions, abandonment, and future are referenced from specification in this # module. -from _framework.face import exceptions # pylint: disable=unused-import -from _framework.foundation import abandonment # pylint: disable=unused-import -from _framework.foundation import future # pylint: disable=unused-import +from grpc.framework.face import exceptions # pylint: disable=unused-import +from grpc.framework.foundation import abandonment # pylint: disable=unused-import +from grpc.framework.foundation import future # pylint: disable=unused-import class CancellableIterator(object): diff --git a/src/python/src/_junkdrawer/__init__.py b/src/python/src/grpc/framework/face/testing/__init__.py similarity index 100% rename from src/python/src/_junkdrawer/__init__.py rename to src/python/src/grpc/framework/face/testing/__init__.py diff --git a/src/python/src/_framework/face/testing/base_util.py b/src/python/src/grpc/framework/face/testing/base_util.py similarity index 92% rename from src/python/src/_framework/face/testing/base_util.py rename to src/python/src/grpc/framework/face/testing/base_util.py index d9ccb3af8fca5..7872a6b9e94de 100644 --- a/src/python/src/_framework/face/testing/base_util.py +++ b/src/python/src/grpc/framework/face/testing/base_util.py @@ -32,11 +32,11 @@ import abc # interfaces is referenced from specification in this module. -from _framework.base import util as _base_util -from _framework.base.packets import implementations -from _framework.base.packets import in_memory -from _framework.base.packets import interfaces # pylint: disable=unused-import -from _framework.foundation import logging_pool +from grpc.framework.base import util as _base_util +from grpc.framework.base.packets import implementations +from grpc.framework.base.packets import in_memory +from grpc.framework.base.packets import interfaces # pylint: disable=unused-import +from grpc.framework.foundation import logging_pool _POOL_SIZE_LIMIT = 20 diff --git a/src/python/src/_framework/face/testing/blocking_invocation_inline_service_test_case.py b/src/python/src/grpc/framework/face/testing/blocking_invocation_inline_service_test_case.py similarity index 96% rename from src/python/src/_framework/face/testing/blocking_invocation_inline_service_test_case.py rename to src/python/src/grpc/framework/face/testing/blocking_invocation_inline_service_test_case.py index 0b1a2f0bd211d..993098f4ae52f 100644 --- a/src/python/src/_framework/face/testing/blocking_invocation_inline_service_test_case.py +++ b/src/python/src/grpc/framework/face/testing/blocking_invocation_inline_service_test_case.py @@ -33,12 +33,12 @@ import abc import unittest # pylint: disable=unused-import -from _framework.face import exceptions -from _framework.face.testing import control -from _framework.face.testing import coverage -from _framework.face.testing import digest -from _framework.face.testing import stock_service -from _framework.face.testing import test_case +from grpc.framework.face import exceptions +from grpc.framework.face.testing import control +from grpc.framework.face.testing import coverage +from grpc.framework.face.testing import digest +from grpc.framework.face.testing import stock_service +from grpc.framework.face.testing import test_case _TIMEOUT = 3 diff --git a/src/python/src/_framework/face/testing/callback.py b/src/python/src/grpc/framework/face/testing/callback.py similarity index 98% rename from src/python/src/_framework/face/testing/callback.py rename to src/python/src/grpc/framework/face/testing/callback.py index 7a20869abe950..d0e63c8c56202 100644 --- a/src/python/src/_framework/face/testing/callback.py +++ b/src/python/src/grpc/framework/face/testing/callback.py @@ -31,7 +31,7 @@ import threading -from _framework.foundation import stream +from grpc.framework.foundation import stream class Callback(stream.Consumer): diff --git a/src/python/src/_framework/face/testing/control.py b/src/python/src/grpc/framework/face/testing/control.py similarity index 100% rename from src/python/src/_framework/face/testing/control.py rename to src/python/src/grpc/framework/face/testing/control.py diff --git a/src/python/src/_framework/face/testing/coverage.py b/src/python/src/grpc/framework/face/testing/coverage.py similarity index 100% rename from src/python/src/_framework/face/testing/coverage.py rename to src/python/src/grpc/framework/face/testing/coverage.py diff --git a/src/python/src/_framework/face/testing/digest.py b/src/python/src/grpc/framework/face/testing/digest.py similarity index 96% rename from src/python/src/_framework/face/testing/digest.py rename to src/python/src/grpc/framework/face/testing/digest.py index 8d1291c975510..b8fb573301370 100644 --- a/src/python/src/_framework/face/testing/digest.py +++ b/src/python/src/grpc/framework/face/testing/digest.py @@ -34,13 +34,13 @@ # testing_control, interfaces, and testing_service are referenced from # specification in this module. -from _framework.face import exceptions -from _framework.face import interfaces as face_interfaces -from _framework.face.testing import control as testing_control # pylint: disable=unused-import -from _framework.face.testing import interfaces # pylint: disable=unused-import -from _framework.face.testing import service as testing_service # pylint: disable=unused-import -from _framework.foundation import stream -from _framework.foundation import stream_util +from grpc.framework.face import exceptions +from grpc.framework.face import interfaces as face_interfaces +from grpc.framework.face.testing import control as testing_control # pylint: disable=unused-import +from grpc.framework.face.testing import interfaces # pylint: disable=unused-import +from grpc.framework.face.testing import service as testing_service # pylint: disable=unused-import +from grpc.framework.foundation import stream +from grpc.framework.foundation import stream_util _IDENTITY = lambda x: x diff --git a/src/python/src/_framework/face/testing/event_invocation_synchronous_event_service_test_case.py b/src/python/src/grpc/framework/face/testing/event_invocation_synchronous_event_service_test_case.py similarity index 97% rename from src/python/src/_framework/face/testing/event_invocation_synchronous_event_service_test_case.py rename to src/python/src/grpc/framework/face/testing/event_invocation_synchronous_event_service_test_case.py index cb786f500c0d9..21e669b9080fb 100644 --- a/src/python/src/_framework/face/testing/event_invocation_synchronous_event_service_test_case.py +++ b/src/python/src/grpc/framework/face/testing/event_invocation_synchronous_event_service_test_case.py @@ -32,13 +32,13 @@ import abc import unittest -from _framework.face import interfaces -from _framework.face.testing import callback as testing_callback -from _framework.face.testing import control -from _framework.face.testing import coverage -from _framework.face.testing import digest -from _framework.face.testing import stock_service -from _framework.face.testing import test_case +from grpc.framework.face import interfaces +from grpc.framework.face.testing import callback as testing_callback +from grpc.framework.face.testing import control +from grpc.framework.face.testing import coverage +from grpc.framework.face.testing import digest +from grpc.framework.face.testing import stock_service +from grpc.framework.face.testing import test_case _TIMEOUT = 3 diff --git a/src/python/src/_framework/face/testing/future_invocation_asynchronous_event_service_test_case.py b/src/python/src/grpc/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py similarity index 97% rename from src/python/src/_framework/face/testing/future_invocation_asynchronous_event_service_test_case.py rename to src/python/src/grpc/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py index 939b238b66e07..42db3050e1f52 100644 --- a/src/python/src/_framework/face/testing/future_invocation_asynchronous_event_service_test_case.py +++ b/src/python/src/grpc/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py @@ -34,14 +34,14 @@ import threading import unittest -from _framework.face import exceptions -from _framework.face.testing import control -from _framework.face.testing import coverage -from _framework.face.testing import digest -from _framework.face.testing import stock_service -from _framework.face.testing import test_case -from _framework.foundation import future -from _framework.foundation import logging_pool +from grpc.framework.face import exceptions +from grpc.framework.face.testing import control +from grpc.framework.face.testing import coverage +from grpc.framework.face.testing import digest +from grpc.framework.face.testing import stock_service +from grpc.framework.face.testing import test_case +from grpc.framework.foundation import future +from grpc.framework.foundation import logging_pool _TIMEOUT = 3 _MAXIMUM_POOL_SIZE = 100 diff --git a/src/python/src/_framework/face/testing/interfaces.py b/src/python/src/grpc/framework/face/testing/interfaces.py similarity index 97% rename from src/python/src/_framework/face/testing/interfaces.py rename to src/python/src/grpc/framework/face/testing/interfaces.py index 253f6f118df52..5932dabf1eb98 100644 --- a/src/python/src/_framework/face/testing/interfaces.py +++ b/src/python/src/grpc/framework/face/testing/interfaces.py @@ -32,7 +32,7 @@ import abc # cardinality is referenced from specification in this module. -from _framework.common import cardinality # pylint: disable=unused-import +from grpc.framework.common import cardinality # pylint: disable=unused-import class Method(object): diff --git a/src/python/src/_framework/face/testing/serial.py b/src/python/src/grpc/framework/face/testing/serial.py similarity index 100% rename from src/python/src/_framework/face/testing/serial.py rename to src/python/src/grpc/framework/face/testing/serial.py diff --git a/src/python/src/_framework/face/testing/service.py b/src/python/src/grpc/framework/face/testing/service.py similarity index 98% rename from src/python/src/_framework/face/testing/service.py rename to src/python/src/grpc/framework/face/testing/service.py index 771346ec2e171..a58e2ee42e41e 100644 --- a/src/python/src/_framework/face/testing/service.py +++ b/src/python/src/grpc/framework/face/testing/service.py @@ -32,8 +32,8 @@ import abc # interfaces is referenced from specification in this module. -from _framework.face import interfaces as face_interfaces # pylint: disable=unused-import -from _framework.face.testing import interfaces +from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import +from grpc.framework.face.testing import interfaces class UnaryUnaryTestMethod(interfaces.Method): diff --git a/src/python/src/_framework/face/testing/stock_service.py b/src/python/src/grpc/framework/face/testing/stock_service.py similarity index 97% rename from src/python/src/_framework/face/testing/stock_service.py rename to src/python/src/grpc/framework/face/testing/stock_service.py index bd82877e83871..83c9418b074a3 100644 --- a/src/python/src/_framework/face/testing/stock_service.py +++ b/src/python/src/grpc/framework/face/testing/stock_service.py @@ -29,12 +29,12 @@ """Examples of Python implementations of the stock.proto Stock service.""" -from _framework.common import cardinality -from _framework.face.testing import service -from _framework.foundation import abandonment -from _framework.foundation import stream -from _framework.foundation import stream_util -from _junkdrawer import stock_pb2 +from grpc.framework.common import cardinality +from grpc.framework.face.testing import service +from grpc.framework.foundation import abandonment +from grpc.framework.foundation import stream +from grpc.framework.foundation import stream_util +from grpc._junkdrawer import stock_pb2 SYMBOL_FORMAT = 'test symbol:%03d' STREAM_LENGTH = 400 diff --git a/src/python/src/_framework/face/testing/test_case.py b/src/python/src/grpc/framework/face/testing/test_case.py similarity index 96% rename from src/python/src/_framework/face/testing/test_case.py rename to src/python/src/grpc/framework/face/testing/test_case.py index 09b5a67f5ad8a..218a2a8549beb 100644 --- a/src/python/src/_framework/face/testing/test_case.py +++ b/src/python/src/grpc/framework/face/testing/test_case.py @@ -32,8 +32,8 @@ import abc # face_interfaces and interfaces are referenced in specification in this module. -from _framework.face import interfaces as face_interfaces # pylint: disable=unused-import -from _framework.face.testing import interfaces # pylint: disable=unused-import +from grpc.framework.face import interfaces as face_interfaces # pylint: disable=unused-import +from grpc.framework.face.testing import interfaces # pylint: disable=unused-import class FaceTestCase(object): diff --git a/src/python/src/grpc_early_adopter/__init__.py b/src/python/src/grpc/framework/foundation/__init__.py similarity index 100% rename from src/python/src/grpc_early_adopter/__init__.py rename to src/python/src/grpc/framework/foundation/__init__.py diff --git a/src/python/src/_framework/foundation/_later_test.py b/src/python/src/grpc/framework/foundation/_later_test.py similarity index 99% rename from src/python/src/_framework/foundation/_later_test.py rename to src/python/src/grpc/framework/foundation/_later_test.py index 50b67907db489..e83e7031289be 100644 --- a/src/python/src/_framework/foundation/_later_test.py +++ b/src/python/src/grpc/framework/foundation/_later_test.py @@ -33,7 +33,7 @@ import time import unittest -from _framework.foundation import later +from grpc.framework.foundation import later TICK = 0.1 diff --git a/src/python/src/_framework/foundation/_logging_pool_test.py b/src/python/src/grpc/framework/foundation/_logging_pool_test.py similarity index 97% rename from src/python/src/_framework/foundation/_logging_pool_test.py rename to src/python/src/grpc/framework/foundation/_logging_pool_test.py index f2224d80e5caf..11463a8bece33 100644 --- a/src/python/src/_framework/foundation/_logging_pool_test.py +++ b/src/python/src/grpc/framework/foundation/_logging_pool_test.py @@ -31,7 +31,7 @@ import unittest -from _framework.foundation import logging_pool +from grpc.framework.foundation import logging_pool _POOL_SIZE = 16 diff --git a/src/python/src/_framework/foundation/_timer_future.py b/src/python/src/grpc/framework/foundation/_timer_future.py similarity index 99% rename from src/python/src/_framework/foundation/_timer_future.py rename to src/python/src/grpc/framework/foundation/_timer_future.py index 4aa66991c5e75..2c9996aa9db7a 100644 --- a/src/python/src/_framework/foundation/_timer_future.py +++ b/src/python/src/grpc/framework/foundation/_timer_future.py @@ -33,7 +33,7 @@ import threading import time -from _framework.foundation import future +from grpc.framework.foundation import future class TimerFuture(future.Future): diff --git a/src/python/src/_framework/foundation/abandonment.py b/src/python/src/grpc/framework/foundation/abandonment.py similarity index 100% rename from src/python/src/_framework/foundation/abandonment.py rename to src/python/src/grpc/framework/foundation/abandonment.py diff --git a/src/python/src/_framework/foundation/callable_util.py b/src/python/src/grpc/framework/foundation/callable_util.py similarity index 100% rename from src/python/src/_framework/foundation/callable_util.py rename to src/python/src/grpc/framework/foundation/callable_util.py diff --git a/src/python/src/_framework/foundation/future.py b/src/python/src/grpc/framework/foundation/future.py similarity index 100% rename from src/python/src/_framework/foundation/future.py rename to src/python/src/grpc/framework/foundation/future.py diff --git a/src/python/src/_framework/foundation/later.py b/src/python/src/grpc/framework/foundation/later.py similarity index 97% rename from src/python/src/_framework/foundation/later.py rename to src/python/src/grpc/framework/foundation/later.py index fc2cf578d0b72..1d1e0650413da 100644 --- a/src/python/src/_framework/foundation/later.py +++ b/src/python/src/grpc/framework/foundation/later.py @@ -31,7 +31,7 @@ import time -from _framework.foundation import _timer_future +from grpc.framework.foundation import _timer_future def later(delay, computation): diff --git a/src/python/src/_framework/foundation/logging_pool.py b/src/python/src/grpc/framework/foundation/logging_pool.py similarity index 100% rename from src/python/src/_framework/foundation/logging_pool.py rename to src/python/src/grpc/framework/foundation/logging_pool.py diff --git a/src/python/src/_framework/foundation/stream.py b/src/python/src/grpc/framework/foundation/stream.py similarity index 100% rename from src/python/src/_framework/foundation/stream.py rename to src/python/src/grpc/framework/foundation/stream.py diff --git a/src/python/src/_framework/foundation/stream_testing.py b/src/python/src/grpc/framework/foundation/stream_testing.py similarity index 98% rename from src/python/src/_framework/foundation/stream_testing.py rename to src/python/src/grpc/framework/foundation/stream_testing.py index c1acedc5c6ea9..098a53d5e75d1 100644 --- a/src/python/src/_framework/foundation/stream_testing.py +++ b/src/python/src/grpc/framework/foundation/stream_testing.py @@ -29,7 +29,7 @@ """Utilities for testing stream-related code.""" -from _framework.foundation import stream +from grpc.framework.foundation import stream class TestConsumer(stream.Consumer): diff --git a/src/python/src/_framework/foundation/stream_util.py b/src/python/src/grpc/framework/foundation/stream_util.py similarity index 99% rename from src/python/src/_framework/foundation/stream_util.py rename to src/python/src/grpc/framework/foundation/stream_util.py index 3a9c04331694d..2210e4efcf03b 100644 --- a/src/python/src/_framework/foundation/stream_util.py +++ b/src/python/src/grpc/framework/foundation/stream_util.py @@ -32,7 +32,7 @@ import logging import threading -from _framework.foundation import stream +from grpc.framework.foundation import stream _NO_VALUE = object() diff --git a/src/python/src/setup.py b/src/python/src/setup.py index 93af4d68ca9e3..8e33ebb31c406 100644 --- a/src/python/src/setup.py +++ b/src/python/src/setup.py @@ -32,13 +32,13 @@ from distutils import core as _core _EXTENSION_SOURCES = ( - '_adapter/_c.c', - '_adapter/_call.c', - '_adapter/_channel.c', - '_adapter/_completion_queue.c', - '_adapter/_error.c', - '_adapter/_server.c', - '_adapter/_server_credentials.c', + 'grpc/_adapter/_c.c', + 'grpc/_adapter/_call.c', + 'grpc/_adapter/_channel.c', + 'grpc/_adapter/_completion_queue.c', + 'grpc/_adapter/_error.c', + 'grpc/_adapter/_server.c', + 'grpc/_adapter/_server_credentials.c', ) _EXTENSION_INCLUDE_DIRECTORIES = ( @@ -51,29 +51,31 @@ ) _EXTENSION_MODULE = _core.Extension( - '_adapter._c', sources=list(_EXTENSION_SOURCES), + 'grpc._adapter._c', sources=list(_EXTENSION_SOURCES), include_dirs=_EXTENSION_INCLUDE_DIRECTORIES, libraries=_EXTENSION_LIBRARIES, ) _PACKAGES=( - '_adapter', - '_framework', - '_framework.base', - '_framework.base.packets', - '_framework.common', - '_framework.face', - '_framework.face.testing', - '_framework.foundation', - '_junkdrawer', - 'grpc_early_adopter', + 'grpc', + 'grpc._adapter', + 'grpc._junkdrawer', + 'grpc.early_adopter', + 'grpc.framework', + 'grpc.framework.base', + 'grpc.framework.base.packets', + 'grpc.framework.common', + 'grpc.framework.face', + 'grpc.framework.face.testing', + 'grpc.framework.foundation', ) _PACKAGE_DIRECTORIES = { - '_adapter': '_adapter', - '_framework': '_framework', - '_junkdrawer': '_junkdrawer', - 'grpc_early_adopter': 'grpc_early_adopter', + 'grpc': 'grpc', + 'grpc._adapter': 'grpc/_adapter', + 'grpc._junkdrawer': 'grpc/_junkdrawer', + 'grpc.early_adopter': 'grpc/early_adopter', + 'grpc.framework': 'grpc/framework', } _core.setup( diff --git a/tools/dockerfile/grpc_python/Dockerfile b/tools/dockerfile/grpc_python/Dockerfile index 2390ed7bcfa98..d434b47351089 100644 --- a/tools/dockerfile/grpc_python/Dockerfile +++ b/tools/dockerfile/grpc_python/Dockerfile @@ -17,19 +17,19 @@ RUN cd /var/local/git/grpc \ # Run Python GRPC's tests RUN cd /var/local/git/grpc \ # TODO(nathaniel): It would be nice for these to be auto-discoverable? - && python2.7 -B -m _adapter._blocking_invocation_inline_service_test - && python2.7 -B -m _adapter._c_test - && python2.7 -B -m _adapter._event_invocation_synchronous_event_service_test - && python2.7 -B -m _adapter._future_invocation_asynchronous_event_service_test - && python2.7 -B -m _adapter._links_test - && python2.7 -B -m _adapter._lonely_rear_link_test - && python2.7 -B -m _adapter._low_test - && python2.7 -B -m _framework.base.packets.implementations_test - && python2.7 -B -m _framework.face.blocking_invocation_inline_service_test - && python2.7 -B -m _framework.face.event_invocation_synchronous_event_service_test - && python2.7 -B -m _framework.face.future_invocation_asynchronous_event_service_test - && python2.7 -B -m _framework.foundation._later_test - && python2.7 -B -m _framework.foundation._logging_pool_test + && python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test + && python2.7 -B -m grpc._adapter._c_test + && python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test + && python2.7 -B -m grpc._adapter._future_invocation_asynchronous_event_service_test + && python2.7 -B -m grpc._adapter._links_test + && python2.7 -B -m grpc._adapter._lonely_rear_link_test + && python2.7 -B -m grpc._adapter._low_test + && python2.7 -B -m grpc._framework.base.packets.implementations_test + && python2.7 -B -m grpc._framework.face.blocking_invocation_inline_service_test + && python2.7 -B -m grpc._framework.face.event_invocation_synchronous_event_service_test + && python2.7 -B -m grpc._framework.face.future_invocation_asynchronous_event_service_test + && python2.7 -B -m grpc._framework.foundation._later_test + && python2.7 -B -m grpc._framework.foundation._logging_pool_test # Add a cacerts directory containing the Google root pem file, allowing the interop client to access the production test instance ADD cacerts cacerts diff --git a/tools/run_tests/run_python.sh b/tools/run_tests/run_python.sh index 7d3ee73a0e4ec..b79278857f37c 100755 --- a/tools/run_tests/run_python.sh +++ b/tools/run_tests/run_python.sh @@ -9,18 +9,18 @@ root=`pwd` export LD_LIBRARY_PATH=$root/libs/opt source python2.7_virtual_environment/bin/activate # TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized. -python2.7 -B -m _adapter._blocking_invocation_inline_service_test -python2.7 -B -m _adapter._c_test -python2.7 -B -m _adapter._event_invocation_synchronous_event_service_test -python2.7 -B -m _adapter._future_invocation_asynchronous_event_service_test -python2.7 -B -m _adapter._links_test -python2.7 -B -m _adapter._lonely_rear_link_test -python2.7 -B -m _adapter._low_test -python2.7 -B -m _framework.base.packets.implementations_test -python2.7 -B -m _framework.face.blocking_invocation_inline_service_test -python2.7 -B -m _framework.face.event_invocation_synchronous_event_service_test -python2.7 -B -m _framework.face.future_invocation_asynchronous_event_service_test -python2.7 -B -m _framework.foundation._later_test -python2.7 -B -m _framework.foundation._logging_pool_test +python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test +python2.7 -B -m grpc._adapter._c_test +python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test +python2.7 -B -m grpc._adapter._future_invocation_asynchronous_event_service_test +python2.7 -B -m grpc._adapter._links_test +python2.7 -B -m grpc._adapter._lonely_rear_link_test +python2.7 -B -m grpc._adapter._low_test +python2.7 -B -m grpc.framework.base.packets.implementations_test +python2.7 -B -m grpc.framework.face.blocking_invocation_inline_service_test +python2.7 -B -m grpc.framework.face.event_invocation_synchronous_event_service_test +python2.7 -B -m grpc.framework.face.future_invocation_asynchronous_event_service_test +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' From 16b8924068c52eb20e0cfd3b1416c6eb720992c3 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Wed, 18 Feb 2015 02:53:37 +0000 Subject: [PATCH 140/173] Drop an erroneous trailing backslash. --- tools/dockerfile/grpc_python_base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dockerfile/grpc_python_base/Dockerfile b/tools/dockerfile/grpc_python_base/Dockerfile index 01292c2e121fd..98f695a81917c 100644 --- a/tools/dockerfile/grpc_python_base/Dockerfile +++ b/tools/dockerfile/grpc_python_base/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y \ python-all-dev \ python3-all-dev \ python-pip \ - python-virtualenv \ + python-virtualenv # Install Python packages from PyPI RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0-alpha-1 From 638a68b21a1936da05d6547570e333c51e33964a Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Tue, 17 Feb 2015 20:12:44 -0800 Subject: [PATCH 141/173] 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 21253848a7d3a..3176a15845240 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -39,6 +39,3 @@ require 'grpc/generic/client_stub' require 'grpc/generic/service' require 'grpc/generic/rpc_server' - -# alias GRPC -GRPC = GRPC From 94640a3df9cb1bc61d5decb5770306d60d52bf41 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 20:42:05 -0800 Subject: [PATCH 142/173] Rework python, expand tool to make this easier --- src/python/interop/interop/__init__.py | 30 ++++++++++++++++++ src/python/src/grpc/__init__.py | 30 ++++++++++++++++++ src/python/src/grpc/_adapter/__init__.py | 30 ++++++++++++++++++ src/python/src/grpc/_junkdrawer/__init__.py | 30 ++++++++++++++++++ src/python/src/grpc/early_adopter/__init__.py | 30 ++++++++++++++++++ src/python/src/grpc/framework/__init__.py | 30 ++++++++++++++++++ .../src/grpc/framework/base/__init__.py | 30 ++++++++++++++++++ .../grpc/framework/base/packets/__init__.py | 30 ++++++++++++++++++ .../src/grpc/framework/common/__init__.py | 30 ++++++++++++++++++ .../src/grpc/framework/face/__init__.py | 30 ++++++++++++++++++ .../grpc/framework/face/testing/__init__.py | 30 ++++++++++++++++++ .../src/grpc/framework/foundation/__init__.py | 30 ++++++++++++++++++ tools/distrib/check_copyright.py | 31 ++++++++++++++++--- 13 files changed, 386 insertions(+), 5 deletions(-) diff --git a/src/python/interop/interop/__init__.py b/src/python/interop/interop/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/interop/interop/__init__.py +++ b/src/python/interop/interop/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/__init__.py b/src/python/src/grpc/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/__init__.py +++ b/src/python/src/grpc/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/_adapter/__init__.py b/src/python/src/grpc/_adapter/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/_adapter/__init__.py +++ b/src/python/src/grpc/_adapter/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/_junkdrawer/__init__.py b/src/python/src/grpc/_junkdrawer/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/_junkdrawer/__init__.py +++ b/src/python/src/grpc/_junkdrawer/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/early_adopter/__init__.py b/src/python/src/grpc/early_adopter/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/early_adopter/__init__.py +++ b/src/python/src/grpc/early_adopter/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/__init__.py b/src/python/src/grpc/framework/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/__init__.py +++ b/src/python/src/grpc/framework/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/base/__init__.py b/src/python/src/grpc/framework/base/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/base/__init__.py +++ b/src/python/src/grpc/framework/base/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/base/packets/__init__.py b/src/python/src/grpc/framework/base/packets/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/base/packets/__init__.py +++ b/src/python/src/grpc/framework/base/packets/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/common/__init__.py b/src/python/src/grpc/framework/common/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/common/__init__.py +++ b/src/python/src/grpc/framework/common/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/face/__init__.py b/src/python/src/grpc/framework/face/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/face/__init__.py +++ b/src/python/src/grpc/framework/face/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/face/testing/__init__.py b/src/python/src/grpc/framework/face/testing/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/face/testing/__init__.py +++ b/src/python/src/grpc/framework/face/testing/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/src/python/src/grpc/framework/foundation/__init__.py b/src/python/src/grpc/framework/foundation/__init__.py index e69de29bb2d1d..708651910607f 100644 --- a/src/python/src/grpc/framework/foundation/__init__.py +++ b/src/python/src/grpc/framework/foundation/__init__.py @@ -0,0 +1,30 @@ +# 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. + + diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index ac54a2e9a445b..fbe01841d9874 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -29,7 +29,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. - +import argparse import os import sys import subprocess @@ -39,6 +39,21 @@ os.path.join(os.path.dirname(sys.argv[0]), '../..')) os.chdir(ROOT) +# parse command line +argp = argparse.ArgumentParser(description='copyright checker') +argp.add_argument('-o', '--output', + default='details', + choices=['list', 'details']) +argp.add_argument('-s', '--skips', + default=0, + action='store_const', + const=1) +argp.add_argument('-a', '--ancient', + default=0, + action='store_const', + const=1) +args = argp.parse_args() + # open the license text with open('LICENSE') as f: LICENSE = f.read().splitlines() @@ -68,12 +83,19 @@ OLD_LICENSE_TEXT = dict( (k, v.replace('2015', '2014')) for k, v in LICENSE_TEXT.iteritems()) +def log(cond, why, filename): + if not cond: return + if args.output == 'details': + print '%s: %s' % (why, filename) + else: + print filename + # scan files, validate the text 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: - #print 'pass: %s' % filename + log(args.skips, 'skip', filename) continue license = LICENSE_TEXT[ext] old_license = OLD_LICENSE_TEXT[ext] @@ -82,8 +104,7 @@ if license in text: pass elif old_license in text: - pass - #print 'old license in: %s' % filename + log(args.ancient, 'old', filename) elif 'DO NOT EDIT' not in text and 'AssemblyInfo.cs' not in filename: - print 'no license in: %s' % filename + log(1, 'missing', filename) From e7163ab6250ea6adc6b85ea36e67bd6c93ccaadc Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 17 Feb 2015 20:46:08 -0800 Subject: [PATCH 143/173] 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 077b432e881b2..358f59238a416 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 144/173] 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 4ae6f5d9559aa..9b113610d57e6 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 145/173] 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 904853d984e09..34bfb61f70d3c 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 146/173] 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 4594cbaeb6f01..7f1069ea5ee66 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 64f0f890c5f42..4ab226339d316 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 be5b29589fd3f..20ba3fb790543 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 284af33b4352a..03a0326128592 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 f1142cf8e568a..04af36f312fbe 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 21a61af3a0482..df4c4dc314675 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 fbf9bcb11799f..3cd0ef5f12841 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 147/173] 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 3cd0ef5f12841..7e827cb0e5795 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 148/173] 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 22a8a04c8235b..ff03f7c93692a 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 149/173] 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 18c81c426dc74..2844d713207da 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 cdefd08662e27..f4afbc771ca26 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 8eb666aea5437..55944b22f6384 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 6f4bc6ba70996..e4e71ad922309 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 18ce0721f6709..e450e6cafa660 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 e5f036f89f9f5..cf846f1190376 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 a436c5d4e21ba..55eb7be6d71c9 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 e4881b782872f..ebdb2ffd6e139 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 b0366faabb90c..24fc595dbd4a5 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 7f1069ea5ee66..cc0d46cede9e6 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 c5267f8563ce3..3a5820bf8330f 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 663e40247d86c..55e4318010eed 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 a8ce8b8ec8454..e8427bf4f869c 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 52304d7f369cd..6f6523dedcd1e 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 4ab226339d316..82eb457ae61ea 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 ff03f7c93692a..81adc274c8c29 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 b32fb3a27c00c..4c33fde9ca612 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 bb16e64c96935..0bb53f7abe919 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 bf62871b7d12b..104ff8597a8d7 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 221664befe267..a89d9cd89ce67 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 410c762375cb2..68d9ab17849c1 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 a550a53afb5b5..750b4369fb120 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 853f91f46714a..0b7f0594f78e5 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 b12d139045124..8e1cd9dd7539e 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 432158a989ad3..cd1ff6c533e00 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 4e0fda13db634..5c6ea7d0f7199 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 20ba3fb790543..c36488f963275 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 a8eacb037fdb1..9927d2937210b 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 094d3016e1efd..ef874883780ca 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 a9cbb7752becd..e60dab51c8a0f 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 12949d569bcec..68a1382a4f58a 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 b2ae5340a5622..a20b93bc86d90 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 a43d998d0294b..c7d3daf221f44 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 630b7769fd592..3096ac4c01d04 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 fa9cc4bf7c789..739fec25b354f 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 5e613f1ba983e..7c0ead0447f7f 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 896dd842ec207..40bcc12d6602b 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 1a3a10c911bd5..02da69add5151 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 19881e83ad84c..87d542595048c 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 db099b83818df..d732b1f0adccc 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 ba3ffe42cc03e..ca6d58ca4301f 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 9025f7c21f851..afb3eba2d2196 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 e67323d5d3dbb..03886556c2cbc 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 9495bfea40a73..92630af826944 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 1c2857dad38de..d88ba7b2d720e 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 0350056d26e85..49c0ecf2b9b0f 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 5b9b3c47a6b99..e98a932712723 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 7828ccdd13c30..fa7995f3f758d 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 80c13e064a9c7..f537472d81aed 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 6f0f684ae7a04..9899cccb3110e 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 9ad56f7b64e6b..e8a4ced30157c 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 d51c268dc98d5..e3e0baeb282e3 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 6e25666350192..79bb7bdd19697 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 92d40b4475240..4868130f65e96 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 9fb1d0bc97b52..22275c42b6686 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 c451e9cc83df7..0847d3510208a 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 60dc02d7af9cd..167c0a86b8685 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 fe84d08b4c8a9..34f0e20dca397 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 54c343866fc6b..5e1b115e897dc 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 a7fdb1f093f01..662e6ef6ccc31 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 8196589a5c4a9..ac9ff8d84793b 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 89d7a0b92a9f5..1d851f3210f59 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 0034f5ef569bd..b3c1d21eb6607 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 fea9c2e2fac61..0e65d1ed104d0 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 d24a61b9f5f97..92d3f5d3dede7 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 9397452f55ea6..81c6be6b2e3b5 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 127ea707bf52e..e3471a01a1bd2 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 3447e9dde455f..3a2aa47d26187 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 5b2c01ca9ba40..92f0d226d5014 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 f48415e63466d..885e3ac4383be 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 92280450a1457..11762f7e7b0ae 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 d9e722c4f1e35..c637e22822df8 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 ec9ecf3d15a3d..8dbe28e941090 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 a7f06bcdc0262..d39ace87e16a3 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 ece0ff99a925d..239123f27a9d8 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 8e8f95fdb357d..170065a5c2788 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 6b8a7d95a8a85..3db8cb6c8e8b7 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 ebaf816902b8a..f9b28db0dcb94 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 155a9a5b1a7c0..c79dda412100d 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 2d61d389e4230..9377cb26d4c5e 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 9d143fc1359b3..cfd83bb02773e 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 a2b5f48f60887..2cf0648cc00b7 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 21cde4877ba2a..f230ca0f9ed11 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 eaa746ef20818..5276eb9bc5690 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 89ad482d358ae..1598034e03193 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 b70af434a7981..97c3c88752b6c 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 5b475432aa273..1ec1c7c21643e 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 a21a37ea7dc4f..41f328e0d139b 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 011dabed1b11b..17a2eb7414b4d 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 d5615f7ae685b..ea4f86a61648d 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 269214f893fa7..ef26ec84e0ac2 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 0b5576f70a66f..df7c302626846 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 c5ec6d21b68f9..2c7c38e1d8b43 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 1787ccd7d8f66..b21b8ff27e1e4 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 564ca69a87794..454d8acd1fa40 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 5d1a04ef82641..7382a29823e6c 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 a82130cb93afc..6e62f8a41114b 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 acd9fa7b55bb7..97c10a0134c3b 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 90f89a93664d5..012ac530ed216 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 53e887ccd1459..4ba5890a33d82 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 a73ecca0b373b..d2cec2f9dacd7 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 1f0c5167de7a0..2d1f3af5f6e2b 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 520b16fd020d2..7924031e88d65 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 7884b21a1e28c..83b189f95b263 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 f94dcec6e9981..478aa9439d67a 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 2b6198336fea0..8a8c9b0bf325f 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 e51f96dd440c0..7cf793fc81b57 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 8503292fd1adf..b87d3b57639dc 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 9e5d56389d2d9..796d89706e769 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 ec86d9a146065..bb9552eac994e 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 55678b5ddb1d6..d4981063a41e7 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 3f53402cf3c5f..1ce548f9e68fb 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 cc5783055138c..b31b7b151ade9 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 9a675087e593a..1c1def27189c5 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 729b11b78dce1..1ad07c06e6e68 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 bf5b90978ef12..11b66446a9ba9 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 3d6114ca18eec..41d2d58329b33 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 06dc2e5dbfaaa..a2e11e580f152 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 e9962a0f66beb..5c980f8af1392 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 bbf8cfc4190d6..9ed11a603a66b 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 86973a050dc18..272fc309c3d9a 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 a3a255eaed225..d807c6fc8a01f 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 b9fcf45ea689e..3cd60ba6f6ac7 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 c136ee0b52864..44283750b3e3e 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 1245d22ddee8d..1845d749fb95f 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 b1a82fccfe73b..cc8de96f85975 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 b81d23e57c2fb..7dbe5f88da325 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 1a5e31f627b4a..44efca739a594 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 e17bcdba0f45f..8da7d973c4f44 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 7b537b1767470..ac70744964cee 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 b980b3029fa6a..60512aa422700 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 53c80386d435c..813c6d462f7d3 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 f7942417769ed..5895610fdd29a 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 b49cc50491cf0..7f885d536bb32 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 08be0e54f8ee5..bed9e84c23075 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 1854285b5a433..07ae6b888ca90 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 f3c22187d73c5..81f3bfc40dc10 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 9184b2a47cfd1..c68a07758acfb 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 @@ int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, 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 a84457f01de97..b8d5ca392a9c0 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 3639798dbcdae..8e99f491e2e3c 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 990b520c6dab7..282e8122aec7a 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 ef2c4faf473a1..7211921ac9459 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 6dc7997833d43..25bb8f1826e54 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 2ed5f39b390b1..edbdc744160be 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 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), 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 a9b59df8854e4..02227abbf6bf9 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 c3eef1b4b73c9..7cac941f80949 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 11f9b05663dc9..2466cafbb00a5 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 c8df07c917017..659aa1e07b77f 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 e6161eb1e86ab..cde21bddfe973 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 94d84f92b5901..06543cff8d27c 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 cbe60801b4955..cb0344278585d 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 7624cd91d3c71..b5f8b165a4f79 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 be75bd1448972..423979a06f12a 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 1cff4fa19514b..5b7e02ebde979 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 6676744ff7ee8..78afa4c48c3a1 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 88a8155a42ff2..ab7627bdbdc61 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 75aa87eb03c74..0e7a61bf2a5d7 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 388ee3633fb48..9c2b8e5c55e5f 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 d29e9e30e8211..91ae99aa478ab 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 5605694fde579..2e037e2ad3dfa 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 0568401590181..d63add5019982 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 18c32f90f40b7..2126a2afee8ab 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 94fa2aba7db95..6e2afcbfc3128 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 63467944ddeea..f418a2a1678c1 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 7bfb89b0715b2..77c7ecec1c47b 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 6f0d72c0c3d9e..49ccd070df398 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 3ec874681a7b2..a0ec11a85b65b 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 d89c692989c0f..3843aff6fc37c 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 669d637ddfa41..9944e8d891b2e 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 30ed16c03bc57..20353a00c3c02 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 8e48686288fb6..3bba57b574ce8 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 3ef9f1bfc0bc7..9256d028a6176 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 31138d694f171..137edf378f716 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 20143150e07a0..a98deba8d8f3e 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 59789a7e4deb4..d227ace2af9e2 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 b13d065fbfffb..a5882f3e026e2 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 1909617614d29..37b36c167ec0d 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 25d467d717156..5e9f943f60665 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 19056ba23e861..edad78152e832 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 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr) { 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 cbf2089f3fa81..c81aa1524a0e6 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 8e586382f7896..756e4727417c1 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 1504c027deb16..6633b044e0c96 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 0d89df79929d6..e1aaa05f7f14d 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 fc66cb951fef7..957f20d06668b 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 81466907fdcf8..9c7f32198476d 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 8b98323e64cd8..8612d2cf7d93f 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 88a06a4a5248c..173e82c3c9714 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 1f7c242c72ed9..0afb12c368c22 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 5c9a3fa0b481a..c7f592c813acb 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 42ff02071ba50..f84b93160269c 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 677f40031ef0f..1fd711939f0c3 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 ddf6789773234..9ce78c64730fb 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 5596413fba395..b632a3c2fdb0f 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 a55da9dd1888d..d2f8d3810ecfe 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 c8375e65b6226..397fd9d68a6e5 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 68e8cb9b12f28..19c032bdc0ea9 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 81dda7d838aa7..35ef565a24bf8 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 28e3d1450f9d6..ffd792804049d 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 bcbff9a1770b1..4cc71b31523ce 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 3159c20f7d7a1..f35fab25abe49 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 c0bb1b66a066d..dfe31102821a5 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 @@ gpr_slice gpr_load_file(const char *filename, int *success) { } 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 92f420e7ceb3a..2bb5418c17bb0 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 e1765666dbe29..612a101d3d07d 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 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename) { 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 7749d4553f7bb..d36a3af203e97 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 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename_out) { 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 cd360c5a225f5..47f763f3866aa 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 446c11ebec31c..c0e7636518a70 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 7f102efea8277..d1b14bbfdbcae 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 53c8153593ab9..c2fcd46905837 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 a64faa98bd939..72086d514d91d 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 36479baeed2d1..40c75989f1061 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 840f24f68aa6a..39ce5c652abb8 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 892e360968f2e..ef7ff7a9afc3e 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 2ebf3e57b1f27..2609ccd4e68d5 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 836a5a6c2a7c8..de26136f854d8 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 22bda966597c8..2560c0ffa6e37 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 97bce60f94cef..634c4ddcafabe 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 64e06d3b6aacc..19cf8a0f6f8f7 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 b6f0cd4af0c16..32f1137dfe4aa 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 02e1c74d9cefc..b853f25880dca 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 9102d98256964..ab3fe87fb4fdc 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 40e5465e5db3c..6d8119769deea 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 94fc1b0bec362..9a9a5ed7d631c 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 8df26bccb9bac..a00df07b988c1 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 190d4e366816e..4358692a973d5 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 74ca9424bbcca..ad015a88f9d23 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 2ee14170484dd..e50086c51ff56 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 268a43c6775cf..bb67c7e836bf6 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 4af537d974bb7..314daa8ac0e94 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 b9fe512335052..5ee69cbb961d2 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 09e2aa5b872ab..7466009b8c0f1 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 aab7fd2ffea90..1541a4b3b9f78 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 3420dc5cabaf8..f3f58b698d84b 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 18500b83e8d1e..7582cb610ef03 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 743ef0c65b248..a08a8b890502a 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 55e434433d382..270b14f486a24 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 fef1c7d3948ba..9dc2854969130 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 ff9bbc237ef5f..0e6276ab58519 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 d3faf0c996a2e..85464d56f997c 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 64ee9d51e807b..7a63b518fa32d 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 cff3d401d92c0..8763441acd64a 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 8b94aa920afe6..f8538bf44f506 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 205cb76cee884..d5f24822785b3 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 ab9435351e1a6..8a3be6ced55cb 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 b34e2d152b5d0..56c32e6037ffa 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 4d639fcbce26a..43c9906a8a4c0 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 a8fdeed87f941..c91936fe4a2b7 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 3cfbf7b954f90..dae939586dadf 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 562e27ff6d43e..14090883eb51f 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 bf0f62367fc07..5c402b05969f6 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 7297a2a12dced..c90e27008c6bf 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 c8861f420d840..fd9761bb39677 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 3b6abb7d032a8..c18fc90aa1425 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 @@ int grpc_server_add_http2_port(grpc_server *server, const char *addr) { 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 dcc6ce1ccc8ff..af427ac19d664 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 df1aea9669ea5..e65c05f396503 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 bc4e789f60cf6..d436b65584638 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 cb96f17831f71..b7b5f4fe0c4fa 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 e3b5fe9fcf7f1..bd0a0ff8a693b 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 2310f841f8b06..221f663e7cfb2 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 6d286383091b2..c76a8dffb8b3d 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 c4ad8f11d5c8b..e6a1b0c30a532 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 c260059e8b90a..618e22630142a 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 3d6e9431933bf..b97d6e822e59d 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 9a3f8e6a7a62d..369bac85db09a 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 9556c0cae80aa..915e70b9d002e 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 fa778c51b2f28..5e8945f1e390b 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 825e156e46e47..742e037c6a988 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 dbb262971b3e9..95f6b3d37db1e 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 63c21a9b92a5c..a8fd189f7988e 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 fc513913d90b2..1d4e5e0398157 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 04bc690108b6f..a0540bba601b7 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 2d9e6c4dcb743..132793b644d6e 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 fefaf159a5c56..ff6f948cc39bd 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 1eba4a243156b..823245b7e2908 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 b0a0d76713c9e..d81ffce535684 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 f5c10f934bf7d..5ba9fbff678cd 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 84a8e2d1e0876..b105b68db8544 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 7791da6d5ad5f..b957cd8f6eb7e 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 1014a29b9f91a..cfd3fe8ecb69d 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 02d0e53fdd516..f221b39b9e932 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 7bd85e8b29da2..9c815fa1554e9 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 f78d81e0aab42..523a50d966be0 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 2af18c30358dc..6f73b4955fd2d 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 147b1d31ffe55..e5b1cb4cff03f 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 9ac3a4750d0dd..053dbc3ad26ef 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 03bf719f376f7..2d1f4c47a7b30 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 31018c3d27b0d..d9943503e2bd0 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 d1e47760324cf..5028d33237bea 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 5d551be642204..2efef951ed459 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 d75869866a5a2..60ce84dc412d8 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 dcd01718a0679..9d41671b3c4be 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 e12357ff5ef38..18edcd2919d65 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 74bbb02134d0a..0f999a1d48f49 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 ac845def379c3..bc6839cd47054 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 03a338bd9becd..f494292070d9d 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 d4d7515c4f2df..eadbfe0c32dc9 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 0ca67acb92db0..cfd203a1f61a7 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 af12f4e700dfd..52a91f2ba781f 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 31e80d36edd9f..c807c4a19a42b 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 a96c7df4a3475..dbe5ef5bafa34 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 9e3480adfaa9c..37076bb8721ce 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 e23421fc15782..0a3739910f5eb 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 3a33deacac558..4ddff58055064 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 fcf03eeb952ca..da7e13eec8947 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 3a6ed5290b35d..28f60aa1a7586 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 d180e90799a99..5dd4a59898189 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 b2fc0c97ee9d8..9a8ee15fdd354 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 c31adab723329..46da754d8c222 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 70713f015f1a7..a8c71b6196064 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 64a829630d106..646c45a963988 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 03a0326128592..4e71492ad0092 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 9cc5cff214852..45502b936172b 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 8e3a9884770cb..90e278157ee45 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 51cb99d1b49c0..53b66b955d353 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 04af36f312fbe..b7a6450d2c90c 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 4419b4b2f1488..f2b75b410ab16 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 c8b2ccb10e262..e536a1b135006 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 85f859b9eb54b..57098b50c42ef 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 a611a227fa746..b3b032899035c 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 096eb7aa0e077..84b083ead6407 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 ee9a1daa8e9cf..8c0844a319998 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 dd23e929b1569..1ca1acad944ba 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 df4c4dc314675..b9c82138f6303 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 ce0271b6a0aa6..fbd606246bc3f 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 20279592cbc59..410e51d8b119d 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 8a28c8770407a..77b0f33ddc423 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 1ca12d0ae900f..f29415b5b8a32 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 7ce7a371f5618..56ac4765164fd 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 908395c92b9a0..59c3b9d406455 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 e1bd11b5a6d0c..42728d0bd947d 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 695ecedd34475..8180c2735fe23 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 5f1903a42ebc8..52fee70a9db01 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 dbdb8e2ff65a3..e93349d65cb30 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 9087d6f919b14..edeebe9702e58 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 140cbf201a194..3c0597715b291 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 a1f390f64b622..bc5896b58bd7e 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 c04a303283a42..1c02a34592934 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 b79c3e3019dd2..cb1e8a79c1f8f 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 981e5a99bc70f..576a5dbd47ad3 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 9b0fe82976e63..4e1553fecd466 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 ee3e1087ce769..c2e85df5b8bad 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 d50f1fb6c5e37..e4bb4d889ea18 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 3add43c48c9ae..9c9a1b38a7bf3 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 8baae3f185a97..7c916e774e39e 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 20d52f0963eb5..5cece4a97d187 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 1fb0f2c690f11..a85949f2674ab 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 baef4d03c68df..167be3a7d0571 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 8737af6cde9ec..4efc9667da41b 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 54e9715d1e38b..2c9cf04cdbc93 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 7560cf1bddfa9..c5b836231a4d4 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 4d8cfc4d89c57..77708d163ed9d 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 4d11e6f5272c2..0affa403c8dc5 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 f8899beae8226..4fd6d8d2d0e07 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 81cd9fa5b95a1..92e87b5d64631 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 61b4a2fa2fe2a..97b95377fb4dd 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 34e4ab4013cb1..e6a63b1ed7274 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 2e2b12fd44402..e422e93989a37 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 f035a9ba7f068..a1d760a5b0782 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 b9946834e93b0..33bfe289e28ab 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 a2cc590d28be3..1587a8c741378 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 33e8a9281c7eb..9aaa19b47433d 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 8ebac19d95a3e..cd31efd9f118b 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 aa7893dbc7b19..63db5c3ec8423 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 Pubsub 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 0023f4844ee14..cb27ce6039848 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 @@ class Service 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 e29e22b8c151e..94d4ad6c3e97b 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 cc4d26087952f..0e2b40bdcae4f 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 acd4160d24850..0dd4d2129335e 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 b86cd396a9f9a..9e65b42caaeaf 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 Testing 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 0b391ed6af0ab..0df3ec1f3a2d8 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 @@ 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 17b5461d3e3c2..d50457f18c642 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 @@ class Service 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 09d1e9858640e..7dc677b6a3a4d 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 7e838e23d1781..9a0687f66963d 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 55ee1d331410f..ff38b2a250148 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 f6ca6fe060c94..c559ae0bb8af8 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 @@ class Service 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 74bdfbb93a740..ec01e740f3e85 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 e34075c1f0c89..208a91f734b03 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 cbf41eda8b7ac..c9f7d94165cfa 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 @@ def crash(msg) 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 f73b12c417feb..605703fd53f6e 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 322c268f377fa..935f206c619a5 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 5d72307668277..9576075ffa141 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 965e9eef409d5..f2a3f3ed3be6b 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 7c98e66c33d12..116e7740561c7 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 6c1210e812dad..696f77e941889 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 cf49259128421..4249db776896a 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 07be66279309a..ff12e90806c6e 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 47776a991a14b..7ed586fbb12a7 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 c563662c2d42f..61b27ab10f23c 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 87a5d0a299cda..9df58e2c69f8f 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 fada3639d5828..838d2abb3d73b 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 72c9dd2ec0031..70147349d5cf1 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 a406e9e9f17f0..ee75231ae729d 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 8feefb047cca7..2ec4ee5aacd90 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 d5e8930fca6c5..0cd79eaf8545d 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 88eb62ab738c6..f054ae9e98a34 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 329ef15c68a54..5873ca597ec77 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 e68843e12b1ef..4789f2e883434 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 92047efd18758..7226359b2d9ed 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 4f6c67ea5e3b6..41c0a955a7a1c 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 2a2e1fbc82269..a2193cdc4e1b1 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 758ac0c2d1662..8836afd6dd333 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/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 9a333589c2142..bfde5dfe3bff5 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 @@ def inspect 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 6876dcb02eb4b..0b7c22d20b859 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 @@ def from_relative_time(timeish) 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 70a92bfed771d..d562f0503d9c0 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 @@ def to_status 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 6c2b6e91c24ae..22218bd7546e8 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 @@ def assert_queue_is_ready 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 099d57151c090..2e470346ede93 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 @@ def start_read_loop 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 7e13de19ca5bd..10405a922ee51 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 @@ def new_active_call(ch, marshal, unmarshal, deadline = nil) 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 876397a6e70ea..ea6abbc400831 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 @@ def send_status(active_client, code, details) 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 40c5ec118e3c7..1ea9cfbef3aba 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 @@ def add_rpc_descs_for(service) 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 ff37617ccfad3..77f0021e9582e 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 @@ def self.included(o) 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 6442f23e895b5..24c0913640d2d 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 @@ # 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 dd526e583a6e3..de7ef5f888013 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 6dd59ab9fcebf..1bd0e093bd78b 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 @@ 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 3a65f45c7ed2c..76e3fae35821a 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 @@ 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 8bb5043186b2f..2a47eac23a3cf 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 @@ def make_test_call 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 82c7915debb61..8e514411e59f3 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 @@ def construct_with_args(a) 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 1321727f5cf9d..734b6517c8f71 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 @@ def new_client_call # 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 6117e062d64b1..89b418583ae8a 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 @@ 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 47b42aed29b76..62a58fff434d7 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 @@ def load_test_certs 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 89acd4ba67668..e2b76a54a269c 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 @@ 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 86495d7369446..3e54c1fd6f1dd 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 @@ def make_test_call 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 c7218da2cff22..1609534f0d46c 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 @@ def expect_server_to_be_invoked(awake_mutex, awake_cond) 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 54ccf7ab8b0db..791395b3aced0 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 @@ def bad_status_alt(_call) 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 27fabd9c31228..6ffde325f6d2a 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 @@ 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 0ec79572e7df0..f8484d778c22d 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 @@ def an_rpc(req, _call) 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 29f2412631990..21e4bd75f0904 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 @@ def an_rpc(_req, _call) 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 9cdce6b40d59e..3c47914741501 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 @@ 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 faa713d562c96..a641a650fba71 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 @@ def load_test_certs 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 1550ba656608d..123e645512775 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 @@ def start_a_server 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 ea0a256713183..3838181bab321 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 @@ 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 b01027ce2678d..d090e71db3c9d 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 @@ 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 d53098b5e42b8..71c4676df402d 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 6081308986870..2b62aa02e175b 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 5f55fa68d3232..b46658b6dd940 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 5652fd9f38baf..f6e9d665a5cfc 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 5450dfbef56e5..fd531b93146cf 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 6e494d50fff5e..17b876af8c404 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 15dc4270d6ff2..82a0af0632baa 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 8b76bc421dfc7..7357a6643760f 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 3b66d236c368e..001c7246e4f88 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 134b9cb98e479..e2573fb9e11e7 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 992d3c032a9c3..2b6fbf3280e73 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 3456ebebd4b47..72bce3ed2571a 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 f358b0b79ac70..2b39f6c7eb0f2 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 a61644f583c21..c37b71d1c584b 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 e222ed62bd7b5..3211fffad8aff 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 38c3b228342a8..de06f558562a5 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 82bf267ce5072..4775d8ee6d9e6 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 35a23698e4de2..a3afe9af2e12f 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 149ac8c07bbb0..bd2f0600f483b 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 fb241cd460cfa..4af50bdd61457 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 b5b7cee85f3ee..98907b901b914 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 2de67913d7c4b..7a7095b588b1d 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 85d95338ddbd4..a83c873387c52 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 17f37d6719f9b..63fbf595b2a16 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 889db54162464..99e21f296c123 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 245966624220a..ecedbfb44ddf3 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 e87f7d648c2f0..72d2942e226f4 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 7f7c1e6597da0..53f3d88964ec6 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 7a656f1cb0be7..bcc2cc6cc6fb7 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 663db5290d1db..b62a563519602 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 cdd4b43447af8..3329188717cea 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 e19d28a41ed11..370db8f230ba3 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 c9870896c00ad..b293489c557a4 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 52ebc9052fc13..e88daca014b06 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 f144cd17aa176..21f4b491d0da7 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 f144cd17aa176..21f4b491d0da7 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 07de01059cc12..ac7de77deaf0a 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 b75b268647c02..6412e621017ee 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 65de02ac1f0c4..ec760485d2d76 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 6b920bb4ade3a..f4f19362fdf4b 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 51486cc169986..ae34e0c3c15a5 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 123c8bc415357..68c7743b4bbc2 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 65972a756e892..bd83efdf38c66 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 20394965d3048..ecc1fb00965c1 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 10c1e0befb527..22e0a5a8936e2 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 8982d027012ae..54af896c7c790 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 2ea8645ea71ec..d204fbc9d7272 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 d15368182a0c1..67a03ccfa7dff 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 bd4ff06701e99..ed59e0f2a948f 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 bd4ff06701e99..ed59e0f2a948f 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 4e27be16b4af0..1cb682b3f001c 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 cd1d03e4cd8c0..8c7dcadf3f829 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 a71e3a773685e..22a483b21ded6 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 b5e4eea6c8699..ac18f00cda755 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 f7394a25b0302..d4dabf3c63c70 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 a86e1aa7f9572..5e1189f35668b 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 be4beb537a62c..ba20879fa27c2 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 eaa88eb91ad36..b621cd4755bea 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 637a9ffe1cf6e..e8213dc8e5e3a 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 d6554b2792320..31058d3858dcd 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 fff83dcbf0b42..0d4fbd8660bca 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 d768f148efe7d..35397ea93abc0 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 2b520046bb5b4..4b75b0057d5f5 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 8d932afb35c47..26d91d13ae6b9 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 ac248f9be0e5c..6ed48c0221a5d 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 6b211ecccf87b..3a735f13be707 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 ab03479586843..3fc23493c3c6a 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 eb984cee978e8..e4b809734f6f2 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 8a5cdc7e92bd1..608a20659e917 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 8a5cdc7e92bd1..608a20659e917 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 e7b7da17569bf..58b7492c25b1d 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 e7b7da17569bf..58b7492c25b1d 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 0a113f033f75c..28bf967b2f947 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 1db2f1a7916f8..c05798bbb7bb2 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 4f41a21aaafa3..5d733d14be5d3 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 ca0683fa6797f..27a69c83f771f 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 ec66f96004214..0cad9ba5151a5 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 c901e595f6354..7d9aa75b77820 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 455f6a6393902..4718107edd1fd 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 abb1086a22d7e..5defe97885d00 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 a250951231889..a1a56d6132c7e 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 aec3a50efc638..537bed47f756b 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 125cde467853f..ea350c923ce6f 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 c76c9483c6a93..f555a54203b1f 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 05c91ffdd4d80..7f1f7412639df 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 1f97724e607a4..859aaf4629a6a 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 6cbdc4e21c17d..110b09998d3af 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 78709f47fbcb1..c8f1f53dbb327 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 f52ae229812b8..a00b54da8855c 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 ae6994ef07187..8409fb4f628d6 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 bbfeab5633010..4329ee5198c15 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 a761a670f0e96..23ea798feac69 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 4ce406c9909ae..1b3383653df60 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 6d0227ad39b00..1cfbbc4105ad7 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 9a6f518399c46..6db618409cfee 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 b3ba491a341d4..e306ea3cf6d69 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 dd90a7edc857a..cefe969c229c5 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 c5cc3adfd699a..dbd5f3126268f 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 2a9c8f88b24e3..0457f6499afd4 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 456515bfd5030..1d0e36ddafc97 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 e2ad78a6f2b6a..8d15a9becc7fe 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 764b9fde1957b..89404c620b0f9 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 c651eaf21ff29..595c1f94ff031 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 e8e4d8b6f1d98..a5d5fada7d0a6 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 298900a6612b0..2db36997b190f 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 ae6fd95651488..d87847c7f92ee 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 40fe4c5911459..81b2ed4553dcd 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 8df32cf111768..eb025d42e01d7 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 1e929d18ef05c..1ac4ce92c2917 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 ff3aee9eae3f9..eccae087b7a76 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 97e1463ae134e..21cc17be516ec 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 1fe7747740801..c15469c20d561 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 e90c999921d7a..c073597a83f29 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 1d15c662898c8..677415a6ecaae 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 36d7adf80b592..025caa17c034e 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 b089954186c17..f111a0744825b 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 4769ce0599894..9fb3319e6fc4b 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 6d14fab863691..22dbb0e81ad19 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 3ee40b6d76d46..dfe30d4564050 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 366bcb20bf601..63b938c010469 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 030d1d4249a3d..3788d66c51780 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 469d7dedc3b23..69cb56b40492a 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 a01ec6f87f379..4beabbe262a5f 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 540d9d1c643c7..827d3d322a28c 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 c70e025326f9f..6e10b23be5267 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 56f927787bc39..c9833dd4df89a 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 716861665b5a5..92f44b331bee1 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 d78dd641ad6cd..51b1d8b8b15cd 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 e1b9d0d035aa0..15b99db774ddf 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 875cf3e52aa6d..3374da45b013f 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 0a6edc1630d94..497b4f926da37 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 dced88257467b..e5a753766eaa8 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 7a70b0ca7f069..b65f4dffbeccf 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 048ed7edd3cb4..7e248968a71fc 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 3be6c366f5c23..b4769cb55f074 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 d155dee9dc2f4..4503694233761 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 bb5d7b8860888..b39b58d323c83 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 5e8ec0a1af851..94c1c96050ee8 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 9b4446f7f8072..24c6b5998e10f 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 56a1e6ee63864..39c993ae595bf 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 34e3aeba38372..4d278d44acf5b 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 a2d190e1c4e1c..9947a4b4ab8f0 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 e6649ec97c251..e69c5ec9dfed3 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 2cd033bf3ac40..4bb36a1b61f19 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 f1447e2e98306..e181b45a6f427 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 46bfc1f533c89..659322e05d3a2 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 a35472db7351a..d4b9f6330c348 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 888d03bc68bbe..137ce5612777f 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 7477986d60971..4cb1779b5f534 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 94cc1d5bd3696..bed94c9a0ac96 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 067ca0fafa586..c4868a16c7b77 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 1682ef4fcde4f..c4d5f12e79722 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 7aed9ea9224fd..9f6f354aefa5a 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 5f3b55da75bc1..41768f2f72dfb 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 e24501508f600..b827e53544665 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 3cd6add167b49..59b5910e1ec27 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 174d2187b0b16..c26612caf2f1c 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 7e827cb0e5795..7057fa07d0c7d 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 974717f6e2e52..c70930387af6a 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 57a503f84f983..76cb05eee41c4 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 a8399779b96dd..b08030fce78b8 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 d2c83aad3df75..1bca2524c2bca 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 718046170f00f..6a30d5d8d46f7 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 cae1a105c96d7..bdaf523b2f6e6 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 301e9a3c3a368..bd6e62d1514f6 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 4e326559bfd37..19a9d2e83bb2b 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 0c32311badb6a..d7dacf03f66e2 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 f5942aa85a133..a258eb020195a 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 9903f0e7835a1..d37288a078c55 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 fbe01841d9874..68fac49d7d5c9 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -41,15 +41,19 @@ # 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 @@ def log(cond, why, filename): 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 9fd1e1c61e6db..1a175dee9dd5e 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 ffb5b85822972..dd076ccf7472d 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 4dab4c093e976..7b691b064ef74 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 37e24949f671f..0ffce7cd0c789 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 a1d7813b20153..cebae549dc4b5 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 70a2f1254025c..4bef368ebaf67 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 a084fe08d6a08..388803aa3b888 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 13bf3124fa3b6..1d56856c0b5bf 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 85feacfb86c9d..29a1fa12d036b 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 d32969f39ca27..bec0ce4553f77 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 084b3893ab09f..d7a58838b43b7 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 7696536141d6c..292aec454825d 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 525b34a7095ed..699b5f3fa13a9 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 fc7e4871182ab..7ce4b253427db 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 8249d5e7ff08a..f4345e461ec34 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 f04044538431c..398d5eee19f9c 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 190d360defe58eec0540d50cbb5d4a8f4878c4f1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 09:23:38 -0800 Subject: [PATCH 150/173] 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 2844d713207da..d752685545913 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 f4afbc771ca26..308f9a77e5715 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 55944b22f6384..2d64a2abfa3d5 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 e4e71ad922309..40b122bc7469c 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 e450e6cafa660..29f6635b7c922 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 cf846f1190376..a973cd755c753 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 55eb7be6d71c9..1fdcc8f755f43 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 ebdb2ffd6e139..75c3cf45b49ad 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 24fc595dbd4a5..890fd04d82448 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 cc0d46cede9e6..24e67c9ee1fb5 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 3a5820bf8330f..f1b4962d1b7fc 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 55e4318010eed..2dced12e37908 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 e8427bf4f869c..eadabda359663 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 6f6523dedcd1e..ac6f394847d06 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 82eb457ae61ea..7ba5d16bf31b5 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 81adc274c8c29..a29621edb3bbf 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 4c33fde9ca612..25290121cdfad 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 0bb53f7abe919..0236b1182a078 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 104ff8597a8d7..ffd5c34ef6dff 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 a89d9cd89ce67..cafa2696ab219 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 68d9ab17849c1..26d18d1bbe4be 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 750b4369fb120..4545c413d25f1 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 0b7f0594f78e5..06744f8f4fd7b 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 8e1cd9dd7539e..5c6787a07705d 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 cd1ff6c533e00..1dfb0c997ca5f 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 5c6ea7d0f7199..0ec0a976d2253 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 c36488f963275..491dfc8136187 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 9927d2937210b..c83924932416c 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 ef874883780ca..89d8557edff67 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 e60dab51c8a0f..4446e0c6b3939 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 68a1382a4f58a..b33cc3da8745c 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 a20b93bc86d90..757f53f9df12a 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 c7d3daf221f44..f03ac8004dad3 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 3096ac4c01d04..76a71ed26fcc7 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 739fec25b354f..c7580655761e1 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 7c0ead0447f7f..0cac9bf586546 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 40bcc12d6602b..2ae24aec06d72 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 02da69add5151..cec62e1a20d16 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 87d542595048c..acacf12013ce8 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 d732b1f0adccc..e77f9f15777f3 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 ca6d58ca4301f..20de12242c72b 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 afb3eba2d2196..580f12dad729b 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 03886556c2cbc..fb9d3d1691efc 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 92630af826944..362046cb95d26 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 d88ba7b2d720e..c142949f770ff 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 49c0ecf2b9b0f..52d6a703189a4 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 e98a932712723..27efa29448559 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 fa7995f3f758d..261e3baabee0b 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 f537472d81aed..8b57f9f0b9230 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 9899cccb3110e..4437375db72fb 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 e8a4ced30157c..3bae222cb00af 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 e3e0baeb282e3..413226a9e8f5e 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 79bb7bdd19697..5a48b52a2dc0b 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 4868130f65e96..a81e6cd3ba900 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 22275c42b6686..ebc18c91e9495 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 0847d3510208a..8d756c37c3141 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 167c0a86b8685..aa764cbb33d22 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 34f0e20dca397..f5b1ad23eee19 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 5e1b115e897dc..e3c76e029127e 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 662e6ef6ccc31..a421e51b78d94 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 ac9ff8d84793b..32b6a8d8e4a05 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 1d851f3210f59..d0c568fad0f16 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 b3c1d21eb6607..61d887b41cd56 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 0e65d1ed104d0..345e4c13706a7 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 92d3f5d3dede7..7c2e4e5d9d4ad 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 81c6be6b2e3b5..6580e5ab5bec8 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 e3471a01a1bd2..08f2e95deb643 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 3a2aa47d26187..ba7b7ba59caa6 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 92f0d226d5014..6acf9695f47a6 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 885e3ac4383be..509ae0df8968a 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 11762f7e7b0ae..640bbd85a5f28 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 c637e22822df8..0382a7a2f3038 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 8dbe28e941090..98d095fccf162 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 d39ace87e16a3..2cb03829c7903 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 239123f27a9d8..84a11062cbe36 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 170065a5c2788..9791f98be88de 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 3db8cb6c8e8b7..7da4fc925804c 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 f9b28db0dcb94..bb6d3638074d7 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 c79dda412100d..6ac3fe62f191f 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 9377cb26d4c5e..fa186551648e3 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 cfd83bb02773e..e19de62ca9418 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 2cf0648cc00b7..3ccc39b717fa4 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 f230ca0f9ed11..5882f8fe0574e 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 5276eb9bc5690..453a0422d85a4 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 1598034e03193..b85cd3956ebae 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 97c3c88752b6c..d1616a3450dc0 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 1ec1c7c21643e..0643c7be83c1d 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 41f328e0d139b..da66a028c4d97 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 17a2eb7414b4d..701d69df7c58c 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 ea4f86a61648d..d987fa2bc10fe 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 ef26ec84e0ac2..93c2bff9b0281 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 df7c302626846..ca07002ff9433 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 2c7c38e1d8b43..e398ae34b4cb8 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 b21b8ff27e1e4..9b8100a3d6c2a 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 454d8acd1fa40..666da2ed0d655 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 7382a29823e6c..af2521908472c 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 6e62f8a41114b..e06b632990304 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 97c10a0134c3b..8a1c04b631ede 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 012ac530ed216..f62098776801b 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 4ba5890a33d82..e97752bbe1922 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 d2cec2f9dacd7..5a1311e7a41f1 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 2d1f3af5f6e2b..f4decda98a97a 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 7924031e88d65..db1fa0a33c8bf 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 83b189f95b263..5860834de3f32 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 478aa9439d67a..6dcc63a6d58b2 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 8a8c9b0bf325f..d912178fda34d 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 7cf793fc81b57..bb6e5e3a89983 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 b87d3b57639dc..cbd8fa9421f2b 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 796d89706e769..96487958a7133 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 bb9552eac994e..e89cf6691c08e 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 d4981063a41e7..2e46aab2283bc 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 1ce548f9e68fb..ac511b97b2618 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 b31b7b151ade9..e3571e8e280c8 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 1c1def27189c5..370ab1345a04e 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 1ad07c06e6e68..8b019e804961c 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 11b66446a9ba9..d0231702a1696 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 41d2d58329b33..058685b295d00 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 a2e11e580f152..18a7d151fc7b9 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 5c980f8af1392..7f29f44f7f98b 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 9ed11a603a66b..14e3d182f666e 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 272fc309c3d9a..f9e9b3d6ee4ca 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 d807c6fc8a01f..f130ab9a078ea 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 3cd60ba6f6ac7..9d04b014ba707 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 44283750b3e3e..fbacad1e99813 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 1845d749fb95f..05b78adeb61dc 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 cc8de96f85975..03b4c775b7fc4 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 7dbe5f88da325..d21072b2832b9 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 44efca739a594..41c193fcad01e 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 8da7d973c4f44..6d748c8698142 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 ac70744964cee..65432ec61aaf2 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 60512aa422700..a5f7c546ecfb5 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 813c6d462f7d3..00115e2536874 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 5895610fdd29a..740bbe716ecbb 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 7f885d536bb32..d3a25ad373bb0 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 bed9e84c23075..6ed164ced1deb 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 07ae6b888ca90..3c8cafa31521f 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 81f3bfc40dc10..a87625262b26d 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 c68a07758acfb..3c56b4674431f 100644 --- a/src/core/iomgr/socket_utils_posix.c +++ b/src/core/iomgr/socket_utils_posix.c @@ -67,4 +67,4 @@ int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, 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 b8d5ca392a9c0..b35fe785f1ac6 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 8e99f491e2e3c..99f38b0e032b4 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 282e8122aec7a..de80e97e7f661 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 7211921ac9459..c919c02440fd4 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 25bb8f1826e54..137aa99c7b101 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 edbdc744160be..2bd93c6af2c60 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -212,4 +212,4 @@ void grpc_tcp_client_connect(void(*cb)(void *arg, grpc_endpoint *tcp), 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 02227abbf6bf9..150a907cb105f 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 7cac941f80949..6ff87704efb7e 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 2466cafbb00a5..c1e5f45208dae 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 659aa1e07b77f..b7a06259497f2 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 cde21bddfe973..c6864efdc5368 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 06543cff8d27c..3efd69a71b998 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 cb0344278585d..565d42e5b2964 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 b5f8b165a4f79..f881dde9fc2b0 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 423979a06f12a..e901f3c33b3b0 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 5b7e02ebde979..df7108a94de69 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 78afa4c48c3a1..dc519e9d5ec96 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 ab7627bdbdc61..60763cc72ea80 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 0e7a61bf2a5d7..774faa5f239bd 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 9c2b8e5c55e5f..f7f59127f9374 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 91ae99aa478ab..13f816995b240 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 2e037e2ad3dfa..4c0bf30780dcd 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 d63add5019982..5d5d0891a3c88 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 2126a2afee8ab..58679a87aa550 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 6e2afcbfc3128..fee75c40e1c80 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 f418a2a1678c1..3b8fea8f7371a 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 77c7ecec1c47b..0eb69d0ccb35c 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 49ccd070df398..b2e0fd215a977 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 a0ec11a85b65b..614db96ad7ac7 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 3843aff6fc37c..c9701b9080db4 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 9944e8d891b2e..1a44058a29e24 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 20353a00c3c02..914e756171801 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 3bba57b574ce8..c85b0cd847513 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 9256d028a6176..5a9b2dab4b3df 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 137edf378f716..031f23dc79d10 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 a98deba8d8f3e..82ba4082e3268 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 d227ace2af9e2..f57d22109cec0 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 a5882f3e026e2..21f41fd682255 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 37b36c167ec0d..f9fb2407cf996 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 5e9f943f60665..e3d91139678a2 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 edad78152e832..c88f0726bb7a8 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -146,4 +146,4 @@ int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr) { 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 c81aa1524a0e6..820d75f795eb8 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 756e4727417c1..0bb0a9f328dc7 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 6633b044e0c96..24e46876d25a0 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 e1aaa05f7f14d..01fd63aca39d0 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 957f20d06668b..388ce4fe2c8c4 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 9c7f32198476d..942de81b888de 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 8612d2cf7d93f..adfcbecb4c8f8 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 173e82c3c9714..51aa578c0c16e 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 0afb12c368c22..56bdcc2ffff6d 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 c7f592c813acb..2c2386d1ab1ba 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 f84b93160269c..a64e0805652c5 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 1fd711939f0c3..98f8dac559591 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 9ce78c64730fb..44f343b4f4004 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 b632a3c2fdb0f..5a4d488dd3cf1 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 d2f8d3810ecfe..72f46c1bd72e4 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 397fd9d68a6e5..ef6bf9ca09641 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 19c032bdc0ea9..91f722530ca36 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 35ef565a24bf8..0c6091b84b8a3 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 ffd792804049d..bdadfb6ca4c41 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 4cc71b31523ce..45f89b6737905 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 f35fab25abe49..177cc36a30a00 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 dfe31102821a5..70100b7e9b568 100644 --- a/src/core/support/file.c +++ b/src/core/support/file.c @@ -86,4 +86,4 @@ gpr_slice gpr_load_file(const char *filename, int *success) { } 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 2bb5418c17bb0..600850e03d4f8 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 612a101d3d07d..11a459ad364b9 100644 --- a/src/core/support/file_posix.c +++ b/src/core/support/file_posix.c @@ -81,4 +81,4 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename) { 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 d36a3af203e97..fe209af9b2dc5 100644 --- a/src/core/support/file_win32.c +++ b/src/core/support/file_win32.c @@ -80,4 +80,4 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename_out) { 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 47f763f3866aa..eacb77082f971 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 c0e7636518a70..379d30b045628 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 d1b14bbfdbcae..f52c2035b9c21 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 c2fcd46905837..5d0c7d820d82d 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 72086d514d91d..48349d2c8316e 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 40c75989f1061..8f85791466db3 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 39ce5c652abb8..cff130ae18d4b 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 ef7ff7a9afc3e..cc84691508fec 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 2609ccd4e68d5..06c0c5607972a 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 de26136f854d8..4cff029286c82 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 2560c0ffa6e37..6cd51f925c3b4 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 634c4ddcafabe..f3d26b45acf8e 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 19cf8a0f6f8f7..eaa182643927e 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 32f1137dfe4aa..8a678b3103d0e 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 b853f25880dca..583abd27d82f5 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 ab3fe87fb4fdc..5dbb40dbc3b5a 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 6d8119769deea..1a5cf57c4f28f 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 9a9a5ed7d631c..0ccbd4923f8cb 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 a00df07b988c1..c9a977cc80eed 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 4358692a973d5..0fb1447e48801 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 ad015a88f9d23..f50ea58335716 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 e50086c51ff56..347cad57e3ad1 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 bb67c7e836bf6..67f7665650298 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 314daa8ac0e94..3675f1eb229df 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 5ee69cbb961d2..8256849655814 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 7466009b8c0f1..12244f6644ed1 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 1541a4b3b9f78..7c31bfe5da217 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 f3f58b698d84b..9d3b5257a7af8 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 7582cb610ef03..fd5289bac3827 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 a08a8b890502a..89a6ba63b274e 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 270b14f486a24..dd3ad124e6da5 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 9dc2854969130..e308c60410fde 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 0e6276ab58519..6bdfd474d2eb9 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 85464d56f997c..7a5f62ed53e09 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 7a63b518fa32d..4d54865d1671b 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 8763441acd64a..06ce8f6656720 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 f8538bf44f506..2efc084d7b3a9 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 d5f24822785b3..a7688b844c6d7 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 8a3be6ced55cb..0fa3f166e2c56 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 56c32e6037ffa..d9b1e4e0747b1 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 c91936fe4a2b7..57f6ddf0f7ff6 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 dae939586dadf..2bd97b95eb188 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 14090883eb51f..c6968f4b24be8 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 5c402b05969f6..1d5b9279977cb 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 c90e27008c6bf..a95215c5de99f 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 fd9761bb39677..5ae59b22554fc 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 c18fc90aa1425..fd702593b89df 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -127,4 +127,4 @@ int grpc_server_add_http2_port(grpc_server *server, const char *addr) { 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 af427ac19d664..f629c7c72de87 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 e65c05f396503..f998de1ad6aaf 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 d436b65584638..11901a58a060f 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 b7b5f4fe0c4fa..796f514f19ed9 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 bd0a0ff8a693b..f5ca6c4e50620 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 221f663e7cfb2..2368fdd738c76 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 c76a8dffb8b3d..733dd5eec4895 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 e6a1b0c30a532..95c27ad286a10 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 618e22630142a..4d05a5f45291e 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 b97d6e822e59d..95b75d4fded38 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 369bac85db09a..9ccef276346c5 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 915e70b9d002e..26004b3b7c626 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 5e8945f1e390b..d9d6f7ef15eeb 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 742e037c6a988..368ca864816a3 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 95f6b3d37db1e..83fc3806eb21b 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 a8fd189f7988e..06429e220b7f0 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 1d4e5e0398157..6cde2c6e47e7e 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 a0540bba601b7..a8db7d66531f9 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 132793b644d6e..093263db170f6 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 ff6f948cc39bd..86b593129b052 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 823245b7e2908..3fd8f672265a8 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 d81ffce535684..94acc8864f7eb 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 5ba9fbff678cd..2c0159260f5a7 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 b105b68db8544..ea0fc1d030228 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 b957cd8f6eb7e..1eecd1754016a 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 cfd3fe8ecb69d..0a926e7e35163 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 f221b39b9e932..131c4acbebb10 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 9c815fa1554e9..bf214b017a21b 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 523a50d966be0..8e2672008cf8a 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 6f73b4955fd2d..79cce553fa722 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 e5b1cb4cff03f..a99d61a553fd2 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 053dbc3ad26ef..580e32c582e6a 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 2d1f4c47a7b30..3fb91fc88f702 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 d9943503e2bd0..33915c4039f3b 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 5028d33237bea..2bef8ba67f5a2 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 2efef951ed459..0722c9ada9baa 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 60ce84dc412d8..8c353c66a725e 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 9d41671b3c4be..551ae27e613c3 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 18edcd2919d65..6fbc5961a1d25 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 0f999a1d48f49..3dc23e7de239e 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 bc6839cd47054..430cae6847c61 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 f494292070d9d..c30e3a27f1d5f 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 eadbfe0c32dc9..828a7f7226f36 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 cfd203a1f61a7..ef0020dc58b66 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 52a91f2ba781f..60193b1844cfc 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 c807c4a19a42b..d1e0b1920ea33 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 dbe5ef5bafa34..e8af200284ae2 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 37076bb8721ce..36e62bce3dad8 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 0a3739910f5eb..2e59275ff80d5 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 4ddff58055064..3c1c4c01a2add 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 da7e13eec8947..aeb9b3fc17d37 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 28f60aa1a7586..432da0734631b 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 5dd4a59898189..90e119ca8e4b2 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 9a8ee15fdd354..ca69d66cbbfcf 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 46da754d8c222..06f5a8ffdfe70 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 a8c71b6196064..abf0fc1c0ad7a 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 646c45a963988..80cbdd93accc6 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 4e71492ad0092..8fdd483474255 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 45502b936172b..acf51cb90b194 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 90e278157ee45..66571cad73dc0 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 53b66b955d353..91724a4837a2a 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 b7a6450d2c90c..e29c6a053d8d5 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 f2b75b410ab16..c7d883d5b0ecc 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 e536a1b135006..1654d4a262cde 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 57098b50c42ef..69a6bb080e0ab 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 b3b032899035c..834884d579693 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 84b083ead6407..5f8c2ba10f4cd 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 8c0844a319998..da98cf5ce0d3e 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 1ca1acad944ba..3c2093c363899 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 b9c82138f6303..10cce450d797b 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 fbd606246bc3f..69ad000ccc69f 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 410e51d8b119d..1ca98129d3eeb 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 77b0f33ddc423..283618f4b6860 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 f29415b5b8a32..bbf8030668695 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 56ac4765164fd..919e5623fa31e 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 59c3b9d406455..9f9e582d070ac 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 dadfd151ecc73..7169ee2a4a5d8 100644 --- a/src/csharp/GrpcApi/Empty.cs +++ b/src/csharp/GrpcApi/Empty.cs @@ -7,12 +7,12 @@ 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 @@ public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { get { return descriptor; } } private static pbd::FileDescriptor descriptor; - + static Empty() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( @@ -34,7 +34,7 @@ static Empty() { 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 @@ static Empty() { }, assigner); } #endregion - + } } #region Messages @@ -57,48 +57,48 @@ private Empty() { } 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 @@ public static Empty ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry 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 @@ internal Builder(Empty cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Empty result; - + private Empty PrepareBuilder() { if (resultIsReadOnly) { Empty original = result; @@ -166,21 +166,21 @@ private Empty PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override Empty BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Empty) { return MergeFrom((Empty) other); @@ -213,18 +213,18 @@ public override Builder MergeFrom(pb::IMessage other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + 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 2d700337ac795..75b1e9dbc2ab5 100644 --- a/src/csharp/GrpcApi/Math.cs +++ b/src/csharp/GrpcApi/Math.cs @@ -7,12 +7,12 @@ 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 @@ public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { 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 @@ static Math() { }, assigner); } #endregion - + } } #region Messages @@ -90,23 +90,23 @@ private DivArgs() { } 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 @@ public bool HasDividend { public long Dividend { get { return dividend_; } } - + public const int DivisorFieldNumber = 2; private bool hasDivisor; private long divisor_; @@ -126,13 +126,13 @@ public bool HasDivisor { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static DivArgs ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -197,14 +197,14 @@ public static DivArgs ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegist 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 @@ internal Builder(DivArgs cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private DivArgs result; - + private DivArgs PrepareBuilder() { if (resultIsReadOnly) { DivArgs original = result; @@ -231,21 +231,21 @@ private DivArgs PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override DivArgs BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is DivArgs) { return MergeFrom((DivArgs) other); @@ -278,7 +278,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(DivArgs other) { if (other == global::math.DivArgs.DefaultInstance) return this; PrepareBuilder(); @@ -291,11 +291,11 @@ public override Builder MergeFrom(DivArgs other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasDividend { get { return result.hasDividend; } } @@ -368,7 +368,7 @@ public Builder ClearDividend() { result.dividend_ = 0L; return this; } - + public bool HasDivisor { get { return result.hasDivisor; } } @@ -393,7 +393,7 @@ static DivArgs() { 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 @@ private DivReply() { } 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 @@ public bool HasQuotient { public long Quotient { get { return quotient_; } } - + public const int RemainderFieldNumber = 2; private bool hasRemainder; private long remainder_; @@ -439,13 +439,13 @@ public bool HasRemainder { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static DivReply ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -510,14 +510,14 @@ public static DivReply ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegis 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 @@ internal Builder(DivReply cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private DivReply result; - + private DivReply PrepareBuilder() { if (resultIsReadOnly) { DivReply original = result; @@ -544,21 +544,21 @@ private DivReply PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override DivReply BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is DivReply) { return MergeFrom((DivReply) other); @@ -591,7 +591,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(DivReply other) { if (other == global::math.DivReply.DefaultInstance) return this; PrepareBuilder(); @@ -604,11 +604,11 @@ public override Builder MergeFrom(DivReply other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasQuotient { get { return result.hasQuotient; } } @@ -681,7 +681,7 @@ public Builder ClearQuotient() { result.quotient_ = 0L; return this; } - + public bool HasRemainder { get { return result.hasRemainder; } } @@ -706,7 +706,7 @@ static DivReply() { 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 @@ private FibArgs() { } 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 @@ public bool HasLimit { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static FibArgs ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -807,14 +807,14 @@ public static FibArgs ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegist 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 @@ internal Builder(FibArgs cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private FibArgs result; - + private FibArgs PrepareBuilder() { if (resultIsReadOnly) { FibArgs original = result; @@ -841,21 +841,21 @@ private FibArgs PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override FibArgs BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is FibArgs) { return MergeFrom((FibArgs) other); @@ -888,7 +888,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(FibArgs other) { if (other == global::math.FibArgs.DefaultInstance) return this; PrepareBuilder(); @@ -898,11 +898,11 @@ public override Builder MergeFrom(FibArgs other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasLimit { get { return result.hasLimit; } } @@ -976,7 +976,7 @@ static FibArgs() { 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 @@ private Num() { } 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 @@ public bool HasNum_ { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static Num ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1077,14 +1077,14 @@ public static Num ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry e 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 @@ internal Builder(Num cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Num result; - + private Num PrepareBuilder() { if (resultIsReadOnly) { Num original = result; @@ -1111,21 +1111,21 @@ private Num PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override Num BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Num) { return MergeFrom((Num) other); @@ -1158,7 +1158,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(Num other) { if (other == global::math.Num.DefaultInstance) return this; PrepareBuilder(); @@ -1168,11 +1168,11 @@ public override Builder MergeFrom(Num other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasNum_ { get { return result.hasNum_; } } @@ -1246,7 +1246,7 @@ static Num() { 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 @@ private FibReply() { } 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 @@ public bool HasCount { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static FibReply ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1347,14 +1347,14 @@ public static FibReply ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegis 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 @@ internal Builder(FibReply cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private FibReply result; - + private FibReply PrepareBuilder() { if (resultIsReadOnly) { FibReply original = result; @@ -1381,21 +1381,21 @@ private FibReply PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override FibReply BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is FibReply) { return MergeFrom((FibReply) other); @@ -1428,7 +1428,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(FibReply other) { if (other == global::math.FibReply.DefaultInstance) return this; PrepareBuilder(); @@ -1438,11 +1438,11 @@ public override Builder MergeFrom(FibReply other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasCount { get { return result.hasCount; } } @@ -1516,16 +1516,16 @@ static FibReply() { 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 07bcc9c9cd481..2202c52a27776 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 @@ public static void FibExample(MathGrpc.IMathServiceClient stub) 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 @@ public static void DivManyExample(MathGrpc.IMathServiceClient stub) }; var recorder = new RecordingObserver(); - + var inputs = stub.DivMany(recorder); foreach (var input in divArgsList) { @@ -108,14 +108,14 @@ public static void DivManyExample(MathGrpc.IMathServiceClient stub) 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 606e7f023903d..caea1608ecf5f 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 @@ public static IMathServiceClient NewStub(Channel channel) 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 ffd794d6c6bfe..1a2f98f8b265e 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 @@ public void Fib(FibArgs request, IObserver responseObserver) // TODO: support cancellation.... throw new NotImplementedException("Not implemented yet"); } - + if (request.Limit > 0) { foreach (var num in FibInternal(request.Limit)) @@ -124,7 +124,7 @@ public DivObserver(IObserver responseObserver) { this.responseObserver = responseObserver; } - + public void OnCompleted() { Task.Factory.StartNew(() => @@ -143,7 +143,7 @@ public void OnNext(DivArgs value) // 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 78e3404d226e5..386f377f08b09 100644 --- a/src/csharp/GrpcApi/Messages.cs +++ b/src/csharp/GrpcApi/Messages.cs @@ -7,10 +7,10 @@ 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 @@ public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { 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 @@ static Messages() { }, assigner); } #endregion - + } #region Enums public enum PayloadType { @@ -111,9 +111,9 @@ public enum PayloadType { UNCOMPRESSABLE = 1, RANDOM = 2, } - + #endregion - + #region Messages [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] public sealed partial class Payload : pb::GeneratedMessage { @@ -124,23 +124,23 @@ private Payload() { } 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 @@ public bool HasType { 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 @@ public bool HasBody { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static Payload ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -231,14 +231,14 @@ public static Payload ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegist 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 @@ internal Builder(Payload cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private Payload result; - + private Payload PrepareBuilder() { if (resultIsReadOnly) { Payload original = result; @@ -265,21 +265,21 @@ private Payload PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override Payload BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is Payload) { return MergeFrom((Payload) other); @@ -312,7 +312,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(Payload other) { if (other == global::grpc.testing.Payload.DefaultInstance) return this; PrepareBuilder(); @@ -325,11 +325,11 @@ public override Builder MergeFrom(Payload other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasType { get { return result.hasType; } } @@ -410,7 +410,7 @@ public Builder ClearType() { result.type_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public bool HasBody { get { return result.hasBody; } } @@ -436,7 +436,7 @@ static Payload() { 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 @@ private SimpleRequest() { } 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 @@ public bool HasResponseType { public global::grpc.testing.PayloadType ResponseType { get { return responseType_; } } - + public const int ResponseSizeFieldNumber = 2; private bool hasResponseSize; private int responseSize_; @@ -482,7 +482,7 @@ public bool HasResponseSize { public int ResponseSize { get { return responseSize_; } } - + public const int PayloadFieldNumber = 3; private bool hasPayload; private global::grpc.testing.Payload payload_; @@ -492,7 +492,7 @@ public bool HasPayload { 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 @@ public bool HasFillUsername { public bool FillUsername { get { return fillUsername_; } } - + public const int FillOauthScopeFieldNumber = 5; private bool hasFillOauthScope; private bool fillOauthScope_; @@ -512,13 +512,13 @@ public bool HasFillOauthScope { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static SimpleRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -601,14 +601,14 @@ public static SimpleRequest ParseFrom(pb::ICodedInputStream input, pb::Extension 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 @@ internal Builder(SimpleRequest cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private SimpleRequest result; - + private SimpleRequest PrepareBuilder() { if (resultIsReadOnly) { SimpleRequest original = result; @@ -635,21 +635,21 @@ private SimpleRequest PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override SimpleRequest BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is SimpleRequest) { return MergeFrom((SimpleRequest) other); @@ -682,7 +682,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(SimpleRequest other) { if (other == global::grpc.testing.SimpleRequest.DefaultInstance) return this; PrepareBuilder(); @@ -704,11 +704,11 @@ public override Builder MergeFrom(SimpleRequest other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasResponseType { get { return result.hasResponseType; } } @@ -806,7 +806,7 @@ public Builder ClearResponseType() { result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public bool HasResponseSize { get { return result.hasResponseSize; } } @@ -826,7 +826,7 @@ public Builder ClearResponseSize() { result.responseSize_ = 0; return this; } - + public bool HasPayload { get { return result.hasPayload; } } @@ -866,7 +866,7 @@ public Builder ClearPayload() { result.payload_ = null; return this; } - + public bool HasFillUsername { get { return result.hasFillUsername; } } @@ -886,7 +886,7 @@ public Builder ClearFillUsername() { result.fillUsername_ = false; return this; } - + public bool HasFillOauthScope { get { return result.hasFillOauthScope; } } @@ -911,7 +911,7 @@ static SimpleRequest() { 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 @@ private SimpleResponse() { } 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 @@ public bool HasPayload { 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 @@ public bool HasUsername { public string Username { get { return username_; } } - + public const int OauthScopeFieldNumber = 3; private bool hasOauthScope; private string oauthScope_ = ""; @@ -967,13 +967,13 @@ public bool HasOauthScope { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static SimpleResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1044,14 +1044,14 @@ public static SimpleResponse ParseFrom(pb::ICodedInputStream input, pb::Extensio 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 @@ internal Builder(SimpleResponse cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private SimpleResponse result; - + private SimpleResponse PrepareBuilder() { if (resultIsReadOnly) { SimpleResponse original = result; @@ -1078,21 +1078,21 @@ private SimpleResponse PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override SimpleResponse BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is SimpleResponse) { return MergeFrom((SimpleResponse) other); @@ -1125,7 +1125,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(SimpleResponse other) { if (other == global::grpc.testing.SimpleResponse.DefaultInstance) return this; PrepareBuilder(); @@ -1141,11 +1141,11 @@ public override Builder MergeFrom(SimpleResponse other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -1247,7 +1247,7 @@ public Builder ClearPayload() { result.payload_ = null; return this; } - + public bool HasUsername { get { return result.hasUsername; } } @@ -1268,7 +1268,7 @@ public Builder ClearUsername() { result.username_ = ""; return this; } - + public bool HasOauthScope { get { return result.hasOauthScope; } } @@ -1294,7 +1294,7 @@ static SimpleResponse() { 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 @@ private StreamingInputCallRequest() { } 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 @@ public bool HasPayload { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static StreamingInputCallRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1395,14 +1395,14 @@ public static StreamingInputCallRequest ParseFrom(pb::ICodedInputStream input, p 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 @@ internal Builder(StreamingInputCallRequest cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingInputCallRequest result; - + private StreamingInputCallRequest PrepareBuilder() { if (resultIsReadOnly) { StreamingInputCallRequest original = result; @@ -1429,21 +1429,21 @@ private StreamingInputCallRequest PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override StreamingInputCallRequest BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingInputCallRequest) { return MergeFrom((StreamingInputCallRequest) other); @@ -1476,7 +1476,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(StreamingInputCallRequest other) { if (other == global::grpc.testing.StreamingInputCallRequest.DefaultInstance) return this; PrepareBuilder(); @@ -1486,11 +1486,11 @@ public override Builder MergeFrom(StreamingInputCallRequest other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -1589,7 +1589,7 @@ static StreamingInputCallRequest() { 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 @@ private StreamingInputCallResponse() { } 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 @@ public bool HasAggregatedPayloadSize { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static StreamingInputCallResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1690,14 +1690,14 @@ public static StreamingInputCallResponse ParseFrom(pb::ICodedInputStream input, 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 @@ internal Builder(StreamingInputCallResponse cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingInputCallResponse result; - + private StreamingInputCallResponse PrepareBuilder() { if (resultIsReadOnly) { StreamingInputCallResponse original = result; @@ -1724,21 +1724,21 @@ private StreamingInputCallResponse PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override StreamingInputCallResponse BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingInputCallResponse) { return MergeFrom((StreamingInputCallResponse) other); @@ -1771,7 +1771,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(StreamingInputCallResponse other) { if (other == global::grpc.testing.StreamingInputCallResponse.DefaultInstance) return this; PrepareBuilder(); @@ -1781,11 +1781,11 @@ public override Builder MergeFrom(StreamingInputCallResponse other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasAggregatedPayloadSize { get { return result.hasAggregatedPayloadSize; } } @@ -1859,7 +1859,7 @@ static StreamingInputCallResponse() { 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 @@ private ResponseParameters() { } 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 @@ public bool HasSize { public int Size { get { return size_; } } - + public const int IntervalUsFieldNumber = 2; private bool hasIntervalUs; private int intervalUs_; @@ -1905,13 +1905,13 @@ public bool HasIntervalUs { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static ResponseParameters ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -1976,14 +1976,14 @@ public static ResponseParameters ParseFrom(pb::ICodedInputStream input, pb::Exte 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 @@ internal Builder(ResponseParameters cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private ResponseParameters result; - + private ResponseParameters PrepareBuilder() { if (resultIsReadOnly) { ResponseParameters original = result; @@ -2010,21 +2010,21 @@ private ResponseParameters PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override ResponseParameters BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is ResponseParameters) { return MergeFrom((ResponseParameters) other); @@ -2057,7 +2057,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(ResponseParameters other) { if (other == global::grpc.testing.ResponseParameters.DefaultInstance) return this; PrepareBuilder(); @@ -2070,11 +2070,11 @@ public override Builder MergeFrom(ResponseParameters other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasSize { get { return result.hasSize; } } @@ -2147,7 +2147,7 @@ public Builder ClearSize() { result.size_ = 0; return this; } - + public bool HasIntervalUs { get { return result.hasIntervalUs; } } @@ -2172,7 +2172,7 @@ static ResponseParameters() { 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 @@ private StreamingOutputCallRequest() { } 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 @@ public bool HasResponseType { 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 @@ public int ResponseParametersCount { 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 @@ public bool HasPayload { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static StreamingOutputCallRequest ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -2308,14 +2308,14 @@ private StreamingOutputCallRequest MakeReadOnly() { 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 @@ internal Builder(StreamingOutputCallRequest cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingOutputCallRequest result; - + private StreamingOutputCallRequest PrepareBuilder() { if (resultIsReadOnly) { StreamingOutputCallRequest original = result; @@ -2342,21 +2342,21 @@ private StreamingOutputCallRequest PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override StreamingOutputCallRequest BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingOutputCallRequest) { return MergeFrom((StreamingOutputCallRequest) other); @@ -2389,7 +2389,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(StreamingOutputCallRequest other) { if (other == global::grpc.testing.StreamingOutputCallRequest.DefaultInstance) return this; PrepareBuilder(); @@ -2405,11 +2405,11 @@ public override Builder MergeFrom(StreamingOutputCallRequest other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasResponseType { get { return result.hasResponseType; } } @@ -2499,7 +2499,7 @@ public Builder ClearResponseType() { result.responseType_ = global::grpc.testing.PayloadType.COMPRESSABLE; return this; } - + public pbc::IPopsicleList ResponseParametersList { get { return PrepareBuilder().responseParameters_; } } @@ -2543,7 +2543,7 @@ public Builder ClearResponseParameters() { result.responseParameters_.Clear(); return this; } - + public bool HasPayload { get { return result.hasPayload; } } @@ -2588,7 +2588,7 @@ static StreamingOutputCallRequest() { 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 @@ private StreamingOutputCallResponse() { } 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 @@ public bool HasPayload { 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 @@ public override void WriteTo(pb::ICodedOutputStream output) { } 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 @@ public override int SerializedSize { return size; } } - + public static StreamingOutputCallResponse ParseFrom(pb::ByteString data) { return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); } @@ -2689,14 +2689,14 @@ public static StreamingOutputCallResponse ParseFrom(pb::ICodedInputStream input, 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 @@ internal Builder(StreamingOutputCallResponse cloneFrom) { result = cloneFrom; resultIsReadOnly = true; } - + private bool resultIsReadOnly; private StreamingOutputCallResponse result; - + private StreamingOutputCallResponse PrepareBuilder() { if (resultIsReadOnly) { StreamingOutputCallResponse original = result; @@ -2723,21 +2723,21 @@ private StreamingOutputCallResponse PrepareBuilder() { } 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 @@ public override Builder Clone() { 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 @@ public override StreamingOutputCallResponse BuildPartial() { resultIsReadOnly = true; return result.MakeReadOnly(); } - + public override Builder MergeFrom(pb::IMessage other) { if (other is StreamingOutputCallResponse) { return MergeFrom((StreamingOutputCallResponse) other); @@ -2770,7 +2770,7 @@ public override Builder MergeFrom(pb::IMessage other) { return this; } } - + public override Builder MergeFrom(StreamingOutputCallResponse other) { if (other == global::grpc.testing.StreamingOutputCallResponse.DefaultInstance) return this; PrepareBuilder(); @@ -2780,11 +2780,11 @@ public override Builder MergeFrom(StreamingOutputCallResponse other) { 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 @@ public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegi } } } - + if (unknownFields != null) { this.UnknownFields = unknownFields.Build(); } return this; } - - + + public bool HasPayload { get { return result.hasPayload; } } @@ -2883,9 +2883,9 @@ static StreamingOutputCallResponse() { 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 725f12c48606d..e0a8e4357fc52 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 @@ // 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 067b21c252c64..6534a44ef4fa5 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 bb3f75d4acb0e..bd298b0932feb 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 @@ public void Fib() 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 0928404429fe0..5594e92e72b81 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 @@ // 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 181210902f7d7..93a7507b2fae5 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 @@ public class Call 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 101965600e049..d89d9a16f9b1f 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 cd4f151f49fe3..d1f795541cc1f 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 @@ protected virtual void Dispose(bool disposing) } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs b/src/csharp/GrpcCore/ClientStreamingAsyncResult.cs index 507d0dd8ad30d..f82fe5f26ced5 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 ee1168621d01b..c4f030267d219 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 @@ public class GrpcEnvironment static object staticLock = new object(); static volatile GrpcEnvironment instance; - + readonly GrpcThreadPool threadPool; bool isClosed; @@ -60,7 +60,7 @@ public class GrpcEnvironment /// 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 a3b40e512c817..d5f3239e1e09b 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 @@ internal class AsyncCall: ICallEventListener, 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; @@ -205,7 +205,7 @@ public TaskCompletionSource StartWrite(TWrite msg, bool buffered) CheckNotFinished(); CheckNoError(); CheckCancelNotRequested(); - + if (halfcloseRequested || halfclosed) { throw new InvalidOperationException("Already halfclosed."); @@ -218,7 +218,7 @@ public TaskCompletionSource StartWrite(TWrite msg, bool buffered) // TODO: wrap serialization... byte[] payload = serializer(msg); - + call.StartWrite(payload, buffered, callbackHandler); writeTcs = new TaskCompletionSource(); return writeTcs; @@ -317,7 +317,7 @@ public void CancelWithStatus(Status status) // grpc_call_cancel_with_status is threadsafe call.CancelWithStatus(status); } - + public void OnClientMetadata() { // TODO: implement.... @@ -434,7 +434,7 @@ protected virtual void Dispose(bool disposing) { call.Dispose(); } - } + } disposed = true; } } @@ -523,4 +523,4 @@ private void HandleEvent(IntPtr eventPtr) { } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs index d91d2ac6cbfe8..e9ccd8d5f993d 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 @@ internal class CallSafeHandle : SafeHandleZeroIsInvalid [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 @@ public static CallSafeHandle Create(ChannelSafeHandle channel, string method, st } 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 @@ private static UInt32 GetFlags(bool buffered) { 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 f6af64c96796a..379c83d537596 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 @@ protected override bool ReleaseHandle() 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 fc2b1d5421007..666f220b8c8a9 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 c2eb1327b3f9f..d38896ec84332 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 @@ internal enum GRPCCompletionType GRPC_QUEUE_SHUTDOWN, /* operation completion */ - GRPC_OP_COMPLETE, + GRPC_OP_COMPLETE, /* A read has completed */ GRPC_READ, @@ -87,7 +87,7 @@ internal enum GRPCCompletionType /* 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 9229472ccd70f..6116e0975afdf 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 @@ protected override bool ReleaseHandle() // 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 @@ protected override bool ReleaseHandle() 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 b768decc8c6ad..f8154fa2505dd 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 c7d8a0a3c3887..74a8ef7b6ea1a 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 2ae0ad237d86f..c91de97ce3b7b 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 @@ protected override bool ReleaseHandle() 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 11207918426cc..1d29864b9f42b 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 49410961cb4b4..60837de5e6561 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 651003dae8b7b..38b75180dc5f8 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 @@ public Timespec Add(TimeSpan timeSpan) { 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 21bd26650b5c7..f031354fd2d7f 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 @@ public static Marshaller StringMarshaller { 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 a8c647035d826..64a4f71396dac 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 74aba25767844..0907b8683365e 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 @@ // 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 5d1ca3bcdf35c..9ec1d2f2f3307 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 62ffa70b713b1..0882a61299506 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 @@ public void Start() internal void RunRpc() { AllowOneRpc(); - + try { var rpcInfo = newRpcQueue.Take(); @@ -105,7 +105,7 @@ internal void RunRpc() if (!callHandlers.TryGetValue(rpcInfo.Method, out callHandler)) { callHandler = new NoSuchMethodCallHandler(); - } + } callHandler.StartCall(rpcInfo.Method, rpcInfo.Call, GetCompletionQueue()); } catch(Exception e) @@ -209,4 +209,4 @@ public string Method } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/ServerCallHandler.cs b/src/csharp/GrpcCore/ServerCallHandler.cs index 12d0c936348b4..bcce4a091fb5e 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 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 b95a0d97b4fcd..273029cab6099 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 f0b4daf071968..1eb17837e4481 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 @@ public Builder(string serviceName) } public Builder AddMethod( - Method method, + Method method, UnaryRequestServerMethod handler) { callHandlers.Add(method.Name, ServerCalls.UnaryRequestCall(method, handler)); @@ -81,7 +81,7 @@ public Builder AddMethod( } 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 dce1e24d7ea26..6430e6b7ab7d4 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 @@ public string Detail } } } -} \ No newline at end of file +} diff --git a/src/csharp/GrpcCore/StatusCode.cs b/src/csharp/GrpcCore/StatusCode.cs index eccaae72f6d70..ba99f9b5e0b45 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 0cadfc0e4a049..0c784e1d3568f 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 d73fc0fc78599..f8940d7584c02 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 1472db6e07e6e..44011565204df 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 @@ public void EmptyCall() 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 1bc6cce401770..8656b1bf01608 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 565b1e2bd65b3..a93d843889f24 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 @@ // 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 1c70a3d6c4421..43414a4cc4953 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 2b03513cb7aff..216982421918f 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 fcc6a572e401b..945afe0642f2e 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 @@ public static void Main(string[] args) 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 @@ private void RunLargeUnary(TestServiceGrpc.ITestServiceClient client) .SetResponseSize(314159) .SetPayload(CreateZerosPayload(271828)) .Build(); - + var response = client.UnaryCall(request); Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); @@ -214,8 +214,8 @@ private void RunPingPong(TestServiceGrpc.ITestServiceClient client) .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 @@ private void RunPingPong(TestServiceGrpc.ITestServiceClient client) .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 @@ private void RunPingPong(TestServiceGrpc.ITestServiceClient client) .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 @@ private void RunPingPong(TestServiceGrpc.ITestServiceClient client) .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 1f3cc19a9def7..00b4bd5895555 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 @@ // 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 a54c8e3809931..eb9b7b105b8ae 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 @@ public static void Main (string[] args) MathExamples.DivManyExample(stub); } - + GrpcEnvironment.Shutdown(); } } diff --git a/src/csharp/MathClient/Properties/AssemblyInfo.cs b/src/csharp/MathClient/Properties/AssemblyInfo.cs index f521cd63f0c6b..aa614943acb87 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 @@ // 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 8180c2735fe23..c165d26e47e11 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 52fee70a9db01..5083674d394a3 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 e93349d65cb30..933541ce5b654 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 edeebe9702e58..6c7a89e596d09 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 3c0597715b291..bf793194d9a7f 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 bc5896b58bd7e..ca22527e6f547 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 1c02a34592934..0ddb5b4cfd255 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 cb1e8a79c1f8f..4b95c72bf73a2 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 576a5dbd47ad3..e60be3d4e155b 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 4e1553fecd466..965186e0cc64f 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 c2e85df5b8bad..ab45da8d19969 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 e4bb4d889ea18..2056fe7d3f8a5 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 9c9a1b38a7bf3..f75a2bf79c8f2 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 7c916e774e39e..f09902420c6e6 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 5cece4a97d187..bc3237f7a6c2d 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 a85949f2674ab..0cada5ace969d 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 1587a8c741378..7e62c1b7a3d4f 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 9aaa19b47433d..2f6bbc950b642 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 cd31efd9f118b..6656a561309fd 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 63db5c3ec8423..d61431f17af11 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 Pubsub 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 cb27ce6039848..43c5265643acf 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 @@ class Service 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 94d4ad6c3e97b..ef31f68f83b65 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 0e2b40bdcae4f..b3b7d0c5a3a90 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 0dd4d2129335e..3579fa5ded80e 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 9e65b42caaeaf..89c349b406001 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 Testing 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 0df3ec1f3a2d8..5948b50eaa5cd 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 @@ 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 d50457f18c642..5a3146c581b24 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 @@ class Service 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 7dc677b6a3a4d..323993ed439e9 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 9a0687f66963d..cb085d4d42988 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 ff38b2a250148..93277e39320c4 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 c559ae0bb8af8..cf58a53913fa9 100755 --- a/src/ruby/bin/math_services.rb +++ b/src/ruby/bin/math_services.rb @@ -53,4 +53,4 @@ class Service 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 ec01e740f3e85..44710520d2979 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 208a91f734b03..435f8f4ebf495 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 c9f7d94165cfa..96c92e2be5dda 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -73,4 +73,4 @@ def crash(msg) 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 605703fd53f6e..ed9240ab637e0 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 935f206c619a5..c65f2153f8d22 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 9576075ffa141..12cf3bccc2bf5 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 f2a3f3ed3be6b..ade6046e24f5f 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 116e7740561c7..3dbfb9dbfd009 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 696f77e941889..bf77d774fee05 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 4249db776896a..532ee5e785998 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 ff12e90806c6e..78a333bd0826b 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 7ed586fbb12a7..60a28ce94bc8b 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 61b27ab10f23c..1f618f593f08f 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 9df58e2c69f8f..4e512760d7f2e 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 838d2abb3d73b..be5574c3191aa 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 70147349d5cf1..3579f2007355f 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 ee75231ae729d..12f12868772b0 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 2ec4ee5aacd90..61b7ea29ff65c 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 0cd79eaf8545d..7c7ef8896870f 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 f054ae9e98a34..312cbf998f29f 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 5873ca597ec77..6c0f252378ad2 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 4789f2e883434..ee30419a1cb6f 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 7226359b2d9ed..6418db23fe86b 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 41c0a955a7a1c..521756203929f 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 a2193cdc4e1b1..f73d2b1e1a641 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 8836afd6dd333..39052265f2e55 100644 --- a/src/ruby/lib/grpc.rb +++ b/src/ruby/lib/grpc.rb @@ -41,4 +41,4 @@ 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 bfde5dfe3bff5..9beb4d1d72d82 100644 --- a/src/ruby/lib/grpc/core/event.rb +++ b/src/ruby/lib/grpc/core/event.rb @@ -40,4 +40,4 @@ def inspect 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 0b7c22d20b859..cfc2a7a6fa888 100644 --- a/src/ruby/lib/grpc/core/time_consts.rb +++ b/src/ruby/lib/grpc/core/time_consts.rb @@ -69,4 +69,4 @@ def from_relative_time(timeish) 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 d562f0503d9c0..7e8753e324382 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -60,4 +60,4 @@ def to_status 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 22218bd7546e8..67e019f050230 100644 --- a/src/ruby/lib/grpc/generic/active_call.rb +++ b/src/ruby/lib/grpc/generic/active_call.rb @@ -535,4 +535,4 @@ def assert_queue_is_ready 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 2e470346ede93..18b0d681fd65f 100644 --- a/src/ruby/lib/grpc/generic/bidi_call.rb +++ b/src/ruby/lib/grpc/generic/bidi_call.rb @@ -220,4 +220,4 @@ def start_read_loop 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 10405a922ee51..a35fae1e2edf1 100644 --- a/src/ruby/lib/grpc/generic/client_stub.rb +++ b/src/ruby/lib/grpc/generic/client_stub.rb @@ -407,4 +407,4 @@ def new_active_call(ch, marshal, unmarshal, deadline = nil) 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 ea6abbc400831..51f7d794fee7a 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -148,4 +148,4 @@ def send_status(active_client, code, details) 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 1ea9cfbef3aba..438aa9a4168d5 100644 --- a/src/ruby/lib/grpc/generic/rpc_server.rb +++ b/src/ruby/lib/grpc/generic/rpc_server.rb @@ -403,4 +403,4 @@ def add_rpc_descs_for(service) 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 77f0021e9582e..09ae6bee15a77 100644 --- a/src/ruby/lib/grpc/generic/service.rb +++ b/src/ruby/lib/grpc/generic/service.rb @@ -234,4 +234,4 @@ def self.included(o) 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 24c0913640d2d..47e0c5b212ccb 100644 --- a/src/ruby/lib/grpc/logconfig.rb +++ b/src/ruby/lib/grpc/logconfig.rb @@ -37,4 +37,4 @@ # 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 de7ef5f888013..fb8356e1e8c12 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 1bd0e093bd78b..88e7e2b3e7ac1 100644 --- a/src/ruby/spec/alloc_spec.rb +++ b/src/ruby/spec/alloc_spec.rb @@ -41,4 +41,4 @@ 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 76e3fae35821a..e1833ebb3a0b4 100644 --- a/src/ruby/spec/byte_buffer_spec.rb +++ b/src/ruby/spec/byte_buffer_spec.rb @@ -64,4 +64,4 @@ 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 2a47eac23a3cf..26175645719e3 100644 --- a/src/ruby/spec/call_spec.rb +++ b/src/ruby/spec/call_spec.rb @@ -160,4 +160,4 @@ def make_test_call 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 8e514411e59f3..af73294abe429 100644 --- a/src/ruby/spec/channel_spec.rb +++ b/src/ruby/spec/channel_spec.rb @@ -178,4 +178,4 @@ def construct_with_args(a) 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 734b6517c8f71..52c985786a8b5 100644 --- a/src/ruby/spec/client_server_spec.rb +++ b/src/ruby/spec/client_server_spec.rb @@ -369,4 +369,4 @@ def new_client_call # 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 89b418583ae8a..11d4e9959cbad 100644 --- a/src/ruby/spec/completion_queue_spec.rb +++ b/src/ruby/spec/completion_queue_spec.rb @@ -71,4 +71,4 @@ 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 62a58fff434d7..001fecd12b623 100644 --- a/src/ruby/spec/credentials_spec.rb +++ b/src/ruby/spec/credentials_spec.rb @@ -74,4 +74,4 @@ def load_test_certs 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 e2b76a54a269c..7d92fcd792870 100644 --- a/src/ruby/spec/event_spec.rb +++ b/src/ruby/spec/event_spec.rb @@ -50,4 +50,4 @@ 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 3e54c1fd6f1dd..84bb7b4f9bd93 100644 --- a/src/ruby/spec/generic/active_call_spec.rb +++ b/src/ruby/spec/generic/active_call_spec.rb @@ -370,4 +370,4 @@ def make_test_call 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 1609534f0d46c..297a13383137a 100644 --- a/src/ruby/spec/generic/client_stub_spec.rb +++ b/src/ruby/spec/generic/client_stub_spec.rb @@ -516,4 +516,4 @@ def expect_server_to_be_invoked(awake_mutex, awake_cond) 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 791395b3aced0..8bff2a9a64471 100644 --- a/src/ruby/spec/generic/rpc_desc_spec.rb +++ b/src/ruby/spec/generic/rpc_desc_spec.rb @@ -354,4 +354,4 @@ def bad_status_alt(_call) 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 6ffde325f6d2a..8383dc1533ee2 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 @@ 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 f8484d778c22d..e8c706044617a 100644 --- a/src/ruby/spec/generic/rpc_server_spec.rb +++ b/src/ruby/spec/generic/rpc_server_spec.rb @@ -401,4 +401,4 @@ def an_rpc(req, _call) 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 21e4bd75f0904..e7f5a65d3b384 100644 --- a/src/ruby/spec/generic/service_spec.rb +++ b/src/ruby/spec/generic/service_spec.rb @@ -339,4 +339,4 @@ def an_rpc(_req, _call) 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 3c47914741501..247286669210b 100644 --- a/src/ruby/spec/metadata_spec.rb +++ b/src/ruby/spec/metadata_spec.rb @@ -61,4 +61,4 @@ 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 a641a650fba71..55598bc8dfd38 100644 --- a/src/ruby/spec/server_credentials_spec.rb +++ b/src/ruby/spec/server_credentials_spec.rb @@ -66,4 +66,4 @@ def load_test_certs 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 123e645512775..5b81f195371d9 100644 --- a/src/ruby/spec/server_spec.rb +++ b/src/ruby/spec/server_spec.rb @@ -209,4 +209,4 @@ def start_a_server 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 3838181bab321..837d2fc42a1ba 100644 --- a/src/ruby/spec/spec_helper.rb +++ b/src/ruby/spec/spec_helper.rb @@ -48,4 +48,4 @@ 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 d090e71db3c9d..871e0e241acac 100644 --- a/src/ruby/spec/time_consts_spec.rb +++ b/src/ruby/spec/time_consts_spec.rb @@ -86,4 +86,4 @@ 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 71c4676df402d..0345f99bdee22 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 2b62aa02e175b..22776f8ca131a 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 b46658b6dd940..4033c181310a6 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 f6e9d665a5cfc..fb1e366b15b1e 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 fd531b93146cf..e2c4d22ef51ef 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 17b876af8c404..83da8b644d6ca 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 82a0af0632baa..9ed98a4345776 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 7357a6643760f..ad6481102e726 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 001c7246e4f88..0b1275f723ad7 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 e2573fb9e11e7..d31f2e2d0ed5f 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 2b6fbf3280e73..d089660bfd265 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 72bce3ed2571a..ff89e0d69f237 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 2b39f6c7eb0f2..58d9805017588 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 c37b71d1c584b..2c4c3b7746254 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 3211fffad8aff..8f2cd0f2e0529 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 de06f558562a5..039909f76cb0b 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 4775d8ee6d9e6..ea367f4446bb2 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 a3afe9af2e12f..27e4baf3c013e 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 bd2f0600f483b..1db9e727b869e 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 4af50bdd61457..35e022c4947b1 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 98907b901b914..759c6b4b9d7bb 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 7a7095b588b1d..c814527a8f009 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 a83c873387c52..92e8e5ad6bf25 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 63fbf595b2a16..faaa14727c96b 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 99e21f296c123..c6fb8b3ea2edd 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 ecedbfb44ddf3..85b7599b1950a 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 72d2942e226f4..345c31d31f881 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 53f3d88964ec6..3c75024922b4e 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 bcc2cc6cc6fb7..64af7cd3db28f 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 b62a563519602..bee6dd2e7b92f 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 3329188717cea..23e82cf2683f4 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 370db8f230ba3..8228353b09bb6 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 b293489c557a4..869f091180c64 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 e88daca014b06..3dd743735311e 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 21f4b491d0da7..003a8bef9b761 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 21f4b491d0da7..003a8bef9b761 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 ac7de77deaf0a..611589678f40d 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 6412e621017ee..ff8832a231eed 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 ec760485d2d76..49ec4715cc4a0 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 f4f19362fdf4b..2e3a05e6692d1 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 ae34e0c3c15a5..49dddc79759f9 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 68c7743b4bbc2..ed8f839a973b8 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 bd83efdf38c66..ab9792e40ab56 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 ecc1fb00965c1..852a153accd3d 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 22e0a5a8936e2..2a302e2b137fe 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 54af896c7c790..875458e7f8058 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 d204fbc9d7272..85369b5aac437 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 67a03ccfa7dff..0cb118d7950f4 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 ed59e0f2a948f..00d940ddb54e4 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 ed59e0f2a948f..00d940ddb54e4 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 1cb682b3f001c..2930ba61430d4 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 8c7dcadf3f829..b2764e9f85831 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 22a483b21ded6..843e9db9edd9b 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 ac18f00cda755..9c09e516fae68 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 d4dabf3c63c70..7f7b594d807d7 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 5e1189f35668b..ba330d5f5f899 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 ba20879fa27c2..a0dc0331f4e04 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 b621cd4755bea..be5627489949f 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 e8213dc8e5e3a..bf3b19b62d410 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 31058d3858dcd..0ed0f985ec84a 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 0d4fbd8660bca..753410401884c 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 35397ea93abc0..bc3b3800139e5 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 4b75b0057d5f5..bb13512ad427e 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 26d91d13ae6b9..b56e08cf1fcd7 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 6ed48c0221a5d..0a3eb7c7b79ec 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 3a735f13be707..3c94de548ea63 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 3fc23493c3c6a..591bc52dc5b0f 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 e4b809734f6f2..2e30d101e18d2 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 608a20659e917..c10b3737441dc 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 608a20659e917..c10b3737441dc 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 58b7492c25b1d..5f8b9974d6827 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 58b7492c25b1d..5f8b9974d6827 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 28bf967b2f947..68164b1c5a51f 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 c05798bbb7bb2..41ba995544b3e 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 5d733d14be5d3..c0066cf101395 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 27a69c83f771f..59c303015a393 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 0cad9ba5151a5..da850049e20da 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 7d9aa75b77820..599b3ad4eaaf0 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 4718107edd1fd..dacec0f72f700 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 5defe97885d00..b3e1e64d0feb1 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 a1a56d6132c7e..f2ccd1fb357f9 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 537bed47f756b..18f57725a26e4 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 ea350c923ce6f..c08ee7d48f22c 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 f555a54203b1f..3be377c4e3dc1 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 7f1f7412639df..22090ead0ac27 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 859aaf4629a6a..0961a3659f66d 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 110b09998d3af..9f5e954b9deda 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 c8f1f53dbb327..ad5a317044837 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 a00b54da8855c..044802b802585 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 8409fb4f628d6..b26115bcd00ce 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 4329ee5198c15..4206a1c58f316 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 23ea798feac69..203e75c7d5776 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 1b3383653df60..78dff92a777c9 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 1cfbbc4105ad7..0e315e51eeef0 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 6db618409cfee..f0a3e26c4eeb8 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 e306ea3cf6d69..bfd5c4877728f 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 cefe969c229c5..302869d70e278 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 dbd5f3126268f..369c34a5a5a41 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 0457f6499afd4..8615fca5fbb43 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 1d0e36ddafc97..03a4d3a1e691f 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 8d15a9becc7fe..fbc96bbde610f 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 89404c620b0f9..f829ab36833ae 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 595c1f94ff031..26a45ae58a954 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 a5d5fada7d0a6..9b7a712c18c62 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 2db36997b190f..a645e15918a93 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 d87847c7f92ee..84aef15c1a9c4 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 81b2ed4553dcd..3c1e28241ec78 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 eb025d42e01d7..0e432314bbad5 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 1ac4ce92c2917..df076b9c1e487 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 eccae087b7a76..c151b77f63915 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 21cc17be516ec..65b70e1006a26 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 c15469c20d561..d893f7f792b7f 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 c073597a83f29..b2db1afc7619e 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 677415a6ecaae..52c311f75c287 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 025caa17c034e..1f16af87a5a69 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 f111a0744825b..c0c14ffa0e5e0 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 9fb3319e6fc4b..39944308743ec 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 22dbb0e81ad19..eccc39a2db113 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 dfe30d4564050..b39b069913419 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 63b938c010469..e3890a79dad38 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 3788d66c51780..8301795dbfda7 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 69cb56b40492a..4ab3d6f45b9a9 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 4beabbe262a5f..a78e4782a29f0 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 827d3d322a28c..43d05c6302b7f 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 6e10b23be5267..c03a905d2af25 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 c9833dd4df89a..2741e17f95f10 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 92f44b331bee1..feaf4363795ea 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 51b1d8b8b15cd..b121abf75728a 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 15b99db774ddf..9116fd0fe4c8f 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 3374da45b013f..35f150c78158b 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 497b4f926da37..0142768261d9a 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 e5a753766eaa8..99b7a52ff98bb 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 b65f4dffbeccf..c2497d3b1a2bb 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 7e248968a71fc..983eaf5a0d7d4 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 b4769cb55f074..edab37b68796b 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 4503694233761..f3da9f0d49cd1 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 b39b58d323c83..e2729a0a198ab 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 94c1c96050ee8..3013533f9b961 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 24c6b5998e10f..49d58114f8799 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 39c993ae595bf..fdb27a22ced42 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 4d278d44acf5b..a3c9f97ce4c6e 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 9947a4b4ab8f0..07867c6b247fc 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 e69c5ec9dfed3..588522389483e 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 4bb36a1b61f19..6a0848fa97835 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 e181b45a6f427..3dc2b9b0678b2 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 659322e05d3a2..35b9361c70c98 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 d4b9f6330c348..a31fcc1db5f82 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 137ce5612777f..bf5bc84b48365 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 4cb1779b5f534..3fce0c9f7ac66 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 bed94c9a0ac96..2a12ab985e01b 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 c4868a16c7b77..f0fe1a0e7c38a 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 c4d5f12e79722..0f05072e50593 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 9f6f354aefa5a..b67fe737cbd78 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 41768f2f72dfb..1c46407311472 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 b827e53544665..b97fbfa613821 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 59b5910e1ec27..d98b38ab68ff9 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 c26612caf2f1c..dc8d76d7eff5a 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 7057fa07d0c7d..7101da1b2a682 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 c70930387af6a..d4ca3ef49e402 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 76cb05eee41c4..ab69e1eefd37d 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 b08030fce78b8..f4b9f04650401 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 1bca2524c2bca..8369ef6562b84 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 bdaf523b2f6e6..824d78531607b 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 bd6e62d1514f6..b0472d32a99e9 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 19a9d2e83bb2b..3476b8354b1a7 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 d7dacf03f66e2..8c6a3354fe46d 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 a258eb020195a..2e17add67faab 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 f4345e461ec34..0901f8d9ae13b 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 398d5eee19f9c..0f5ae4059f05f 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 151/173] 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 68fac49d7d5c9..c81a1ea55bf6e 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -111,7 +111,7 @@ def log(cond, why, filename): 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 152/173] 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 2abbc8d3cc64e..e40c6afd095dc 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 153/173] 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 c34738fb4a79c..5d6eb1084119f 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 08350b8ba22b4..0af15a25a6104 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 793cdae9e6f08..ac896933201b5 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 c3bb940075baf..4295a0a960c0a 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 074efadf8935a..5485d580c3222 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 e3814da406e70..65a8140465252 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 c2437630b7d40..927a3a83aa267 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 2cf6a036aa4ce..e34ad5e967279 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 42728d0bd947d..89bc0de3ba0d0 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 2bc5c29d17248..328e050aefb70 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 167be3a7d0571..fe1fb1d39977c 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 98fc3a3907050..f66a108c19b7b 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 4efc9667da41b..d00724b247e54 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 2c9cf04cdbc93..c97d23445504d 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 f53d99ab5b62d..eb6526463d9f1 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 c2437630b7d40..927a3a83aa267 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 c5b836231a4d4..848c96742d958 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 77708d163ed9d..449a8cc4c362c 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 0affa403c8dc5..4a403868c7c69 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 4fd6d8d2d0e07..8e99d6f162801 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 92e87b5d64631..16def1fa708e7 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 97b95377fb4dd..fd946e0325de6 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 e6a63b1ed7274..d6694724e5498 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 e422e93989a37..2c61ea8aa0980 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 a1d760a5b0782..3f176fb5e4aad 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 33bfe289e28ab..c3358ed899f8e 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 d50f94e11c761..e97a5cf97ebc4 100755 --- a/src/php/tests/generated_code/math.php +++ b/src/php/tests/generated_code/math.php @@ -9,10 +9,10 @@ class DivArgs extends \DrSlump\Protobuf\Message { /** @var int */ public $dividend = null; - + /** @var int */ public $divisor = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -52,7 +52,7 @@ public static function descriptor() public function hasDividend(){ return $this->_has(1); } - + /** * Clear value * @@ -61,7 +61,7 @@ public function hasDividend(){ public function clearDividend(){ return $this->_clear(1); } - + /** * Get value * @@ -70,7 +70,7 @@ public function clearDividend(){ public function getDividend(){ return $this->_get(1); } - + /** * Set value * @@ -80,7 +80,7 @@ public function getDividend(){ public function setDividend( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -89,7 +89,7 @@ public function setDividend( $value){ public function hasDivisor(){ return $this->_has(2); } - + /** * Clear value * @@ -98,7 +98,7 @@ public function hasDivisor(){ public function clearDivisor(){ return $this->_clear(2); } - + /** * Get value * @@ -107,7 +107,7 @@ public function clearDivisor(){ public function getDivisor(){ return $this->_get(2); } - + /** * Set value * @@ -126,10 +126,10 @@ class DivReply extends \DrSlump\Protobuf\Message { /** @var int */ public $quotient = null; - + /** @var int */ public $remainder = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -169,7 +169,7 @@ public static function descriptor() public function hasQuotient(){ return $this->_has(1); } - + /** * Clear value * @@ -178,7 +178,7 @@ public function hasQuotient(){ public function clearQuotient(){ return $this->_clear(1); } - + /** * Get value * @@ -187,7 +187,7 @@ public function clearQuotient(){ public function getQuotient(){ return $this->_get(1); } - + /** * Set value * @@ -197,7 +197,7 @@ public function getQuotient(){ public function setQuotient( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -206,7 +206,7 @@ public function setQuotient( $value){ public function hasRemainder(){ return $this->_has(2); } - + /** * Clear value * @@ -215,7 +215,7 @@ public function hasRemainder(){ public function clearRemainder(){ return $this->_clear(2); } - + /** * Get value * @@ -224,7 +224,7 @@ public function clearRemainder(){ public function getRemainder(){ return $this->_get(2); } - + /** * Set value * @@ -243,7 +243,7 @@ class FibArgs extends \DrSlump\Protobuf\Message { /** @var int */ public $limit = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -275,7 +275,7 @@ public static function descriptor() public function hasLimit(){ return $this->_has(1); } - + /** * Clear value * @@ -284,7 +284,7 @@ public function hasLimit(){ public function clearLimit(){ return $this->_clear(1); } - + /** * Get value * @@ -293,7 +293,7 @@ public function clearLimit(){ public function getLimit(){ return $this->_get(1); } - + /** * Set value * @@ -312,7 +312,7 @@ class Num extends \DrSlump\Protobuf\Message { /** @var int */ public $num = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -344,7 +344,7 @@ public static function descriptor() public function hasNum(){ return $this->_has(1); } - + /** * Clear value * @@ -353,7 +353,7 @@ public function hasNum(){ public function clearNum(){ return $this->_clear(1); } - + /** * Get value * @@ -362,7 +362,7 @@ public function clearNum(){ public function getNum(){ return $this->_get(1); } - + /** * Set value * @@ -381,7 +381,7 @@ class FibReply extends \DrSlump\Protobuf\Message { /** @var int */ public $count = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -413,7 +413,7 @@ public static function descriptor() public function hasCount(){ return $this->_has(1); } - + /** * Clear value * @@ -422,7 +422,7 @@ public function hasCount(){ public function clearCount(){ return $this->_clear(1); } - + /** * Get value * @@ -431,7 +431,7 @@ public function clearCount(){ 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 129c96fa13679..a626a17ab3777 100755 --- a/src/php/tests/interop/messages.php +++ b/src/php/tests/interop/messages.php @@ -17,10 +17,10 @@ class Payload extends \DrSlump\Protobuf\Message { /** @var int - \grpc\testing\PayloadType */ public $type = null; - + /** @var string */ public $body = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -61,7 +61,7 @@ public static function descriptor() public function hasType(){ return $this->_has(1); } - + /** * Clear value * @@ -70,7 +70,7 @@ public function hasType(){ public function clearType(){ return $this->_clear(1); } - + /** * Get value * @@ -79,7 +79,7 @@ public function clearType(){ public function getType(){ return $this->_get(1); } - + /** * Set value * @@ -89,7 +89,7 @@ public function getType(){ public function setType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -98,7 +98,7 @@ public function setType( $value){ public function hasBody(){ return $this->_has(2); } - + /** * Clear value * @@ -107,7 +107,7 @@ public function hasBody(){ public function clearBody(){ return $this->_clear(2); } - + /** * Get value * @@ -116,7 +116,7 @@ public function clearBody(){ public function getBody(){ return $this->_get(2); } - + /** * Set value * @@ -135,19 +135,19 @@ class SimpleRequest extends \DrSlump\Protobuf\Message { /** @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 @@ public static function descriptor() public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -222,7 +222,7 @@ public function hasResponseType(){ public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -231,7 +231,7 @@ public function clearResponseType(){ public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -241,7 +241,7 @@ public function getResponseType(){ public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -250,7 +250,7 @@ public function setResponseType( $value){ public function hasResponseSize(){ return $this->_has(2); } - + /** * Clear value * @@ -259,7 +259,7 @@ public function hasResponseSize(){ public function clearResponseSize(){ return $this->_clear(2); } - + /** * Get value * @@ -268,7 +268,7 @@ public function clearResponseSize(){ public function getResponseSize(){ return $this->_get(2); } - + /** * Set value * @@ -278,7 +278,7 @@ public function getResponseSize(){ public function setResponseSize( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -287,7 +287,7 @@ public function setResponseSize( $value){ public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -296,7 +296,7 @@ public function hasPayload(){ public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -305,7 +305,7 @@ public function clearPayload(){ public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -315,7 +315,7 @@ public function getPayload(){ public function setPayload(\grpc\testing\Payload $value){ return $this->_set(3, $value); } - + /** * Check if has a value * @@ -324,7 +324,7 @@ public function setPayload(\grpc\testing\Payload $value){ public function hasFillUsername(){ return $this->_has(4); } - + /** * Clear value * @@ -333,7 +333,7 @@ public function hasFillUsername(){ public function clearFillUsername(){ return $this->_clear(4); } - + /** * Get value * @@ -342,7 +342,7 @@ public function clearFillUsername(){ public function getFillUsername(){ return $this->_get(4); } - + /** * Set value * @@ -352,7 +352,7 @@ public function getFillUsername(){ public function setFillUsername( $value){ return $this->_set(4, $value); } - + /** * Check if has a value * @@ -361,7 +361,7 @@ public function setFillUsername( $value){ public function hasFillOauthScope(){ return $this->_has(5); } - + /** * Clear value * @@ -370,7 +370,7 @@ public function hasFillOauthScope(){ public function clearFillOauthScope(){ return $this->_clear(5); } - + /** * Get value * @@ -379,7 +379,7 @@ public function clearFillOauthScope(){ public function getFillOauthScope(){ return $this->_get(5); } - + /** * Set value * @@ -398,13 +398,13 @@ class SimpleResponse extends \DrSlump\Protobuf\Message { /** @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 @@ public static function descriptor() public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -462,7 +462,7 @@ public function hasPayload(){ public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -471,7 +471,7 @@ public function clearPayload(){ public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -481,7 +481,7 @@ public function getPayload(){ public function setPayload(\grpc\testing\Payload $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -490,7 +490,7 @@ public function setPayload(\grpc\testing\Payload $value){ public function hasUsername(){ return $this->_has(2); } - + /** * Clear value * @@ -499,7 +499,7 @@ public function hasUsername(){ public function clearUsername(){ return $this->_clear(2); } - + /** * Get value * @@ -508,7 +508,7 @@ public function clearUsername(){ public function getUsername(){ return $this->_get(2); } - + /** * Set value * @@ -518,7 +518,7 @@ public function getUsername(){ public function setUsername( $value){ return $this->_set(2, $value); } - + /** * Check if has a value * @@ -527,7 +527,7 @@ public function setUsername( $value){ public function hasOauthScope(){ return $this->_has(3); } - + /** * Clear value * @@ -536,7 +536,7 @@ public function hasOauthScope(){ public function clearOauthScope(){ return $this->_clear(3); } - + /** * Get value * @@ -545,7 +545,7 @@ public function clearOauthScope(){ public function getOauthScope(){ return $this->_get(3); } - + /** * Set value * @@ -564,7 +564,7 @@ class StreamingInputCallRequest extends \DrSlump\Protobuf\Message { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -597,7 +597,7 @@ public static function descriptor() public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -606,7 +606,7 @@ public function hasPayload(){ public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -615,7 +615,7 @@ public function clearPayload(){ public function getPayload(){ return $this->_get(1); } - + /** * Set value * @@ -634,7 +634,7 @@ class StreamingInputCallResponse extends \DrSlump\Protobuf\Message { /** @var int */ public $aggregated_payload_size = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -666,7 +666,7 @@ public static function descriptor() public function hasAggregatedPayloadSize(){ return $this->_has(1); } - + /** * Clear value * @@ -675,7 +675,7 @@ public function hasAggregatedPayloadSize(){ public function clearAggregatedPayloadSize(){ return $this->_clear(1); } - + /** * Get value * @@ -684,7 +684,7 @@ public function clearAggregatedPayloadSize(){ public function getAggregatedPayloadSize(){ return $this->_get(1); } - + /** * Set value * @@ -703,10 +703,10 @@ class ResponseParameters extends \DrSlump\Protobuf\Message { /** @var int */ public $size = null; - + /** @var int */ public $interval_us = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -746,7 +746,7 @@ public static function descriptor() public function hasSize(){ return $this->_has(1); } - + /** * Clear value * @@ -755,7 +755,7 @@ public function hasSize(){ public function clearSize(){ return $this->_clear(1); } - + /** * Get value * @@ -764,7 +764,7 @@ public function clearSize(){ public function getSize(){ return $this->_get(1); } - + /** * Set value * @@ -774,7 +774,7 @@ public function getSize(){ public function setSize( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -783,7 +783,7 @@ public function setSize( $value){ public function hasIntervalUs(){ return $this->_has(2); } - + /** * Clear value * @@ -792,7 +792,7 @@ public function hasIntervalUs(){ public function clearIntervalUs(){ return $this->_clear(2); } - + /** * Get value * @@ -801,7 +801,7 @@ public function clearIntervalUs(){ public function getIntervalUs(){ return $this->_get(2); } - + /** * Set value * @@ -820,13 +820,13 @@ class StreamingOutputCallRequest extends \DrSlump\Protobuf\Message { /** @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 @@ public static function descriptor() public function hasResponseType(){ return $this->_has(1); } - + /** * Clear value * @@ -886,7 +886,7 @@ public function hasResponseType(){ public function clearResponseType(){ return $this->_clear(1); } - + /** * Get value * @@ -895,7 +895,7 @@ public function clearResponseType(){ public function getResponseType(){ return $this->_get(1); } - + /** * Set value * @@ -905,7 +905,7 @@ public function getResponseType(){ public function setResponseType( $value){ return $this->_set(1, $value); } - + /** * Check if has a value * @@ -914,7 +914,7 @@ public function setResponseType( $value){ public function hasResponseParameters(){ return $this->_has(2); } - + /** * Clear value * @@ -923,7 +923,7 @@ public function hasResponseParameters(){ public function clearResponseParameters(){ return $this->_clear(2); } - + /** * Get value * @@ -933,7 +933,7 @@ public function clearResponseParameters(){ public function getResponseParameters($idx = NULL){ return $this->_get(2, $idx); } - + /** * Set value * @@ -943,7 +943,7 @@ public function getResponseParameters($idx = NULL){ public function setResponseParameters(\grpc\testing\ResponseParameters $value, $idx = NULL){ return $this->_set(2, $value, $idx); } - + /** * Get all elements of * @@ -952,7 +952,7 @@ public function setResponseParameters(\grpc\testing\ResponseParameters $value, $ public function getResponseParametersList(){ return $this->_get(2); } - + /** * Add a new element to * @@ -962,7 +962,7 @@ public function getResponseParametersList(){ public function addResponseParameters(\grpc\testing\ResponseParameters $value){ return $this->_add(2, $value); } - + /** * Check if has a value * @@ -971,7 +971,7 @@ public function addResponseParameters(\grpc\testing\ResponseParameters $value){ public function hasPayload(){ return $this->_has(3); } - + /** * Clear value * @@ -980,7 +980,7 @@ public function hasPayload(){ public function clearPayload(){ return $this->_clear(3); } - + /** * Get value * @@ -989,7 +989,7 @@ public function clearPayload(){ public function getPayload(){ return $this->_get(3); } - + /** * Set value * @@ -1008,7 +1008,7 @@ class StreamingOutputCallResponse extends \DrSlump\Protobuf\Message { /** @var \grpc\testing\Payload */ public $payload = null; - + /** @var \Closure[] */ protected static $__extensions = array(); @@ -1041,7 +1041,7 @@ public static function descriptor() public function hasPayload(){ return $this->_has(1); } - + /** * Clear value * @@ -1050,7 +1050,7 @@ public function hasPayload(){ public function clearPayload(){ return $this->_clear(1); } - + /** * Get value * @@ -1059,7 +1059,7 @@ public function clearPayload(){ 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 fd502a1c817e2..9a13309a18212 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 @@ def _perform_lonely_client_test_with_ticket_kind( 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 c2806c235cf39..8d9a312133381 100644 --- a/src/python/src/grpc/early_adopter/interfaces.py +++ b/src/python/src/grpc/early_adopter/interfaces.py @@ -181,7 +181,7 @@ def service_stream_stream(self, request_iterator): 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 2cf6a036aa4ce..e34ad5e967279 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 98fc3a3907050..f66a108c19b7b 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 e3814da406e70..65a8140465252 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 32b8c63195ff7..b55780e5cdef6 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 ffe7ecae56aa5..68ec6149f5966 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 01369c540f9cd..58ec680ecd00d 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 b0b07269cf6dd..e54c016d2f3c3 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 3e4b38b839f5c..9c27f6869ecb9 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 478ff4c58dc27..880f3e26a48c9 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -40,13 +40,13 @@ _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 1a175dee9dd5e..d4dbd75426cf2 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 dd076ccf7472d..efb06c8521bc1 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 7b691b064ef74..a0835a12ed448 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 0ffce7cd0c789..664150bca0159 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 cebae549dc4b5..247c28450e8ce 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 4bef368ebaf67..8a9ece33170d3 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 388803aa3b888..30eb0377c295d 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 1d56856c0b5bf..fe00e0c53dae1 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 29a1fa12d036b..c3e88c565d276 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 bec0ce4553f77..2d52a6e33b458 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 d7a58838b43b7..9303a67a1e669 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 699b5f3fa13a9..ccf1b9d6f5491 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 7ce4b253427db..f21f854b09a3b 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 d0d007e6d1139625e05ebd5859289c08a8668033 Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Wed, 18 Feb 2015 10:28:09 -0800 Subject: [PATCH 154/173] 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 7f1069ea5ee66..8345a6f5affc5 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 853f91f46714a..3a7b693f9a9f1 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 7cc2c309f3615a365a0ce0f19d8dac1a42b34c4c Mon Sep 17 00:00:00 2001 From: vjpai Date: Wed, 18 Feb 2015 12:33:37 -0800 Subject: [PATCH 155/173] 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 d2f08ec677e27..f1e7aa7bf432d 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 485042b5b3e34..97a00e0a1a1d7 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 3e0f77c01429c..d107801e083b9 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 156/173] 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 485042b5b3e34..e45b128dbeda2 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 07af69126b87e..4bca52e302705 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 157/173] 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 485042b5b3e34..e45b128dbeda2 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 07af69126b87e..4bca52e302705 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 158/173] 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 caea1608ecf5f..44e704e4969d2 100644 --- a/src/csharp/GrpcApi/MathGrpc.cs +++ b/src/csharp/GrpcApi/MathGrpc.cs @@ -81,7 +81,7 @@ public interface IMathServiceClient 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 @@ public MathServiceClientStub(Channel channel) 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 6534a44ef4fa5..64d5c0956330b 100644 --- a/src/csharp/GrpcApi/TestServiceGrpc.cs +++ b/src/csharp/GrpcApi/TestServiceGrpc.cs @@ -99,7 +99,7 @@ public interface ITestServiceClient 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 @@ public TestServiceClientStub(Channel channel) 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 d89d9a16f9b1f..e5ddd879d6834 100644 --- a/src/csharp/GrpcCore/Calls.cs +++ b/src/csharp/GrpcCore/Calls.cs @@ -47,50 +47,42 @@ public static class Calls { 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 @@ public static TResponse BlockingClientStreamingCall(Call 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 34b9f6dfb82ff..a574f181c8a7c 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 d5f3239e1e09b..ae7428978ea27 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 @@ 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 @@ internal class AsyncCall: ICallEventListener, IDisposable 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 @@ public void StartReadingToStream(IObserver readObserver) { 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 @@ public void InitializeServer(CallSafeHandle call) 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 @@ public TaskCompletionSource StartWrite(TWrite msg, bool buffered) // 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 @@ public void WritesDone() 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 @@ public void WriteStatus(Status status) 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 @@ public TaskCompletionSource StartRead() 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 @@ public void CancelWithStatus(Status status) // 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 @@ protected virtual void Dispose(bool disposing) { call.Dispose(); } - } + } disposed = true; } } @@ -489,38 +391,195 @@ private void DisposeResourcesIfNeeded() } } - 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 0000000000000..ddfd94a3b5654 --- /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 e9ccd8d5f993d..55d66a62ca74d 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 @@ 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 @@ internal class CallSafeHandle : SafeHandleZeroIsInvalid 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 @@ private static UInt32 GetFlags(bool buffered) { 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 60837de5e6561..4d10a9bdf965c 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 @@ 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 @@ public void OnError(Exception error) 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 666f220b8c8a9..5ea436df1977a 100644 --- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs @@ -45,12 +45,6 @@ internal class CompletionQueueSafeHandle : SafeHandleZeroIsInvalid [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 @@ public static CompletionQueueSafeHandle Create() 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 6116e0975afdf..0000000000000 --- 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 f8154fa2505dd..634a0b2d721a0 100644 --- a/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs +++ b/src/csharp/GrpcCore/Internal/GrpcThreadPool.cs @@ -48,7 +48,6 @@ internal class GrpcThreadPool readonly object myLock = new object(); readonly List threads = new List(); readonly int poolSize; - readonly Action eventHandler; CompletionQueueSafeHandle cq; @@ -56,11 +55,6 @@ public GrpcThreadPool(int poolSize) { this.poolSize = poolSize; } - internal GrpcThreadPool(int poolSize, Action eventHandler) { - this.poolSize = poolSize; - this.eventHandler = eventHandler; - } - public void Start() { lock (myLock) @@ -104,34 +98,19 @@ internal CompletionQueueSafeHandle CompletionQueue } } - 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 @@ private void ThreadBodyNoHandler() } 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 74a8ef7b6ea1a..59f08d4ca8974 100644 --- a/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs +++ b/src/csharp/GrpcCore/Internal/SafeHandleZeroIsInvalid.cs @@ -56,6 +56,12 @@ public override bool IsInvalid 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 c91de97ce3b7b..c096602800884 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -38,13 +38,16 @@ 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 @@ internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid [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 @@ public void Shutdown() 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 1d29864b9f42b..e9cb65cb3b0bd 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 @@ public ServerWritingObserver(AsyncCall call) 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 0882a61299506..91842d81821ce 100644 --- a/src/csharp/GrpcCore/Server.cs +++ b/src/csharp/GrpcCore/Server.cs @@ -49,8 +49,8 @@ public class Server { // 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 @@ public class Server 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 @@ internal void RunRpc() { 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 @@ private async Task StartHandlingRpcs() { 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 bcce4a091fb5e..3bc3b15396452 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -59,15 +59,16 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 44011565204df..dd3fc7038e774 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -36,6 +36,7 @@ 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 @@ public class ClientServerTest Marshallers.StringMarshaller); [Test] - public void EmptyCall() + public void UnaryCall() { GrpcEnvironment.Initialize(); @@ -69,6 +70,7 @@ public void EmptyCall() 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 @@ public void EmptyCall() 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 c7949af44ec95..eff862537b0bb 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 159/173] 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 eff862537b0bb..2961a708be80d 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 160/173] 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 a574f181c8a7c..ee76b742ce4af 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 161/173] 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 bd298b0932feb..9056142097b76 100644 --- a/src/csharp/GrpcApiTests/MathClientServerTests.cs +++ b/src/csharp/GrpcApiTests/MathClientServerTests.cs @@ -64,6 +64,15 @@ public void Init() client = MathGrpc.NewStub(channel); } + [TestFixtureTearDown] + public void Cleanup() + { + channel.Dispose(); + + server.ShutdownAsync().Wait(); + GrpcEnvironment.Shutdown(); + } + [Test] public void Div1() { @@ -136,15 +145,6 @@ public void DivMany() 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 c4f030267d219..55a6cac8f6978 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 ae7428978ea27..ce0ba30d53d60 100644 --- a/src/csharp/GrpcCore/Internal/AsyncCall.cs +++ b/src/csharp/GrpcCore/Internal/AsyncCall.cs @@ -42,15 +42,13 @@ 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 @@ internal class AsyncCall : IDisposable 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 @@ public AsyncCall(Func serializer, Func deserializ 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 @@ public Task ClientStreamingCallAsync() lock (myLock) { started = true; + readingDone = true; unaryResponseTcs = new TaskCompletionSource(); call.StartClientStreaming(unaryResponseHandler); @@ -191,15 +176,43 @@ public void StartDuplexStreamingCall(IObserver readObserver) } } - 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 @@ public Task SendCloseFromClientAsync() { 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 @@ public Task SendStatusFromServerAsync(Status status) { 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 @@ public Task ReceiveMessageAsync() { 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 @@ public Task ReceiveMessageAsync() } } - 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 @@ public void CancelWithStatus(Status status) { 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 @@ private void CheckStarted() } } - 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 @@ private void CompleteStreamObserver(Status status) { } } - 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 @@ private void HandleUnaryResponseCompletion(GRPCOpError error, IntPtr batchContex } 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 @@ private void HandleUnaryResponseCompletion(GRPCOpError error, IntPtr batchContex // 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 @@ private void HandleWriteFinished(GRPCOpError error, IntPtr batchContextPtr) { 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 @@ private void HandleHalfclosed(GRPCOpError error, IntPtr batchContextPtr) { { 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 @@ private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) { readTcs = null; if (payload == null) { - doneWithReading = true; + readingDone = true; } observer = readObserver; status = finishedStatus; @@ -515,7 +522,8 @@ private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) { // 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 @@ private void HandleReadFinished(GRPCOpError error, IntPtr batchContextPtr) { } 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 3bc3b15396452..73dfa52def83f 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -60,7 +60,7 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf asyncCall.InitializeServer(call); - var finishedTask = asyncCall.StartServerSide(); + var finishedTask = asyncCall.ServerSideUnaryRequestCallAsync(); var request = asyncCall.ReceiveMessageAsync().Result; @@ -91,14 +91,9 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 dd3fc7038e774..37d770e0c0497 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -52,11 +52,21 @@ public class ClientServerTest 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 @@ public void UnaryCall() [Test] public void UnaryCallPerformance() { - GrpcEnvironment.Initialize(); - Server server = new Server(); server.AddServiceDefinition( ServerServiceDefinition.CreateBuilder("someService") @@ -107,16 +115,11 @@ public void UnaryCallPerformance() } 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 @@ public void UnknownMethodHandler() } 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 162/173] 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 2961a708be80d..1dd6c692e5f1a 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 163/173] 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 73dfa52def83f..48d1eaa335941 100644 --- a/src/csharp/GrpcCore/ServerCallHandler.cs +++ b/src/csharp/GrpcCore/ServerCallHandler.cs @@ -109,12 +109,28 @@ public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSaf 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 37d770e0c0497..d0e357e29a60e 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -85,8 +85,6 @@ public void UnaryCall() } 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 164/173] 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 d0e357e29a60e..e76189974d32a 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -140,7 +140,8 @@ public void UnknownMethodHandler() 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 165/173] 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 c096602800884..047bde1addfa3 100644 --- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs +++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs @@ -52,13 +52,8 @@ internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid [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 @@ public static ServerSafeHandle NewServer(CompletionQueueSafeHandle cq, IntPtr ar 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 1dd6c692e5f1a..304ee9cf34ca0 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 1a305b1d9dc19910ad81df88f494cf282747bc54 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 18 Feb 2015 13:37:06 -0800 Subject: [PATCH 166/173] 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 72a4b0cd122b8..64478b3753277 100755 --- a/tools/run_tests/run_tests.py +++ b/tools/run_tests/run_tests.py @@ -62,15 +62,18 @@ def job_spec(self, binary, hash_targets): # 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 @@ def build_steps(self): '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 167/173] 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 c7949af44ec95..a8d4b0e2e3519 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 168/173] 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 89a6ba63b274e..40caa93868052 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 551ae27e613c3..6999d581028c3 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 07867c6b247fc..d003582a2ff87 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 ec77624a9f56c1158e1e425c0cbdba591ad2d86a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 18 Feb 2015 14:06:56 -0800 Subject: [PATCH 169/173] 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 e76189974d32a..ba43e4f6a07a9 100644 --- a/src/csharp/GrpcCoreTests/ClientServerTest.cs +++ b/src/csharp/GrpcCoreTests/ClientServerTest.cs @@ -61,7 +61,7 @@ public void Init() [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 170/173] 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 9fb2819506292..a1c3938a33ce7 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 171/173] 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 b2e0fd215a977..60e82d9dfae19 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 e308c60410fde..e38734c6a4921 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 6999d581028c3..5b2d0a5e5b773 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 3dc23e7de239e..1c15716fadf8a 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 430cae6847c61..7a56e34690135 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 0345f99bdee22..59a4564220b1c 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 22776f8ca131a..ba8100b7d2fc0 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 302869d70e278..f911db6de1f33 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 edab37b68796b..86c6bb1f56aac 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 f3da9f0d49cd1..d1e5f0829a87b 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 3013533f9b961..5c7801079fe83 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 d003582a2ff87..f345cebdb6afd 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 6a0848fa97835..6d13bf1f8c993 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 172/173] 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 58bbc7a783e34..3794d943f66ec 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 07af69126b87e..a980e94687a50 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 0000000000000..2c437960cbe03 --- /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 8345a6f5affc5..29aef7ae5da4a 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 22a8a04c8235b..f94538560e046 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 20ba3fb790543..740189fcd02d5 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 60dc02d7af9cd..6229170c2a881 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 03a0326128592..1bc1db5fb0af5 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 7e827cb0e5795..2848ffce1f218 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 173/173] 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 2c437960cbe03..105250ce9d7cd 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