diff options
304 files changed, 1645 insertions, 1303 deletions
@@ -1047,7 +1047,6 @@ cc_library( ".", ], deps = [ - "//external:protobuf_compiler", ], ) @@ -1143,13 +1143,13 @@ static: static_c static_cxx static_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a static_zookeeper_libs -static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a +static_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib.a $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a shared: shared_c shared_cxx shared_c: pc_c pc_c_unsecure cache.mk pc_c_zookeeper $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)gpr$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_zookeeper_libs -shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) +shared_cxx: pc_cxx pc_cxx_unsecure cache.mk $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) shared_csharp: shared_c $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc_csharp_ext$(SHARED_VERSION).$(SHARED_EXT) ifeq ($(HAS_ZOOKEEPER),true) @@ -1768,6 +1768,8 @@ strip-static_cxx: static_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping libgrpc++.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++.a + $(E) "[STRIP] Stripping libgrpc++_codegen_lib.a" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib.a $(E) "[STRIP] Stripping libgrpc++_unsecure.a" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a endif @@ -1790,6 +1792,8 @@ strip-shared_cxx: shared_cxx ifeq ($(CONFIG),opt) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) + $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT)" + $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(E) "[STRIP] Stripping $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(STRIP) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) endif @@ -2101,6 +2105,9 @@ install-static_cxx: static_cxx strip-static_cxx install-pkg-config_cxx $(E) "[INSTALL] Installing libgrpc++.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++.a $(prefix)/lib/libgrpc++.a + $(E) "[INSTALL] Installing libgrpc++_codegen_lib.a" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib.a $(prefix)/lib/libgrpc++_codegen_lib.a $(E) "[INSTALL] Installing libgrpc++_unsecure.a" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_unsecure.a $(prefix)/lib/libgrpc++_unsecure.a @@ -2163,6 +2170,15 @@ else ifneq ($(SYSTEM),Darwin) $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++.so.0 $(Q) ln -sf $(SHARED_PREFIX)grpc++$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++.so endif + $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT)" + $(Q) $(INSTALL) -d $(prefix)/lib + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/$(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) +ifeq ($(SYSTEM),MINGW32) + $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib-imp.a $(prefix)/lib/libgrpc++_codegen_lib-imp.a +else ifneq ($(SYSTEM),Darwin) + $(Q) ln -sf $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_codegen_lib.so.0 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/libgrpc++_codegen_lib.so +endif $(E) "[INSTALL] Installing $(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT)" $(Q) $(INSTALL) -d $(prefix)/lib $(Q) $(INSTALL) $(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) $(prefix)/lib/$(SHARED_PREFIX)grpc++_unsecure$(SHARED_VERSION).$(SHARED_EXT) @@ -3331,6 +3347,7 @@ ifeq ($(NO_PROTOBUF),true) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib.a: protobuf_dep_error +$(LIBDIR)/$(CONFIG)/$(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT): protobuf_dep_error else @@ -3345,6 +3362,23 @@ endif +ifeq ($(SYSTEM),MINGW32) +$(LIBDIR)/$(CONFIG)/grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_CODEGEN_LIB_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared grpc++_codegen_lib.def -Wl,--output-def=$(LIBDIR)/$(CONFIG)/grpc++_codegen_lib$(SHARED_VERSION).def -Wl,--out-implib=$(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION)-dll.a -o $(LIBDIR)/$(CONFIG)/grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_CODEGEN_LIB_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) +else +$(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT): $(LIBGRPC++_CODEGEN_LIB_OBJS) $(ZLIB_DEP) $(PROTOBUF_DEP) + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` +ifeq ($(SYSTEM),Darwin) + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -install_name $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) -dynamiclib -o $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_CODEGEN_LIB_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) +else + $(Q) $(LDXX) $(LDFLAGS) -L$(LIBDIR)/$(CONFIG) -shared -Wl,-soname,libgrpc++_codegen_lib.so.0 -o $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBGRPC++_CODEGEN_LIB_OBJS) $(LDLIBS) $(ZLIB_MERGE_LIBS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) + $(Q) ln -sf $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION).so.0 + $(Q) ln -sf $(SHARED_PREFIX)grpc++_codegen_lib$(SHARED_VERSION).$(SHARED_EXT) $(LIBDIR)/$(CONFIG)/libgrpc++_codegen_lib$(SHARED_VERSION).so +endif +endif endif diff --git a/build.yaml b/build.yaml index beb5219ce0..cfd904d281 100644 --- a/build.yaml +++ b/build.yaml @@ -763,7 +763,7 @@ libs: secure: check vs_project_guid: '{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}' - name: grpc++_codegen_lib - build: protoc + build: all language: c++ headers: [] src: [] diff --git a/examples/node/README.md b/examples/node/README.md index c1ef6b05ab..28878833ce 100644 --- a/examples/node/README.md +++ b/examples/node/README.md @@ -10,6 +10,11 @@ INSTALL ------- ```sh + $ # Get the gRPC repository + $ export REPO_ROOT=grpc # REPO root can be any directory of your choice + $ git clone https://github.com/grpc/grpc.git $REPO_ROOT + $ cd $REPO_ROOT + $ cd examples/node $ npm install ``` diff --git a/include/grpc++/generic/async_generic_service.h b/include/grpc++/generic/async_generic_service.h index 9ae8391dc4..b87b17ee0d 100644 --- a/include/grpc++/generic/async_generic_service.h +++ b/include/grpc++/generic/async_generic_service.h @@ -34,8 +34,8 @@ #ifndef GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H #define GRPCXX_GENERIC_ASYNC_GENERIC_SERVICE_H -#include <grpc++/support/byte_buffer.h> #include <grpc++/support/async_stream.h> +#include <grpc++/support/byte_buffer.h> struct grpc_server; diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h index 8f9afe8251..cac345e0dc 100644 --- a/include/grpc++/impl/codegen/async_stream.h +++ b/include/grpc++/impl/codegen/async_stream.h @@ -215,7 +215,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> { CallOpSet<CallOpSendMessage> write_ops_; CallOpSet<CallOpClientSendClose> writes_done_ops_; CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage, - CallOpClientRecvStatus> finish_ops_; + CallOpClientRecvStatus> + finish_ops_; }; /// Client-side interface for asynchronous bi-directional streaming. @@ -350,7 +351,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, CallOpSet<CallOpSendInitialMetadata> meta_ops_; CallOpSet<CallOpRecvMessage<R>> read_ops_; CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpServerSendStatus> finish_ops_; + CallOpServerSendStatus> + finish_ops_; }; template <class W> diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h index 9c6dbd5484..1526debf54 100644 --- a/include/grpc++/impl/codegen/async_unary_call.h +++ b/include/grpc++/impl/codegen/async_unary_call.h @@ -101,10 +101,12 @@ class ClientAsyncResponseReader GRPC_FINAL class CallOpSetCollection : public CallOpSetCollectionInterface { public: SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpClientSendClose> init_buf_; + CallOpClientSendClose> + init_buf_; CallOpSet<CallOpRecvInitialMetadata> meta_buf_; CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>, - CallOpClientRecvStatus> finish_buf_; + CallOpClientRecvStatus> + finish_buf_; }; std::shared_ptr<CallOpSetCollection> collection_; }; @@ -159,7 +161,8 @@ class ServerAsyncResponseWriter GRPC_FINAL ServerContext* ctx_; CallOpSet<CallOpSendInitialMetadata> meta_buf_; CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpServerSendStatus> finish_buf_; + CallOpServerSendStatus> + finish_buf_; }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h index 03affc2125..50f5a75191 100644 --- a/include/grpc++/impl/codegen/call.h +++ b/include/grpc++/impl/codegen/call.h @@ -280,7 +280,8 @@ class CallOpRecvMessage { if (*status) { got_message = true; *status = SerializationTraits<R>::Deserialize(recv_buf_, message_, - max_message_size).ok(); + max_message_size) + .ok(); } else { got_message = false; g_core_codegen_interface->grpc_byte_buffer_destroy(recv_buf_); diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index a2b7d928c3..6c35a95765 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -56,7 +56,8 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, Call call(channel->CreateCall(method, context, &cq)); CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, CallOpRecvInitialMetadata, CallOpRecvMessage<OutputMessage>, - CallOpClientSendClose, CallOpClientRecvStatus> ops; + CallOpClientSendClose, CallOpClientRecvStatus> + ops; Status status = ops.SendMessage(request); if (!status.ok()) { return status; diff --git a/include/grpc++/impl/codegen/impl/async_stream.h b/include/grpc++/impl/codegen/impl/async_stream.h index 413eab7570..95c844723a 100644 --- a/include/grpc++/impl/codegen/impl/async_stream.h +++ b/include/grpc++/impl/codegen/impl/async_stream.h @@ -215,7 +215,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> { CallOpSet<CallOpSendMessage> write_ops_; CallOpSet<CallOpClientSendClose> writes_done_ops_; CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage, - CallOpClientRecvStatus> finish_ops_; + CallOpClientRecvStatus> + finish_ops_; }; /// Client-side interface for asynchronous bi-directional streaming. @@ -350,7 +351,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, CallOpSet<CallOpSendInitialMetadata> meta_ops_; CallOpSet<CallOpRecvMessage<R>> read_ops_; CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpServerSendStatus> finish_ops_; + CallOpServerSendStatus> + finish_ops_; }; template <class W> diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h index 3ecca0a406..0ab2ae466a 100644 --- a/include/grpc++/impl/codegen/method_handler_impl.h +++ b/include/grpc++/impl/codegen/method_handler_impl.h @@ -61,7 +61,8 @@ class RpcMethodHandler : public MethodHandler { GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_); CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpServerSendStatus> ops; + CallOpServerSendStatus> + ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.ok()) { status = ops.SendMessage(rsp); @@ -74,7 +75,8 @@ class RpcMethodHandler : public MethodHandler { private: // Application provided rpc handler function. std::function<Status(ServiceType*, ServerContext*, const RequestType*, - ResponseType*)> func_; + ResponseType*)> + func_; // The class the above handler function lives in. ServiceType* service_; }; @@ -96,7 +98,8 @@ class ClientStreamingHandler : public MethodHandler { GPR_CODEGEN_ASSERT(!param.server_context->sent_initial_metadata_); CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpServerSendStatus> ops; + CallOpServerSendStatus> + ops; ops.SendInitialMetadata(param.server_context->initial_metadata_); if (status.ok()) { status = ops.SendMessage(rsp); @@ -108,7 +111,8 @@ class ClientStreamingHandler : public MethodHandler { private: std::function<Status(ServiceType*, ServerContext*, ServerReader<RequestType>*, - ResponseType*)> func_; + ResponseType*)> + func_; ServiceType* service_; }; @@ -143,7 +147,8 @@ class ServerStreamingHandler : public MethodHandler { private: std::function<Status(ServiceType*, ServerContext*, const RequestType*, - ServerWriter<ResponseType>*)> func_; + ServerWriter<ResponseType>*)> + func_; ServiceType* service_; }; @@ -174,7 +179,8 @@ class BidiStreamingHandler : public MethodHandler { private: std::function<Status(ServiceType*, ServerContext*, - ServerReaderWriter<ResponseType, RequestType>*)> func_; + ServerReaderWriter<ResponseType, RequestType>*)> + func_; ServiceType* service_; }; diff --git a/include/grpc++/impl/codegen/rpc_service_method.h b/include/grpc++/impl/codegen/rpc_service_method.h index 6256301677..8b1f026c91 100644 --- a/include/grpc++/impl/codegen/rpc_service_method.h +++ b/include/grpc++/impl/codegen/rpc_service_method.h @@ -40,10 +40,10 @@ #include <memory> #include <vector> -#include <grpc/impl/codegen/byte_buffer.h> #include <grpc++/impl/codegen/config.h> #include <grpc++/impl/codegen/rpc_method.h> #include <grpc++/impl/codegen/status.h> +#include <grpc/impl/codegen/byte_buffer.h> namespace grpc { class ServerContext; diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h index 91ebe574b1..f8326bc44b 100644 --- a/include/grpc++/impl/codegen/server_context.h +++ b/include/grpc++/impl/codegen/server_context.h @@ -37,12 +37,12 @@ #include <map> #include <memory> -#include <grpc/impl/codegen/compression_types.h> -#include <grpc/impl/codegen/time.h> -#include <grpc++/impl/codegen/security/auth_context.h> #include <grpc++/impl/codegen/config.h> +#include <grpc++/impl/codegen/security/auth_context.h> #include <grpc++/impl/codegen/string_ref.h> #include <grpc++/impl/codegen/time.h> +#include <grpc/impl/codegen/compression_types.h> +#include <grpc/impl/codegen/time.h> struct gpr_timespec; struct grpc_metadata; diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 7d4ed277ed..908d124df1 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -192,10 +192,11 @@ class ServerInterface : public CallHook { bool FinalizeResult(void** tag, bool* status) GRPC_OVERRIDE { bool serialization_status = *status && payload_ && - SerializationTraits<Message>::Deserialize( - payload_, request_, server_->max_message_size()).ok(); + SerializationTraits<Message>::Deserialize(payload_, request_, + server_->max_message_size()) + .ok(); bool ret = RegisteredAsyncRequest::FinalizeResult(tag, status); - *status = serialization_status&&* status; + *status = serialization_status && *status; return ret; } diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h index 5f878469ce..0eabc5fc0f 100644 --- a/include/grpc++/impl/codegen/sync_stream.h +++ b/include/grpc++/impl/codegen/sync_stream.h @@ -123,7 +123,8 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> { ClientContext* context, const W& request) : context_(context), call_(channel->CreateCall(method, context, &cq_)) { CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage, - CallOpClientSendClose> ops; + CallOpClientSendClose> + ops; ops.SendInitialMetadata(context->send_initial_metadata_); // TODO(ctiller): don't assert GPR_CODEGEN_ASSERT(ops.SendMessage(request).ok()); @@ -235,7 +236,8 @@ class ClientWriter : public ClientWriterInterface<W> { private: ClientContext* context_; CallOpSet<CallOpRecvInitialMetadata, CallOpGenericRecvMessage, - CallOpClientRecvStatus> finish_ops_; + CallOpClientRecvStatus> + finish_ops_; CompletionQueue cq_; Call call_; }; diff --git a/include/grpc++/support/byte_buffer.h b/include/grpc++/support/byte_buffer.h index 27307f8fcd..3825518de1 100644 --- a/include/grpc++/support/byte_buffer.h +++ b/include/grpc++/support/byte_buffer.h @@ -34,13 +34,13 @@ #ifndef GRPCXX_SUPPORT_BYTE_BUFFER_H #define GRPCXX_SUPPORT_BYTE_BUFFER_H -#include <grpc/grpc.h> -#include <grpc/byte_buffer.h> -#include <grpc/support/log.h> #include <grpc++/impl/serialization_traits.h> #include <grpc++/support/config.h> #include <grpc++/support/slice.h> #include <grpc++/support/status.h> +#include <grpc/byte_buffer.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include <vector> diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h index a9ede35f90..8c2f7c71eb 100644 --- a/include/grpc++/support/channel_arguments.h +++ b/include/grpc++/support/channel_arguments.h @@ -34,12 +34,12 @@ #ifndef GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H #define GRPCXX_SUPPORT_CHANNEL_ARGUMENTS_H -#include <vector> #include <list> +#include <vector> +#include <grpc++/support/config.h> #include <grpc/compression.h> #include <grpc/grpc.h> -#include <grpc++/support/config.h> namespace grpc { namespace testing { diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h index 724691a033..6251a8bcde 100644 --- a/include/grpc++/support/slice.h +++ b/include/grpc++/support/slice.h @@ -34,8 +34,8 @@ #ifndef GRPCXX_SUPPORT_SLICE_H #define GRPCXX_SUPPORT_SLICE_H -#include <grpc/support/slice.h> #include <grpc++/support/config.h> +#include <grpc/support/slice.h> namespace grpc { diff --git a/include/grpc/byte_buffer_reader.h b/include/grpc/byte_buffer_reader.h index b0e63a6da2..600bd3810a 100644 --- a/include/grpc/byte_buffer_reader.h +++ b/include/grpc/byte_buffer_reader.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,8 +34,8 @@ #ifndef GRPC_BYTE_BUFFER_READER_H #define GRPC_BYTE_BUFFER_READER_H -#include <grpc/grpc.h> #include <grpc/byte_buffer.h> +#include <grpc/grpc.h> #ifdef __cplusplus extern "C" { diff --git a/include/grpc/compression.h b/include/grpc/compression.h index 70ba393261..39023ded34 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -36,8 +36,8 @@ #include <stdlib.h> -#include <grpc/impl/codegen/port_platform.h> #include <grpc/impl/codegen/compression_types.h> +#include <grpc/impl/codegen/port_platform.h> #ifdef __cplusplus extern "C" { @@ -59,9 +59,8 @@ GRPCAPI int grpc_compression_algorithm_name( * compression algorithms encoded in the \a accepted_encodings bitset. * * It abort()s for unknown levels . */ -GRPCAPI grpc_compression_algorithm -grpc_compression_algorithm_for_level(grpc_compression_level level, - uint32_t accepted_encodings); +GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level( + grpc_compression_level level, uint32_t accepted_encodings); GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts); diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 5113645daf..fe0cf28b3b 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -36,13 +36,13 @@ #include <grpc/status.h> -#include <stddef.h> #include <grpc/byte_buffer.h> -#include <grpc/support/slice.h> -#include <grpc/support/time.h> #include <grpc/impl/codegen/connectivity_state.h> -#include <grpc/impl/codegen/propagation_bits.h> #include <grpc/impl/codegen/grpc_types.h> +#include <grpc/impl/codegen/propagation_bits.h> +#include <grpc/support/slice.h> +#include <grpc/support/time.h> +#include <stddef.h> #ifdef __cplusplus extern "C" { @@ -154,9 +154,8 @@ GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm); GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm); /** Check the connectivity state of a channel. */ -GRPCAPI grpc_connectivity_state -grpc_channel_check_connectivity_state(grpc_channel *channel, - int try_to_connect); +GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( + grpc_channel *channel, int try_to_connect); /** Watch for a change in connectivity state. Once the channel connectivity state is different from last_observed_state, @@ -267,9 +266,10 @@ GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); and description passed in. Importantly, this function does not send status nor description to the remote endpoint. */ -GRPCAPI grpc_call_error -grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, - const char *description, void *reserved); +GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, + grpc_status_code status, + const char *description, + void *reserved); /** Destroy a call. THREAD SAFETY: grpc_call_destroy is thread-compatible */ @@ -283,13 +283,11 @@ GRPCAPI void grpc_call_destroy(grpc_call *call); to \a cq_bound_to_call. Note that \a cq_for_notification must have been registered to the server via \a grpc_server_register_completion_queue. */ -GRPCAPI 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_for_notification, - void *tag_new); +GRPCAPI 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_for_notification, void *tag_new); /** Registers a method in the server. Methods to this (host, method) pair will not be reported by diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 368d5dda51..f2d04e551a 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -80,9 +80,8 @@ grpc_auth_context_peer_identity(const grpc_auth_context *ctx); /* Finds a property in the context. May return an empty iterator (first _next will return NULL) if no property with this name was found in the context. */ -GRPCAPI grpc_auth_property_iterator -grpc_auth_context_find_properties_by_name(const grpc_auth_context *ctx, - const char *name); +GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name( + const grpc_auth_context *ctx, const char *name); /* Gets the name of the property that indicates the peer identity. Will return NULL if the peer is not authenticated. */ @@ -363,8 +362,8 @@ GRPCAPI int grpc_server_add_secure_http2_port(grpc_server *server, /* Sets a credentials to a call. Can only be called on the client side before grpc_call_start_batch. */ -GRPCAPI grpc_call_error -grpc_call_set_credentials(grpc_call *call, grpc_call_credentials *creds); +GRPCAPI grpc_call_error grpc_call_set_credentials(grpc_call *call, + grpc_call_credentials *creds); /* --- Auth Metadata Processing --- */ diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index d6e18e9ca5..afd8c5d4cf 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -34,8 +34,8 @@ #ifndef GRPC_IMPL_CODEGEN_LOG_H #define GRPC_IMPL_CODEGEN_LOG_H -#include <stdlib.h> /* for abort() */ #include <stdarg.h> +#include <stdlib.h> /* for abort() */ #include <grpc/impl/codegen/port_platform.h> diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index a62fdd087b..03c59e72a0 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -122,8 +122,8 @@ GPRAPI gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *)); /* Equivalent to gpr_slice_new, but with a two argument destroy function that also takes the slice length. */ -GPRAPI gpr_slice -gpr_slice_new_with_len(void *p, size_t len, void (*destroy)(void *, size_t)); +GPRAPI gpr_slice gpr_slice_new_with_len(void *p, size_t len, + void (*destroy)(void *, size_t)); /* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc() call. diff --git a/include/grpc/impl/codegen/slice_buffer.h b/include/grpc/impl/codegen/slice_buffer.h index 4fe909ee82..7191878496 100644 --- a/include/grpc/impl/codegen/slice_buffer.h +++ b/include/grpc/impl/codegen/slice_buffer.h @@ -73,8 +73,8 @@ GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice); slice at the returned index in sb->slices) The implementation MAY decide to concatenate data at the end of a small slice added in this fashion. */ -GPRAPI size_t -gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, gpr_slice slice); +GPRAPI size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, + gpr_slice slice); GPRAPI void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices, size_t n); /* add a very small (less than 8 bytes) amount of data to the end of a slice diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h index c22bedfe77..b4f45097c7 100644 --- a/include/grpc/impl/codegen/time.h +++ b/include/grpc/impl/codegen/time.h @@ -88,8 +88,8 @@ GPRAPI void gpr_time_init(void); GPRAPI gpr_timespec gpr_now(gpr_clock_type clock); /* Convert a timespec from one clock to another */ -GPRAPI gpr_timespec -gpr_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock); +GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t, + gpr_clock_type target_clock); /* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b respectively. */ diff --git a/src/core/census/grpc_filter.c b/src/core/census/grpc_filter.c index c8aaf31e2d..11120a28d1 100644 --- a/src/core/census/grpc_filter.c +++ b/src/core/census/grpc_filter.c @@ -172,13 +172,27 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_client_census_filter = { - client_start_transport_op, grpc_channel_next_op, sizeof(call_data), - client_init_call_elem, grpc_call_stack_ignore_set_pollset, - client_destroy_call_elem, sizeof(channel_data), init_channel_elem, - destroy_channel_elem, grpc_call_next_get_peer, "census-client"}; + client_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + client_init_call_elem, + grpc_call_stack_ignore_set_pollset, + client_destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "census-client"}; const grpc_channel_filter grpc_server_census_filter = { - server_start_transport_op, grpc_channel_next_op, sizeof(call_data), - server_init_call_elem, grpc_call_stack_ignore_set_pollset, - server_destroy_call_elem, sizeof(channel_data), init_channel_elem, - destroy_channel_elem, grpc_call_next_get_peer, "census-server"}; + server_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + server_init_call_elem, + grpc_call_stack_ignore_set_pollset, + server_destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "census-server"}; diff --git a/src/core/census/grpc_plugin.c b/src/core/census/grpc_plugin.c index 8d60a5197e..3ca9400f7e 100644 --- a/src/core/census/grpc_plugin.c +++ b/src/core/census/grpc_plugin.c @@ -38,8 +38,8 @@ #include <grpc/census.h> #include "src/core/census/grpc_filter.h" -#include "src/core/surface/channel_init.h" #include "src/core/channel/channel_stack_builder.h" +#include "src/core/surface/channel_init.h" static bool maybe_add_census_filter(grpc_channel_stack_builder *builder, void *arg_must_be_null) { diff --git a/src/core/channel/channel_args.c b/src/core/channel/channel_args.c index bae7a90a01..e0382fa0d9 100644 --- a/src/core/channel/channel_args.c +++ b/src/core/channel/channel_args.c @@ -31,8 +31,8 @@ * */ -#include <grpc/grpc.h> #include "src/core/channel/channel_args.h" +#include <grpc/grpc.h> #include "src/core/support/string.h" #include <grpc/census.h> diff --git a/src/core/channel/client_channel.c b/src/core/channel/client_channel.c index f021a8ae32..ad1ded9ab7 100644 --- a/src/core/channel/client_channel.c +++ b/src/core/channel/client_channel.c @@ -431,9 +431,17 @@ static void cc_set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, } const grpc_channel_filter grpc_client_channel_filter = { - cc_start_transport_stream_op, cc_start_transport_op, sizeof(call_data), - init_call_elem, cc_set_pollset, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, cc_get_peer, "client-channel", + cc_start_transport_stream_op, + cc_start_transport_op, + sizeof(call_data), + init_call_elem, + cc_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + cc_get_peer, + "client-channel", }; void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx, diff --git a/src/core/channel/compress_filter.c b/src/core/channel/compress_filter.c index 3e7ca08fd2..6f5a9740ad 100644 --- a/src/core/channel/compress_filter.c +++ b/src/core/channel/compress_filter.c @@ -291,7 +291,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_compress_filter = { - compress_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "compress"}; + compress_start_transport_stream_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "compress"}; diff --git a/src/core/channel/connected_channel.c b/src/core/channel/connected_channel.c index e7ed3ccfeb..df11d54297 100644 --- a/src/core/channel/connected_channel.c +++ b/src/core/channel/connected_channel.c @@ -37,13 +37,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" -#include "src/core/transport/transport.h" -#include "src/core/profiling/timers.h" #include <grpc/byte_buffer.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> +#include "src/core/profiling/timers.h" +#include "src/core/support/string.h" +#include "src/core/transport/transport.h" #define MAX_BUFFER_LENGTH 8192 @@ -132,9 +132,17 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { } static const grpc_channel_filter connected_channel_filter = { - con_start_transport_stream_op, con_start_transport_op, sizeof(call_data), - init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, con_get_peer, "connected", + con_start_transport_stream_op, + con_start_transport_op, + sizeof(call_data), + init_call_elem, + set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + con_get_peer, + "connected", }; static void bind_transport(grpc_channel_stack *channel_stack, diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 1aa27208c2..582427daf9 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -242,7 +242,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "http-client"}; + hc_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "http-client"}; diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 370f8dbe42..1a2e0c5db3 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -227,7 +227,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_http_server_filter = { - hs_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "http-server"}; + hs_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "http-server"}; diff --git a/src/core/client_config/lb_policies/pick_first.c b/src/core/client_config/lb_policies/pick_first.c index 8ed1223d39..2833f112f4 100644 --- a/src/core/client_config/lb_policies/pick_first.c +++ b/src/core/client_config/lb_policies/pick_first.c @@ -378,8 +378,14 @@ void pf_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, } static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = { - pf_destroy, pf_shutdown, pf_pick, pf_cancel_pick, pf_ping_one, pf_exit_idle, - pf_check_connectivity, pf_notify_on_state_change}; + pf_destroy, + pf_shutdown, + pf_pick, + pf_cancel_pick, + pf_ping_one, + pf_exit_idle, + pf_check_connectivity, + pf_notify_on_state_change}; static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {} diff --git a/src/core/client_config/lb_policies/round_robin.c b/src/core/client_config/lb_policies/round_robin.c index 98d9acc75b..114ece6e4d 100644 --- a/src/core/client_config/lb_policies/round_robin.c +++ b/src/core/client_config/lb_policies/round_robin.c @@ -483,8 +483,14 @@ static void rr_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, } static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = { - rr_destroy, rr_shutdown, rr_pick, rr_cancel_pick, rr_ping_one, rr_exit_idle, - rr_check_connectivity, rr_notify_on_state_change}; + rr_destroy, + rr_shutdown, + rr_pick, + rr_cancel_pick, + rr_ping_one, + rr_exit_idle, + rr_check_connectivity, + rr_notify_on_state_change}; static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {} diff --git a/src/core/client_config/resolvers/zookeeper_resolver.c b/src/core/client_config/resolvers/zookeeper_resolver.c index 166738e768..e0e18792a2 100644 --- a/src/core/client_config/resolvers/zookeeper_resolver.c +++ b/src/core/client_config/resolvers/zookeeper_resolver.c @@ -44,9 +44,9 @@ #include "src/core/client_config/lb_policy_registry.h" #include "src/core/client_config/resolver_registry.h" #include "src/core/iomgr/resolve_address.h" +#include "src/core/json/json.h" #include "src/core/support/string.h" #include "src/core/surface/api_trace.h" -#include "src/core/json/json.h" /** Zookeeper session expiration time in milliseconds */ #define GRPC_ZOOKEEPER_SESSION_TIMEOUT 15000 diff --git a/src/core/client_config/subchannel.c b/src/core/client_config/subchannel.c index 8f150a8d81..c5cd504929 100644 --- a/src/core/client_config/subchannel.c +++ b/src/core/client_config/subchannel.c @@ -185,8 +185,8 @@ static void connection_destroy(grpc_exec_ctx *exec_ctx, void *arg, gpr_free(c); } -void grpc_connected_subchannel_ref(grpc_connected_subchannel *c - GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +void grpc_connected_subchannel_ref( + grpc_connected_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_CHANNEL_STACK_REF(CHANNEL_STACK_FROM_CONNECTION(c), REF_REASON); } @@ -227,8 +227,8 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta, return old_val; } -grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *c - GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +grpc_subchannel *grpc_subchannel_ref( + grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { gpr_atm old_refs; old_refs = ref_mutate(c, (1 << INTERNAL_REF_BITS), 0 REF_MUTATE_PURPOSE("STRONG_REF")); @@ -236,8 +236,8 @@ grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *c return c; } -grpc_subchannel *grpc_subchannel_weak_ref(grpc_subchannel *c - GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +grpc_subchannel *grpc_subchannel_weak_ref( + grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { gpr_atm old_refs; old_refs = ref_mutate(c, 1, 0 REF_MUTATE_PURPOSE("WEAK_REF")); GPR_ASSERT(old_refs != 0); @@ -626,8 +626,8 @@ static void subchannel_call_destroy(grpc_exec_ctx *exec_ctx, void *call, GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0); } -void grpc_subchannel_call_ref(grpc_subchannel_call *c - GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { +void grpc_subchannel_call_ref( + grpc_subchannel_call *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) { GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON); } diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h index ef9f2f1d1e..83e1c58a4c 100644 --- a/src/core/client_config/subchannel.h +++ b/src/core/client_config/subchannel.h @@ -83,25 +83,25 @@ typedef struct grpc_subchannel_args grpc_subchannel_args; #define GRPC_SUBCHANNEL_REF_EXTRA_ARGS #endif -grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *channel - GRPC_SUBCHANNEL_REF_EXTRA_ARGS); +grpc_subchannel *grpc_subchannel_ref( + grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); grpc_subchannel *grpc_subchannel_ref_from_weak_ref( grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); void grpc_subchannel_unref(grpc_exec_ctx *exec_ctx, grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); -grpc_subchannel *grpc_subchannel_weak_ref(grpc_subchannel *channel - GRPC_SUBCHANNEL_REF_EXTRA_ARGS); +grpc_subchannel *grpc_subchannel_weak_ref( + grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx, grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); -void grpc_connected_subchannel_ref(grpc_connected_subchannel *channel - GRPC_SUBCHANNEL_REF_EXTRA_ARGS); +void grpc_connected_subchannel_ref( + grpc_connected_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); void grpc_connected_subchannel_unref(grpc_exec_ctx *exec_ctx, grpc_connected_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS); -void grpc_subchannel_call_ref(grpc_subchannel_call *call - GRPC_SUBCHANNEL_REF_EXTRA_ARGS); +void grpc_subchannel_call_ref( + grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS); void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx, grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS); diff --git a/src/core/http/format_request.c b/src/core/http/format_request.c index 60179297bf..ac9bb8aeb8 100644 --- a/src/core/http/format_request.c +++ b/src/core/http/format_request.c @@ -37,11 +37,11 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/slice.h> #include <grpc/support/string_util.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" static void fill_common_header(const grpc_httpcli_request *request, gpr_strvec *buf) { diff --git a/src/core/http/format_request.h b/src/core/http/format_request.h index 49593b695c..dfd6fadbde 100644 --- a/src/core/http/format_request.h +++ b/src/core/http/format_request.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_HTTP_FORMAT_REQUEST_H #define GRPC_CORE_HTTP_FORMAT_REQUEST_H -#include "src/core/http/httpcli.h" #include <grpc/support/slice.h> +#include "src/core/http/httpcli.h" gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request); gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request, diff --git a/src/core/http/httpcli_security_connector.c b/src/core/http/httpcli_security_connector.c index ce82701089..a1a32f7558 100644 --- a/src/core/http/httpcli_security_connector.c +++ b/src/core/http/httpcli_security_connector.c @@ -35,11 +35,11 @@ #include <string.h> -#include "src/core/security/handshake.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/security/handshake.h" +#include "src/core/support/string.h" #include "src/core/tsi/ssl_transport_security.h" typedef struct { diff --git a/src/core/iomgr/endpoint.h b/src/core/iomgr/endpoint.h index 788f3ac5bc..b4be852e33 100644 --- a/src/core/iomgr/endpoint.h +++ b/src/core/iomgr/endpoint.h @@ -34,11 +34,11 @@ #ifndef GRPC_CORE_IOMGR_ENDPOINT_H #define GRPC_CORE_IOMGR_ENDPOINT_H -#include "src/core/iomgr/pollset.h" -#include "src/core/iomgr/pollset_set.h" #include <grpc/support/slice.h> #include <grpc/support/slice_buffer.h> #include <grpc/support/time.h> +#include "src/core/iomgr/pollset.h" +#include "src/core/iomgr/pollset_set.h" /* An endpoint caps a streaming channel between two communicating processes. Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */ diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/iomgr/endpoint_pair_posix.c index f84b8441df..66d19a486c 100644 --- a/src/core/iomgr/endpoint_pair_posix.c +++ b/src/core/iomgr/endpoint_pair_posix.c @@ -42,14 +42,14 @@ #include <errno.h> #include <fcntl.h> #include <string.h> -#include <sys/types.h> #include <sys/socket.h> +#include <sys/types.h> -#include "src/core/iomgr/tcp_posix.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/iomgr/tcp_posix.h" +#include "src/core/support/string.h" static void create_sockets(int sv[2]) { int flags; diff --git a/src/core/iomgr/endpoint_pair_windows.c b/src/core/iomgr/endpoint_pair_windows.c index db9d092dca..2024f58143 100644 --- a/src/core/iomgr/endpoint_pair_windows.c +++ b/src/core/iomgr/endpoint_pair_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,16 +34,16 @@ #include <grpc/support/port_platform.h> #ifdef GPR_WINSOCK_SOCKET -#include "src/core/iomgr/sockaddr_utils.h" #include "src/core/iomgr/endpoint_pair.h" +#include "src/core/iomgr/sockaddr_utils.h" #include <errno.h> #include <fcntl.h> #include <string.h> -#include "src/core/iomgr/tcp_windows.h" -#include "src/core/iomgr/socket_windows.h" #include <grpc/support/log.h> +#include "src/core/iomgr/socket_windows.h" +#include "src/core/iomgr/tcp_windows.h" static void create_sockets(SOCKET sv[2]) { SOCKET svr_sock = INVALID_SOCKET; diff --git a/src/core/iomgr/fd_posix.h b/src/core/iomgr/fd_posix.h index a5c8ff1d9a..1993ada79f 100644 --- a/src/core/iomgr/fd_posix.h +++ b/src/core/iomgr/fd_posix.h @@ -34,11 +34,11 @@ #ifndef GRPC_CORE_IOMGR_FD_POSIX_H #define GRPC_CORE_IOMGR_FD_POSIX_H -#include "src/core/iomgr/iomgr_internal.h" -#include "src/core/iomgr/pollset.h" #include <grpc/support/atm.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> +#include "src/core/iomgr/iomgr_internal.h" +#include "src/core/iomgr/pollset.h" typedef struct grpc_fd grpc_fd; diff --git a/src/core/iomgr/iocp_windows.c b/src/core/iomgr/iocp_windows.c index fa87e5246b..37e277dcc1 100644 --- a/src/core/iomgr/iocp_windows.c +++ b/src/core/iomgr/iocp_windows.c @@ -37,15 +37,15 @@ #include <winsock2.h> +#include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/log_win32.h> -#include <grpc/support/alloc.h> #include <grpc/support/thd.h> -#include "src/core/iomgr/timer.h" #include "src/core/iomgr/iocp_windows.h" #include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/socket_windows.h" +#include "src/core/iomgr/timer.h" static ULONG g_iocp_kick_token; static OVERLAPPED g_iocp_custom_overlap; diff --git a/src/core/iomgr/iomgr_internal.h b/src/core/iomgr/iomgr_internal.h index d06b068b1c..1cad3182ec 100644 --- a/src/core/iomgr/iomgr_internal.h +++ b/src/core/iomgr/iomgr_internal.h @@ -36,8 +36,8 @@ #include <stdbool.h> -#include "src/core/iomgr/iomgr.h" #include <grpc/support/sync.h> +#include "src/core/iomgr/iomgr.h" typedef struct grpc_iomgr_object { char *name; diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/iomgr/iomgr_posix.c index fecb7b9760..2f7f34746b 100644 --- a/src/core/iomgr/iomgr_posix.c +++ b/src/core/iomgr/iomgr_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,9 @@ #ifdef GPR_POSIX_SOCKET -#include "src/core/iomgr/iomgr_posix.h" #include "src/core/debug/trace.h" #include "src/core/iomgr/fd_posix.h" +#include "src/core/iomgr/iomgr_posix.h" #include "src/core/iomgr/tcp_posix.h" void grpc_iomgr_platform_init(void) { diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/iomgr/iomgr_windows.c index 14775516bb..2d104130f7 100644 --- a/src/core/iomgr/iomgr_windows.c +++ b/src/core/iomgr/iomgr_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,9 +39,9 @@ #include <grpc/support/log.h> -#include "src/core/iomgr/socket_windows.h" #include "src/core/iomgr/iocp_windows.h" #include "src/core/iomgr/iomgr.h" +#include "src/core/iomgr/socket_windows.h" /* Windows' io manager is going to be fully designed using IO completion ports. All of what we're doing here is basically make sure that diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index c7f30f435f..1a99224c80 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -38,8 +38,8 @@ #include <grpc/support/log.h> #include <grpc/support/thd.h> -#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/iocp_windows.h" +#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset_windows.h" diff --git a/src/core/iomgr/sockaddr_posix.h b/src/core/iomgr/sockaddr_posix.h index e4425ed735..a398096837 100644 --- a/src/core/iomgr/sockaddr_posix.h +++ b/src/core/iomgr/sockaddr_posix.h @@ -35,10 +35,10 @@ #define GRPC_CORE_IOMGR_SOCKADDR_POSIX_H #include <arpa/inet.h> +#include <netdb.h> +#include <netinet/in.h> #include <sys/socket.h> #include <sys/types.h> -#include <netinet/in.h> -#include <netdb.h> #include <unistd.h> #endif /* GRPC_CORE_IOMGR_SOCKADDR_POSIX_H */ diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/iomgr/sockaddr_win32.h index 7acb8f7f57..ef306e3cc3 100644 --- a/src/core/iomgr/sockaddr_win32.h +++ b/src/core/iomgr/sockaddr_win32.h @@ -36,6 +36,8 @@ #include <winsock2.h> #include <ws2tcpip.h> + +// must be included after the above #include <mswsock.h> #endif /* GRPC_CORE_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 a9af594700..570daccc9e 100644 --- a/src/core/iomgr/socket_utils_common_posix.c +++ b/src/core/iomgr/socket_utils_common_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,23 +38,23 @@ #include "src/core/iomgr/socket_utils_posix.h" #include <arpa/inet.h> -#include <limits.h> +#include <errno.h> #include <fcntl.h> +#include <limits.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <stdio.h> -#include <sys/types.h> +#include <string.h> #include <sys/socket.h> +#include <sys/types.h> #include <unistd.h> -#include <string.h> -#include <errno.h> -#include "src/core/iomgr/sockaddr_utils.h" -#include "src/core/support/string.h" #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/sync.h> +#include "src/core/iomgr/sockaddr_utils.h" +#include "src/core/support/string.h" /* set a socket to non blocking mode */ int grpc_set_socket_nonblocking(int fd, int non_blocking) { diff --git a/src/core/iomgr/socket_utils_linux.c b/src/core/iomgr/socket_utils_linux.c index a87625262b..e16885f231 100644 --- a/src/core/iomgr/socket_utils_linux.c +++ b/src/core/iomgr/socket_utils_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,8 +37,8 @@ #include "src/core/iomgr/socket_utils_posix.h" -#include <sys/types.h> #include <sys/socket.h> +#include <sys/types.h> int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int nonblock, int cloexec) { diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h index b01e28b6f2..3908550380 100644 --- a/src/core/iomgr/socket_utils_posix.h +++ b/src/core/iomgr/socket_utils_posix.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H #define GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H -#include <unistd.h> #include <sys/socket.h> +#include <unistd.h> /* a wrapper for accept or accept4 */ int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index fafb7b6622..c1f419e273 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,8 @@ #ifdef GPR_WINSOCK_SOCKET #include <winsock2.h> + +// must be included after winsock2.h #include <mswsock.h> #include <grpc/support/alloc.h> diff --git a/src/core/iomgr/socket_windows.h b/src/core/iomgr/socket_windows.h index 8e50e7a953..6fe3c6e080 100644 --- a/src/core/iomgr/socket_windows.h +++ b/src/core/iomgr/socket_windows.h @@ -37,11 +37,11 @@ #include <grpc/support/port_platform.h> #include <winsock2.h> -#include <grpc/support/sync.h> #include <grpc/support/atm.h> +#include <grpc/support/sync.h> -#include "src/core/iomgr/iomgr_internal.h" #include "src/core/iomgr/exec_ctx.h" +#include "src/core/iomgr/iomgr_internal.h" /* This holds the data for an outstanding read or write on a socket. The mutex to protect the concurrent access to that data is the one diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h index 2e29833b70..c36f8de713 100644 --- a/src/core/iomgr/tcp_client.h +++ b/src/core/iomgr/tcp_client.h @@ -34,10 +34,10 @@ #ifndef GRPC_CORE_IOMGR_TCP_CLIENT_H #define GRPC_CORE_IOMGR_TCP_CLIENT_H +#include <grpc/support/time.h> #include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/pollset_set.h" #include "src/core/iomgr/sockaddr.h" -#include <grpc/support/time.h> /* Asynchronously connect to an address (specified as (addr, len)), and call cb with arg and the completed connection when done (or call cb with arg and diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/iomgr/tcp_client_windows.c index 689c6f7b10..da83f7b79c 100644 --- a/src/core/iomgr/tcp_client_windows.c +++ b/src/core/iomgr/tcp_client_windows.c @@ -43,13 +43,13 @@ #include <grpc/support/slice_buffer.h> #include <grpc/support/useful.h> -#include "src/core/iomgr/timer.h" #include "src/core/iomgr/iocp_windows.h" -#include "src/core/iomgr/tcp_client.h" -#include "src/core/iomgr/tcp_windows.h" #include "src/core/iomgr/sockaddr.h" #include "src/core/iomgr/sockaddr_utils.h" #include "src/core/iomgr/socket_windows.h" +#include "src/core/iomgr/tcp_client.h" +#include "src/core/iomgr/tcp_windows.h" +#include "src/core/iomgr/timer.h" typedef struct { grpc_closure *on_done; diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index f74eb3fe51..e8f73811ce 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -297,7 +297,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) { unwind_slice_idx = tcp->outgoing_slice_idx; unwind_byte_idx = tcp->outgoing_byte_idx; for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count && - iov_size != MAX_WRITE_IOVEC; + iov_size != MAX_WRITE_IOVEC; iov_size++) { iov[iov_size].iov_base = GPR_SLICE_START_PTR( @@ -446,7 +446,7 @@ static char *tcp_get_peer(grpc_endpoint *ep) { } static const grpc_endpoint_vtable vtable = { - tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set, + tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set, tcp_shutdown, tcp_destroy, tcp_get_peer}; grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size, diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 11508044dc..74ee68a6f1 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -54,6 +54,11 @@ #include <sys/types.h> #include <unistd.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/string_util.h> +#include <grpc/support/sync.h> +#include <grpc/support/time.h> #include "src/core/iomgr/pollset_posix.h" #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/sockaddr_utils.h" @@ -61,11 +66,6 @@ #include "src/core/iomgr/tcp_posix.h" #include "src/core/iomgr/unix_sockets_posix.h" #include "src/core/support/string.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/string_util.h> -#include <grpc/support/sync.h> -#include <grpc/support/time.h> #define MIN_SAFE_ACCEPT_QUEUE_SIZE 100 diff --git a/src/core/iomgr/tcp_windows.c b/src/core/iomgr/tcp_windows.c index 038e4158c8..9b1db5fa7e 100644 --- a/src/core/iomgr/tcp_windows.c +++ b/src/core/iomgr/tcp_windows.c @@ -44,12 +44,12 @@ #include <grpc/support/string_util.h> #include <grpc/support/useful.h> -#include "src/core/iomgr/timer.h" #include "src/core/iomgr/iocp_windows.h" #include "src/core/iomgr/sockaddr.h" #include "src/core/iomgr/sockaddr_utils.h" #include "src/core/iomgr/socket_windows.h" #include "src/core/iomgr/tcp_client.h" +#include "src/core/iomgr/timer.h" static int set_non_block(SOCKET sock) { int status; @@ -146,8 +146,8 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, bool success) { grpc_winsocket_callback_info *info = &socket->read_info; if (success) { - if (socket->read_info.wsa_error != 0 && !tcp->shutting_down) { - if (socket->read_info.wsa_error != WSAECONNRESET) { + if (info->wsa_error != 0 && !tcp->shutting_down) { + if (info->wsa_error != WSAECONNRESET) { char *utf8_message = gpr_format_message(info->wsa_error); gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message); gpr_free(utf8_message); @@ -306,7 +306,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep, ok = true; GPR_ASSERT(bytes_sent == tcp->write_slices->length); } else { - if (socket->read_info.wsa_error != WSAECONNRESET) { + if (info->wsa_error != WSAECONNRESET) { char *utf8_message = gpr_format_message(info->wsa_error); gpr_log(GPR_ERROR, "WSASend error: %s", utf8_message); gpr_free(utf8_message); @@ -382,9 +382,9 @@ static char *win_get_peer(grpc_endpoint *ep) { return gpr_strdup(tcp->peer_string); } -static grpc_endpoint_vtable vtable = {win_read, win_write, win_add_to_pollset, - win_add_to_pollset_set, win_shutdown, - win_destroy, win_get_peer}; +static grpc_endpoint_vtable vtable = { + win_read, win_write, win_add_to_pollset, win_add_to_pollset_set, + win_shutdown, win_destroy, win_get_peer}; grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) { grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp)); diff --git a/src/core/iomgr/timer.h b/src/core/iomgr/timer.h index 63505df427..1e2d1cbfbd 100644 --- a/src/core/iomgr/timer.h +++ b/src/core/iomgr/timer.h @@ -34,10 +34,10 @@ #ifndef GRPC_CORE_IOMGR_TIMER_H #define GRPC_CORE_IOMGR_TIMER_H -#include "src/core/iomgr/iomgr.h" -#include "src/core/iomgr/exec_ctx.h" #include <grpc/support/port_platform.h> #include <grpc/support/time.h> +#include "src/core/iomgr/exec_ctx.h" +#include "src/core/iomgr/iomgr.h" typedef struct grpc_timer { gpr_timespec deadline; diff --git a/src/core/iomgr/udp_server.c b/src/core/iomgr/udp_server.c index e7853af58a..174159170f 100644 --- a/src/core/iomgr/udp_server.c +++ b/src/core/iomgr/udp_server.c @@ -54,6 +54,12 @@ #include <sys/types.h> #include <unistd.h> +#include <grpc/grpc.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/string_util.h> +#include <grpc/support/sync.h> +#include <grpc/support/time.h> #include "src/core/iomgr/fd_posix.h" #include "src/core/iomgr/pollset_posix.h" #include "src/core/iomgr/resolve_address.h" @@ -61,12 +67,6 @@ #include "src/core/iomgr/socket_utils_posix.h" #include "src/core/iomgr/unix_sockets_posix.h" #include "src/core/support/string.h" -#include <grpc/grpc.h> -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/string_util.h> -#include <grpc/support/time.h> #define INIT_PORT_CAP 2 diff --git a/src/core/iomgr/unix_sockets_posix.c b/src/core/iomgr/unix_sockets_posix.c index 480ff613f6..174a7e7abf 100644 --- a/src/core/iomgr/unix_sockets_posix.c +++ b/src/core/iomgr/unix_sockets_posix.c @@ -36,8 +36,8 @@ #ifdef GPR_HAVE_UNIX_SOCKET #include <string.h> -#include <sys/types.h> #include <sys/stat.h> +#include <sys/types.h> #include <sys/un.h> #include <grpc/support/alloc.h> diff --git a/src/core/iomgr/wakeup_fd_nospecial.c b/src/core/iomgr/wakeup_fd_nospecial.c index 78d763c103..7b2be9ed52 100644 --- a/src/core/iomgr/wakeup_fd_nospecial.c +++ b/src/core/iomgr/wakeup_fd_nospecial.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,8 +40,8 @@ #ifdef GPR_POSIX_NO_SPECIAL_WAKEUP_FD -#include "src/core/iomgr/wakeup_fd_posix.h" #include <stddef.h> +#include "src/core/iomgr/wakeup_fd_posix.h" static int check_availability_invalid(void) { return 0; } diff --git a/src/core/iomgr/wakeup_fd_posix.c b/src/core/iomgr/wakeup_fd_posix.c index f40be081b0..07778c408e 100644 --- a/src/core/iomgr/wakeup_fd_posix.c +++ b/src/core/iomgr/wakeup_fd_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,9 @@ #ifdef GPR_POSIX_WAKEUP_FD -#include "src/core/iomgr/wakeup_fd_posix.h" -#include "src/core/iomgr/wakeup_fd_pipe.h" #include <stddef.h> +#include "src/core/iomgr/wakeup_fd_pipe.h" +#include "src/core/iomgr/wakeup_fd_posix.h" static const grpc_wakeup_fd_vtable *wakeup_fd_vtable = NULL; int grpc_allow_specialized_wakeup_fd = 1; diff --git a/src/core/iomgr/workqueue.h b/src/core/iomgr/workqueue.h index 2ba1e5d9a2..2b923ba152 100644 --- a/src/core/iomgr/workqueue.h +++ b/src/core/iomgr/workqueue.h @@ -34,10 +34,10 @@ #ifndef GRPC_CORE_IOMGR_WORKQUEUE_H #define GRPC_CORE_IOMGR_WORKQUEUE_H -#include "src/core/iomgr/iomgr.h" -#include "src/core/iomgr/pollset.h" #include "src/core/iomgr/closure.h" #include "src/core/iomgr/exec_ctx.h" +#include "src/core/iomgr/iomgr.h" +#include "src/core/iomgr/pollset.h" #ifdef GPR_POSIX_SOCKET #include "src/core/iomgr/workqueue_posix.h" diff --git a/src/core/json/json_string.c b/src/core/json/json_string.c index 2bc0b513d5..d4ebce18e1 100644 --- a/src/core/json/json_string.c +++ b/src/core/json/json_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <string.h> #include <stdlib.h> +#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> diff --git a/src/core/profiling/basic_timers.c b/src/core/profiling/basic_timers.c index df32472d1c..3067f52c21 100644 --- a/src/core/profiling/basic_timers.c +++ b/src/core/profiling/basic_timers.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,9 +39,9 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/time.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> +#include <grpc/support/time.h> #include <stdio.h> typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type; diff --git a/src/core/security/client_auth_filter.c b/src/core/security/client_auth_filter.c index 332d4259d2..e2c23ef98d 100644 --- a/src/core/security/client_auth_filter.c +++ b/src/core/security/client_auth_filter.c @@ -331,6 +331,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, const grpc_channel_filter grpc_client_auth_filter = { auth_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer, - "client-auth"}; + init_call_elem, set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "client-auth"}; diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 0ba6d5dd84..c8348bc12c 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -38,8 +38,8 @@ #include "src/core/channel/channel_args.h" #include "src/core/channel/http_client_filter.h" -#include "src/core/http/parser.h" #include "src/core/http/httpcli.h" +#include "src/core/http/parser.h" #include "src/core/iomgr/executor.h" #include "src/core/json/json.h" #include "src/core/support/string.h" diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h index afac7a5bf2..bfa7cc71bd 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -34,10 +34,10 @@ #ifndef GRPC_CORE_SECURITY_CREDENTIALS_H #define GRPC_CORE_SECURITY_CREDENTIALS_H -#include "src/core/transport/metadata_batch.h" #include <grpc/grpc.h> #include <grpc/grpc_security.h> #include <grpc/support/sync.h> +#include "src/core/transport/metadata_batch.h" #include "src/core/http/httpcli.h" #include "src/core/http/parser.h" diff --git a/src/core/security/handshake.c b/src/core/security/handshake.c index b5bb6667a7..9fb10a0ecb 100644 --- a/src/core/security/handshake.c +++ b/src/core/security/handshake.c @@ -36,11 +36,11 @@ #include <stdbool.h> #include <string.h> -#include "src/core/security/security_context.h" -#include "src/core/security/secure_endpoint.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> +#include "src/core/security/secure_endpoint.h" +#include "src/core/security/security_context.h" #define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256 diff --git a/src/core/security/secure_endpoint.c b/src/core/security/secure_endpoint.c index d11c43be20..58b081dc4a 100644 --- a/src/core/security/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -32,14 +32,14 @@ */ #include "src/core/security/secure_endpoint.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/slice_buffer.h> #include <grpc/support/slice.h> +#include <grpc/support/slice_buffer.h> #include <grpc/support/sync.h> -#include "src/core/tsi/transport_security_interface.h" #include "src/core/debug/trace.h" +#include "src/core/support/string.h" +#include "src/core/tsi/transport_security_interface.h" #define STAGING_BUFFER_SIZE 8192 @@ -354,8 +354,9 @@ static char *endpoint_get_peer(grpc_endpoint *secure_ep) { } static const grpc_endpoint_vtable vtable = { - endpoint_read, endpoint_write, endpoint_add_to_pollset, - endpoint_add_to_pollset_set, endpoint_shutdown, endpoint_destroy, + endpoint_read, endpoint_write, + endpoint_add_to_pollset, endpoint_add_to_pollset_set, + endpoint_shutdown, endpoint_destroy, endpoint_get_peer}; grpc_endpoint *grpc_secure_endpoint_create( diff --git a/src/core/security/secure_endpoint.h b/src/core/security/secure_endpoint.h index 5176ef2059..7368f8424b 100644 --- a/src/core/security/secure_endpoint.h +++ b/src/core/security/secure_endpoint.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_SECURITY_SECURE_ENDPOINT_H #define GRPC_CORE_SECURITY_SECURE_ENDPOINT_H -#include "src/core/iomgr/endpoint.h" #include <grpc/support/slice.h> +#include "src/core/iomgr/endpoint.h" struct tsi_frame_protector; diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index a71b3bc915..f6afc0f633 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -34,9 +34,9 @@ #include <string.h> #include "src/core/security/security_context.h" +#include "src/core/support/string.h" #include "src/core/surface/api_trace.h" #include "src/core/surface/call.h" -#include "src/core/support/string.h" #include <grpc/grpc_security.h> #include <grpc/support/alloc.h> diff --git a/src/core/security/server_auth_filter.c b/src/core/security/server_auth_filter.c index 3d8e5e8d35..f3c411d6d4 100644 --- a/src/core/security/server_auth_filter.c +++ b/src/core/security/server_auth_filter.c @@ -259,6 +259,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, const grpc_channel_filter grpc_server_auth_filter = { auth_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data), - init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer, - "server-auth"}; + init_call_elem, set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "server-auth"}; diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index 009ec95682..da29ca934b 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -35,6 +35,10 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/useful.h> #include "src/core/channel/channel_args.h" #include "src/core/channel/http_server_filter.h" #include "src/core/iomgr/endpoint.h" @@ -47,10 +51,6 @@ #include "src/core/surface/api_trace.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/useful.h> typedef struct grpc_server_secure_state { grpc_server *server; diff --git a/src/core/statistics/census_log.c b/src/core/statistics/census_log.c index 257ba586a3..3802d1cc7a 100644 --- a/src/core/statistics/census_log.c +++ b/src/core/statistics/census_log.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,7 +90,6 @@ argument. E.g. cl_block_initialize() will initialize a cl_block. */ #include "src/core/statistics/census_log.h" -#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/cpu.h> @@ -98,6 +97,7 @@ #include <grpc/support/port_platform.h> #include <grpc/support/sync.h> #include <grpc/support/useful.h> +#include <string.h> /* End of platform specific code */ diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/statistics/census_rpc_stats.c index 524a60793a..c78d6fd612 100644 --- a/src/core/statistics/census_rpc_stats.c +++ b/src/core/statistics/census_rpc_stats.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,16 +33,16 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> #include "src/core/statistics/census_interface.h" #include "src/core/statistics/census_rpc_stats.h" -#include "src/core/statistics/hash_table.h" #include "src/core/statistics/census_tracing.h" +#include "src/core/statistics/hash_table.h" #include "src/core/statistics/window_stats.h" #include "src/core/support/murmur_hash.h" #include "src/core/support/string.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> #define NUM_INTERVALS 3 #define MINUTE_INTERVAL 0 @@ -85,8 +85,8 @@ static void delete_key(void *key) { gpr_free(key); } static const census_ht_option ht_opt = { CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */, - simple_hash /* hash function */, cmp_str_keys /* key comparator */, - delete_stats /* data deleter */, delete_key /* key deleter */ + simple_hash /* hash function */, cmp_str_keys /* key comparator */, + delete_stats /* data deleter */, delete_key /* key deleter */ }; static void init_rpc_stats(void *stats) { diff --git a/src/core/statistics/census_rpc_stats.h b/src/core/statistics/census_rpc_stats.h index 4cf17d2e52..f7f220e45f 100644 --- a/src/core/statistics/census_rpc_stats.h +++ b/src/core/statistics/census_rpc_stats.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_STATISTICS_CENSUS_RPC_STATS_H #define GRPC_CORE_STATISTICS_CENSUS_RPC_STATS_H -#include "src/core/statistics/census_interface.h" #include <grpc/support/port_platform.h> +#include "src/core/statistics/census_interface.h" #ifdef __cplusplus extern "C" { diff --git a/src/core/statistics/census_tracing.c b/src/core/statistics/census_tracing.c index dc0f8a26f5..ad82498eba 100644 --- a/src/core/statistics/census_tracing.c +++ b/src/core/statistics/census_tracing.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,18 +31,18 @@ * */ -#include "src/core/statistics/census_interface.h" #include "src/core/statistics/census_tracing.h" +#include "src/core/statistics/census_interface.h" #include <stdio.h> #include <string.h> -#include "src/core/statistics/hash_table.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/sync.h> +#include "src/core/statistics/hash_table.h" +#include "src/core/support/string.h" void census_trace_obj_destroy(census_trace_obj *obj) { census_trace_annotation *p = obj->annotations; @@ -60,8 +60,11 @@ static void delete_trace_obj(void *obj) { } static const census_ht_option ht_opt = { - CENSUS_HT_UINT64 /* key type */, 571 /* n_of_buckets */, NULL /* hash */, - NULL /* compare_keys */, delete_trace_obj /* delete data */, + CENSUS_HT_UINT64 /* key type */, + 571 /* n_of_buckets */, + NULL /* hash */, + NULL /* compare_keys */, + delete_trace_obj /* delete data */, NULL /* delete key */ }; diff --git a/src/core/statistics/hash_table.c b/src/core/statistics/hash_table.c index 0cadcd4740..3ef79c0d7d 100644 --- a/src/core/statistics/hash_table.c +++ b/src/core/statistics/hash_table.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,11 +33,11 @@ #include "src/core/statistics/hash_table.h" -#include <stdio.h> #include <stddef.h> +#include <stdio.h> -#include <grpc/support/log.h> #include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include <grpc/support/port_platform.h> #define CENSUS_HT_NUM_BUCKETS 1999 diff --git a/src/core/statistics/window_stats.c b/src/core/statistics/window_stats.c index 3f2940853a..eb296865a0 100644 --- a/src/core/statistics/window_stats.c +++ b/src/core/statistics/window_stats.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,13 +32,13 @@ */ #include "src/core/statistics/window_stats.h" -#include <math.h> -#include <stddef.h> -#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include <math.h> +#include <stddef.h> +#include <string.h> /* typedefs make typing long names easier. Use cws (for census_window_stats) */ typedef census_window_stats_stat_info cws_stat_info; diff --git a/src/core/support/alloc.c b/src/core/support/alloc.c index b99584bd20..fd9fb8f5e7 100644 --- a/src/core/support/alloc.c +++ b/src/core/support/alloc.c @@ -33,9 +33,9 @@ #include <grpc/support/alloc.h> -#include <stdlib.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> +#include <stdlib.h> #include "src/core/profiling/timers.h" static gpr_allocation_functions g_alloc_functions = {malloc, realloc, free}; diff --git a/src/core/support/cmdline.c b/src/core/support/cmdline.c index b517f30b2d..eff46a1655 100644 --- a/src/core/support/cmdline.c +++ b/src/core/support/cmdline.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,10 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" typedef enum { ARGTYPE_INT, ARGTYPE_BOOL, ARGTYPE_STRING } argtype; diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c index 7af6a8f009..5597df2d03 100644 --- a/src/core/support/cpu_linux.c +++ b/src/core/support/cpu_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,10 +39,10 @@ #ifdef GPR_CPU_LINUX -#include <sched.h> #include <errno.h> -#include <unistd.h> +#include <sched.h> #include <string.h> +#include <unistd.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> diff --git a/src/core/support/cpu_posix.c b/src/core/support/cpu_posix.c index 8f01c284ca..e508ddd8ca 100644 --- a/src/core/support/cpu_posix.c +++ b/src/core/support/cpu_posix.c @@ -36,8 +36,8 @@ #ifdef GPR_CPU_POSIX #include <errno.h> -#include <unistd.h> #include <string.h> +#include <unistd.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> diff --git a/src/core/support/env_posix.c b/src/core/support/env_posix.c index 1dd2af56bc..256212be76 100644 --- a/src/core/support/env_posix.c +++ b/src/core/support/env_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,8 +41,8 @@ #include <grpc/support/log.h> -#include "src/core/support/string.h" #include <grpc/support/string_util.h> +#include "src/core/support/string.h" char *gpr_getenv(const char *name) { char *result = getenv(name); diff --git a/src/core/support/histogram.c b/src/core/support/histogram.c index 20ed2b14b1..62227be1a6 100644 --- a/src/core/support/histogram.c +++ b/src/core/support/histogram.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,8 +38,8 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/port_platform.h> #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> #include <grpc/support/useful.h> /* Histograms are stored with exponentially increasing bucket sizes. diff --git a/src/core/support/host_port.c b/src/core/support/host_port.c index 23f65b1581..31243a7221 100644 --- a/src/core/support/host_port.c +++ b/src/core/support/host_port.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,10 +35,10 @@ #include <string.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" int gpr_join_host_port(char **out, const char *host, int port) { if (host[0] != '[' && strchr(host, ':') != NULL) { diff --git a/src/core/support/log_android.c b/src/core/support/log_android.c index 5d0c7d820d..640c9d7099 100644 --- a/src/core/support/log_android.c +++ b/src/core/support/log_android.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,12 +35,12 @@ #ifdef GPR_ANDROID +#include <android/log.h> #include <grpc/support/log.h> #include <grpc/support/time.h> -#include <stdio.h> #include <stdarg.h> +#include <stdio.h> #include <string.h> -#include <android/log.h> static android_LogPriority severity_to_log_priority(gpr_log_severity severity) { switch (severity) { diff --git a/src/core/support/log_linux.c b/src/core/support/log_linux.c index d66b7a3cc0..e60512c526 100644 --- a/src/core/support/log_linux.c +++ b/src/core/support/log_linux.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,12 +47,12 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> -#include <stdio.h> +#include <linux/unistd.h> #include <stdarg.h> +#include <stdio.h> #include <string.h> -#include <time.h> -#include <linux/unistd.h> #include <sys/syscall.h> +#include <time.h> #include <unistd.h> static long gettid(void) { return syscall(__NR_gettid); } diff --git a/src/core/support/log_posix.c b/src/core/support/log_posix.c index 3ff171f99c..7429dd0a2c 100644 --- a/src/core/support/log_posix.c +++ b/src/core/support/log_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,12 +38,12 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> -#include <stdio.h> +#include <pthread.h> #include <stdarg.h> -#include <string.h> #include <stdio.h> +#include <stdio.h> +#include <string.h> #include <time.h> -#include <pthread.h> static intptr_t gettid(void) { return (intptr_t)pthread_self(); } diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c index e18e667fe5..89ec0917d5 100644 --- a/src/core/support/log_win32.c +++ b/src/core/support/log_win32.c @@ -35,14 +35,14 @@ #ifdef GPR_WIN32 -#include <stdio.h> #include <stdarg.h> +#include <stdio.h> #include <grpc/support/alloc.h> -#include <grpc/support/log_win32.h> #include <grpc/support/log.h> -#include <grpc/support/time.h> +#include <grpc/support/log_win32.h> #include <grpc/support/string_util.h> +#include <grpc/support/time.h> #include "src/core/support/string.h" #include "src/core/support/string_win32.h" diff --git a/src/core/support/stack_lockfree.c b/src/core/support/stack_lockfree.c index 9daecd2e18..8e0bbfaee8 100644 --- a/src/core/support/stack_lockfree.c +++ b/src/core/support/stack_lockfree.c @@ -36,10 +36,10 @@ #include <stdlib.h> #include <string.h> -#include <grpc/support/port_platform.h> #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> /* The lockfree node structure is a single architecture-level word that allows for an atomic CAS to set it up. */ @@ -64,10 +64,10 @@ typedef union lockfree_node { struct lockfree_node_contents contents; } lockfree_node; -#define ENTRY_ALIGNMENT_BITS 3 /* make sure that entries aligned to 8-bytes */ -#define INVALID_ENTRY_INDEX \ - ((1 << 16) - 1) /* reserve this entry as invalid \ - */ +/* make sure that entries aligned to 8-bytes */ +#define ENTRY_ALIGNMENT_BITS 3 +/* reserve this entry as invalid */ +#define INVALID_ENTRY_INDEX ((1 << 16) - 1) struct gpr_stack_lockfree { lockfree_node *entries; diff --git a/src/core/support/string.h b/src/core/support/string.h index a367ed7cd8..8ff16882ab 100644 --- a/src/core/support/string.h +++ b/src/core/support/string.h @@ -37,8 +37,8 @@ #include <stddef.h> #include <grpc/support/port_platform.h> -#include <grpc/support/slice_buffer.h> #include <grpc/support/slice.h> +#include <grpc/support/slice_buffer.h> #ifdef __cplusplus extern "C" { diff --git a/src/core/support/string_posix.c b/src/core/support/string_posix.c index 25c333db4e..a73b3106a5 100644 --- a/src/core/support/string_posix.c +++ b/src/core/support/string_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #ifdef GPR_POSIX_STRING -#include <stdio.h> #include <stdarg.h> +#include <stdio.h> #include <string.h> #include <grpc/support/alloc.h> diff --git a/src/core/support/string_win32.c b/src/core/support/string_win32.c index 3b1f702cf1..0780907994 100644 --- a/src/core/support/string_win32.c +++ b/src/core/support/string_win32.c @@ -37,8 +37,8 @@ #ifdef GPR_WIN32 -#include <stdio.h> #include <stdarg.h> +#include <stdio.h> #include <string.h> #include <grpc/support/alloc.h> diff --git a/src/core/support/subprocess_posix.c b/src/core/support/subprocess_posix.c index 171054e4da..662e7dd999 100644 --- a/src/core/support/subprocess_posix.c +++ b/src/core/support/subprocess_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,15 +37,15 @@ #include <grpc/support/subprocess.h> -#include <unistd.h> #include <assert.h> #include <errno.h> -#include <stdio.h> -#include <string.h> #include <signal.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/wait.h> +#include <unistd.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> diff --git a/src/core/support/subprocess_windows.c b/src/core/support/subprocess_windows.c index 2b25ef063a..6afbefeb2b 100644 --- a/src/core/support/subprocess_windows.c +++ b/src/core/support/subprocess_windows.c @@ -35,9 +35,9 @@ #ifdef GPR_WINDOWS_SUBPROCESS -#include <windows.h> #include <string.h> #include <tchar.h> +#include <windows.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> diff --git a/src/core/support/sync.c b/src/core/support/sync.c index 69e3e39c5c..800cf20287 100644 --- a/src/core/support/sync.c +++ b/src/core/support/sync.c @@ -33,9 +33,9 @@ /* Generic implementation of synchronization primitives. */ +#include <grpc/support/atm.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> -#include <grpc/support/atm.h> /* Number of mutexes to allocate for events, to avoid lock contention. Should be a prime. */ diff --git a/src/core/support/sync_posix.c b/src/core/support/sync_posix.c index d3c483f1b5..be4d0ac1c9 100644 --- a/src/core/support/sync_posix.c +++ b/src/core/support/sync_posix.c @@ -36,10 +36,10 @@ #ifdef GPR_POSIX_SYNC #include <errno.h> -#include <time.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> +#include <time.h> #include "src/core/profiling/timers.h" void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, NULL) == 0); } diff --git a/src/core/support/thd_posix.c b/src/core/support/thd_posix.c index 653a1c88c1..4d874d3656 100644 --- a/src/core/support/thd_posix.c +++ b/src/core/support/thd_posix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,13 +37,13 @@ #ifdef GPR_POSIX_SYNC -#include <pthread.h> -#include <stdlib.h> -#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include <pthread.h> +#include <stdlib.h> +#include <string.h> struct thd_arg { void (*body)(void *arg); /* body of a thread */ diff --git a/src/core/support/thd_win32.c b/src/core/support/thd_win32.c index a9db180c1b..630eb7f625 100644 --- a/src/core/support/thd_win32.c +++ b/src/core/support/thd_win32.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,10 @@ #ifdef GPR_WIN32 -#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> +#include <string.h> #if defined(_MSC_VER) #define thread_local __declspec(thread) diff --git a/src/core/support/time.c b/src/core/support/time.c index 423d12ffc0..0e2c8fcf1a 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -33,11 +33,11 @@ /* Generic implementation of time calls. */ +#include <grpc/support/log.h> #include <grpc/support/time.h> #include <limits.h> #include <stdio.h> #include <string.h> -#include <grpc/support/log.h> int gpr_time_cmp(gpr_timespec a, gpr_timespec b) { int cmp = (a.tv_sec > b.tv_sec) - (a.tv_sec < b.tv_sec); diff --git a/src/core/support/time_posix.c b/src/core/support/time_posix.c index 36d75e7da2..f999e08cb0 100644 --- a/src/core/support/time_posix.c +++ b/src/core/support/time_posix.c @@ -98,9 +98,9 @@ gpr_timespec gpr_now(gpr_clock_type clock_type) { #else /* For some reason Apple's OSes haven't implemented clock_gettime. */ -#include <sys/time.h> #include <mach/mach.h> #include <mach/mach_time.h> +#include <sys/time.h> static double g_time_scale; static uint64_t g_time_start; diff --git a/src/core/support/time_win32.c b/src/core/support/time_win32.c index 8af957e6f4..2c344d3f3b 100644 --- a/src/core/support/time_win32.c +++ b/src/core/support/time_win32.c @@ -39,10 +39,10 @@ #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <limits.h> +#include <process.h> #include <src/core/support/time_precise.h> #include <sys/timeb.h> -#include <process.h> -#include <limits.h> #include "src/core/support/block_annotate.h" diff --git a/src/core/surface/alarm.c b/src/core/surface/alarm.c index 8169ede065..1085285f95 100644 --- a/src/core/surface/alarm.c +++ b/src/core/surface/alarm.c @@ -31,10 +31,10 @@ * */ -#include "src/core/iomgr/timer.h" -#include "src/core/surface/completion_queue.h" #include <grpc/grpc.h> #include <grpc/support/alloc.h> +#include "src/core/iomgr/timer.h" +#include "src/core/surface/completion_queue.h" struct grpc_alarm { grpc_timer alarm; diff --git a/src/core/surface/api_trace.h b/src/core/surface/api_trace.h index 29a9b2d79c..af53829de4 100644 --- a/src/core/surface/api_trace.h +++ b/src/core/surface/api_trace.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_SURFACE_API_TRACE_H #define GRPC_CORE_SURFACE_API_TRACE_H -#include "src/core/debug/trace.h" #include <grpc/support/log.h> +#include "src/core/debug/trace.h" extern int grpc_api_trace; diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 4679854227..4a418faaed 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,15 +31,15 @@ * */ -#include <string.h> #include <grpc/byte_buffer_reader.h> +#include <string.h> +#include <grpc/byte_buffer.h> #include <grpc/compression.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/slice_buffer.h> -#include <grpc/byte_buffer.h> #include "src/core/compression/message_compress.h" diff --git a/src/core/surface/call_log_batch.c b/src/core/surface/call_log_batch.c index 46756f418b..044211616c 100644 --- a/src/core/surface/call_log_batch.c +++ b/src/core/surface/call_log_batch.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,9 +33,9 @@ #include "src/core/surface/call.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" static void add_metadata(gpr_strvec *b, const grpc_metadata *md, size_t count) { size_t i; diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index 964ab34431..0010b64c7d 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -40,12 +40,12 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include "src/core/surface/channel_init.h" #include "src/core/client_config/resolver_registry.h" #include "src/core/iomgr/iomgr.h" #include "src/core/support/string.h" #include "src/core/surface/api_trace.h" #include "src/core/surface/call.h" +#include "src/core/surface/channel_init.h" #include "src/core/surface/init.h" #include "src/core/transport/static_metadata.h" diff --git a/src/core/surface/channel.h b/src/core/surface/channel.h index c08988d9e7..6a803ffe23 100644 --- a/src/core/surface/channel.h +++ b/src/core/surface/channel.h @@ -35,8 +35,8 @@ #define GRPC_CORE_SURFACE_CHANNEL_H #include "src/core/channel/channel_stack.h" -#include "src/core/surface/channel_stack_type.h" #include "src/core/client_config/subchannel_factory.h" +#include "src/core/surface/channel_stack_type.h" grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target, const grpc_channel_args *args, diff --git a/src/core/surface/channel_stack_type.c b/src/core/surface/channel_stack_type.c index 29bb7704f8..1a6e949ffe 100644 --- a/src/core/surface/channel_stack_type.c +++ b/src/core/surface/channel_stack_type.c @@ -31,9 +31,9 @@ * */ -#include <grpc/support/port_platform.h> #include "src/core/surface/channel_stack_type.h" #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type) { switch (type) { diff --git a/src/core/surface/completion_queue.h b/src/core/surface/completion_queue.h index 07f6d0c8f6..213d89c079 100644 --- a/src/core/surface/completion_queue.h +++ b/src/core/surface/completion_queue.h @@ -36,8 +36,8 @@ /* Internal API for completion queues */ -#include "src/core/iomgr/pollset.h" #include <grpc/grpc.h> +#include "src/core/iomgr/pollset.h" typedef struct grpc_cq_completion { /** user supplied tag */ diff --git a/src/core/surface/event_string.c b/src/core/surface/event_string.c index 33cd4a43aa..85a372b9ad 100644 --- a/src/core/surface/event_string.c +++ b/src/core/surface/event_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,9 @@ #include <stdio.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" static void addhdr(gpr_strvec *buf, grpc_event *ev) { char *tmp; diff --git a/src/core/surface/init.c b/src/core/surface/init.c index 233572a9f3..3c4db3e6cc 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -42,14 +42,14 @@ /* TODO(ctiller): find another way? - better not to include census here */ #include "src/core/census/grpc_plugin.h" #include "src/core/channel/channel_stack.h" +#include "src/core/channel/client_channel.h" #include "src/core/channel/compress_filter.h" #include "src/core/channel/connected_channel.h" -#include "src/core/channel/client_channel.h" #include "src/core/channel/http_client_filter.h" #include "src/core/channel/http_server_filter.h" -#include "src/core/client_config/lb_policy_registry.h" #include "src/core/client_config/lb_policies/pick_first.h" #include "src/core/client_config/lb_policies/round_robin.h" +#include "src/core/client_config/lb_policy_registry.h" #include "src/core/client_config/resolver_registry.h" #include "src/core/client_config/resolvers/dns_resolver.h" #include "src/core/client_config/resolvers/sockaddr_resolver.h" diff --git a/src/core/surface/init_secure.c b/src/core/surface/init_secure.c index 311dda9864..e0d66a8d46 100644 --- a/src/core/surface/init_secure.c +++ b/src/core/surface/init_secure.c @@ -36,12 +36,12 @@ #include <limits.h> #include <string.h> -#include "src/core/surface/channel_init.h" #include "src/core/debug/trace.h" #include "src/core/security/auth_filters.h" #include "src/core/security/credentials.h" #include "src/core/security/secure_endpoint.h" #include "src/core/security/security_connector.h" +#include "src/core/surface/channel_init.h" #include "src/core/tsi/transport_security_interface.h" void grpc_security_pre_init(void) { diff --git a/src/core/surface/lame_client.c b/src/core/surface/lame_client.c index 58f89946d2..25f3a74349 100644 --- a/src/core/surface/lame_client.c +++ b/src/core/surface/lame_client.c @@ -37,13 +37,13 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include "src/core/channel/channel_stack.h" #include "src/core/support/string.h" #include "src/core/surface/api_trace.h" -#include "src/core/surface/channel.h" #include "src/core/surface/call.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> +#include "src/core/surface/channel.h" typedef struct { grpc_linked_mdelem status; @@ -118,10 +118,17 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_lame_filter = { - lame_start_transport_stream_op, lame_start_transport_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - lame_get_peer, "lame-client", + lame_start_transport_stream_op, + lame_start_transport_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + lame_get_peer, + "lame-client", }; #define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1)) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index da93474b26..a92f2b3e38 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -754,10 +754,17 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_server_top_filter = { - server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "server", + server_start_transport_stream_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "server", }; void grpc_server_register_completion_queue(grpc_server *server, @@ -895,7 +902,8 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, channel = grpc_channel_create(exec_ctx, NULL, args, GRPC_SERVER_CHANNEL, transport); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0)->channel_data; + grpc_channel_get_channel_stack(channel), 0) + ->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -916,7 +924,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, method = grpc_mdstr_from_string(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; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; diff --git a/src/core/surface/server_chttp2.c b/src/core/surface/server_chttp2.c index ff2840f655..546760ecfa 100644 --- a/src/core/surface/server_chttp2.c +++ b/src/core/surface/server_chttp2.c @@ -33,15 +33,15 @@ #include <grpc/grpc.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/useful.h> #include "src/core/channel/http_server_filter.h" #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/tcp_server.h" #include "src/core/surface/api_trace.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/useful.h> static void setup_transport(grpc_exec_ctx *exec_ctx, void *server, grpc_transport *transport) { diff --git a/src/core/surface/surface_trace.h b/src/core/surface/surface_trace.h index ed820ebd05..a55a88e44d 100644 --- a/src/core/surface/surface_trace.h +++ b/src/core/surface/surface_trace.h @@ -34,9 +34,9 @@ #ifndef GRPC_CORE_SURFACE_SURFACE_TRACE_H #define GRPC_CORE_SURFACE_SURFACE_TRACE_H +#include <grpc/support/log.h> #include "src/core/debug/trace.h" #include "src/core/surface/api_trace.h" -#include <grpc/support/log.h> #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ if (grpc_api_trace) { \ diff --git a/src/core/transport/byte_stream.h b/src/core/transport/byte_stream.h index b8d0ade2b5..ab42d07e7e 100644 --- a/src/core/transport/byte_stream.h +++ b/src/core/transport/byte_stream.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_TRANSPORT_BYTE_STREAM_H #define GRPC_CORE_TRANSPORT_BYTE_STREAM_H -#include "src/core/iomgr/exec_ctx.h" #include <grpc/support/slice_buffer.h> +#include "src/core/iomgr/exec_ctx.h" /** Internal bit flag for grpc_begin_message's \a flags signaling the use of * compression for the message */ diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/transport/chttp2/bin_encoder.c index f26bc7e29b..3d31162499 100644 --- a/src/core/transport/chttp2/bin_encoder.c +++ b/src/core/transport/chttp2/bin_encoder.c @@ -35,8 +35,8 @@ #include <string.h> -#include "src/core/transport/chttp2/huffsyms.h" #include <grpc/support/log.h> +#include "src/core/transport/chttp2/huffsyms.h" static const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; @@ -46,70 +46,18 @@ typedef struct { uint8_t length; } b64_huff_sym; -static const b64_huff_sym huff_alphabet[64] = {{0x21, 6}, - {0x5d, 7}, - {0x5e, 7}, - {0x5f, 7}, - {0x60, 7}, - {0x61, 7}, - {0x62, 7}, - {0x63, 7}, - {0x64, 7}, - {0x65, 7}, - {0x66, 7}, - {0x67, 7}, - {0x68, 7}, - {0x69, 7}, - {0x6a, 7}, - {0x6b, 7}, - {0x6c, 7}, - {0x6d, 7}, - {0x6e, 7}, - {0x6f, 7}, - {0x70, 7}, - {0x71, 7}, - {0x72, 7}, - {0xfc, 8}, - {0x73, 7}, - {0xfd, 8}, - {0x3, 5}, - {0x23, 6}, - {0x4, 5}, - {0x24, 6}, - {0x5, 5}, - {0x25, 6}, - {0x26, 6}, - {0x27, 6}, - {0x6, 5}, - {0x74, 7}, - {0x75, 7}, - {0x28, 6}, - {0x29, 6}, - {0x2a, 6}, - {0x7, 5}, - {0x2b, 6}, - {0x76, 7}, - {0x2c, 6}, - {0x8, 5}, - {0x9, 5}, - {0x2d, 6}, - {0x77, 7}, - {0x78, 7}, - {0x79, 7}, - {0x7a, 7}, - {0x7b, 7}, - {0x0, 5}, - {0x1, 5}, - {0x2, 5}, - {0x19, 6}, - {0x1a, 6}, - {0x1b, 6}, - {0x1c, 6}, - {0x1d, 6}, - {0x1e, 6}, - {0x1f, 6}, - {0x7fb, 11}, - {0x18, 6}}; +static const b64_huff_sym huff_alphabet[64] = { + {0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7}, + {0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7}, + {0x68, 7}, {0x69, 7}, {0x6a, 7}, {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, + {0x6e, 7}, {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, {0xfc, 8}, + {0x73, 7}, {0xfd, 8}, {0x3, 5}, {0x23, 6}, {0x4, 5}, {0x24, 6}, + {0x5, 5}, {0x25, 6}, {0x26, 6}, {0x27, 6}, {0x6, 5}, {0x74, 7}, + {0x75, 7}, {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, {0x2b, 6}, + {0x76, 7}, {0x2c, 6}, {0x8, 5}, {0x9, 5}, {0x2d, 6}, {0x77, 7}, + {0x78, 7}, {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x0, 5}, {0x1, 5}, + {0x2, 5}, {0x19, 6}, {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, + {0x1e, 6}, {0x1f, 6}, {0x7fb, 11}, {0x18, 6}}; static const uint8_t tail_xtra[3] = {0, 2, 3}; diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index f9a1af8873..6cc6d4eaf2 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,11 +35,11 @@ #include <string.h> -#include "src/core/transport/chttp2/internal.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" +#include "src/core/transport/chttp2/internal.h" #include "src/core/transport/transport.h" grpc_chttp2_parse_error grpc_chttp2_data_parser_init( diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/transport/chttp2/frame_data.h index 92929d5c97..9dbaa60d44 100644 --- a/src/core/transport/chttp2/frame_data.h +++ b/src/core/transport/chttp2/frame_data.h @@ -36,9 +36,9 @@ /* Parser for GRPC streams embedded in DATA frames */ -#include "src/core/iomgr/exec_ctx.h" #include <grpc/support/slice.h> #include <grpc/support/slice_buffer.h> +#include "src/core/iomgr/exec_ctx.h" #include "src/core/transport/byte_stream.h" #include "src/core/transport/chttp2/frame.h" diff --git a/src/core/transport/chttp2/frame_goaway.h b/src/core/transport/chttp2/frame_goaway.h index 616287e9ee..b980e47723 100644 --- a/src/core/transport/chttp2/frame_goaway.h +++ b/src/core/transport/chttp2/frame_goaway.h @@ -34,11 +34,11 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_GOAWAY_H #define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_GOAWAY_H -#include "src/core/iomgr/exec_ctx.h" -#include "src/core/transport/chttp2/frame.h" #include <grpc/support/port_platform.h> #include <grpc/support/slice.h> #include <grpc/support/slice_buffer.h> +#include "src/core/iomgr/exec_ctx.h" +#include "src/core/transport/chttp2/frame.h" typedef enum { GRPC_CHTTP2_GOAWAY_LSI0, diff --git a/src/core/transport/chttp2/frame_ping.h b/src/core/transport/chttp2/frame_ping.h index fc4dd7ac58..2412cd7a6f 100644 --- a/src/core/transport/chttp2/frame_ping.h +++ b/src/core/transport/chttp2/frame_ping.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_PING_H #define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_PING_H -#include "src/core/iomgr/exec_ctx.h" #include <grpc/support/slice.h> +#include "src/core/iomgr/exec_ctx.h" #include "src/core/transport/chttp2/frame.h" typedef struct { diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/transport/chttp2/frame_rst_stream.h index d563a22e24..f725c5d767 100644 --- a/src/core/transport/chttp2/frame_rst_stream.h +++ b/src/core/transport/chttp2/frame_rst_stream.h @@ -35,8 +35,8 @@ #define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H #include <grpc/support/slice.h> -#include "src/core/transport/chttp2/frame.h" #include "src/core/iomgr/exec_ctx.h" +#include "src/core/transport/chttp2/frame.h" typedef struct { uint8_t byte; diff --git a/src/core/transport/chttp2/frame_settings.h b/src/core/transport/chttp2/frame_settings.h index e3c10d3cc5..59dbff9b40 100644 --- a/src/core/transport/chttp2/frame_settings.h +++ b/src/core/transport/chttp2/frame_settings.h @@ -36,8 +36,8 @@ #include <grpc/support/port_platform.h> #include <grpc/support/slice.h> -#include "src/core/transport/chttp2/frame.h" #include "src/core/iomgr/exec_ctx.h" +#include "src/core/transport/chttp2/frame.h" typedef enum { GRPC_CHTTP2_SPS_ID0, diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/transport/chttp2/frame_window_update.h index 0b3712b091..9b7ca3ce63 100644 --- a/src/core/transport/chttp2/frame_window_update.h +++ b/src/core/transport/chttp2/frame_window_update.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H #define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H -#include "src/core/iomgr/exec_ctx.h" #include <grpc/support/slice.h> +#include "src/core/iomgr/exec_ctx.h" #include "src/core/transport/chttp2/frame.h" typedef struct { diff --git a/src/core/transport/chttp2/hpack_encoder.h b/src/core/transport/chttp2/hpack_encoder.h index 90aaf867c5..6d86eb7c83 100644 --- a/src/core/transport/chttp2/hpack_encoder.h +++ b/src/core/transport/chttp2/hpack_encoder.h @@ -34,12 +34,12 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H #define GRPC_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H -#include "src/core/transport/chttp2/frame.h" -#include "src/core/transport/metadata.h" -#include "src/core/transport/metadata_batch.h" #include <grpc/support/port_platform.h> #include <grpc/support/slice.h> #include <grpc/support/slice_buffer.h> +#include "src/core/transport/chttp2/frame.h" +#include "src/core/transport/metadata.h" +#include "src/core/transport/metadata_batch.h" #define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256 #define GRPC_CHTTP2_HPACKC_NUM_VALUES 256 diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/transport/chttp2/hpack_table.h index 6e1b5e66b5..c984ca35e4 100644 --- a/src/core/transport/chttp2/hpack_table.h +++ b/src/core/transport/chttp2/hpack_table.h @@ -34,9 +34,9 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_HPACK_TABLE_H #define GRPC_CORE_TRANSPORT_CHTTP2_HPACK_TABLE_H -#include "src/core/transport/metadata.h" #include <grpc/support/port_platform.h> #include <grpc/support/slice.h> +#include "src/core/transport/metadata.h" /* HPACK header table */ diff --git a/src/core/transport/chttp2/huffsyms.c b/src/core/transport/chttp2/huffsyms.c index 7b138e9b5d..ebc85d3378 100644 --- a/src/core/transport/chttp2/huffsyms.c +++ b/src/core/transport/chttp2/huffsyms.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,261 +37,69 @@ command: :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */ const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = { - {0x1ff8, 13}, - {0x7fffd8, 23}, - {0xfffffe2, 28}, - {0xfffffe3, 28}, - {0xfffffe4, 28}, - {0xfffffe5, 28}, - {0xfffffe6, 28}, - {0xfffffe7, 28}, - {0xfffffe8, 28}, - {0xffffea, 24}, - {0x3ffffffc, 30}, - {0xfffffe9, 28}, - {0xfffffea, 28}, - {0x3ffffffd, 30}, - {0xfffffeb, 28}, - {0xfffffec, 28}, - {0xfffffed, 28}, - {0xfffffee, 28}, - {0xfffffef, 28}, - {0xffffff0, 28}, - {0xffffff1, 28}, - {0xffffff2, 28}, - {0x3ffffffe, 30}, - {0xffffff3, 28}, - {0xffffff4, 28}, - {0xffffff5, 28}, - {0xffffff6, 28}, - {0xffffff7, 28}, - {0xffffff8, 28}, - {0xffffff9, 28}, - {0xffffffa, 28}, - {0xffffffb, 28}, - {0x14, 6}, - {0x3f8, 10}, - {0x3f9, 10}, - {0xffa, 12}, - {0x1ff9, 13}, - {0x15, 6}, - {0xf8, 8}, - {0x7fa, 11}, - {0x3fa, 10}, - {0x3fb, 10}, - {0xf9, 8}, - {0x7fb, 11}, - {0xfa, 8}, - {0x16, 6}, - {0x17, 6}, - {0x18, 6}, - {0x0, 5}, - {0x1, 5}, - {0x2, 5}, - {0x19, 6}, - {0x1a, 6}, - {0x1b, 6}, - {0x1c, 6}, - {0x1d, 6}, - {0x1e, 6}, - {0x1f, 6}, - {0x5c, 7}, - {0xfb, 8}, - {0x7ffc, 15}, - {0x20, 6}, - {0xffb, 12}, - {0x3fc, 10}, - {0x1ffa, 13}, - {0x21, 6}, - {0x5d, 7}, - {0x5e, 7}, - {0x5f, 7}, - {0x60, 7}, - {0x61, 7}, - {0x62, 7}, - {0x63, 7}, - {0x64, 7}, - {0x65, 7}, - {0x66, 7}, - {0x67, 7}, - {0x68, 7}, - {0x69, 7}, - {0x6a, 7}, - {0x6b, 7}, - {0x6c, 7}, - {0x6d, 7}, - {0x6e, 7}, - {0x6f, 7}, - {0x70, 7}, - {0x71, 7}, - {0x72, 7}, - {0xfc, 8}, - {0x73, 7}, - {0xfd, 8}, - {0x1ffb, 13}, - {0x7fff0, 19}, - {0x1ffc, 13}, - {0x3ffc, 14}, - {0x22, 6}, - {0x7ffd, 15}, - {0x3, 5}, - {0x23, 6}, - {0x4, 5}, - {0x24, 6}, - {0x5, 5}, - {0x25, 6}, - {0x26, 6}, - {0x27, 6}, - {0x6, 5}, - {0x74, 7}, - {0x75, 7}, - {0x28, 6}, - {0x29, 6}, - {0x2a, 6}, - {0x7, 5}, - {0x2b, 6}, - {0x76, 7}, - {0x2c, 6}, - {0x8, 5}, - {0x9, 5}, - {0x2d, 6}, - {0x77, 7}, - {0x78, 7}, - {0x79, 7}, - {0x7a, 7}, - {0x7b, 7}, - {0x7ffe, 15}, - {0x7fc, 11}, - {0x3ffd, 14}, - {0x1ffd, 13}, - {0xffffffc, 28}, - {0xfffe6, 20}, - {0x3fffd2, 22}, - {0xfffe7, 20}, - {0xfffe8, 20}, - {0x3fffd3, 22}, - {0x3fffd4, 22}, - {0x3fffd5, 22}, - {0x7fffd9, 23}, - {0x3fffd6, 22}, - {0x7fffda, 23}, - {0x7fffdb, 23}, - {0x7fffdc, 23}, - {0x7fffdd, 23}, - {0x7fffde, 23}, - {0xffffeb, 24}, - {0x7fffdf, 23}, - {0xffffec, 24}, - {0xffffed, 24}, - {0x3fffd7, 22}, - {0x7fffe0, 23}, - {0xffffee, 24}, - {0x7fffe1, 23}, - {0x7fffe2, 23}, - {0x7fffe3, 23}, - {0x7fffe4, 23}, - {0x1fffdc, 21}, - {0x3fffd8, 22}, - {0x7fffe5, 23}, - {0x3fffd9, 22}, - {0x7fffe6, 23}, - {0x7fffe7, 23}, - {0xffffef, 24}, - {0x3fffda, 22}, - {0x1fffdd, 21}, - {0xfffe9, 20}, - {0x3fffdb, 22}, - {0x3fffdc, 22}, - {0x7fffe8, 23}, - {0x7fffe9, 23}, - {0x1fffde, 21}, - {0x7fffea, 23}, - {0x3fffdd, 22}, - {0x3fffde, 22}, - {0xfffff0, 24}, - {0x1fffdf, 21}, - {0x3fffdf, 22}, - {0x7fffeb, 23}, - {0x7fffec, 23}, - {0x1fffe0, 21}, - {0x1fffe1, 21}, - {0x3fffe0, 22}, - {0x1fffe2, 21}, - {0x7fffed, 23}, - {0x3fffe1, 22}, - {0x7fffee, 23}, - {0x7fffef, 23}, - {0xfffea, 20}, - {0x3fffe2, 22}, - {0x3fffe3, 22}, - {0x3fffe4, 22}, - {0x7ffff0, 23}, - {0x3fffe5, 22}, - {0x3fffe6, 22}, - {0x7ffff1, 23}, - {0x3ffffe0, 26}, - {0x3ffffe1, 26}, - {0xfffeb, 20}, - {0x7fff1, 19}, - {0x3fffe7, 22}, - {0x7ffff2, 23}, - {0x3fffe8, 22}, - {0x1ffffec, 25}, - {0x3ffffe2, 26}, - {0x3ffffe3, 26}, - {0x3ffffe4, 26}, - {0x7ffffde, 27}, - {0x7ffffdf, 27}, - {0x3ffffe5, 26}, - {0xfffff1, 24}, - {0x1ffffed, 25}, - {0x7fff2, 19}, - {0x1fffe3, 21}, - {0x3ffffe6, 26}, - {0x7ffffe0, 27}, - {0x7ffffe1, 27}, - {0x3ffffe7, 26}, - {0x7ffffe2, 27}, - {0xfffff2, 24}, - {0x1fffe4, 21}, - {0x1fffe5, 21}, - {0x3ffffe8, 26}, - {0x3ffffe9, 26}, - {0xffffffd, 28}, - {0x7ffffe3, 27}, - {0x7ffffe4, 27}, - {0x7ffffe5, 27}, - {0xfffec, 20}, - {0xfffff3, 24}, - {0xfffed, 20}, - {0x1fffe6, 21}, - {0x3fffe9, 22}, - {0x1fffe7, 21}, - {0x1fffe8, 21}, - {0x7ffff3, 23}, - {0x3fffea, 22}, - {0x3fffeb, 22}, - {0x1ffffee, 25}, - {0x1ffffef, 25}, - {0xfffff4, 24}, - {0xfffff5, 24}, - {0x3ffffea, 26}, - {0x7ffff4, 23}, - {0x3ffffeb, 26}, - {0x7ffffe6, 27}, - {0x3ffffec, 26}, - {0x3ffffed, 26}, - {0x7ffffe7, 27}, - {0x7ffffe8, 27}, - {0x7ffffe9, 27}, - {0x7ffffea, 27}, - {0x7ffffeb, 27}, - {0xffffffe, 28}, - {0x7ffffec, 27}, - {0x7ffffed, 27}, - {0x7ffffee, 27}, - {0x7ffffef, 27}, - {0x7fffff0, 27}, - {0x3ffffee, 26}, + {0x1ff8, 13}, {0x7fffd8, 23}, {0xfffffe2, 28}, {0xfffffe3, 28}, + {0xfffffe4, 28}, {0xfffffe5, 28}, {0xfffffe6, 28}, {0xfffffe7, 28}, + {0xfffffe8, 28}, {0xffffea, 24}, {0x3ffffffc, 30}, {0xfffffe9, 28}, + {0xfffffea, 28}, {0x3ffffffd, 30}, {0xfffffeb, 28}, {0xfffffec, 28}, + {0xfffffed, 28}, {0xfffffee, 28}, {0xfffffef, 28}, {0xffffff0, 28}, + {0xffffff1, 28}, {0xffffff2, 28}, {0x3ffffffe, 30}, {0xffffff3, 28}, + {0xffffff4, 28}, {0xffffff5, 28}, {0xffffff6, 28}, {0xffffff7, 28}, + {0xffffff8, 28}, {0xffffff9, 28}, {0xffffffa, 28}, {0xffffffb, 28}, + {0x14, 6}, {0x3f8, 10}, {0x3f9, 10}, {0xffa, 12}, + {0x1ff9, 13}, {0x15, 6}, {0xf8, 8}, {0x7fa, 11}, + {0x3fa, 10}, {0x3fb, 10}, {0xf9, 8}, {0x7fb, 11}, + {0xfa, 8}, {0x16, 6}, {0x17, 6}, {0x18, 6}, + {0x0, 5}, {0x1, 5}, {0x2, 5}, {0x19, 6}, + {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6}, + {0x1e, 6}, {0x1f, 6}, {0x5c, 7}, {0xfb, 8}, + {0x7ffc, 15}, {0x20, 6}, {0xffb, 12}, {0x3fc, 10}, + {0x1ffa, 13}, {0x21, 6}, {0x5d, 7}, {0x5e, 7}, + {0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x62, 7}, + {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, + {0x67, 7}, {0x68, 7}, {0x69, 7}, {0x6a, 7}, + {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, {0x6e, 7}, + {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, + {0xfc, 8}, {0x73, 7}, {0xfd, 8}, {0x1ffb, 13}, + {0x7fff0, 19}, {0x1ffc, 13}, {0x3ffc, 14}, {0x22, 6}, + {0x7ffd, 15}, {0x3, 5}, {0x23, 6}, {0x4, 5}, + {0x24, 6}, {0x5, 5}, {0x25, 6}, {0x26, 6}, + {0x27, 6}, {0x6, 5}, {0x74, 7}, {0x75, 7}, + {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, + {0x2b, 6}, {0x76, 7}, {0x2c, 6}, {0x8, 5}, + {0x9, 5}, {0x2d, 6}, {0x77, 7}, {0x78, 7}, + {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x7ffe, 15}, + {0x7fc, 11}, {0x3ffd, 14}, {0x1ffd, 13}, {0xffffffc, 28}, + {0xfffe6, 20}, {0x3fffd2, 22}, {0xfffe7, 20}, {0xfffe8, 20}, + {0x3fffd3, 22}, {0x3fffd4, 22}, {0x3fffd5, 22}, {0x7fffd9, 23}, + {0x3fffd6, 22}, {0x7fffda, 23}, {0x7fffdb, 23}, {0x7fffdc, 23}, + {0x7fffdd, 23}, {0x7fffde, 23}, {0xffffeb, 24}, {0x7fffdf, 23}, + {0xffffec, 24}, {0xffffed, 24}, {0x3fffd7, 22}, {0x7fffe0, 23}, + {0xffffee, 24}, {0x7fffe1, 23}, {0x7fffe2, 23}, {0x7fffe3, 23}, + {0x7fffe4, 23}, {0x1fffdc, 21}, {0x3fffd8, 22}, {0x7fffe5, 23}, + {0x3fffd9, 22}, {0x7fffe6, 23}, {0x7fffe7, 23}, {0xffffef, 24}, + {0x3fffda, 22}, {0x1fffdd, 21}, {0xfffe9, 20}, {0x3fffdb, 22}, + {0x3fffdc, 22}, {0x7fffe8, 23}, {0x7fffe9, 23}, {0x1fffde, 21}, + {0x7fffea, 23}, {0x3fffdd, 22}, {0x3fffde, 22}, {0xfffff0, 24}, + {0x1fffdf, 21}, {0x3fffdf, 22}, {0x7fffeb, 23}, {0x7fffec, 23}, + {0x1fffe0, 21}, {0x1fffe1, 21}, {0x3fffe0, 22}, {0x1fffe2, 21}, + {0x7fffed, 23}, {0x3fffe1, 22}, {0x7fffee, 23}, {0x7fffef, 23}, + {0xfffea, 20}, {0x3fffe2, 22}, {0x3fffe3, 22}, {0x3fffe4, 22}, + {0x7ffff0, 23}, {0x3fffe5, 22}, {0x3fffe6, 22}, {0x7ffff1, 23}, + {0x3ffffe0, 26}, {0x3ffffe1, 26}, {0xfffeb, 20}, {0x7fff1, 19}, + {0x3fffe7, 22}, {0x7ffff2, 23}, {0x3fffe8, 22}, {0x1ffffec, 25}, + {0x3ffffe2, 26}, {0x3ffffe3, 26}, {0x3ffffe4, 26}, {0x7ffffde, 27}, + {0x7ffffdf, 27}, {0x3ffffe5, 26}, {0xfffff1, 24}, {0x1ffffed, 25}, + {0x7fff2, 19}, {0x1fffe3, 21}, {0x3ffffe6, 26}, {0x7ffffe0, 27}, + {0x7ffffe1, 27}, {0x3ffffe7, 26}, {0x7ffffe2, 27}, {0xfffff2, 24}, + {0x1fffe4, 21}, {0x1fffe5, 21}, {0x3ffffe8, 26}, {0x3ffffe9, 26}, + {0xffffffd, 28}, {0x7ffffe3, 27}, {0x7ffffe4, 27}, {0x7ffffe5, 27}, + {0xfffec, 20}, {0xfffff3, 24}, {0xfffed, 20}, {0x1fffe6, 21}, + {0x3fffe9, 22}, {0x1fffe7, 21}, {0x1fffe8, 21}, {0x7ffff3, 23}, + {0x3fffea, 22}, {0x3fffeb, 22}, {0x1ffffee, 25}, {0x1ffffef, 25}, + {0xfffff4, 24}, {0xfffff5, 24}, {0x3ffffea, 26}, {0x7ffff4, 23}, + {0x3ffffeb, 26}, {0x7ffffe6, 27}, {0x3ffffec, 26}, {0x3ffffed, 26}, + {0x7ffffe7, 27}, {0x7ffffe8, 27}, {0x7ffffe9, 27}, {0x7ffffea, 27}, + {0x7ffffeb, 27}, {0xffffffe, 28}, {0x7ffffec, 27}, {0x7ffffed, 27}, + {0x7ffffee, 27}, {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26}, {0x3fffffff, 30}, }; diff --git a/src/core/transport/chttp2/timeout_encoding.h b/src/core/transport/chttp2/timeout_encoding.h index 81bae8e936..f8e25226eb 100644 --- a/src/core/transport/chttp2/timeout_encoding.h +++ b/src/core/transport/chttp2/timeout_encoding.h @@ -34,8 +34,8 @@ #ifndef GRPC_CORE_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H #define GRPC_CORE_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H -#include "src/core/support/string.h" #include <grpc/support/time.h> +#include "src/core/support/string.h" #define GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index b16768d06e..b45bf31997 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1398,8 +1398,8 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, bool success) { gpr_mu_unlock(&t->mu); GPR_TIMER_BEGIN("recv_data.parse", 0); for (; i < t->read_buffer.count && - grpc_chttp2_perform_read(exec_ctx, transport_parsing, - t->read_buffer.slices[i]); + grpc_chttp2_perform_read(exec_ctx, transport_parsing, + t->read_buffer.slices[i]); i++) ; GPR_TIMER_END("recv_data.parse", 0); @@ -1474,9 +1474,10 @@ static void connectivity_state_set( grpc_connectivity_state state, const char *reason) { GRPC_CHTTP2_IF_TRACING( gpr_log(GPR_DEBUG, "set connectivity_state=%d", state)); - grpc_connectivity_state_set(exec_ctx, &TRANSPORT_FROM_GLOBAL(transport_global) - ->channel_callback.state_tracker, - state, reason); + grpc_connectivity_state_set( + exec_ctx, + &TRANSPORT_FROM_GLOBAL(transport_global)->channel_callback.state_tracker, + state, reason); } /******************************************************************************* @@ -1756,10 +1757,15 @@ static char *chttp2_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *t) { return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string); } -static const grpc_transport_vtable vtable = { - sizeof(grpc_chttp2_stream), "chttp2", init_stream, set_pollset, - perform_stream_op, perform_transport_op, destroy_stream, destroy_transport, - chttp2_get_peer}; +static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream), + "chttp2", + init_stream, + set_pollset, + perform_stream_op, + perform_transport_op, + destroy_stream, + destroy_transport, + chttp2_get_peer}; grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 807ae071a3..7ed28feca8 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -44,12 +44,12 @@ #include <grpc/support/string_util.h> #include <grpc/support/time.h> +#include "src/core/iomgr/iomgr_internal.h" #include "src/core/profiling/timers.h" #include "src/core/support/murmur_hash.h" #include "src/core/support/string.h" #include "src/core/transport/chttp2/bin_encoder.h" #include "src/core/transport/static_metadata.h" -#include "src/core/iomgr/iomgr_internal.h" /* There are two kinds of mdelem and mdstr instances. * Static instances are declared in static_metadata.{h,c} and diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index 84abb59e99..30bbb89880 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -66,24 +66,95 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = 82, 83, 84, 35, 85, 35, 86, 35, 87, 35, 88, 35}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept", - "accept-charset", "accept-encoding", "accept-language", "accept-ranges", - "access-control-allow-origin", "age", "allow", "application/grpc", - ":authority", "authorization", "cache-control", "census-bin", - "census-binary-bin", "content-disposition", "content-encoding", - "content-language", "content-length", "content-location", "content-range", - "content-type", "cookie", "date", "deflate", "deflate,gzip", "", "etag", - "expect", "expires", "from", "GET", "grpc", "grpc-accept-encoding", - "grpc-encoding", "grpc-internal-encoding-request", "grpc-message", - "grpc-status", "grpc-timeout", "gzip", "gzip, deflate", "host", "http", - "https", "identity", "identity,deflate", "identity,deflate,gzip", - "identity,gzip", "if-match", "if-modified-since", "if-none-match", - "if-range", "if-unmodified-since", "last-modified", "link", "location", - "max-forwards", ":method", ":path", "POST", "proxy-authenticate", - "proxy-authorization", "range", "referer", "refresh", "retry-after", - ":scheme", "server", "set-cookie", "/", "/index.html", ":status", - "strict-transport-security", "te", "trailers", "transfer-encoding", - "user-agent", "vary", "via", "www-authenticate"}; + "0", + "1", + "2", + "200", + "204", + "206", + "304", + "400", + "404", + "500", + "accept", + "accept-charset", + "accept-encoding", + "accept-language", + "accept-ranges", + "access-control-allow-origin", + "age", + "allow", + "application/grpc", + ":authority", + "authorization", + "cache-control", + "census-bin", + "census-binary-bin", + "content-disposition", + "content-encoding", + "content-language", + "content-length", + "content-location", + "content-range", + "content-type", + "cookie", + "date", + "deflate", + "deflate,gzip", + "", + "etag", + "expect", + "expires", + "from", + "GET", + "grpc", + "grpc-accept-encoding", + "grpc-encoding", + "grpc-internal-encoding-request", + "grpc-message", + "grpc-status", + "grpc-timeout", + "gzip", + "gzip, deflate", + "host", + "http", + "https", + "identity", + "identity,deflate", + "identity,deflate,gzip", + "identity,gzip", + "if-match", + "if-modified-since", + "if-none-match", + "if-range", + "if-unmodified-since", + "last-modified", + "link", + "location", + "max-forwards", + ":method", + ":path", + "POST", + "proxy-authenticate", + "proxy-authorization", + "range", + "referer", + "refresh", + "retry-after", + ":scheme", + "server", + "set-cookie", + "/", + "/index.html", + ":status", + "strict-transport-security", + "te", + "trailers", + "transfer-encoding", + "user-agent", + "vary", + "via", + "www-authenticate"}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index 0f068dcb38..f43e56f23c 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -36,11 +36,11 @@ #include <stddef.h> +#include "src/core/channel/context.h" #include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset_set.h" -#include "src/core/transport/metadata_batch.h" #include "src/core/transport/byte_stream.h" -#include "src/core/channel/context.h" +#include "src/core/transport/metadata_batch.h" /* forward declarations */ typedef struct grpc_transport grpc_transport; diff --git a/src/core/transport/transport_op_string.c b/src/core/transport/transport_op_string.c index 98b51afc88..8453412480 100644 --- a/src/core/transport/transport_op_string.c +++ b/src/core/transport/transport_op_string.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,10 +37,10 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" /* These routines are here to facilitate debugging - they produce string representations of various transport data structures */ diff --git a/src/core/tsi/fake_transport_security.c b/src/core/tsi/fake_transport_security.c index 72ac32a171..c0106f7a33 100644 --- a/src/core/tsi/fake_transport_security.c +++ b/src/core/tsi/fake_transport_security.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -493,8 +493,10 @@ static void fake_handshaker_destroy(tsi_handshaker *self) { static const tsi_handshaker_vtable handshaker_vtable = { fake_handshaker_get_bytes_to_send_to_peer, - fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result, - fake_handshaker_extract_peer, fake_handshaker_create_frame_protector, + fake_handshaker_process_bytes_from_peer, + fake_handshaker_get_result, + fake_handshaker_extract_peer, + fake_handshaker_create_frame_protector, fake_handshaker_destroy, }; diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c index 42d25ca929..8df582609b 100644 --- a/src/core/tsi/ssl_transport_security.c +++ b/src/core/tsi/ssl_transport_security.c @@ -1039,8 +1039,10 @@ static void ssl_handshaker_destroy(tsi_handshaker *self) { static const tsi_handshaker_vtable handshaker_vtable = { ssl_handshaker_get_bytes_to_send_to_peer, - ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result, - ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector, + ssl_handshaker_process_bytes_from_peer, + ssl_handshaker_get_result, + ssl_handshaker_extract_peer, + ssl_handshaker_create_frame_protector, ssl_handshaker_destroy, }; diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 73147fd7bb..db636a5456 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -33,13 +33,13 @@ #include <grpc++/client_context.h> +#include <grpc++/security/credentials.h> +#include <grpc++/server_context.h> +#include <grpc++/support/time.h> #include <grpc/compression.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc++/security/credentials.h> -#include <grpc++/server_context.h> -#include <grpc++/support/time.h> #include "src/core/channel/compress_filter.h" #include "src/cpp/common/create_auth_context.h" diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 1293203b93..efea02995a 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,11 +33,11 @@ #include <grpc++/security/credentials.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> #include <grpc++/channel.h> #include <grpc++/support/channel_arguments.h> #include <grpc++/support/config.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include "src/cpp/client/create_channel_internal.h" namespace grpc { diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index c34b840f90..cdc8406f24 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -31,12 +31,12 @@ * */ +#include "src/cpp/client/secure_credentials.h" #include <grpc++/channel.h> #include <grpc++/impl/grpc_library.h> #include <grpc++/support/channel_arguments.h> #include <grpc/support/log.h> #include "src/cpp/client/create_channel_internal.h" -#include "src/cpp/client/secure_credentials.h" #include "src/cpp/common/secure_auth_context.h" namespace grpc { diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index 9e84102154..fd82331a44 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -36,8 +36,8 @@ #include <grpc/grpc_security.h> -#include <grpc++/support/config.h> #include <grpc++/security/credentials.h> +#include <grpc++/support/config.h> #include "src/cpp/server/thread_pool_interface.h" diff --git a/src/cpp/common/core_codegen.h b/src/cpp/common/core_codegen.h index 0d8c6b79f7..e15cb4c34a 100644 --- a/src/cpp/common/core_codegen.h +++ b/src/cpp/common/core_codegen.h @@ -34,8 +34,8 @@ // This file should be compiled as part of grpc++. #include <grpc++/impl/codegen/core_codegen_interface.h> -#include <grpc/impl/codegen/grpc_types.h> #include <grpc/byte_buffer.h> +#include <grpc/impl/codegen/grpc_types.h> namespace grpc { diff --git a/src/cpp/common/create_auth_context.h b/src/cpp/common/create_auth_context.h index 4f3da397ba..c53055503f 100644 --- a/src/cpp/common/create_auth_context.h +++ b/src/cpp/common/create_auth_context.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,8 +32,8 @@ */ #include <memory> -#include <grpc/grpc.h> #include <grpc++/security/auth_context.h> +#include <grpc/grpc.h> namespace grpc { diff --git a/src/cpp/common/insecure_create_auth_context.cc b/src/cpp/common/insecure_create_auth_context.cc index b2e153229a..7ec5d9bd12 100644 --- a/src/cpp/common/insecure_create_auth_context.cc +++ b/src/cpp/common/insecure_create_auth_context.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,8 +32,8 @@ */ #include <memory> -#include <grpc/grpc.h> #include <grpc++/security/auth_context.h> +#include <grpc/grpc.h> namespace grpc { diff --git a/src/cpp/common/secure_create_auth_context.cc b/src/cpp/common/secure_create_auth_context.cc index 40bc298b64..d7cf803fde 100644 --- a/src/cpp/common/secure_create_auth_context.cc +++ b/src/cpp/common/secure_create_auth_context.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,9 @@ */ #include <memory> +#include <grpc++/security/auth_context.h> #include <grpc/grpc.h> #include <grpc/grpc_security.h> -#include <grpc++/security/auth_context.h> #include "src/cpp/common/secure_auth_context.h" namespace grpc { diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 134e5f1d5f..1947d68e3e 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -33,10 +33,10 @@ #include <grpc++/server_builder.h> -#include <grpc/support/cpu.h> -#include <grpc/support/log.h> #include <grpc++/impl/service_type.h> #include <grpc++/server.h> +#include <grpc/support/cpu.h> +#include <grpc/support/log.h> #include "src/cpp/server/thread_pool_interface.h" namespace grpc { diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc index 2685e31ee6..bb5fce389d 100644 --- a/src/cpp/util/time.cc +++ b/src/cpp/util/time.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #ifndef GRPC_CXX0X_NO_CHRONO -#include <grpc/support/time.h> #include <grpc++/support/time.h> +#include <grpc/support/time.h> using std::chrono::duration_cast; using std::chrono::nanoseconds; diff --git a/src/node/README.md b/src/node/README.md index 3501b54a66..15d4c6d02f 100644 --- a/src/node/README.md +++ b/src/node/README.md @@ -7,6 +7,8 @@ Beta ## PREREQUISITES - `node`: This requires `node` to be installed, version `0.12` or above. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package. +- **Note:** If you installed `node` via a package manager and the version is still less than `0.12`, try directly installing it from [nodejs.org](https://nodejs.org). + ## INSTALLATION Install the gRPC NPM package @@ -17,7 +19,21 @@ npm install grpc ## BUILD FROM SOURCE 1. Clone [the grpc Git Repository](https://github.com/grpc/grpc). - 3. Run `npm install`. + 2. Run `npm install` from the repository root. + + - **Note:** On Windows, this might fail due to [nodejs issue #4932](https://github.com/nodejs/node/issues/4932) in which case, you will see something like the following in `npm install`'s output (towards the very beginning): + + ``` + .. + Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. + WINDOWS_BUILD_WARNING + "..\IMPORTANT: Due to https:\github.com\nodejs\node\issues\4932, to build this library on Windows, you must first remove C:\Users\jenkins\.node-gyp\4.4.0\include\node\openssl" + ... + .. + ``` + + To fix this, you will have to delete the folder `C:\Users\<username>\.node-gyp\<node_version>\include\node\openssl` and retry `npm install` + ## TESTING To run the test suite, simply run `npm test` in the install location. diff --git a/src/node/performance/benchmark_client.js b/src/node/performance/benchmark_client.js index 620aecde97..80bec0b73e 100644 --- a/src/node/performance/benchmark_client.js +++ b/src/node/performance/benchmark_client.js @@ -45,6 +45,9 @@ var EventEmitter = require('events'); var _ = require('lodash'); var PoissonProcess = require('poisson-process'); var Histogram = require('./histogram'); + +var genericService = require('./generic_service'); + var grpc = require('../../../'); var serviceProto = grpc.load({ root: __dirname + '/../../..', @@ -104,10 +107,14 @@ function BenchmarkClient(server_targets, channels, histogram_params, } this.clients = []; + var GenericClient = grpc.makeGenericClientConstructor(genericService); + this.genericClients = []; for (var i = 0; i < channels; i++) { this.clients[i] = new serviceProto.BenchmarkService( server_targets[i % server_targets.length], creds, options); + this.genericClients[i] = new GenericClient( + server_targets[i % server_targets.length], creds, options); } this.histogram = new Histogram(histogram_params.resolution, @@ -130,9 +137,11 @@ util.inherits(BenchmarkClient, EventEmitter); * 'STREAMING' * @param {number} req_size The size of the payload to send with each request * @param {number} resp_size The size of payload to request be sent in responses + * @param {boolean} generic Indicates that the generic (non-proto) clients + * should be used */ BenchmarkClient.prototype.startClosedLoop = function( - outstanding_rpcs_per_channel, rpc_type, req_size, resp_size) { + outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, generic) { var self = this; self.running = true; @@ -141,12 +150,20 @@ BenchmarkClient.prototype.startClosedLoop = function( var makeCall; - var argument = { - response_size: resp_size, - payload: { - body: zeroBuffer(req_size) - } - }; + var argument; + var client_list; + if (generic) { + argument = zeroBuffer(req_size); + client_list = self.genericClients; + } else { + argument = { + response_size: resp_size, + payload: { + body: zeroBuffer(req_size) + } + }; + client_list = self.clients; + } if (rpc_type == 'UNARY') { makeCall = function(client) { @@ -195,7 +212,7 @@ BenchmarkClient.prototype.startClosedLoop = function( }; } - _.each(self.clients, function(client) { + _.each(client_list, function(client) { _.times(outstanding_rpcs_per_channel, function() { makeCall(client); }); @@ -213,9 +230,12 @@ BenchmarkClient.prototype.startClosedLoop = function( * @param {number} req_size The size of the payload to send with each request * @param {number} resp_size The size of payload to request be sent in responses * @param {number} offered_load The load parameter for the Poisson process + * @param {boolean} generic Indicates that the generic (non-proto) clients + * should be used */ BenchmarkClient.prototype.startPoisson = function( - outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, offered_load) { + outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, offered_load, + generic) { var self = this; self.running = true; @@ -224,12 +244,20 @@ BenchmarkClient.prototype.startPoisson = function( var makeCall; - var argument = { - response_size: resp_size, - payload: { - body: zeroBuffer(req_size) - } - }; + var argument; + var client_list; + if (generic) { + argument = zeroBuffer(req_size); + client_list = self.genericClients; + } else { + argument = { + response_size: resp_size, + payload: { + body: zeroBuffer(req_size) + } + }; + client_list = self.clients; + } if (rpc_type == 'UNARY') { makeCall = function(client, poisson) { @@ -282,7 +310,7 @@ BenchmarkClient.prototype.startPoisson = function( var averageIntervalMs = (1 / offered_load) * 1000; - _.each(self.clients, function(client) { + _.each(client_list, function(client) { _.times(outstanding_rpcs_per_channel, function() { var p = PoissonProcess.create(averageIntervalMs, function() { makeCall(client, p); diff --git a/src/node/performance/benchmark_server.js b/src/node/performance/benchmark_server.js index e48acd48f5..b1b0bd12ab 100644 --- a/src/node/performance/benchmark_server.js +++ b/src/node/performance/benchmark_server.js @@ -41,6 +41,8 @@ var fs = require('fs'); var path = require('path'); +var genericService = require('./generic_service'); + var grpc = require('../../../'); var serviceProto = grpc.load({ root: __dirname + '/../../..', @@ -84,14 +86,28 @@ function streamingCall(call) { }); } +function makeStreamingGenericCall(response_size) { + var response = zeroBuffer(response_size); + return function streamingGenericCall(call) { + call.on('data', function(value) { + call.write(response); + }); + call.on('end', function() { + call.end(); + }); + }; +} + /** * BenchmarkServer class. Constructed based on parameters from the driver and * stores statistics. * @param {string} host The host to serve on * @param {number} port The port to listen to - * @param {tls} Indicates whether TLS should be used + * @param {boolean} tls Indicates whether TLS should be used + * @param {boolean} generic Indicates whether to use the generic service + * @param {number=} response_size The response size for the generic service */ -function BenchmarkServer(host, port, tls) { +function BenchmarkServer(host, port, tls, generic, response_size) { var server_creds; var host_override; if (tls) { @@ -109,10 +125,16 @@ function BenchmarkServer(host, port, tls) { var server = new grpc.Server(); this.port = server.bind(host + ':' + port, server_creds); - server.addProtoService(serviceProto.BenchmarkService.service, { - unaryCall: unaryCall, - streamingCall: streamingCall - }); + if (generic) { + server.addService(genericService, { + streamingCall: makeStreamingGenericCall(response_size) + }); + } else { + server.addProtoService(serviceProto.BenchmarkService.service, { + unaryCall: unaryCall, + streamingCall: streamingCall + }); + } this.server = server; } diff --git a/src/node/performance/generic_service.js b/src/node/performance/generic_service.js new file mode 100644 index 0000000000..ce09cc4336 --- /dev/null +++ b/src/node/performance/generic_service.js @@ -0,0 +1,46 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of 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. + * + */ + +var _ = require('lodash'); + +module.exports = { + 'streamingCall' : { + path: '/grpc.testing/BenchmarkService', + requestStream: true, + responseStream: true, + requestSerialize: _.identity, + requestDeserialize: _.identity, + responseSerialize: _.identity, + responseDeserialize: _.identity + } +}; diff --git a/src/node/performance/worker_service_impl.js b/src/node/performance/worker_service_impl.js index 1439249878..2c4651370f 100644 --- a/src/node/performance/worker_service_impl.js +++ b/src/node/performance/worker_service_impl.js @@ -56,18 +56,31 @@ exports.runClient = function runClient(call) { client.on('error', function(error) { call.emit('error', error); }); + var req_size, resp_size, generic; + switch (setup.payload_config.payload) { + case 'bytebuf_params': + req_size = setup.payload_config.bytebuf_params.req_size; + resp_size = setup.payload_config.bytebuf_params.resp_size; + generic = true; + break; + case 'simple_params': + req_size = setup.payload_config.simple_params.req_size; + resp_size = setup.payload_config.simple_params.resp_size; + generic = false; + break; + default: + call.emit('error', new Error('Unsupported PayloadConfig type' + + setup.payload_config.payload)); + } switch (setup.load_params.load) { case 'closed_loop': client.startClosedLoop(setup.outstanding_rpcs_per_channel, - setup.rpc_type, - setup.payload_config.simple_params.req_size, - setup.payload_config.simple_params.resp_size); + setup.rpc_type, req_size, resp_size, generic); break; case 'poisson': client.startPoisson(setup.outstanding_rpcs_per_channel, - setup.rpc_type, setup.payload_config.req_size, - setup.payload_config.resp_size, - setup.load_params.poisson.offered_load); + setup.rpc_type, req_size, resp_size, + setup.load_params.poisson.offered_load, generic); break; default: call.emit('error', new Error('Unsupported LoadParams type' + diff --git a/src/node/src/server.js b/src/node/src/server.js index 0cf7ba3424..dd0bc12bc9 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -339,7 +339,7 @@ function _read(size) { try { deserialized = self.deserialize(data); } catch (e) { - e.code = grpc.status.INVALID_ARGUMENT; + e.code = grpc.status.INTERNAL; self.emit('error', e); return; } @@ -475,7 +475,7 @@ function handleUnary(call, handler, metadata) { try { emitter.request = handler.deserialize(result.read); } catch (e) { - e.code = grpc.status.INVALID_ARGUMENT; + e.code = grpc.status.INTERNAL; handleError(call, e); return; } @@ -516,7 +516,7 @@ function handleServerStreaming(call, handler, metadata) { try { stream.request = handler.deserialize(result.read); } catch (e) { - e.code = grpc.status.INVALID_ARGUMENT; + e.code = grpc.status.INTERNAL; stream.emit('error', e); return; } diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index 8a232d6fc4..edbfc0a288 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -709,14 +709,14 @@ describe('Other conditions', function() { it('should respond correctly to a unary call', function(done) { misbehavingClient.unary(badArg, function(err, data) { assert(err); - assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); + assert.strictEqual(err.code, grpc.status.INTERNAL); done(); }); }); it('should respond correctly to a client stream', function(done) { var call = misbehavingClient.clientStream(function(err, data) { assert(err); - assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); + assert.strictEqual(err.code, grpc.status.INTERNAL); done(); }); call.write(badArg); @@ -729,7 +729,7 @@ describe('Other conditions', function() { assert.fail(data, null, 'Unexpected data', '==='); }); call.on('error', function(err) { - assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); + assert.strictEqual(err.code, grpc.status.INTERNAL); done(); }); }); @@ -739,7 +739,7 @@ describe('Other conditions', function() { assert.fail(data, null, 'Unexpected data', '==='); }); call.on('error', function(err) { - assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT); + assert.strictEqual(err.code, grpc.status.INTERNAL); done(); }); call.write(badArg); diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h index a52095dd01..7b66cd4c32 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h @@ -36,8 +36,6 @@ typedef void(^GRPCQueueCompletionHandler)(bool success); -extern const int64_t kGRPCCompletionQueueDefaultTimeoutSecs; - /** * This class lets one more easily use |grpc_completion_queue|. To use it, pass the value of the * |unmanagedQueue| property of an instance of this class to |grpc_channel_create_call|. Then for @@ -51,11 +49,6 @@ extern const int64_t kGRPCCompletionQueueDefaultTimeoutSecs; */ @interface GRPCCompletionQueue : NSObject @property(nonatomic, readonly) grpc_completion_queue *unmanagedQueue; -@property(nonatomic, readonly) int64_t timeoutSecs; + (instancetype)completionQueue; - -- (instancetype)init; -- (instancetype)initWithTimeout:(int64_t)timeoutSecs NS_DESIGNATED_INITIALIZER; - @end diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m index be214d4d36..d89602f7cb 100644 --- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m +++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m @@ -35,9 +35,6 @@ #import <grpc/grpc.h> - -const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60; - @implementation GRPCCompletionQueue + (instancetype)completionQueue { @@ -50,13 +47,8 @@ const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60; } - (instancetype)init { - return [self initWithTimeout:kGRPCCompletionQueueDefaultTimeoutSecs]; -} - -- (instancetype)initWithTimeout:(int64_t)timeoutSecs { if ((self = [super init])) { _unmanagedQueue = grpc_completion_queue_create(NULL); - _timeoutSecs = timeoutSecs; // This is for the following block to capture the pointer by value (instead // of retaining self and doing self->_unmanagedQueue). This is essential @@ -74,28 +66,22 @@ const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60; gDefaultConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); }); dispatch_async(gDefaultConcurrentQueue, ^{ - // Using a non-infinite deadline to re-enter grpc_completion_queue_next() - // alleviates https://github.com/grpc/grpc/issues/5593 - gpr_timespec deadline = (timeoutSecs < 0) - ? gpr_inf_future(GPR_CLOCK_REALTIME) - : gpr_time_from_seconds(timeoutSecs, GPR_CLOCK_REALTIME); while (YES) { - // The following call blocks until an event is available or the deadline elapses. - grpc_event event = grpc_completion_queue_next(unmanagedQueue, deadline, NULL); + // The following call blocks until an event is available. + grpc_event event = grpc_completion_queue_next(unmanagedQueue, + gpr_inf_future(GPR_CLOCK_REALTIME), + NULL); GRPCQueueCompletionHandler handler; switch (event.type) { case GRPC_OP_COMPLETE: handler = (__bridge_transfer GRPCQueueCompletionHandler)event.tag; handler(event.success); break; - case GRPC_QUEUE_TIMEOUT: - // Nothing to do here - break; case GRPC_QUEUE_SHUTDOWN: grpc_completion_queue_destroy(unmanagedQueue); return; default: - [NSException raise:@"Unrecognized completion type" format:@"type=%d", event.type]; + [NSException raise:@"Unrecognized completion type" format:@""]; } }; }); diff --git a/src/python/grpcio/tests/_result.py b/src/python/grpcio/tests/_result.py index 065153f0c3..18b0f43963 100644 --- a/src/python/grpcio/tests/_result.py +++ b/src/python/grpcio/tests/_result.py @@ -204,7 +204,7 @@ class AugmentedResult(unittest.TestResult): """ case_id = self.id_map(test) self.cases[case_id] = self.cases[case_id].updated( - stdout=stdout, stderr=stderr) + stdout=stdout.decode(), stderr=stderr.decode()) def augmented_results(self, filter): """Convenience method to retrieve filtered case results. diff --git a/src/python/grpcio/tests/_runner.py b/src/python/grpcio/tests/_runner.py index e899154b0b..173a170409 100644 --- a/src/python/grpcio/tests/_runner.py +++ b/src/python/grpcio/tests/_runner.py @@ -42,6 +42,7 @@ import time import unittest import uuid +import six from six import moves from tests import _loader @@ -95,6 +96,8 @@ class CaptureFile(object): Arguments: value (str): What to write to the original file. """ + if six.PY3 and not isinstance(value, six.binary_type): + value = bytes(value, 'ascii') if self._saved_fd is None: os.write(self._redirect_fd, value) else: @@ -171,9 +174,9 @@ class Runner(object): result.stopTestRun() stdout_pipe.write_bypass(result_out.getvalue()) stdout_pipe.write_bypass( - '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output())) + '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output().decode())) stderr_pipe.write_bypass( - '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output())) + '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output().decode())) os._exit(1) signal.signal(signal.SIGINT, sigint_handler) signal.signal(signal.SIGSEGV, fault_handler) @@ -216,7 +219,7 @@ class Runner(object): sys.stdout.write(result_out.getvalue()) sys.stdout.flush() signal.signal(signal.SIGINT, signal.SIG_DFL) - with open('report.xml', 'w') as report_xml_file: + with open('report.xml', 'wb') as report_xml_file: _result.jenkins_junit_xml(result).write(report_xml_file) return result diff --git a/src/python/grpcio/tests/interop/methods.py b/src/python/grpcio/tests/interop/methods.py index 1f5561c1f0..7f42b4a005 100644 --- a/src/python/grpcio/tests/interop/methods.py +++ b/src/python/grpcio/tests/interop/methods.py @@ -29,6 +29,8 @@ """Implementations of interoperability test methods.""" +from __future__ import print_function + import enum import json import os @@ -208,7 +210,7 @@ def _ping_pong(stub): with stub, _Pipe() as pipe: response_iterator = stub.FullDuplexCall(pipe, _TIMEOUT) - print 'Starting ping-pong with response iterator %s' % response_iterator + print('Starting ping-pong with response iterator %s' % response_iterator) for response_size, payload_size in zip( request_response_sizes, request_payload_sizes): request = messages_pb2.StreamingOutputCallRequest( diff --git a/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py b/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py index ba5b219a88..230ec6487d 100644 --- a/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py +++ b/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -42,6 +42,8 @@ import threading import time import unittest +from six import moves + from grpc.beta import implementations from grpc.framework.foundation import future from grpc.framework.interfaces.face import face @@ -250,7 +252,7 @@ class PythonPluginTest(unittest.TestCase): def testImportAttributes(self): # check that we can access the generated module and its members. import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) self.assertIsNotNone(getattr(test_pb2, SERVICER_IDENTIFIER, None)) self.assertIsNotNone(getattr(test_pb2, STUB_IDENTIFIER, None)) self.assertIsNotNone(getattr(test_pb2, SERVER_FACTORY_IDENTIFIER, None)) @@ -258,13 +260,13 @@ class PythonPluginTest(unittest.TestCase): def testUpDown(self): import protoc_plugin_test_pb2 as test_pb2 - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (servicer, stub): request = test_pb2.SimpleRequest(response_size=13) def testUnaryCall(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): request = test_pb2.SimpleRequest(response_size=13) response = stub.UnaryCall(request, test_constants.LONG_TIMEOUT) @@ -273,7 +275,7 @@ class PythonPluginTest(unittest.TestCase): def testUnaryCallFuture(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = test_pb2.SimpleRequest(response_size=13) with _CreateService(test_pb2) as (methods, stub): # Check that the call does not block waiting for the server to respond. @@ -286,7 +288,7 @@ class PythonPluginTest(unittest.TestCase): def testUnaryCallFutureExpired(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): request = test_pb2.SimpleRequest(response_size=13) with methods.pause(): @@ -297,7 +299,7 @@ class PythonPluginTest(unittest.TestCase): def testUnaryCallFutureCancelled(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = test_pb2.SimpleRequest(response_size=13) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): @@ -307,7 +309,7 @@ class PythonPluginTest(unittest.TestCase): def testUnaryCallFutureFailed(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = test_pb2.SimpleRequest(response_size=13) with _CreateService(test_pb2) as (methods, stub): with methods.fail(): @@ -317,20 +319,20 @@ class PythonPluginTest(unittest.TestCase): def testStreamingOutputCall(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = _streaming_output_request(test_pb2) with _CreateService(test_pb2) as (methods, stub): responses = stub.StreamingOutputCall( request, test_constants.LONG_TIMEOUT) expected_responses = methods.StreamingOutputCall( request, 'not a real RpcContext!') - for expected_response, response in itertools.izip_longest( + for expected_response, response in moves.zip_longest( expected_responses, responses): self.assertEqual(expected_response, response) def testStreamingOutputCallExpired(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = _streaming_output_request(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): @@ -341,7 +343,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingOutputCallCancelled(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = _streaming_output_request(test_pb2) with _CreateService(test_pb2) as (unused_methods, stub): responses = stub.StreamingOutputCall( @@ -353,7 +355,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingOutputCallFailed(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request = _streaming_output_request(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.fail(): @@ -364,7 +366,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingInputCall(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): response = stub.StreamingInputCall( _streaming_input_request_iterator(test_pb2), @@ -375,7 +377,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingInputCallFuture(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): response_future = stub.StreamingInputCall.future( @@ -388,7 +390,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingInputCallFutureExpired(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): response_future = stub.StreamingInputCall.future( @@ -401,7 +403,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingInputCallFutureCancelled(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): response_future = stub.StreamingInputCall.future( @@ -414,7 +416,7 @@ class PythonPluginTest(unittest.TestCase): def testStreamingInputCallFutureFailed(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.fail(): response_future = stub.StreamingInputCall.future( @@ -424,19 +426,19 @@ class PythonPluginTest(unittest.TestCase): def testFullDuplexCall(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): responses = stub.FullDuplexCall( _full_duplex_request_iterator(test_pb2), test_constants.LONG_TIMEOUT) expected_responses = methods.FullDuplexCall( _full_duplex_request_iterator(test_pb2), 'not a real RpcContext!') - for expected_response, response in itertools.izip_longest( + for expected_response, response in moves.zip_longest( expected_responses, responses): self.assertEqual(expected_response, response) def testFullDuplexCallExpired(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request_iterator = _full_duplex_request_iterator(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.pause(): @@ -447,7 +449,7 @@ class PythonPluginTest(unittest.TestCase): def testFullDuplexCallCancelled(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): request_iterator = _full_duplex_request_iterator(test_pb2) responses = stub.FullDuplexCall( @@ -459,7 +461,7 @@ class PythonPluginTest(unittest.TestCase): def testFullDuplexCallFailed(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) request_iterator = _full_duplex_request_iterator(test_pb2) with _CreateService(test_pb2) as (methods, stub): with methods.fail(): @@ -471,7 +473,7 @@ class PythonPluginTest(unittest.TestCase): def testHalfDuplexCall(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) with _CreateService(test_pb2) as (methods, stub): def half_duplex_request_iterator(): request = test_pb2.StreamingOutputCallRequest() @@ -485,13 +487,13 @@ class PythonPluginTest(unittest.TestCase): half_duplex_request_iterator(), test_constants.LONG_TIMEOUT) expected_responses = methods.HalfDuplexCall( half_duplex_request_iterator(), 'not a real RpcContext!') - for check in itertools.izip_longest(expected_responses, responses): + for check in moves.zip_longest(expected_responses, responses): expected_response, response = check self.assertEqual(expected_response, response) def testHalfDuplexCallWedged(self): import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top - reload(test_pb2) + moves.reload_module(test_pb2) condition = threading.Condition() wait_cell = [False] @contextlib.contextmanager diff --git a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py index a6fd82388c..06bfc34977 100644 --- a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py +++ b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -29,11 +29,13 @@ """Tests for the old '_low'.""" -import Queue import threading import time import unittest +import six +from six.moves import queue + from grpc._adapter import _intermediary_low as _low _STREAM_LENGTH = 300 @@ -67,7 +69,7 @@ class LonelyClientTest(unittest.TestCase): second_event = completion_queue.get(after_deadline) self.assertIsNotNone(second_event) kinds = [event.kind for event in (first_event, second_event)] - self.assertItemsEqual( + six.assertCountEqual(self, (_low.Event.Kind.METADATA_ACCEPTED, _low.Event.Kind.FINISH), kinds) @@ -99,7 +101,7 @@ class EchoTest(unittest.TestCase): self.server = _low.Server(self.server_completion_queue) port = self.server.add_http2_addr('[::]:0') self.server.start() - self.server_events = Queue.Queue() + self.server_events = queue.Queue() self.server_completion_queue_thread = threading.Thread( target=_drive_completion_queue, args=(self.server_completion_queue, self.server_events)) @@ -107,7 +109,7 @@ class EchoTest(unittest.TestCase): self.client_completion_queue = _low.CompletionQueue() self.channel = _low.Channel('%s:%d' % (self.host, port), None) - self.client_events = Queue.Queue() + self.client_events = queue.Queue() self.client_completion_queue_thread = threading.Thread( target=_drive_completion_queue, args=(self.client_completion_queue, self.client_events)) @@ -315,7 +317,7 @@ class CancellationTest(unittest.TestCase): self.server = _low.Server(self.server_completion_queue) port = self.server.add_http2_addr('[::]:0') self.server.start() - self.server_events = Queue.Queue() + self.server_events = queue.Queue() self.server_completion_queue_thread = threading.Thread( target=_drive_completion_queue, args=(self.server_completion_queue, self.server_events)) @@ -323,7 +325,7 @@ class CancellationTest(unittest.TestCase): self.client_completion_queue = _low.CompletionQueue() self.channel = _low.Channel('%s:%d' % (self.host, port), None) - self.client_events = Queue.Queue() + self.client_events = queue.Queue() self.client_completion_queue_thread = threading.Thread( target=_drive_completion_queue, args=(self.client_completion_queue, self.client_events)) diff --git a/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py b/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py index fe69e63995..94bcc1428e 100644 --- a/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py +++ b/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py @@ -29,6 +29,8 @@ """Part of the tests of the base interface of RPC Framework.""" +from __future__ import division + import abc import collections import enum @@ -47,8 +49,8 @@ from tests.unit.framework.interfaces.base import test_interfaces # pylint: disa _GROUP = 'base test cases test group' _METHOD = 'base test cases test method' -_PAYLOAD_RANDOM_SECTION_MAXIMUM_SIZE = test_constants.PAYLOAD_SIZE / 20 -_MINIMUM_PAYLOAD_SIZE = test_constants.PAYLOAD_SIZE / 600 +_PAYLOAD_RANDOM_SECTION_MAXIMUM_SIZE = test_constants.PAYLOAD_SIZE // 20 +_MINIMUM_PAYLOAD_SIZE = test_constants.PAYLOAD_SIZE // 600 def _create_payload(randomness): @@ -59,7 +61,7 @@ def _create_payload(randomness): random_section = bytes( bytearray( randomness.getrandbits(8) for _ in range(random_section_length))) - sevens_section = '\x07' * (length - random_section_length) + sevens_section = b'\x07' * (length - random_section_length) return b''.join(randomness.sample((random_section, sevens_section), 2)) @@ -385,13 +387,13 @@ class _SequenceController(Controller): return request + request def deserialize_request(self, serialized_request): - return serialized_request[:len(serialized_request) / 2] + return serialized_request[:len(serialized_request) // 2] def serialize_response(self, response): return response * 3 def deserialize_response(self, serialized_response): - return serialized_response[2 * len(serialized_response) / 3:] + return serialized_response[2 * len(serialized_response) // 3:] def invocation(self): with self._condition: diff --git a/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py b/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py index 530ba4ff0f..936b87f597 100644 --- a/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py +++ b/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py @@ -29,6 +29,8 @@ """Test code for the Face layer of RPC Framework.""" +from __future__ import division + import abc import itertools import unittest @@ -182,7 +184,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest. some_completed_response_futures_iterator = itertools.islice( futures.as_completed(response_futures_to_indices), - test_constants.PARALLELISM / 2) + test_constants.PARALLELISM // 2) for response_future in some_completed_response_futures_iterator: index = response_futures_to_indices[response_future] test_messages.verify(requests[index], response_future.result(), self) diff --git a/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py b/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py index 89f344c289..401b52f614 100644 --- a/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py +++ b/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py @@ -29,6 +29,8 @@ """Test code for the Face layer of RPC Framework.""" +from __future__ import division + import abc import contextlib import itertools @@ -277,7 +279,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest. some_completed_response_futures_iterator = itertools.islice( futures.as_completed(response_futures_to_indices), - test_constants.PARALLELISM / 2) + test_constants.PARALLELISM // 2) for response_future in some_completed_response_futures_iterator: index = response_futures_to_indices[response_future] test_messages.verify(requests[index], response_future.result(), self) diff --git a/templates/composer.json.template b/templates/composer.json.template new file mode 100644 index 0000000000..275b4655ce --- /dev/null +++ b/templates/composer.json.template @@ -0,0 +1,27 @@ +%YAML 1.2 +--- | + { + "name": "grpc/grpc", + "type": "library", + "description": "gRPC library for PHP", + "version": "${settings.php_version.php()}", + "keywords": ["rpc"], + "homepage": "http://grpc.io", + "license": "BSD-3-Clause", + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/stanley-cheung/Protobuf-PHP" + } + ], + "require": { + "php": ">=5.5.0", + "datto/protobuf-php": "dev-master", + "google/auth": "v0.7" + }, + "autoload": { + "psr-4": { + "Grpc\\": "src/php/lib/Grpc/" + } + } + } diff --git a/templates/package.xml.template b/templates/package.xml.template index 8f757401e4..2f498c02f4 100644 --- a/templates/package.xml.template +++ b/templates/package.xml.template @@ -15,8 +15,8 @@ <date>2016-03-01</date> <time>16:06:07</time> <version> - <release>0.14.0</release> - <api>0.14.0</api> + <release>${settings.php_version.php()}</release> + <api>${settings.php_version.php()}</api> </version> <stability> <release>beta</release> @@ -157,8 +157,8 @@ </release> <release> <version> - <release>0.14.0</release> - <api>0.14.0</api> + <release>${settings.php_version.php()}</release> + <api>${settings.php_version.php()}</api> </version> <stability> <release>beta</release> diff --git a/templates/test/core/end2end/end2end_defs.include b/templates/test/core/end2end/end2end_defs.include index 929827e145..461c8eb698 100644 --- a/templates/test/core/end2end/end2end_defs.include +++ b/templates/test/core/end2end/end2end_defs.include @@ -36,7 +36,9 @@ /* This file is auto-generated */ #include "test/core/end2end/end2end_tests.h" + #include <string.h> + #include <grpc/support/log.h> % for test in tests: @@ -64,4 +66,4 @@ void grpc_end2end_tests(int argc, char **argv, gpr_log(GPR_DEBUG, "not a test: '%s'", argv[i]); abort(); } -}</%def>
\ No newline at end of file +}</%def> diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index ba1901301c..c7130f9580 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -36,9 +36,9 @@ #include "src/core/channel/channel_stack.h" #include "src/core/channel/http_server_filter.h" #include "src/core/iomgr/endpoint_pair.h" +#include "src/core/support/string.h" #include "src/core/surface/completion_queue.h" #include "src/core/surface/server.h" -#include "src/core/support/string.h" #include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> @@ -155,9 +155,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/bad_client/tests/badreq.c b/test/core/bad_client/tests/badreq.c index 6d59d25b92..95d46d5731 100644 --- a/test/core/bad_client/tests/badreq.c +++ b/test/core/bad_client/tests/badreq.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #include <string.h> -#include "test/core/end2end/cq_verifier.h" #include "src/core/surface/server.h" +#include "test/core/end2end/cq_verifier.h" #define PFX_STR \ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ @@ -45,9 +45,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/connection_prefix.c b/test/core/bad_client/tests/connection_prefix.c index 66ff8c2936..000ecca6c6 100644 --- a/test/core/bad_client/tests/connection_prefix.c +++ b/test/core/bad_client/tests/connection_prefix.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,15 +31,15 @@ * */ -#include "test/core/bad_client/bad_client.h" #include "src/core/surface/server.h" +#include "test/core/bad_client/bad_client.h" static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/headers.c b/test/core/bad_client/tests/headers.c index 2186a4ffcb..4ecdb64139 100644 --- a/test/core/bad_client/tests/headers.c +++ b/test/core/bad_client/tests/headers.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include "test/core/bad_client/bad_client.h" #include "src/core/surface/server.h" +#include "test/core/bad_client/bad_client.h" #define PFX_STR \ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ @@ -41,9 +41,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/initial_settings_frame.c b/test/core/bad_client/tests/initial_settings_frame.c index fb6149cc3b..2104892766 100644 --- a/test/core/bad_client/tests/initial_settings_frame.c +++ b/test/core/bad_client/tests/initial_settings_frame.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include "test/core/bad_client/bad_client.h" #include "src/core/surface/server.h" +#include "test/core/bad_client/bad_client.h" #define PFX_STR "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" #define ONE_SETTING_HDR "\x00\x00\x06\x04\x00\x00\x00\x00\x00" @@ -40,9 +40,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/server_registered_method.c b/test/core/bad_client/tests/server_registered_method.c index dc6ecc51f0..d280804687 100644 --- a/test/core/bad_client/tests/server_registered_method.c +++ b/test/core/bad_client/tests/server_registered_method.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #include <string.h> -#include "test/core/end2end/cq_verifier.h" #include "src/core/surface/server.h" +#include "test/core/end2end/cq_verifier.h" #define PFX_STR \ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ diff --git a/test/core/bad_client/tests/simple_request.c b/test/core/bad_client/tests/simple_request.c index c04319edc5..e535be1527 100644 --- a/test/core/bad_client/tests/simple_request.c +++ b/test/core/bad_client/tests/simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #include <string.h> -#include "test/core/end2end/cq_verifier.h" #include "src/core/surface/server.h" +#include "test/core/end2end/cq_verifier.h" #define PFX_STR \ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ @@ -108,9 +108,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, static void failure_verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/unknown_frame.c b/test/core/bad_client/tests/unknown_frame.c index 2ef340eeb5..729a6d9a75 100644 --- a/test/core/bad_client/tests/unknown_frame.c +++ b/test/core/bad_client/tests/unknown_frame.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include "test/core/bad_client/bad_client.h" #include "src/core/surface/server.h" +#include "test/core/bad_client/bad_client.h" #define PFX_STR \ "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" \ @@ -41,9 +41,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } diff --git a/test/core/bad_client/tests/window_overflow.c b/test/core/bad_client/tests/window_overflow.c index 646d5c5f4c..a9117de36a 100644 --- a/test/core/bad_client/tests/window_overflow.c +++ b/test/core/bad_client/tests/window_overflow.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,9 +60,9 @@ static void verifier(grpc_server *server, grpc_completion_queue *cq, void *registered_method) { while (grpc_server_has_open_connections(server)) { - GPR_ASSERT(grpc_completion_queue_next(cq, - GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT(grpc_completion_queue_next( + cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(20), NULL) + .type == GRPC_QUEUE_TIMEOUT); } } @@ -90,8 +90,15 @@ int main(int argc, char **argv) { addbuf(PFX_STR, sizeof(PFX_STR) - 1); for (i = 0; i < NUM_FRAMES; i++) { - uint8_t hdr[9] = {(uint8_t)(FRAME_SIZE >> 16), (uint8_t)(FRAME_SIZE >> 8), - (uint8_t)FRAME_SIZE, 0, 0, 0, 0, 0, 1}; + uint8_t hdr[9] = {(uint8_t)(FRAME_SIZE >> 16), + (uint8_t)(FRAME_SIZE >> 8), + (uint8_t)FRAME_SIZE, + 0, + 0, + 0, + 0, + 0, + 1}; addbuf(hdr, sizeof(hdr)); for (j = 0; j < MESSAGES_PER_FRAME; j++) { uint8_t message[5] = {0, 0, 0, 0, 0}; diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c index a78a0798ae..e2babfa114 100644 --- a/test/core/bad_ssl/bad_ssl_test.c +++ b/test/core/bad_ssl/bad_ssl_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <string.h> #include <stdio.h> +#include <string.h> #include <grpc/grpc.h> #include <grpc/grpc_security.h> @@ -41,9 +41,10 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/subprocess.h> +#include "src/core/support/env.h" #include "src/core/support/string.h" -#include "test/core/util/port.h" #include "test/core/end2end/cq_verifier.h" +#include "test/core/util/port.h" #include "test/core/util/test_config.h" static void *tag(intptr_t t) { return (void *)t; } @@ -144,6 +145,9 @@ int main(int argc, char **argv) { } else { strcpy(root, "."); } + if (argc == 2) { + gpr_setenv("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", argv[1]); + } /* figure out our test name */ tmp = lunder - 1; while (*tmp != '_') tmp--; diff --git a/test/core/channel/channel_stack_test.c b/test/core/channel/channel_stack_test.c index e19e9a57ae..c4c288d736 100644 --- a/test/core/channel/channel_stack_test.c +++ b/test/core/channel/channel_stack_test.c @@ -92,10 +92,17 @@ static void free_call(grpc_exec_ctx *exec_ctx, void *arg, bool success) { } static void test_create_channel_stack(void) { - const grpc_channel_filter filter = { - call_func, channel_func, sizeof(int), call_init_func, - grpc_call_stack_ignore_set_pollset, call_destroy_func, sizeof(int), - channel_init_func, channel_destroy_func, get_peer, "some_test_filter"}; + const grpc_channel_filter filter = {call_func, + channel_func, + sizeof(int), + call_init_func, + grpc_call_stack_ignore_set_pollset, + call_destroy_func, + sizeof(int), + channel_init_func, + channel_destroy_func, + get_peer, + "some_test_filter"}; const grpc_channel_filter *filters = &filter; grpc_channel_stack *channel_stack; grpc_call_stack *call_stack; diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index 1ea0c423c1..91fa63ea97 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -139,8 +139,9 @@ static void kill_server(const servers_fixture *f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %d", i); GPR_ASSERT(f->servers[i] != NULL); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT( + grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); f->servers[i] = NULL; } @@ -206,8 +207,8 @@ static void teardown_servers(servers_fixture *f) { if (f->servers[i] == NULL) continue; grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), - n_millis_time(5000), - NULL).type == GRPC_OP_COMPLETE); + n_millis_time(5000), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); } grpc_completion_queue_shutdown(f->cq); @@ -304,9 +305,10 @@ static int *perform_request(servers_fixture *f, grpc_channel *client, grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL)); s_idx = -1; - while ((ev = grpc_completion_queue_next( - f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10 * RETRY_TIMEOUT), - NULL)).type != GRPC_QUEUE_TIMEOUT) { + while ( + (ev = grpc_completion_queue_next( + f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(10 * RETRY_TIMEOUT), NULL)) + .type != GRPC_QUEUE_TIMEOUT) { GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); read_tag = ((int)(intptr_t)ev.tag); gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", @@ -378,9 +380,10 @@ static int *perform_request(servers_fixture *f, grpc_channel *client, } } - GPR_ASSERT(grpc_completion_queue_next( - f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(2 * RETRY_TIMEOUT), - NULL).type == GRPC_QUEUE_TIMEOUT); + GPR_ASSERT( + grpc_completion_queue_next( + f->cq, GRPC_TIMEOUT_MILLIS_TO_DEADLINE(2 * RETRY_TIMEOUT), NULL) + .type == GRPC_QUEUE_TIMEOUT); grpc_metadata_array_destroy(&rdata->initial_metadata_recv); grpc_metadata_array_destroy(&rdata->trailing_metadata_recv); diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c index 724d419a7a..3687f7caf4 100644 --- a/test/core/end2end/cq_verifier.c +++ b/test/core/end2end/cq_verifier.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,8 +37,6 @@ #include <stdio.h> #include <string.h> -#include "src/core/surface/event_string.h" -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/byte_buffer_reader.h> #include <grpc/support/alloc.h> @@ -46,6 +44,8 @@ #include <grpc/support/string_util.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" +#include "src/core/surface/event_string.h" #define ROOT_EXPECTATION 1000 diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c index 58e13a4098..77589a7eee 100644 --- a/test/core/end2end/dualstack_socket_test.c +++ b/test/core/end2end/dualstack_socket_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,9 +39,9 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include "src/core/support/string.h" #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/socket_utils_posix.h" +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" #include "test/core/util/port.h" @@ -249,9 +249,9 @@ void test_connect(const char *server_host, const char *client_host, int port, /* Destroy server. */ grpc_server_shutdown_and_notify(server, cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(server); grpc_completion_queue_shutdown(cq); drain_cq(cq); diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 17dc190d14..b8934512c6 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -35,7 +35,9 @@ /* This file is auto-generated */ #include "test/core/end2end/end2end_tests.h" + #include <string.h> + #include <grpc/support/log.h> extern void bad_hostname(grpc_end2end_test_config config); diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 6f2f5aff78..f0969794c6 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -35,7 +35,9 @@ /* This file is auto-generated */ #include "test/core/end2end/end2end_tests.h" + #include <string.h> + #include <grpc/support/log.h> extern void bad_hostname(grpc_end2end_test_config config); diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c index e74c9ae243..4d89a8f8c3 100644 --- a/test/core/end2end/fixtures/h2_census.c +++ b/test/core/end2end/fixtures/h2_census.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +35,12 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/host_port.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> +#include <grpc/support/useful.h> #include "src/core/channel/channel_args.h" #include "src/core/channel/client_channel.h" #include "src/core/channel/connected_channel.h" @@ -42,12 +48,6 @@ #include "src/core/surface/channel.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c index fea8a4f751..19a2495eaf 100644 --- a/test/core/end2end/fixtures/h2_compress.c +++ b/test/core/end2end/fixtures/h2_compress.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,6 +35,12 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/host_port.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> +#include <grpc/support/useful.h> #include "src/core/channel/channel_args.h" #include "src/core/channel/client_channel.h" #include "src/core/channel/connected_channel.h" @@ -42,12 +48,6 @@ #include "src/core/surface/channel.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/host_port.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_fakesec.c b/test/core/end2end/fixtures/h2_fakesec.c index 2767f1df4a..8be8e35b1a 100644 --- a/test/core/end2end/fixtures/h2_fakesec.c +++ b/test/core/end2end/fixtures/h2_fakesec.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,14 +36,14 @@ #include <stdio.h> #include <string.h> -#include "src/core/channel/channel_args.h" -#include "src/core/security/credentials.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> -#include "test/core/util/test_config.h" -#include "test/core/util/port.h" +#include "src/core/channel/channel_args.h" +#include "src/core/security/credentials.h" #include "test/core/end2end/data/ssl_test_data.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" typedef struct fullstack_secure_fixture_data { char *localaddr; diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c index 4b93581899..f2d72f0445 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.c +++ b/test/core/end2end/fixtures/h2_full+pipe.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,21 +35,21 @@ #include <string.h> -#include "src/core/channel/client_channel.h" -#include "src/core/channel/connected_channel.h" -#include "src/core/channel/http_server_filter.h" -#include "src/core/surface/channel.h" -#include "src/core/surface/server.h" -#include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include "src/core/channel/client_channel.h" +#include "src/core/channel/connected_channel.h" +#include "src/core/channel/http_server_filter.h" +#include "src/core/iomgr/wakeup_fd_posix.h" +#include "src/core/surface/channel.h" +#include "src/core/surface/server.h" +#include "src/core/transport/chttp2_transport.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "src/core/iomgr/wakeup_fd_posix.h" typedef struct fullstack_fixture_data { char *localaddr; diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c index 042ee212d7..c84bd72530 100644 --- a/test/core/end2end/fixtures/h2_full+trace.c +++ b/test/core/end2end/fixtures/h2_full+trace.c @@ -35,21 +35,21 @@ #include <string.h> -#include "src/core/channel/client_channel.h" -#include "src/core/channel/connected_channel.h" -#include "src/core/channel/http_server_filter.h" -#include "src/core/surface/channel.h" -#include "src/core/surface/server.h" -#include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include "src/core/channel/client_channel.h" +#include "src/core/channel/connected_channel.h" +#include "src/core/channel/http_server_filter.h" +#include "src/core/support/env.h" +#include "src/core/surface/channel.h" +#include "src/core/surface/server.h" +#include "src/core/transport/chttp2_transport.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "src/core/support/env.h" typedef struct fullstack_fixture_data { char *localaddr; diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c index ebaa1c6a2c..c56d2fc073 100644 --- a/test/core/end2end/fixtures/h2_full.c +++ b/test/core/end2end/fixtures/h2_full.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,18 +35,18 @@ #include <string.h> -#include "src/core/channel/client_channel.h" -#include "src/core/channel/connected_channel.h" -#include "src/core/channel/http_server_filter.h" -#include "src/core/surface/channel.h" -#include "src/core/surface/server.h" -#include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include "src/core/channel/client_channel.h" +#include "src/core/channel/connected_channel.h" +#include "src/core/channel/http_server_filter.h" +#include "src/core/surface/channel.h" +#include "src/core/surface/server.h" +#include "src/core/transport/chttp2_transport.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_oauth2.c b/test/core/end2end/fixtures/h2_oauth2.c index e2c82917ef..279061b99e 100644 --- a/test/core/end2end/fixtures/h2_oauth2.c +++ b/test/core/end2end/fixtures/h2_oauth2.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,15 +36,15 @@ #include <stdio.h> #include <string.h> -#include "src/core/channel/channel_args.h" -#include "src/core/iomgr/iomgr.h" -#include "src/core/security/credentials.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> -#include "test/core/util/test_config.h" -#include "test/core/util/port.h" +#include "src/core/channel/channel_args.h" +#include "src/core/iomgr/iomgr.h" +#include "src/core/security/credentials.h" #include "test/core/end2end/data/ssl_test_data.h" +#include "test/core/util/port.h" +#include "test/core/util/test_config.h" static const char oauth2_md[] = "Bearer aaslkfjs424535asdf"; static const char *client_identity_property_name = "smurf_name"; diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c index 8bcc1b6ee0..1e9aa624e3 100644 --- a/test/core/end2end/fixtures/h2_proxy.c +++ b/test/core/end2end/fixtures/h2_proxy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,18 +35,18 @@ #include <string.h> -#include "src/core/channel/client_channel.h" -#include "src/core/channel/connected_channel.h" -#include "src/core/channel/http_server_filter.h" -#include "src/core/surface/channel.h" -#include "src/core/surface/server.h" -#include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include "src/core/channel/client_channel.h" +#include "src/core/channel/connected_channel.h" +#include "src/core/channel/http_server_filter.h" +#include "src/core/surface/channel.h" +#include "src/core/surface/server.h" +#include "src/core/transport/chttp2_transport.h" #include "test/core/end2end/fixtures/proxy.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c index 482aa8dba8..33068721fa 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.c +++ b/test/core/end2end/fixtures/h2_sockpair+trace.c @@ -35,22 +35,22 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> +#include <grpc/support/useful.h> #include "src/core/channel/client_channel.h" +#include "src/core/channel/compress_filter.h" #include "src/core/channel/connected_channel.h" #include "src/core/channel/http_client_filter.h" #include "src/core/channel/http_server_filter.h" -#include "src/core/channel/compress_filter.h" #include "src/core/iomgr/endpoint_pair.h" #include "src/core/iomgr/iomgr.h" #include "src/core/support/env.h" #include "src/core/surface/channel.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c index cf1c4ac2ae..d64c85aea8 100644 --- a/test/core/end2end/fixtures/h2_sockpair.c +++ b/test/core/end2end/fixtures/h2_sockpair.c @@ -35,6 +35,11 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> +#include <grpc/support/useful.h> #include "src/core/channel/client_channel.h" #include "src/core/channel/compress_filter.h" #include "src/core/channel/connected_channel.h" @@ -45,11 +50,6 @@ #include "src/core/surface/channel.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c index f49938c619..67180a5edb 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.c +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c @@ -35,21 +35,21 @@ #include <string.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> +#include <grpc/support/sync.h> +#include <grpc/support/thd.h> +#include <grpc/support/useful.h> #include "src/core/channel/client_channel.h" +#include "src/core/channel/compress_filter.h" #include "src/core/channel/connected_channel.h" #include "src/core/channel/http_client_filter.h" #include "src/core/channel/http_server_filter.h" -#include "src/core/channel/compress_filter.h" #include "src/core/iomgr/endpoint_pair.h" #include "src/core/iomgr/iomgr.h" #include "src/core/surface/channel.h" #include "src/core/surface/server.h" #include "src/core/transport/chttp2_transport.h" -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> -#include <grpc/support/sync.h> -#include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl+poll.c b/test/core/end2end/fixtures/h2_ssl+poll.c index 66268c77d5..4c3bc64197 100644 --- a/test/core/end2end/fixtures/h2_ssl+poll.c +++ b/test/core/end2end/fixtures/h2_ssl+poll.c @@ -44,8 +44,8 @@ #include "src/core/iomgr/pollset_posix.h" #include "src/core/security/credentials.h" #include "src/core/support/env.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl.c b/test/core/end2end/fixtures/h2_ssl.c index e21a3477df..6a4e8dcb37 100644 --- a/test/core/end2end/fixtures/h2_ssl.c +++ b/test/core/end2end/fixtures/h2_ssl.c @@ -43,8 +43,8 @@ #include "src/core/channel/channel_args.h" #include "src/core/security/credentials.h" #include "src/core/support/env.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.c b/test/core/end2end/fixtures/h2_ssl_proxy.c index 6340d3f403..f5fcb91812 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.c +++ b/test/core/end2end/fixtures/h2_ssl_proxy.c @@ -43,8 +43,8 @@ #include "src/core/channel/channel_args.h" #include "src/core/security/credentials.h" #include "src/core/support/env.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "test/core/end2end/data/ssl_test_data.h" #include "test/core/end2end/fixtures/proxy.h" #include "test/core/util/port.h" diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c index 30928270e5..3228c055a0 100644 --- a/test/core/end2end/fixtures/h2_uds.c +++ b/test/core/end2end/fixtures/h2_uds.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,13 +37,6 @@ #include <string.h> #include <unistd.h> -#include "src/core/channel/client_channel.h" -#include "src/core/channel/connected_channel.h" -#include "src/core/channel/http_server_filter.h" -#include "src/core/support/string.h" -#include "src/core/surface/channel.h" -#include "src/core/surface/server.h" -#include "src/core/transport/chttp2_transport.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/log.h> @@ -51,6 +44,13 @@ #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/useful.h> +#include "src/core/channel/client_channel.h" +#include "src/core/channel/connected_channel.h" +#include "src/core/channel/http_server_filter.h" +#include "src/core/support/string.h" +#include "src/core/surface/channel.h" +#include "src/core/surface/server.h" +#include "src/core/transport/chttp2_transport.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c index 2fa1a0a108..642b044ed8 100644 --- a/test/core/end2end/invalid_call_argument_test.c +++ b/test/core/end2end/invalid_call_argument_test.c @@ -63,7 +63,7 @@ struct test_state { static struct test_state g_state; static void prepare_test(int is_client) { - int port; + int port = grpc_pick_unused_port_or_die(); char *server_hostport; grpc_op *op; g_state.is_client = is_client; @@ -85,7 +85,6 @@ static void prepare_test(int is_client) { } else { g_state.server = grpc_server_create(NULL, NULL); grpc_server_register_completion_queue(g_state.server, g_state.cq, NULL); - port = grpc_pick_unused_port_or_die(); gpr_join_host_port(&server_hostport, "0.0.0.0", port); grpc_server_add_insecure_http2_port(g_state.server, server_hostport); grpc_server_start(g_state.server); @@ -131,15 +130,16 @@ static void cleanup_test() { grpc_server_shutdown_and_notify(g_state.server, g_state.cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(g_state.cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(g_state.server); grpc_call_details_destroy(&g_state.call_details); grpc_metadata_array_destroy(&g_state.server_initial_metadata_recv); } grpc_completion_queue_shutdown(g_state.cq); while (grpc_completion_queue_next(g_state.cq, - gpr_inf_future(GPR_CLOCK_REALTIME), - NULL).type != GRPC_QUEUE_SHUTDOWN) + gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(g_state.cq); } diff --git a/test/core/end2end/no_server_test.c b/test/core/end2end/no_server_test.c index 5c971eac6a..c1be55df13 100644 --- a/test/core/end2end/no_server_test.c +++ b/test/core/end2end/no_server_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,8 +88,9 @@ int main(int argc, char **argv) { GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED); grpc_completion_queue_shutdown(cq); - while (grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL).type != GRPC_QUEUE_SHUTDOWN) + while ( + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); grpc_call_destroy(call); diff --git a/test/core/end2end/tests/bad_hostname.c b/test/core/end2end/tests/bad_hostname.c index 14587389c7..fe7a275244 100644 --- a/test/core/end2end/tests/bad_hostname.c +++ b/test/core/end2end/tests/bad_hostname.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c index 4eccd16c4c..a4f4afac65 100644 --- a/test/core/end2end/tests/binary_metadata.c +++ b/test/core/end2end/tests/binary_metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c index c9d4251b68..417f7e82bd 100644 --- a/test/core/end2end/tests/call_creds.c +++ b/test/core/end2end/tests/call_creds.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,15 +36,15 @@ #include <stdio.h> #include <string.h> -#include <grpc/grpc_security.h> #include <grpc/byte_buffer.h> +#include <grpc/grpc_security.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> -#include "test/core/end2end/cq_verifier.h" #include "src/core/security/credentials.h" #include "src/core/support/string.h" +#include "test/core/end2end/cq_verifier.h" static const char iam_token[] = "token"; static const char iam_selector[] = "selector"; @@ -93,9 +93,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c index 4646bf7bca..2025f1191f 100644 --- a/test/core/end2end/tests/cancel_after_accept.c +++ b/test/core/end2end/tests/cancel_after_accept.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c index 364598a76a..bc958a6ff3 100644 --- a/test/core/end2end/tests/cancel_after_client_done.c +++ b/test/core/end2end/tests/cancel_after_client_done.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c index ec0b0dea4c..5bab10e030 100644 --- a/test/core/end2end/tests/cancel_after_invoke.c +++ b/test/core/end2end/tests/cancel_after_invoke.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c index 7b432fe87e..8c0becd1c8 100644 --- a/test/core/end2end/tests/cancel_before_invoke.c +++ b/test/core/end2end/tests/cancel_before_invoke.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.c b/test/core/end2end/tests/cancel_in_a_vacuum.c index 214ab2b9e8..7bea7d7e65 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 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index 1541ca099f..135bdf026c 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c index 33b1d8f9fe..c9092e3394 100644 --- a/test/core/end2end/tests/compressed_payload.c +++ b/test/core/end2end/tests/compressed_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,10 +43,10 @@ #include <grpc/support/time.h> #include <grpc/support/useful.h> -#include "test/core/end2end/cq_verifier.h" #include "src/core/channel/channel_args.h" #include "src/core/channel/compress_filter.h" #include "src/core/surface/call_test_only.h" +#include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -80,9 +80,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/default_host.c b/test/core/end2end/tests/default_host.c index dc3303436b..5455428144 100644 --- a/test/core/end2end/tests/default_host.c +++ b/test/core/end2end/tests/default_host.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/empty_batch.c b/test/core/end2end/tests/empty_batch.c index 24320c0f32..53b5ca5e6b 100644 --- a/test/core/end2end/tests/empty_batch.c +++ b/test/core/end2end/tests/empty_batch.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/high_initial_seqno.c b/test/core/end2end/tests/high_initial_seqno.c index 8d16ef5f5e..72007821c8 100644 --- a/test/core/end2end/tests/high_initial_seqno.c +++ b/test/core/end2end/tests/high_initial_seqno.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,9 +79,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/hpack_size.c b/test/core/end2end/tests/hpack_size.c index fd4fe3419f..189131870e 100644 --- a/test/core/end2end/tests/hpack_size.c +++ b/test/core/end2end/tests/hpack_size.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -262,9 +262,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c index f0b019821d..7f03ebbc6f 100644 --- a/test/core/end2end/tests/invoke_large_request.c +++ b/test/core/end2end/tests/invoke_large_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,9 +73,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c index 1b41e89b26..4b77974470 100644 --- a/test/core/end2end/tests/large_metadata.c +++ b/test/core/end2end/tests/large_metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/max_concurrent_streams.c b/test/core/end2end/tests/max_concurrent_streams.c index d6b2a06f9b..05472bf19e 100644 --- a/test/core/end2end/tests/max_concurrent_streams.c +++ b/test/core/end2end/tests/max_concurrent_streams.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c index 59ab7f476c..2202306325 100644 --- a/test/core/end2end/tests/max_message_length.c +++ b/test/core/end2end/tests/max_message_length.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index 2109310634..5de82c9795 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/no_op.c b/test/core/end2end/tests/no_op.c index 4bc1d631d1..efcd496071 100644 --- a/test/core/end2end/tests/no_op.c +++ b/test/core/end2end/tests/no_op.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c index bc220cbdc9..74af28ddc3 100644 --- a/test/core/end2end/tests/payload.c +++ b/test/core/end2end/tests/payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c index 8351f508c5..7af01497c5 100644 --- a/test/core/end2end/tests/ping_pong_streaming.c +++ b/test/core/end2end/tests/ping_pong_streaming.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/registered_call.c b/test/core/end2end/tests/registered_call.c index d9d2b19d12..4051ded1f8 100644 --- a/test/core/end2end/tests/registered_call.c +++ b/test/core/end2end/tests/registered_call.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c index 340aba6cdb..f480009f00 100644 --- a/test/core/end2end/tests/request_with_flags.c +++ b/test/core/end2end/tests/request_with_flags.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,9 +76,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c index 1aced6a875..07f9993d24 100644 --- a/test/core/end2end/tests/request_with_payload.c +++ b/test/core/end2end/tests/request_with_payload.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/server_finishes_request.c b/test/core/end2end/tests/server_finishes_request.c index 6bca8d476c..a7d1661f56 100644 --- a/test/core/end2end/tests/server_finishes_request.c +++ b/test/core/end2end/tests/server_finishes_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c index 0afef7503b..e9f5a38c76 100644 --- a/test/core/end2end/tests/simple_delayed_request.c +++ b/test/core/end2end/tests/simple_delayed_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -63,9 +63,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c index c5084a560f..0e214e3770 100644 --- a/test/core/end2end/tests/simple_metadata.c +++ b/test/core/end2end/tests/simple_metadata.c @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 3720cd1631..a8ed79330d 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,13 @@ #include <stdio.h> #include <string.h> -#include "src/core/support/string.h" #include <grpc/byte_buffer.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/support/string.h" #include "test/core/end2end/cq_verifier.h" enum { TIMEOUT = 200000 }; @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c index 78525e9538..03f4f3e79b 100644 --- a/test/core/end2end/tests/trailing_metadata.c +++ b/test/core/end2end/tests/trailing_metadata.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,9 +75,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } diff --git a/test/core/fling/fling_stream_test.c b/test/core/fling/fling_stream_test.c index 78a73372aa..ff3d919b05 100644 --- a/test/core/fling/fling_stream_test.c +++ b/test/core/fling/fling_stream_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,19 +35,19 @@ #define _POSIX_SOURCE #endif -#include <unistd.h> #include <assert.h> -#include <stdio.h> -#include <string.h> #include <signal.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/wait.h> +#include <unistd.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" #include "test/core/util/port.h" int main(int argc, char **argv) { diff --git a/test/core/fling/fling_test.c b/test/core/fling/fling_test.c index cf43ecfd2d..4e16b7f1b4 100644 --- a/test/core/fling/fling_test.c +++ b/test/core/fling/fling_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <string.h> #include <stdio.h> +#include <string.h> #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> diff --git a/test/core/http/format_request_test.c b/test/core/http/format_request_test.c index 67dfd24803..5e2b709f89 100644 --- a/test/core/http/format_request_test.c +++ b/test/core/http/format_request_test.c @@ -142,8 +142,7 @@ static void test_format_post_request_content_type_override(void) { "POST /index.html HTTP/1.0\r\n" "Host: example.com\r\n" "Connection: close\r\n" - "User-Agent: " GRPC_HTTPCLI_USER_AGENT - "\r\n" + "User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n" "x-yz: abc\r\n" "Content-Type: application/x-www-form-urlencoded\r\n" "Content-Length: 11\r\n" diff --git a/test/core/iomgr/fd_conservation_posix_test.c b/test/core/iomgr/fd_conservation_posix_test.c index 401bf70a9e..c38f509b16 100644 --- a/test/core/iomgr/fd_conservation_posix_test.c +++ b/test/core/iomgr/fd_conservation_posix_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,9 +35,9 @@ #include <grpc/support/log.h> -#include "test/core/util/test_config.h" #include "src/core/iomgr/endpoint_pair.h" #include "src/core/iomgr/iomgr.h" +#include "test/core/util/test_config.h" int main(int argc, char **argv) { int i; diff --git a/test/core/iomgr/resolve_address_test.c b/test/core/iomgr/resolve_address_test.c index 56ce091a88..b2a09978e6 100644 --- a/test/core/iomgr/resolve_address_test.c +++ b/test/core/iomgr/resolve_address_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,10 +32,10 @@ */ #include "src/core/iomgr/resolve_address.h" -#include "src/core/iomgr/executor.h" #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> +#include "src/core/iomgr/executor.h" #include "test/core/util/test_config.h" static gpr_timespec test_deadline(void) { diff --git a/test/core/iomgr/timer_list_test.c b/test/core/iomgr/timer_list_test.c index 7a21fdd5c1..955bf44bb6 100644 --- a/test/core/iomgr/timer_list_test.c +++ b/test/core/iomgr/timer_list_test.c @@ -81,9 +81,8 @@ static void add_test(void) { } GPR_ASSERT(!grpc_timer_check( - &exec_ctx, - gpr_time_add(start, gpr_time_from_millis(600, GPR_TIMESPAN)), - NULL)); + &exec_ctx, gpr_time_add(start, gpr_time_from_millis(600, GPR_TIMESPAN)), + NULL)); grpc_exec_ctx_finish(&exec_ctx); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 10)); @@ -101,9 +100,8 @@ static void add_test(void) { } GPR_ASSERT(!grpc_timer_check( - &exec_ctx, - gpr_time_add(start, gpr_time_from_millis(1600, GPR_TIMESPAN)), - NULL)); + &exec_ctx, gpr_time_add(start, gpr_time_from_millis(1600, GPR_TIMESPAN)), + NULL)); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); GPR_ASSERT(cb_called[i][0] == 0); diff --git a/test/core/iomgr/udp_server_test.c b/test/core/iomgr/udp_server_test.c index 365b5c002b..042e936456 100644 --- a/test/core/iomgr/udp_server_test.c +++ b/test/core/iomgr/udp_server_test.c @@ -31,18 +31,18 @@ * */ -#include "src/core/iomgr/iomgr.h" -#include "src/core/iomgr/pollset_posix.h" #include "src/core/iomgr/udp_server.h" #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> +#include "src/core/iomgr/iomgr.h" +#include "src/core/iomgr/pollset_posix.h" #include "test/core/util/test_config.h" -#include <sys/socket.h> #include <netinet/in.h> #include <string.h> +#include <sys/socket.h> #include <unistd.h> #ifdef GRPC_NEED_UDP diff --git a/test/core/json/json_rewrite_test.c b/test/core/json/json_rewrite_test.c index d99cb0dd03..1916d4b86c 100644 --- a/test/core/json/json_rewrite_test.c +++ b/test/core/json/json_rewrite_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #include <stdlib.h> #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> #include <grpc/support/log.h> +#include <grpc/support/useful.h> #include "test/core/util/test_config.h" #include "src/core/json/json_reader.h" diff --git a/test/core/json/json_stream_error_test.c b/test/core/json/json_stream_error_test.c index 400776759d..3b07fcd38e 100644 --- a/test/core/json/json_stream_error_test.c +++ b/test/core/json/json_stream_error_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,8 @@ #include <stdlib.h> #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> #include <grpc/support/log.h> +#include <grpc/support/useful.h> #include "test/core/util/test_config.h" #include "src/core/json/json_reader.h" diff --git a/test/core/json/json_test.c b/test/core/json/json_test.c index cbd96a75fe..db3119af70 100644 --- a/test/core/json/json_test.c +++ b/test/core/json/json_test.c @@ -34,9 +34,9 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include <grpc/support/useful.h> #include "src/core/json/json.h" #include "src/core/support/string.h" @@ -67,7 +67,7 @@ static testing_pair testing_pairs[] = { {"{\"\\ud834\\udd1e\":0}", "{\"\\ud834\\udd1e\":0}"}, /* Testing nested empty containers. */ { - " [ [ ] , { } , [ ] ] ", "[[],{},[]]", + " [ [ ] , { } , [ ] ] ", "[[],{},[]]", }, /* Testing escapes and control chars in key strings. */ {" { \"\\u007f\x7f\\n\\r\\\"\\f\\b\\\\a , b\": 1, \"\": 0 } ", diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index dd1544c27b..7ed3372d5d 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 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,13 +49,13 @@ #endif #include <sys/socket.h> -#include "src/core/iomgr/socket_utils_posix.h" #include <grpc/support/cmdline.h> #include <grpc/support/histogram.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/iomgr/socket_utils_posix.h" typedef struct fd_pair { int read_fd; diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index fd9ccbf45d..3a6b9696ab 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -47,8 +47,8 @@ #include "src/core/http/httpcli.h" #include "src/core/security/json_token.h" #include "src/core/support/env.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "test/core/util/test_config.h" /* -- Mock channel credentials. -- */ diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.c index 609d874fd1..31a56ea723 100644 --- a/test/core/security/security_connector_test.c +++ b/test/core/security/security_connector_test.c @@ -43,8 +43,8 @@ #include "src/core/security/security_connector.h" #include "src/core/security/security_context.h" #include "src/core/support/env.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "src/core/tsi/ssl_transport_security.h" #include "src/core/tsi/transport_security.h" #include "test/core/util/test_config.h" diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index 77cc57d4d6..7cbb0c022b 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -32,9 +32,6 @@ */ #include "src/core/statistics/census_log.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> @@ -42,6 +39,9 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "test/core/util/test_config.h" /* Fills in 'record' of size 'size'. Each byte in record is filled in with the diff --git a/test/core/statistics/census_stub_test.c b/test/core/statistics/census_stub_test.c index 8e409a3726..e734a34f55 100644 --- a/test/core/statistics/census_stub_test.c +++ b/test/core/statistics/census_stub_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,10 +34,10 @@ #include <stdio.h> #include <stdlib.h> -#include "src/core/statistics/census_interface.h" -#include "src/core/statistics/census_rpc_stats.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include "src/core/statistics/census_interface.h" +#include "src/core/statistics/census_rpc_stats.h" #include "test/core/util/test_config.h" /* Tests census noop stubs in a simulated rpc flow */ diff --git a/test/core/statistics/hash_table_test.c b/test/core/statistics/hash_table_test.c index 3b119dbc0c..7ff5bb77ad 100644 --- a/test/core/statistics/hash_table_test.c +++ b/test/core/statistics/hash_table_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,11 +37,11 @@ #include "src/core/statistics/hash_table.h" -#include "src/core/support/murmur_hash.h" -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include "src/core/support/murmur_hash.h" +#include "src/core/support/string.h" #include "test/core/util/test_config.h" static uint64_t hash64(const void *k) { @@ -65,8 +65,8 @@ static void free_data(void *data) { gpr_free(data); } static void test_create_table(void) { /* Create table with uint64 key type */ census_ht *ht = NULL; - census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, - NULL}; + census_ht_option ht_options = { + CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, NULL}; ht = census_ht_create(&ht_options); GPR_ASSERT(ht != NULL); GPR_ASSERT(census_ht_get_size(ht) == 0); @@ -120,8 +120,8 @@ static void test_table_with_int_key(void) { /* Test that there is no memory leak when keys and values are owned by table. */ static void test_value_and_key_deleter(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, - &free_data, &free_data}; + census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, + &cmp_str_keys, &free_data, &free_data}; census_ht *ht = census_ht_create(&opt); census_ht_key key; char *val = NULL; @@ -185,8 +185,8 @@ static void test_simple_add_and_erase(void) { } static void test_insertion_and_deletion_with_high_collision_rate(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, - &cmp_str_keys, NULL, NULL}; + census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, + &cmp_str_keys, NULL, NULL}; census_ht *ht = census_ht_create(&opt); char key_str[1000][GPR_LTOA_MIN_BUFSIZE]; uint64_t val = 0; @@ -209,12 +209,12 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) { } static void test_table_with_string_key(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, NULL, - NULL}; + census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, + &cmp_str_keys, NULL, NULL}; census_ht *ht = census_ht_create(&opt); - const char *keys[] = {"k1", "a", "000", "apple", - "banana_a_long_long_long_banana", "%$", "111", "foo", - "b"}; + const char *keys[] = { + "k1", "a", "000", "apple", "banana_a_long_long_long_banana", + "%$", "111", "foo", "b"}; const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; int i = 0; GPR_ASSERT(ht != NULL); diff --git a/test/core/statistics/rpc_stats_test.c b/test/core/statistics/rpc_stats_test.c index b1d8814cfa..3ece3caaf3 100644 --- a/test/core/statistics/rpc_stats_test.c +++ b/test/core/statistics/rpc_stats_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,15 +33,15 @@ #include <string.h> -#include "src/core/statistics/census_interface.h" -#include "src/core/statistics/census_rpc_stats.h" -#include "src/core/statistics/census_tracing.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/string.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> +#include "src/core/statistics/census_interface.h" +#include "src/core/statistics/census_rpc_stats.h" +#include "src/core/statistics/census_tracing.h" #include "test/core/util/test_config.h" /* Ensure all possible state transitions are called without causing problem */ diff --git a/test/core/statistics/trace_test.c b/test/core/statistics/trace_test.c index 75904040ff..2c64e89ddd 100644 --- a/test/core/statistics/trace_test.c +++ b/test/core/statistics/trace_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,12 +31,9 @@ * */ -#include <string.h> #include <stdio.h> +#include <string.h> -#include "src/core/statistics/census_interface.h" -#include "src/core/statistics/census_tracing.h" -#include "src/core/statistics/census_tracing.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> @@ -44,6 +41,9 @@ #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/statistics/census_interface.h" +#include "src/core/statistics/census_tracing.h" +#include "src/core/statistics/census_tracing.h" #include "test/core/util/test_config.h" /* Ensure all possible state transitions are called without causing problem */ diff --git a/test/core/statistics/window_stats_test.c b/test/core/statistics/window_stats_test.c index 578138fdd2..9ed7ee1fac 100644 --- a/test/core/statistics/window_stats_test.c +++ b/test/core/statistics/window_stats_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,9 +32,9 @@ */ #include "src/core/statistics/window_stats.h" -#include <stdlib.h> #include <grpc/support/log.h> #include <grpc/support/time.h> +#include <stdlib.h> #include "test/core/util/test_config.h" typedef struct test_stat { diff --git a/test/core/support/alloc_test.c b/test/core/support/alloc_test.c index 6bdba8c390..e2d0c16b41 100644 --- a/test/core/support/alloc_test.c +++ b/test/core/support/alloc_test.c @@ -31,8 +31,8 @@ * */ -#include <grpc/support/log.h> #include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include "test/core/util/test_config.h" static void *fake_malloc(size_t size) { return (void *)size; } diff --git a/test/core/support/load_file_test.c b/test/core/support/load_file_test.c index 70189b739d..a14fdc656e 100644 --- a/test/core/support/load_file_test.c +++ b/test/core/support/load_file_test.c @@ -39,8 +39,8 @@ #include <grpc/support/slice.h> #include "src/core/support/load_file.h" -#include "src/core/support/tmpfile.h" #include "src/core/support/string.h" +#include "src/core/support/tmpfile.h" #include "test/core/util/test_config.h" #define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x) diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c index d311eb136a..2121a4c5fa 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.c @@ -33,13 +33,13 @@ /* Test of gpr synchronization support. */ -#include <stdio.h> -#include <stdlib.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> +#include <stdio.h> +#include <stdlib.h> #include "test/core/util/test_config.h" /* ==================Example use of interface=================== diff --git a/test/core/support/thd_test.c b/test/core/support/thd_test.c index 0c176da2d3..771c5104c8 100644 --- a/test/core/support/thd_test.c +++ b/test/core/support/thd_test.c @@ -33,12 +33,12 @@ /* Test of gpr thread support. */ -#include <stdio.h> -#include <stdlib.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> +#include <stdio.h> +#include <stdlib.h> #include "test/core/util/test_config.h" #define NUM_THREADS 300 diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index 6cc3786df1..643e9eada7 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -33,14 +33,14 @@ /* Test of gpr time support. */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "test/core/util/test_config.h" static void to_fp(void *arg, const char *buf, size_t len) { diff --git a/test/core/support/tls_test.c b/test/core/support/tls_test.c index c6fb1a4a26..7b73e5beb7 100644 --- a/test/core/support/tls_test.c +++ b/test/core/support/tls_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,12 +33,12 @@ /* Test of gpr thread local storage support. */ -#include <stdio.h> -#include <stdlib.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/tls.h> +#include <stdio.h> +#include <stdlib.h> #include "test/core/util/test_config.h" #define NUM_THREADS 100 diff --git a/test/core/support/useful_test.c b/test/core/support/useful_test.c index 3665bbf972..08a8cc90a9 100644 --- a/test/core/support/useful_test.c +++ b/test/core/support/useful_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,9 +31,9 @@ * */ -#include <grpc/support/useful.h> -#include <grpc/support/port_platform.h> #include <grpc/support/log.h> +#include <grpc/support/port_platform.h> +#include <grpc/support/useful.h> #include "test/core/util/test_config.h" int main(int argc, char **argv) { diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index c87fbdc897..c8aacdb017 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +31,10 @@ * */ -#include <grpc/byte_buffer_reader.h> #include <grpc/byte_buffer.h> -#include <grpc/support/slice.h> +#include <grpc/byte_buffer_reader.h> #include <grpc/grpc.h> +#include <grpc/support/slice.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> diff --git a/test/core/surface/completion_queue_test.c b/test/core/surface/completion_queue_test.c index ec49840ba8..4f534de0f6 100644 --- a/test/core/surface/completion_queue_test.c +++ b/test/core/surface/completion_queue_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,12 +33,12 @@ #include "src/core/surface/completion_queue.h" -#include "src/core/iomgr/iomgr.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> #include <grpc/support/useful.h> +#include "src/core/iomgr/iomgr.h" #include "test/core/util/test_config.h" #define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x) diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c index d1838075be..815b03c535 100644 --- a/test/core/transport/chttp2/bin_encoder_test.c +++ b/test/core/transport/chttp2/bin_encoder_test.c @@ -39,9 +39,9 @@ * TODO(murgatroid99): Remove this */ #include <grpc/grpc.h> -#include "src/core/support/string.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> +#include "src/core/support/string.h" static int all_ok = 1; diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 4a9d143640..f5de087bac 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,12 +35,12 @@ #include <stdio.h> -#include "src/core/support/string.h" -#include "src/core/transport/chttp2/hpack_parser.h" -#include "src/core/transport/metadata.h" #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/support/string.h" +#include "src/core/transport/chttp2/hpack_parser.h" +#include "src/core/transport/metadata.h" #include "test/core/util/parse_hexstring.h" #include "test/core/util/slice_splitter.h" #include "test/core/util/test_config.h" diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c index 3c5f2e4e31..4c0fa2e2e7 100644 --- a/test/core/transport/chttp2/hpack_table_test.c +++ b/test/core/transport/chttp2/hpack_table_test.c @@ -33,8 +33,8 @@ #include "src/core/transport/chttp2/hpack_table.h" -#include <string.h> #include <stdio.h> +#include <string.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> diff --git a/test/core/util/port_windows.c b/test/core/util/port_windows.c index 77125dde75..4cbedc0aa6 100644 --- a/test/core/util/port_windows.c +++ b/test/core/util/port_windows.c @@ -37,18 +37,18 @@ #include "test/core/util/port.h" +#include <errno.h> #include <process.h> #include <stdio.h> -#include <errno.h> #include <string.h> #include <grpc/grpc.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include "src/core/support/env.h" #include "src/core/http/httpcli.h" #include "src/core/iomgr/sockaddr_utils.h" +#include "src/core/support/env.h" #include "test/core/util/port_server_client.h" #define NUM_RANDOM_PORTS_TO_PICK 100 diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index a629ff5a90..4c6dd6039c 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <grpc/grpc_security.h> #include <grpc++/security/auth_context.h> +#include <grpc/grpc_security.h> #include <gtest/gtest.h> #include "src/cpp/common/secure_auth_context.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 11de646999..123d4947e0 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,10 +31,10 @@ * */ -#include <grpc/grpc_security.h> +#include "src/cpp/common/secure_auth_context.h" #include <grpc++/security/auth_context.h> +#include <grpc/grpc_security.h> #include <gtest/gtest.h> -#include "src/cpp/common/secure_auth_context.h" #include "test/cpp/util/string_ref_helper.h" extern "C" { diff --git a/test/cpp/end2end/hybrid_end2end_test.cc b/test/cpp/end2end/hybrid_end2end_test.cc index c72e20628f..02043a89d3 100644 --- a/test/cpp/end2end/hybrid_end2end_test.cc +++ b/test/cpp/end2end/hybrid_end2end_test.cc @@ -356,7 +356,8 @@ TEST_F(HybridEnd2endTest, AsyncEcho) { TEST_F(HybridEnd2endTest, AsyncEchoRequestStream) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithAsyncMethod_Echo<TestServiceImpl> > + service; SetUpServer(&service, nullptr, nullptr); ResetStub(); std::thread echo_handler_thread( @@ -436,7 +437,8 @@ TEST_F(HybridEnd2endTest, GenericEcho) { TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; SetUpServer(&service, nullptr, &generic_service); ResetStub(); @@ -453,7 +455,8 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream) { // Add a second service with one sync method. TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; TestServiceImplDupPkg dup_service; SetUpServer(&service, &dup_service, &generic_service); @@ -472,7 +475,8 @@ TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_SyncDupService) { // Add a second service with one async method. TEST_F(HybridEnd2endTest, GenericEchoAsyncRequestStream_AsyncDupService) { EchoTestService::WithAsyncMethod_RequestStream< - EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > service; + EchoTestService::WithGenericMethod_Echo<TestServiceImpl> > + service; AsyncGenericService generic_service; duplicate::EchoTestService::AsyncService dup_service; SetUpServer(&service, &dup_service, &generic_service); diff --git a/test/cpp/end2end/test_service_impl.cc b/test/cpp/end2end/test_service_impl.cc index fe29c4afe9..2f5dd6d49e 100644 --- a/test/cpp/end2end/test_service_impl.cc +++ b/test/cpp/end2end/test_service_impl.cc @@ -129,10 +129,9 @@ Status TestServiceImpl::Echo(ServerContext* context, const EchoRequest* request, if (request->has_param() && request->param().echo_metadata()) { const std::multimap<grpc::string_ref, grpc::string_ref>& client_metadata = context->client_metadata(); - for ( - std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator iter = - client_metadata.begin(); - iter != client_metadata.end(); ++iter) { + for (std::multimap<grpc::string_ref, grpc::string_ref>::const_iterator + iter = client_metadata.begin(); + iter != client_metadata.end(); ++iter) { context->AddTrailingMetadata(ToString(iter->first), ToString(iter->second)); } diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index e246c0b0e2..114d715baa 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -318,7 +318,7 @@ class AsyncClientEnd2endTest : public ::testing::Test { TEST_F(AsyncClientEnd2endTest, ThreadStress) { common_.ResetStub(); - std::vector<std::thread*> send_threads, completion_threads; + std::vector<std::thread *> send_threads, completion_threads; for (int i = 0; i < kNumAsyncReceiveThreads; ++i) { completion_threads.push_back(new std::thread( &AsyncClientEnd2endTest_ThreadStress_Test::AsyncCompleteRpc, this)); diff --git a/test/cpp/interop/client.cc b/test/cpp/interop/client.cc index 788adefd24..8b237fe75f 100644 --- a/test/cpp/interop/client.cc +++ b/test/cpp/interop/client.cc @@ -35,11 +35,11 @@ #include <unistd.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include "test/cpp/interop/client_helper.h" #include "test/cpp/interop/interop_client.h" diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index 5caf0f2d1d..029b967801 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -39,13 +39,13 @@ #include <memory> #include <sstream> -#include <grpc/grpc.h> -#include <grpc/support/alloc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> +#include <grpc/grpc.h> +#include <grpc/support/alloc.h> +#include <grpc/support/log.h> #include "src/cpp/client/secure_credentials.h" #include "test/core/security/oauth2_utils.h" diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index 46f6fdac40..514d4fa861 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -48,8 +48,8 @@ #include "src/core/transport/byte_stream.h" #include "src/proto/grpc/testing/empty.grpc.pb.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" #include "test/cpp/interop/client_helper.h" namespace grpc { diff --git a/test/cpp/interop/interop_client.h b/test/cpp/interop/interop_client.h index 3f57f3c733..e6706b5713 100644 --- a/test/cpp/interop/interop_client.h +++ b/test/cpp/interop/interop_client.h @@ -36,8 +36,8 @@ #include <memory> -#include <grpc/grpc.h> #include <grpc++/channel.h> +#include <grpc/grpc.h> #include "src/proto/grpc/testing/messages.grpc.pb.h" #include "src/proto/grpc/testing/test.grpc.pb.h" diff --git a/test/cpp/interop/interop_test.cc b/test/cpp/interop/interop_test.cc index faf6698903..f0fccf4615 100644 --- a/test/cpp/interop/interop_test.cc +++ b/test/cpp/interop/interop_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,14 +35,14 @@ #define _POSIX_SOURCE #endif -#include <unistd.h> #include <assert.h> -#include <stdio.h> -#include <string.h> #include <signal.h> +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/wait.h> +#include <unistd.h> #include <grpc/support/alloc.h> #include <grpc/support/host_port.h> diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc index 79a60cc860..c668edaceb 100644 --- a/test/cpp/interop/reconnect_interop_client.cc +++ b/test/cpp/interop/reconnect_interop_client.cc @@ -34,16 +34,16 @@ #include <memory> #include <sstream> -#include <grpc/grpc.h> -#include <grpc/support/log.h> #include <gflags/gflags.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> -#include "test/cpp/util/create_test_channel.h" -#include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" +#include <grpc/grpc.h> +#include <grpc/support/log.h> #include "src/proto/grpc/testing/empty.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "test/cpp/util/create_test_channel.h" +#include "test/cpp/util/test_config.h" DEFINE_int32(server_control_port, 0, "Server port for control rpcs."); DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection."); diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index 57337e5239..38c2fba9cf 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,9 +36,9 @@ #include <memory> -#include <grpc/compression.h> -#include <grpc++/server_context.h> #include <grpc++/security/server_credentials.h> +#include <grpc++/server_context.h> +#include <grpc/compression.h> namespace grpc { namespace testing { diff --git a/test/cpp/interop/server_main.cc b/test/cpp/interop/server_main.cc index 18ac35d551..8a718701c3 100644 --- a/test/cpp/interop/server_main.cc +++ b/test/cpp/interop/server_main.cc @@ -40,19 +40,19 @@ #include <thread> #include <gflags/gflags.h> -#include <grpc/grpc.h> -#include <grpc/support/log.h> -#include <grpc/support/useful.h> +#include <grpc++/security/server_credentials.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> -#include <grpc++/security/server_credentials.h> +#include <grpc/grpc.h> +#include <grpc/support/log.h> +#include <grpc/support/useful.h> -#include "test/cpp/interop/server_helper.h" -#include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/test.grpc.pb.h" #include "src/proto/grpc/testing/empty.grpc.pb.h" #include "src/proto/grpc/testing/messages.grpc.pb.h" +#include "src/proto/grpc/testing/test.grpc.pb.h" +#include "test/cpp/interop/server_helper.h" +#include "test/cpp/util/test_config.h" DEFINE_bool(use_tls, false, "Whether to use tls."); DEFINE_int32(port, 0, "Server port."); diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 702354dc87..162f7b3778 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -43,12 +43,12 @@ #include <grpc++/impl/thd.h> #include <grpc/support/time.h> +#include "src/proto/grpc/testing/metrics.grpc.pb.h" +#include "src/proto/grpc/testing/metrics.pb.h" #include "test/cpp/interop/interop_client.h" #include "test/cpp/interop/stress_interop_client.h" #include "test/cpp/util/metrics_server.h" #include "test/cpp/util/test_config.h" -#include "src/proto/grpc/testing/metrics.grpc.pb.h" -#include "src/proto/grpc/testing/metrics.pb.h" extern "C" { extern void gpr_default_log(gpr_log_func_args* args); diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 9e9da9909a..dcdb665a9a 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -141,7 +141,8 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function<gpr_timespec()> next_issue_; std::function<std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> start_req_; + CompletionQueue*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncResponseReader<ResponseType>> @@ -359,10 +360,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { State next_state_; std::function<void(grpc::Status, ResponseType*)> callback_; std::function<gpr_timespec()> next_issue_; - std::function< - std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> start_req_; + std::function<std::unique_ptr< + grpc::ClientAsyncReaderWriter<RequestType, ResponseType>>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::ClientAsyncReaderWriter<RequestType, ResponseType>> @@ -491,7 +492,8 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function<gpr_timespec()> next_issue_; std::function<std::unique_ptr<grpc::GenericClientAsyncReaderWriter>( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> start_req_; + CompletionQueue*, void*)> + start_req_; grpc::Status status_; double start_; std::unique_ptr<grpc::GenericClientAsyncReaderWriter> stream_; diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 3af61f7391..1e2e28029e 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -36,8 +36,8 @@ #include <memory> -#include "test/cpp/qps/histogram.h" #include "src/proto/grpc/testing/control.grpc.pb.h" +#include "test/cpp/qps/histogram.h" namespace grpc { namespace testing { diff --git a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc index 77ed11f287..fc06cddfef 100644 --- a/test/cpp/qps/generic_async_streaming_ping_pong_test.cc +++ b/test/cpp/qps/generic_async_streaming_ping_pong_test.cc @@ -62,6 +62,7 @@ static void RunGenericAsyncStreamingPingPong() { ServerConfig server_config; server_config.set_server_type(ASYNC_GENERIC_SERVER); server_config.set_async_server_threads(1); + *server_config.mutable_payload_config() = client_config.payload_config(); const auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2); diff --git a/test/cpp/qps/perf_db_client.h b/test/cpp/qps/perf_db_client.h index ece020aa9b..668083b811 100644 --- a/test/cpp/qps/perf_db_client.h +++ b/test/cpp/qps/perf_db_client.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,17 +31,17 @@ * */ +#include <cfloat> #include <iostream> #include <memory> #include <string> -#include <cfloat> -#include <grpc/grpc.h> -#include <grpc++/support/channel_arguments.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> +#include <grpc++/support/channel_arguments.h> +#include <grpc/grpc.h> #include "src/proto/grpc/testing/perf_db.grpc.pb.h" namespace grpc { diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index 69fb4d75e8..f9bd01b2a1 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -171,6 +171,10 @@ static void QpsDriver() { server_config.set_core_limit(FLAGS_server_core_limit); } + if (FLAGS_bbuf_resp_size >= 0) { + *server_config.mutable_payload_config() = client_config.payload_config(); + } + if (FLAGS_secure_test) { // Set up security params SecurityParams security; diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index d7b3f76e0e..1bfb07013d 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -387,12 +387,14 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config, } std::unique_ptr<Server> CreateAsyncServer(const ServerConfig &config) { - return std::unique_ptr<Server>(new AsyncQpsServerTest< - SimpleRequest, SimpleResponse, BenchmarkService::AsyncService, - grpc::ServerContext>( - config, RegisterBenchmarkService, - &BenchmarkService::AsyncService::RequestUnaryCall, - &BenchmarkService::AsyncService::RequestStreamingCall, ProcessSimpleRPC)); + return std::unique_ptr<Server>( + new AsyncQpsServerTest<SimpleRequest, SimpleResponse, + BenchmarkService::AsyncService, + grpc::ServerContext>( + config, RegisterBenchmarkService, + &BenchmarkService::AsyncService::RequestUnaryCall, + &BenchmarkService::AsyncService::RequestStreamingCall, + ProcessSimpleRPC)); } std::unique_ptr<Server> CreateAsyncGenericServer(const ServerConfig &config) { return std::unique_ptr<Server>( diff --git a/test/cpp/util/benchmark_config.cc b/test/cpp/util/benchmark_config.cc index 3c38221b4c..5c3a4cf35d 100644 --- a/test/cpp/util/benchmark_config.cc +++ b/test/cpp/util/benchmark_config.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <gflags/gflags.h> #include "test/cpp/util/benchmark_config.h" +#include <gflags/gflags.h> DEFINE_bool(enable_log_reporter, true, "Enable reporting of benchmark results through GprLog"); diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc index eb9dabcc2a..bc172e9717 100644 --- a/test/cpp/util/byte_buffer_test.cc +++ b/test/cpp/util/byte_buffer_test.cc @@ -36,8 +36,8 @@ #include <cstring> #include <vector> -#include <grpc/support/slice.h> #include <grpc++/support/slice.h> +#include <grpc/support/slice.h> #include <gtest/gtest.h> namespace grpc { diff --git a/test/cpp/util/cli_call_test.cc b/test/cpp/util/cli_call_test.cc index 5fdf519320..474ac282ce 100644 --- a/test/cpp/util/cli_call_test.cc +++ b/test/cpp/util/cli_call_test.cc @@ -33,18 +33,18 @@ #include "test/cpp/util/cli_call.h" -#include <grpc/grpc.h> #include <grpc++/channel.h> #include <grpc++/client_context.h> #include <grpc++/create_channel.h> #include <grpc++/server.h> #include <grpc++/server_builder.h> #include <grpc++/server_context.h> +#include <grpc/grpc.h> #include <gtest/gtest.h> +#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/core/util/port.h" #include "test/core/util/test_config.h" -#include "src/proto/grpc/testing/echo.grpc.pb.h" #include "test/cpp/util/string_ref_helper.h" using grpc::testing::EchoRequest; diff --git a/test/cpp/util/grpc_cli.cc b/test/cpp/util/grpc_cli.cc index f9b9f0c40a..0b0bc20a35 100644 --- a/test/cpp/util/grpc_cli.cc +++ b/test/cpp/util/grpc_cli.cc @@ -1,6 +1,6 @@ /* - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,11 +65,11 @@ #include <sstream> #include <gflags/gflags.h> -#include <grpc/grpc.h> #include <grpc++/channel.h> #include <grpc++/create_channel.h> #include <grpc++/security/credentials.h> #include <grpc++/support/string_ref.h> +#include <grpc/grpc.h> #include "test/cpp/util/cli_call.h" #include "test/cpp/util/string_ref_helper.h" diff --git a/test/cpp/util/test_config.cc b/test/cpp/util/test_config.cc index e74f8fb14f..c446ae55c7 100644 --- a/test/cpp/util/test_config.cc +++ b/test/cpp/util/test_config.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ * */ -#include <gflags/gflags.h> #include "test/cpp/util/test_config.h" +#include <gflags/gflags.h> // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. diff --git a/test/cpp/util/test_credentials_provider.cc b/test/cpp/util/test_credentials_provider.cc index e314fd6d75..9c09a73115 100644 --- a/test/cpp/util/test_credentials_provider.cc +++ b/test/cpp/util/test_credentials_provider.cc @@ -36,8 +36,8 @@ #include <unordered_map> -#include <grpc/support/sync.h> #include <grpc++/impl/sync.h> +#include <grpc/support/sync.h> #include "test/core/end2end/data/ssl_test_data.h" diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 48c6ce7697..e78c85b43a 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -31,8 +31,8 @@ * */ -#include <grpc/support/time.h> #include <grpc++/support/time.h> +#include <grpc/support/time.h> #include <gtest/gtest.h> using std::chrono::duration_cast; diff --git a/tools/buildgen/plugins/expand_version.py b/tools/buildgen/plugins/expand_version.py index b55e1b15ff..dd77f7af12 100755 --- a/tools/buildgen/plugins/expand_version.py +++ b/tools/buildgen/plugins/expand_version.py @@ -84,6 +84,11 @@ class Version: else: return '%d.%d.%d' % (self.major, self.minor, self.patch) + def php(self): + """Version string in PHP style""" + """PECL does not allow tag in version string""" + return '%d.%d.%d' % (self.major, self.minor, self.patch) + def mako_plugin(dictionary): """Expand version numbers: - for each language, ensure there's a language_version tag in diff --git a/tools/dockerfile/grpc_clang_format/Dockerfile b/tools/dockerfile/grpc_clang_format/Dockerfile index 4b101f6f53..be2ffc58cf 100644 --- a/tools/dockerfile/grpc_clang_format/Dockerfile +++ b/tools/dockerfile/grpc_clang_format/Dockerfile @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -27,9 +27,13 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FROM ubuntu:vivid +FROM ubuntu:wily RUN apt-get update -RUN apt-get -y install clang-format-3.6 +RUN apt-get -y install wget +RUN echo deb http://llvm.org/apt/wily/ llvm-toolchain-wily main >> /etc/apt/sources.list +RUN echo deb-src http://llvm.org/apt/wily/ llvm-toolchain-wily main >> /etc/apt/sources.list +RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key| apt-key add - +RUN apt-get update +RUN apt-get -y install clang-format-3.8 ADD clang_format_all_the_things.sh / CMD ["echo 'Run with tools/distrib/clang_format_code.sh'"] - diff --git a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh index d56bc01831..a50ca17411 100755 --- a/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh +++ b/tools/dockerfile/grpc_clang_format/clang_format_all_the_things.sh @@ -37,7 +37,7 @@ DIRS="src/core src/cpp test/core test/cpp include" GLOB="*.h *.c *.cc" # clang format command -CLANG_FORMAT=clang-format-3.6 +CLANG_FORMAT=clang-format-3.8 files= for dir in $DIRS diff --git a/tools/gce/create_linux_performance_worker.sh b/tools/gce/create_linux_performance_worker.sh new file mode 100755 index 0000000000..720fc80a0d --- /dev/null +++ b/tools/gce/create_linux_performance_worker.sh @@ -0,0 +1,61 @@ +#!/bin/bash +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of 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. + +# Creates a performance worker on GCE. + +set -ex + +cd $(dirname $0) + +CLOUD_PROJECT=grpc-testing +ZONE=us-central1-b # this zone allows 32core machines + +INSTANCE_NAME="${1:-grpc-performance-driver}" +MACHINE_TYPE=n1-standard-32 + +gcloud compute instances create $INSTANCE_NAME \ + --project="$CLOUD_PROJECT" \ + --zone "$ZONE" \ + --machine-type $MACHINE_TYPE \ + --image ubuntu-15-10 \ + --boot-disk-size 300 + +echo 'Created GCE instance, waiting 60 seconds for it to come online.' +sleep 60 + +gcloud compute copy-files \ + --project="$CLOUD_PROJECT" \ + --zone "$ZONE" \ + jenkins_master.pub linux_performance_worker_init.sh ${INSTANCE_NAME}:~ + +gcloud compute ssh \ + --project="$CLOUD_PROJECT" \ + --zone "$ZONE" \ + $INSTANCE_NAME --command "./linux_performance_worker_init.sh" diff --git a/tools/gce/linux_performance_worker_init.sh b/tools/gce/linux_performance_worker_init.sh new file mode 100755 index 0000000000..bae2b51106 --- /dev/null +++ b/tools/gce/linux_performance_worker_init.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of 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. + +# Initializes a fresh GCE VM to become a jenkins linux performance worker. +# You shouldn't run this script on your own, +# use create_linux_performance_worker.sh instead. + +set -ex + +sudo apt-get update + +# Install JRE +sudo apt-get install -y openjdk-7-jre +sudo apt-get install -y unzip lsof + +# Setup jenkins user (or the user will already exist bcuz magic) +sudo adduser jenkins --disabled-password || true + +# Add pubkey of jenkins@grpc-jenkins-master to authorized keys of jenkins@ +# This needs to happen as the last step to prevent Jenkins master from connecting +# to a machine that hasn't been properly setup yet. +cat jenkins_master.pub | sudo tee --append ~jenkins/.ssh/authorized_keys + +sudo apt-get install -y \ + autoconf \ + autotools-dev \ + build-essential \ + bzip2 \ + ccache \ + curl \ + gcc \ + gcc-multilib \ + git \ + gyp \ + lcov \ + libc6 \ + libc6-dbg \ + libc6-dev \ + libgtest-dev \ + libtool \ + make \ + strace \ + pypy \ + python-dev \ + python-pip \ + python-setuptools \ + python-yaml \ + telnet \ + unzip \ + wget \ + zip + +# perftools +sudo apt-get install -y google-perftools libgoogle-perftools-dev + +# C++ dependencies +sudo apt-get install -y libgflags-dev libgtest-dev libc++-dev clang + +# Python dependencies +sudo pip install tabulate +curl -O https://bootstrap.pypa.io/get-pip.py +sudo pypy get-pip.py +sudo pypy -m pip install tabulate + +# Node dependences. +touch .profile +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash +nvm install 0.12 && npm config set cache /tmp/npm-cache + +# C# dependencies (http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives) + +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list +sudo apt-get update +sudo apt-get install -y mono-devel nuget + +# Ruby dependencies +gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 +curl -sSL https://get.rvm.io | bash -s stable --ruby diff --git a/vsprojects/grpc.sln b/vsprojects/grpc.sln index 3f6b337972..851bca0d1c 100644 --- a/vsprojects/grpc.sln +++ b/vsprojects/grpc.sln @@ -92,6 +92,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++", "vcxproj\.\grpc++\ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_codegen_lib", "vcxproj\.\grpc++_codegen_lib\grpc++_codegen_lib.vcxproj", "{AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}" + ProjectSection(myProperties) = preProject + lib = "True" + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_unsecure", "vcxproj\.\grpc++_unsecure\grpc++_unsecure.vcxproj", "{6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}" ProjectSection(myProperties) = preProject lib = "True" @@ -341,6 +346,22 @@ Global {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|Win32.Build.0 = Release-DLL|Win32 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.ActiveCfg = Release-DLL|x64 {C187A093-A0FE-489D-A40A-6E33DE0F9FEB}.Release-DLL|x64.Build.0 = Release-DLL|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|Win32.ActiveCfg = Debug|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|x64.ActiveCfg = Debug|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|Win32.ActiveCfg = Release|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|x64.ActiveCfg = Release|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|Win32.Build.0 = Debug|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|x64.Build.0 = Debug|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|Win32.Build.0 = Release|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|x64.Build.0 = Release|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug-DLL|x64.Build.0 = Debug|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release-DLL|Win32.Build.0 = Release|Win32 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release-DLL|x64.ActiveCfg = Release|x64 + {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release-DLL|x64.Build.0 = Release|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|Win32.ActiveCfg = Debug|Win32 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Debug|x64.ActiveCfg = Debug|x64 {6EE56155-DF7C-4F6E-BFC4-F6F776BEB211}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/grpc_protoc_plugins.sln b/vsprojects/grpc_protoc_plugins.sln index 9471aae138..444cb268d0 100644 --- a/vsprojects/grpc_protoc_plugins.sln +++ b/vsprojects/grpc_protoc_plugins.sln @@ -8,11 +8,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_codegen_lib", "vcxproj lib = "True" EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc++_codegen_lib", "vcxproj\.\grpc++_codegen_lib\grpc++_codegen_lib.vcxproj", "{AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}" - ProjectSection(myProperties) = preProject - lib = "True" - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grpc_plugin_support", "vcxproj\.\grpc_plugin_support\grpc_plugin_support.vcxproj", "{B6E81D84-2ACB-41B8-8781-493A944C7817}" ProjectSection(myProperties) = preProject lib = "True" @@ -77,14 +72,6 @@ Global {A828FD72-44CE-4EA5-8966-6E4624458D58}.Debug|x64.Build.0 = Debug|x64 {A828FD72-44CE-4EA5-8966-6E4624458D58}.Release|Win32.Build.0 = Release|Win32 {A828FD72-44CE-4EA5-8966-6E4624458D58}.Release|x64.Build.0 = Release|x64 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|Win32.ActiveCfg = Debug|Win32 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|x64.ActiveCfg = Debug|x64 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|Win32.ActiveCfg = Release|Win32 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|x64.ActiveCfg = Release|x64 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|Win32.Build.0 = Debug|Win32 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Debug|x64.Build.0 = Debug|x64 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|Win32.Build.0 = Release|Win32 - {AAC6AF12-94C8-4A3C-A1BF-DAA4738F4500}.Release|x64.Build.0 = Release|x64 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|Win32.ActiveCfg = Debug|Win32 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Debug|x64.ActiveCfg = Debug|x64 {B6E81D84-2ACB-41B8-8781-493A944C7817}.Release|Win32.ActiveCfg = Release|Win32 |