Skip to content

Commit

Permalink
Merge branch 'master' of github.com:grpc/grpc into nanopb_build_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dgquintas committed Jun 13, 2018
2 parents 72fda21 + c54f607 commit 4027392
Show file tree
Hide file tree
Showing 74 changed files with 1,269 additions and 3,691 deletions.
6 changes: 6 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
Checks: 'modernize-use-nullptr,google-build-namespaces,google-build-explicit-make-pair,readability-function-size'
WarningsAsErrors: 'modernize-use-nullptr,google-build-namespaces,google-build-explicit-make-pair,readability-function-size'
CheckOptions:
- key: readability-function-size.StatementThreshold
value: '450'
45 changes: 45 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx address_sorting_test)
endif()
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_cxx cancel_ares_query_test)
endif()

add_custom_target(buildtests
DEPENDS buildtests_c buildtests_cxx)
Expand Down Expand Up @@ -16187,6 +16190,48 @@ target_link_libraries(address_sorting_test
${_gRPC_GFLAGS_LIBRARIES}
)

endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)

add_executable(cancel_ares_query_test
test/cpp/naming/cancel_ares_query_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)


target_include_directories(cancel_ares_query_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${_gRPC_SSL_INCLUDE_DIR}
PRIVATE ${_gRPC_PROTOBUF_INCLUDE_DIR}
PRIVATE ${_gRPC_ZLIB_INCLUDE_DIR}
PRIVATE ${_gRPC_BENCHMARK_INCLUDE_DIR}
PRIVATE ${_gRPC_CARES_INCLUDE_DIR}
PRIVATE ${_gRPC_GFLAGS_INCLUDE_DIR}
PRIVATE ${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
PRIVATE third_party/googletest/googletest/include
PRIVATE third_party/googletest/googletest
PRIVATE third_party/googletest/googlemock/include
PRIVATE third_party/googletest/googlemock
PRIVATE ${_gRPC_PROTO_GENS_DIR}
)

target_link_libraries(cancel_ares_query_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc++_test_util
grpc_test_util
gpr_test_util
grpc++
grpc
gpr
grpc++_test_config
${_gRPC_GFLAGS_LIBRARIES}
)

endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
Expand Down
48 changes: 48 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1314,6 +1314,7 @@ resolver_component_tests_runner_invoker_unsecure: $(BINDIR)/$(CONFIG)/resolver_c
resolver_component_tests_runner_invoker: $(BINDIR)/$(CONFIG)/resolver_component_tests_runner_invoker
address_sorting_test_unsecure: $(BINDIR)/$(CONFIG)/address_sorting_test_unsecure
address_sorting_test: $(BINDIR)/$(CONFIG)/address_sorting_test
cancel_ares_query_test: $(BINDIR)/$(CONFIG)/cancel_ares_query_test
alts_credentials_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/alts_credentials_fuzzer_one_entry
api_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/api_fuzzer_one_entry
client_fuzzer_one_entry: $(BINDIR)/$(CONFIG)/client_fuzzer_one_entry
Expand Down Expand Up @@ -1751,6 +1752,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/resolver_component_tests_runner_invoker \
$(BINDIR)/$(CONFIG)/address_sorting_test_unsecure \
$(BINDIR)/$(CONFIG)/address_sorting_test \
$(BINDIR)/$(CONFIG)/cancel_ares_query_test \

else
buildtests_cxx: privatelibs_cxx \
Expand Down Expand Up @@ -1875,6 +1877,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/resolver_component_tests_runner_invoker \
$(BINDIR)/$(CONFIG)/address_sorting_test_unsecure \
$(BINDIR)/$(CONFIG)/address_sorting_test \
$(BINDIR)/$(CONFIG)/cancel_ares_query_test \

endif

Expand Down Expand Up @@ -2360,6 +2363,8 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/address_sorting_test_unsecure || ( echo test address_sorting_test_unsecure failed ; exit 1 )
$(E) "[RUN] Testing address_sorting_test"
$(Q) $(BINDIR)/$(CONFIG)/address_sorting_test || ( echo test address_sorting_test failed ; exit 1 )
$(E) "[RUN] Testing cancel_ares_query_test"
$(Q) $(BINDIR)/$(CONFIG)/cancel_ares_query_test || ( echo test cancel_ares_query_test failed ; exit 1 )


flaky_test_cxx: buildtests_cxx
Expand Down Expand Up @@ -23687,6 +23692,49 @@ endif
endif


CANCEL_ARES_QUERY_TEST_SRC = \
test/cpp/naming/cancel_ares_query_test.cc \

CANCEL_ARES_QUERY_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(CANCEL_ARES_QUERY_TEST_SRC))))
ifeq ($(NO_SECURE),true)

# You can't build secure targets if you don't have OpenSSL.

$(BINDIR)/$(CONFIG)/cancel_ares_query_test: openssl_dep_error

else




ifeq ($(NO_PROTOBUF),true)

# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.

$(BINDIR)/$(CONFIG)/cancel_ares_query_test: protobuf_dep_error

else

$(BINDIR)/$(CONFIG)/cancel_ares_query_test: $(PROTOBUF_DEP) $(CANCEL_ARES_QUERY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(CANCEL_ARES_QUERY_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/cancel_ares_query_test

endif

endif

$(OBJDIR)/$(CONFIG)/test/cpp/naming/cancel_ares_query_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a

deps_cancel_ares_query_test: $(CANCEL_ARES_QUERY_TEST_OBJS:.o=.dep)

ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(CANCEL_ARES_QUERY_TEST_OBJS:.o=.dep)
endif
endif


ALTS_CREDENTIALS_FUZZER_ONE_ENTRY_SRC = \
test/core/security/alts_credentials_fuzzer.cc \
test/core/util/one_corpus_entry_fuzzer.cc \
Expand Down
3 changes: 2 additions & 1 deletion bazel/grpc_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
generate_mocks = generate_mocks,
)

def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = "moderate"):
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = "moderate", tags = []):
copts = []
if language.upper() == "C":
copts = if_not_windows(["-std=c99"])
Expand Down Expand Up @@ -138,6 +138,7 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
poller,
'$(location %s)' % name,
] + args['args'],
tags = tags,
)
else:
native.cc_test(**args)
Expand Down
2 changes: 2 additions & 0 deletions include/grpc/impl/codegen/grpc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ typedef struct {
/** If non-zero, client authority filter is disabled for the channel */
#define GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER \
"grpc.disable_client_authority_filter"
/** If set to zero, disables use of http proxies. Enabled by default. */
#define GRPC_ARG_ENABLE_HTTP_PROXY "grpc.enable_http_proxy"
/** \} */

/** Result of a grpc call. If the caller satisfies the prerequisites of a
Expand Down
29 changes: 26 additions & 3 deletions include/grpcpp/impl/codegen/server_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,35 @@ class ServerInterface : public internal::CallHook {
public:
virtual ~ServerInterface() {}

/// Shutdown the server, blocking until all rpc processing finishes.
/// Forcefully terminate pending calls after \a deadline expires.
/// \a Shutdown does the following things:
///
/// 1. Shutdown the server: deactivate all listening ports, mark it in
/// "shutdown mode" so that further call Request's or incoming RPC matches
/// are no longer allowed. Also return all Request'ed-but-not-yet-active
/// calls as failed (!ok). This refers to calls that have been requested
/// at the server by the server-side library or application code but that
/// have not yet been matched to incoming RPCs from the client. Note that
/// this would even include default calls added automatically by the gRPC
/// C++ API without the user's input (e.g., "Unimplemented RPC method")
///
/// 2. Block until all rpc method handlers invoked automatically by the sync
/// API finish.
///
/// 3. If all pending calls complete (and all their operations are
/// retrieved by Next) before \a deadline expires, this finishes
/// gracefully. Otherwise, forcefully cancel all pending calls associated
/// with the server after \a deadline expires. In the case of the sync API,
/// if the RPC function for a streaming call has already been started and
/// takes a week to complete, the RPC function won't be forcefully
/// terminated (since that would leave state corrupt and incomplete) and
/// the method handler will just keep running (which will prevent the
/// server from completing the "join" operation that it needs to do at
/// shutdown time).
///
/// All completion queue associated with the server (for example, for async
/// serving) must be shutdown *after* this method has returned:
/// See \a ServerBuilder::AddCompletionQueue for details.
/// They must also be drained (by repeated Next) after being shutdown.
///
/// \param deadline How long to wait until pending rpcs are forcefully
/// terminated.
Expand All @@ -63,7 +86,7 @@ class ServerInterface : public internal::CallHook {
ShutdownInternal(TimePoint<T>(deadline).raw_time());
}

/// Shutdown the server, waiting for all rpc processing to finish.
/// Shutdown the server without a deadline and forced cancellation.
///
/// All completion queue associated with the server (for example, for async
/// serving) must be shutdown *after* this method has returned:
Expand Down
2 changes: 2 additions & 0 deletions include/grpcpp/server_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,14 @@ class ServerBuilder {
// Fine control knobs

/// Set max receive message size in bytes.
/// The default is GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH.
ServerBuilder& SetMaxReceiveMessageSize(int max_receive_message_size) {
max_receive_message_size_ = max_receive_message_size;
return *this;
}

/// Set max send message size in bytes.
/// The default is GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH.
ServerBuilder& SetMaxSendMessageSize(int max_send_message_size) {
max_send_message_size_ = max_send_message_size;
return *this;
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/csharp_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ std::string GetCSharpMethodType(MethodType method_type) {
std::string GetServiceNameFieldName() { return "__ServiceName"; }

std::string GetMarshallerFieldName(const Descriptor* message) {
return "__Marshaller_" + message->name();
return "__Marshaller_" +
grpc_generator::StringReplace(message->full_name(), ".", "_", true);
}

std::string GetMethodFieldName(const MethodDescriptor* method) {
Expand Down
13 changes: 13 additions & 0 deletions src/core/ext/filters/client_channel/http_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,24 @@ static char* get_http_proxy_server(char** user_cred) {
return proxy_name;
}

/**
* Checks the value of GRPC_ARG_ENABLE_HTTP_PROXY to determine if http_proxy
* should be used.
*/
bool http_proxy_enabled(const grpc_channel_args* args) {
const grpc_arg* arg =
grpc_channel_args_find(args, GRPC_ARG_ENABLE_HTTP_PROXY);
return grpc_channel_arg_get_bool(arg, true);
}

static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
const char* server_uri,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
if (!http_proxy_enabled(args)) {
return false;
}
char* user_cred = nullptr;
*name_to_resolve = get_http_proxy_server(&user_cred);
if (*name_to_resolve == nullptr) return false;
Expand Down
Loading

0 comments on commit 4027392

Please sign in to comment.