Skip to content

Commit

Permalink
Merge github.com:grpc/grpc into hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Apr 18, 2017
2 parents c3666d7 + 6b4435c commit a12c065
Show file tree
Hide file tree
Showing 101 changed files with 2,410 additions and 1,018 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,13 @@ gdb.txt

# ctags file
tags

# perf data
perf.data
perf.data.old

# bm_diff
bm_diff_new/
bm_diff_old/
bm_*.json

32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ add_dependencies(buildtests_c error_test)
if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c ev_epoll_linux_test)
endif()
add_dependencies(buildtests_c fake_resolver_test)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_dependencies(buildtests_c fd_conservation_posix_test)
endif()
Expand Down Expand Up @@ -5444,6 +5445,37 @@ target_link_libraries(ev_epoll_linux_test
)

endif()
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)

add_executable(fake_resolver_test
test/core/client_channel/resolvers/fake_resolver_test.c
)


target_include_directories(fake_resolver_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${BENCHMARK_ROOT_DIR}/include
PRIVATE ${ZLIB_ROOT_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
PRIVATE ${CARES_BUILD_INCLUDE_DIR}
PRIVATE ${CARES_INCLUDE_DIR}
PRIVATE ${CARES_PLATFORM_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)

target_link_libraries(fake_resolver_test
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr_test_util
gpr
)

endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
Expand Down
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,7 @@ dualstack_socket_test: $(BINDIR)/$(CONFIG)/dualstack_socket_test
endpoint_pair_test: $(BINDIR)/$(CONFIG)/endpoint_pair_test
error_test: $(BINDIR)/$(CONFIG)/error_test
ev_epoll_linux_test: $(BINDIR)/$(CONFIG)/ev_epoll_linux_test
fake_resolver_test: $(BINDIR)/$(CONFIG)/fake_resolver_test
fd_conservation_posix_test: $(BINDIR)/$(CONFIG)/fd_conservation_posix_test
fd_posix_test: $(BINDIR)/$(CONFIG)/fd_posix_test
fling_client: $(BINDIR)/$(CONFIG)/fling_client
Expand Down Expand Up @@ -1366,6 +1367,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/endpoint_pair_test \
$(BINDIR)/$(CONFIG)/error_test \
$(BINDIR)/$(CONFIG)/ev_epoll_linux_test \
$(BINDIR)/$(CONFIG)/fake_resolver_test \
$(BINDIR)/$(CONFIG)/fd_conservation_posix_test \
$(BINDIR)/$(CONFIG)/fd_posix_test \
$(BINDIR)/$(CONFIG)/fling_client \
Expand Down Expand Up @@ -1777,6 +1779,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/error_test || ( echo test error_test failed ; exit 1 )
$(E) "[RUN] Testing ev_epoll_linux_test"
$(Q) $(BINDIR)/$(CONFIG)/ev_epoll_linux_test || ( echo test ev_epoll_linux_test failed ; exit 1 )
$(E) "[RUN] Testing fake_resolver_test"
$(Q) $(BINDIR)/$(CONFIG)/fake_resolver_test || ( echo test fake_resolver_test failed ; exit 1 )
$(E) "[RUN] Testing fd_conservation_posix_test"
$(Q) $(BINDIR)/$(CONFIG)/fd_conservation_posix_test || ( echo test fd_conservation_posix_test failed ; exit 1 )
$(E) "[RUN] Testing fd_posix_test"
Expand Down Expand Up @@ -9401,6 +9405,38 @@ endif
endif


FAKE_RESOLVER_TEST_SRC = \
test/core/client_channel/resolvers/fake_resolver_test.c \

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

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

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

else



$(BINDIR)/$(CONFIG)/fake_resolver_test: $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(FAKE_RESOLVER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/fake_resolver_test

endif

$(OBJDIR)/$(CONFIG)/test/core/client_channel/resolvers/fake_resolver_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a

deps_fake_resolver_test: $(FAKE_RESOLVER_TEST_OBJS:.o=.dep)

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


FD_CONSERVATION_POSIX_TEST_SRC = \
test/core/iomgr/fd_conservation_posix_test.c \

Expand Down
2 changes: 1 addition & 1 deletion PYTHON-MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ graft include/grpc
graft third_party/boringssl
graft third_party/nanopb
graft third_party/zlib
graft third_party/c-ares
graft third_party/cares
include src/python/grpcio/_spawn_patch.py
include src/python/grpcio/commands.py
include src/python/grpcio/grpc_version.py
Expand Down
10 changes: 10 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1820,6 +1820,16 @@ targets:
- uv
platforms:
- linux
- name: fake_resolver_test
build: test
language: c
src:
- test/core/client_channel/resolvers/fake_resolver_test.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
- name: fd_conservation_posix_test
build: test
language: c
Expand Down
4 changes: 2 additions & 2 deletions doc/server_side_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The contents of the *auth properties* are populated by an *auth interceptor*. Th

WARNING: AuthContext is the only reliable source of truth when it comes to authenticating RPCs. Using any other call/context properties for authentication purposes is wrong and inherently unsafe.

####Example AuthContext contents
#### Example AuthContext contents

For secure channel using mutual TLS authentication with both client and server certificates (test certificates from this repository are used).

Expand Down Expand Up @@ -45,7 +45,7 @@ gRPC comes with some basic "interceptors" already built-in.
WARNING: While there is a public API that allows anyone to write their own custom interceptor, please think twice before using it.
There are legitimate uses for custom interceptors but you should keep in mind that as auth interceptors essentially decide which RPCs are authenticated and which are not, their code is very sensitive from the security perspective and getting things wrong might have serious consequences. If unsure, we strongly recommend to rely on official & proven interceptors that come with gRPC.

####Available auth interceptors
#### Available auth interceptors
- TLS/SSL certificate authentication (built into gRPC's security layer, automatically used whenever you use a secure connection)
- (coming soon) JWT auth token authentication
- more will be added over time
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC in 3 minutes (C++)
# gRPC in 3 minutes (C++)

## Installation

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cpptutorial.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: C++
# gRPC Basics: C++

This tutorial provides a basic C++ programmer's introduction to working with
gRPC. By walking through this example you'll learn how to:
Expand Down
2 changes: 1 addition & 1 deletion examples/csharp/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: C# sample code
# gRPC Basics: C# sample code

The files in this folder are the samples used in [gRPC Basics: C#][],
a detailed tutorial for using gRPC in C#.
Expand Down
2 changes: 1 addition & 1 deletion examples/node/dynamic_codegen/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: Node.js sample code
# gRPC Basics: Node.js sample code

The files in this folder are the samples used in [gRPC Basics: Node.js][], a detailed tutorial for using gRPC in Node.js.

Expand Down
2 changes: 1 addition & 1 deletion examples/node/static_codegen/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: Node.js sample code
# gRPC Basics: Node.js sample code

The files in this folder are the samples used in [gRPC Basics: Node.js][], a detailed tutorial for using gRPC in Node.js.

Expand Down
2 changes: 1 addition & 1 deletion examples/objective-c/auth_sample/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#OAuth2 on gRPC: Objective-C
# OAuth2 on gRPC: Objective-C

This is the supporting code for the tutorial "[OAuth2 on gRPC: Objective-C](http://www.grpc.io/docs/tutorials/auth/oauth2-objective-c.html)."
2 changes: 1 addition & 1 deletion examples/objective-c/helloworld/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC in 3 minutes (Objective-C)
# gRPC in 3 minutes (Objective-C)

## Installation

Expand Down
2 changes: 1 addition & 1 deletion examples/objective-c/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: Objective-C
# gRPC Basics: Objective-C

This is the supporting code for the tutorial "[gRPC Basics: Objective-C](http://www.grpc.io/docs/tutorials/basic/objective-c.html)."

2 changes: 1 addition & 1 deletion examples/php/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: PHP sample code
# gRPC Basics: PHP sample code

The files in this folder are the samples used in [gRPC Basics: PHP][],
a detailed tutorial for using gRPC in PHP.
Expand Down
2 changes: 1 addition & 1 deletion examples/ruby/errors_and_cancellation/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Errors and Cancelletion code samples for grpc-ruby
# Errors and Cancelletion code samples for grpc-ruby

The examples in this directory show use of grpc errors.

Expand Down
2 changes: 1 addition & 1 deletion examples/ruby/route_guide/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#gRPC Basics: Ruby sample code
# gRPC Basics: Ruby sample code

The files in this folder are the samples used in [gRPC Basics: Ruby][],
a detailed tutorial for using gRPC in Ruby.
Expand Down
1 change: 0 additions & 1 deletion grpc.def
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ EXPORTS
grpc_channel_create_registered_call
grpc_call_start_batch
grpc_call_get_peer
grpc_call_set_load_reporting_cost_context
grpc_census_call_set_context
grpc_census_call_get_context
grpc_channel_get_target
Expand Down
3 changes: 2 additions & 1 deletion include/grpc++/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class Server final : public ServerInterface, private GrpcLibraryCodegen {
/// Called before server is started.
virtual void PreServerStart(Server* server) {}
/// Called after a server port is added.
virtual void AddPort(Server* server, int port) {}
virtual void AddPort(Server* server, const grpc::string& addr,
ServerCredentials* creds, int port) {}
};
/// Set the global callback object. Can only be called once. Does not take
/// ownership of callbacks, and expects the pointed to object to be alive
Expand Down
6 changes: 0 additions & 6 deletions include/grpc/grpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,6 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call,
functionality. Instead, use grpc_auth_context. */
GRPCAPI char *grpc_call_get_peer(grpc_call *call);

struct grpc_load_reporting_cost_context;

/* Associate costs contained in \a cost_context to \a call. */
GRPCAPI void grpc_call_set_load_reporting_cost_context(
grpc_call *call, struct grpc_load_reporting_cost_context *context);

struct census_context;

/** Set census context for a call; Must be called before first call to
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 @@ -248,6 +248,8 @@ typedef struct {
/** Secondary user agent: goes at the end of the user-agent metadata
sent on each request. A string. */
#define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
/** The minimum time between subsequent connection attempts, in ms */
#define GRPC_ARG_MIN_RECONNECT_BACKOFF_MS "grpc.min_reconnect_backoff_ms"
/** The maximum time between subsequent connection attempts, in ms */
#define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
/** The time between the first and second connection attempts, in ms */
Expand Down
12 changes: 6 additions & 6 deletions include/grpc/load_reporting.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#define GRPC_LOAD_REPORTING_H

#include <grpc/impl/codegen/port_platform.h>
#include <grpc/slice.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -50,11 +49,12 @@ extern "C" {
* gRPC LB system. */
#define GRPC_LB_TOKEN_MD_KEY "lb-token"

/** A sequence of values for load reporting purposes */
typedef struct grpc_load_reporting_cost_context {
grpc_slice *values;
size_t values_count;
} grpc_load_reporting_cost_context;
/** Metadata key for gRPC LB cost reporting.
*
* The value corresponding to this key is an opaque binary blob reported by the
* backend as part of its trailing metadata containing cost information for the
* call. */
#define GRPC_LB_COST_MD_KEY "lb-cost-bin"

#ifdef __cplusplus
}
Expand Down
6 changes: 3 additions & 3 deletions include/grpc/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ GPRAPI grpc_slice grpc_slice_from_static_string(const char *source);
/* Create a slice pointing to constant memory */
GPRAPI grpc_slice grpc_slice_from_static_buffer(const void *source, size_t len);

/* Return a result slice derived from s, which shares a ref count with s, where
result.data==s.data+begin, and result.length==end-begin.
The ref count of s is increased by one.
/* Return a result slice derived from s, which shares a ref count with \a s,
where result.data==s.data+begin, and result.length==end-begin. The ref count
of \a s is increased by one. Do not assign result back to \a s.
Requires s initialized, begin <= end, begin <= s.length, and
end <= source->length. */
GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
Expand Down
8 changes: 8 additions & 0 deletions src/compiler/python_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ PrivateGenerator::PrivateGenerator(const GeneratorConfiguration& config,
void PrivateGenerator::PrintAllComments(StringVector comments,
grpc_generator::Printer* out) {
if (comments.empty()) {
// Python requires code structures like class and def to have
// a body, even if it is just "pass" or a docstring. We need
// to ensure not to generate empty bodies. We could do something
// smarter and more sophisticated, but at the moment, if there is
// no docstring to print, we simply emit "pass" to ensure validity
// of the generated code.
out->Print("# missing associated documentation comment in .proto file\n");
out->Print("pass\n");
return;
}
out->Print("\"\"\"");
Expand Down
Loading

0 comments on commit a12c065

Please sign in to comment.