Merge github.com:grpc/grpc into credit

Conflicts:
	build.json
	src/cpp/client/credentials.cc
	vsprojects/vs2013/grpc.vcxproj
	vsprojects/vs2013/grpc.vcxproj.filters
	vsprojects/vs2013/grpc_shared.vcxproj
	vsprojects/vs2013/grpc_shared.vcxproj.filters
	vsprojects/vs2013/grpc_unsecure.vcxproj
	vsprojects/vs2013/grpc_unsecure.vcxproj.filters
pull/835/head
Craig Tiller 10 years ago
commit 01ea61e482
  1. 1
      .travis.yml
  2. 42
      Makefile
  3. 2
      README.md
  4. 20
      build.json
  5. 73
      include/grpc++/status_code_enum.h
  6. 73
      include/grpc/status.h
  7. 196
      src/compiler/python_generator.cc
  8. 2
      src/core/channel/channel_stack.c
  9. 4
      src/core/channel/channel_stack.h
  10. 4
      src/core/channel/connected_channel.c
  11. 63
      src/core/debug/trace.c
  12. 22
      src/core/debug/trace.h
  13. 3
      src/core/iomgr/iomgr_posix.c
  14. 6
      src/core/iomgr/tcp_posix.c
  15. 2
      src/core/iomgr/tcp_posix.h
  16. 6
      src/core/security/secure_endpoint.c
  17. 2
      src/core/security/secure_endpoint.h
  18. 7
      src/core/surface/completion_queue.c
  19. 10
      src/core/surface/init.c
  20. 39
      src/core/surface/init.h
  21. 42
      src/core/surface/init_secure.c
  22. 37
      src/core/surface/init_unsecure.c
  23. 36
      src/core/surface/surface_trace.c
  24. 4
      src/core/surface/surface_trace.h
  25. 3
      src/core/transport/chttp2/frame_settings.c
  26. 47
      src/core/transport/chttp2_transport.c
  27. 2
      src/core/transport/chttp2_transport.h
  28. 4
      src/core/tsi/transport_security.c
  29. 4
      src/core/tsi/transport_security_interface.h
  30. 73
      src/csharp/Grpc.Core/StatusCode.cs
  31. 0
      src/csharp/README.md
  32. 0
      src/php/README.md
  33. 0
      src/php/tests/data/README
  34. 0
      src/python/README.md
  35. 0
      src/python/interop/interop/credentials/README
  36. 3
      src/python/src/setup.py
  37. 0
      src/ruby/README.md
  38. 0
      src/ruby/bin/interop/README.md
  39. 0
      src/ruby/spec/testdata/README
  40. 6
      templates/Makefile.template
  41. 2
      test/compiler/python_plugin_test.py
  42. 2
      test/core/end2end/no_server_test.c
  43. 4
      test/core/fling/server.c
  44. 1
      tools/buildgen/build-cleaner.py
  45. 59
      tools/dockerfile/grpc_csharp_mono/Dockerfile
  46. 53
      tools/dockerfile/grpc_csharp_mono_base/Dockerfile
  47. 5
      tools/run_tests/build_python.sh
  48. 2
      tools/run_tests/run_lcov.sh
  49. 3
      tools/run_tests/run_python.sh
  50. 2
      tools/run_tests/run_tests.py
  51. 4
      tools/run_tests/tests.json
  52. 5
      vsprojects/vs2013/grpc.vcxproj
  53. 9
      vsprojects/vs2013/grpc.vcxproj.filters
  54. 5
      vsprojects/vs2013/grpc_shared.vcxproj
  55. 9
      vsprojects/vs2013/grpc_shared.vcxproj.filters
  56. 5
      vsprojects/vs2013/grpc_unsecure.vcxproj
  57. 9
      vsprojects/vs2013/grpc_unsecure.vcxproj.filters

@ -14,6 +14,7 @@ env:
- CONFIG=opt TEST=c++ - CONFIG=opt TEST=c++
- CONFIG=opt TEST=node - CONFIG=opt TEST=node
- CONFIG=opt TEST=ruby - CONFIG=opt TEST=ruby
- CONFIG=opt TEST=python
script: script:
- rvm use $RUBY_VERSION - rvm use $RUBY_VERSION
- gem install bundler - gem install bundler

@ -2135,7 +2135,7 @@ ifeq ($(INSTALL_OK),true)
@echo "Your system looks ready to go." @echo "Your system looks ready to go."
@echo @echo
else else
@echo "Your system doesn't have protoc 3.0.0+ installed. While this" @echo "We couldn't find protoc 3.0.0+ installed on your system. While this"
@echo "won't prevent grpc from working, you won't be able to compile" @echo "won't prevent grpc from working, you won't be able to compile"
@echo "and run any meaningful code with it." @echo "and run any meaningful code with it."
@echo @echo
@ -2144,7 +2144,8 @@ else
@echo @echo
@echo " https://github.com/google/protobuf/releases" @echo " https://github.com/google/protobuf/releases"
@echo @echo
@echo "Once you've done so, you can re-run this check by doing:" @echo "Once you've done so, or if you think this message is in error,"
@echo "you can re-run this check by doing:"
@echo @echo
@echo " make verify-install" @echo " make verify-install"
endif endif
@ -2348,6 +2349,7 @@ LIBGRPC_SRC = \
src/core/security/secure_transport_setup.c \ src/core/security/secure_transport_setup.c \
src/core/security/security_context.c \ src/core/security/security_context.c \
src/core/security/server_secure_chttp2.c \ src/core/security/server_secure_chttp2.c \
src/core/surface/init_secure.c \
src/core/surface/secure_channel_create.c \ src/core/surface/secure_channel_create.c \
src/core/tsi/fake_transport_security.c \ src/core/tsi/fake_transport_security.c \
src/core/tsi/ssl_transport_security.c \ src/core/tsi/ssl_transport_security.c \
@ -2426,6 +2428,7 @@ LIBGRPC_SRC = \
src/core/surface/server.c \ src/core/surface/server.c \
src/core/surface/server_chttp2.c \ src/core/surface/server_chttp2.c \
src/core/surface/server_create.c \ src/core/surface/server_create.c \
src/core/surface/surface_trace.c \
src/core/transport/chttp2/alpn.c \ src/core/transport/chttp2/alpn.c \
src/core/transport/chttp2/bin_encoder.c \ src/core/transport/chttp2/bin_encoder.c \
src/core/transport/chttp2/frame_data.c \ src/core/transport/chttp2/frame_data.c \
@ -2491,6 +2494,7 @@ src/core/security/secure_endpoint.c: $(OPENSSL_DEP)
src/core/security/secure_transport_setup.c: $(OPENSSL_DEP) src/core/security/secure_transport_setup.c: $(OPENSSL_DEP)
src/core/security/security_context.c: $(OPENSSL_DEP) src/core/security/security_context.c: $(OPENSSL_DEP)
src/core/security/server_secure_chttp2.c: $(OPENSSL_DEP) src/core/security/server_secure_chttp2.c: $(OPENSSL_DEP)
src/core/surface/init_secure.c: $(OPENSSL_DEP)
src/core/surface/secure_channel_create.c: $(OPENSSL_DEP) src/core/surface/secure_channel_create.c: $(OPENSSL_DEP)
src/core/tsi/fake_transport_security.c: $(OPENSSL_DEP) src/core/tsi/fake_transport_security.c: $(OPENSSL_DEP)
src/core/tsi/ssl_transport_security.c: $(OPENSSL_DEP) src/core/tsi/ssl_transport_security.c: $(OPENSSL_DEP)
@ -2569,6 +2573,7 @@ src/core/surface/metadata_array.c: $(OPENSSL_DEP)
src/core/surface/server.c: $(OPENSSL_DEP) src/core/surface/server.c: $(OPENSSL_DEP)
src/core/surface/server_chttp2.c: $(OPENSSL_DEP) src/core/surface/server_chttp2.c: $(OPENSSL_DEP)
src/core/surface/server_create.c: $(OPENSSL_DEP) src/core/surface/server_create.c: $(OPENSSL_DEP)
src/core/surface/surface_trace.c: $(OPENSSL_DEP)
src/core/transport/chttp2/alpn.c: $(OPENSSL_DEP) src/core/transport/chttp2/alpn.c: $(OPENSSL_DEP)
src/core/transport/chttp2/bin_encoder.c: $(OPENSSL_DEP) src/core/transport/chttp2/bin_encoder.c: $(OPENSSL_DEP)
src/core/transport/chttp2/frame_data.c: $(OPENSSL_DEP) src/core/transport/chttp2/frame_data.c: $(OPENSSL_DEP)
@ -2651,6 +2656,7 @@ $(OBJDIR)/$(CONFIG)/src/core/security/secure_endpoint.o:
$(OBJDIR)/$(CONFIG)/src/core/security/secure_transport_setup.o: $(OBJDIR)/$(CONFIG)/src/core/security/secure_transport_setup.o:
$(OBJDIR)/$(CONFIG)/src/core/security/security_context.o: $(OBJDIR)/$(CONFIG)/src/core/security/security_context.o:
$(OBJDIR)/$(CONFIG)/src/core/security/server_secure_chttp2.o: $(OBJDIR)/$(CONFIG)/src/core/security/server_secure_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/init_secure.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/secure_channel_create.o: $(OBJDIR)/$(CONFIG)/src/core/surface/secure_channel_create.o:
$(OBJDIR)/$(CONFIG)/src/core/tsi/fake_transport_security.o: $(OBJDIR)/$(CONFIG)/src/core/tsi/fake_transport_security.o:
$(OBJDIR)/$(CONFIG)/src/core/tsi/ssl_transport_security.o: $(OBJDIR)/$(CONFIG)/src/core/tsi/ssl_transport_security.o:
@ -2729,6 +2735,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/metadata_array.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/surface_trace.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o:
@ -2828,6 +2835,7 @@ $(OBJDIR)/$(CONFIG)/test/core/util/slice_splitter.o:
LIBGRPC_UNSECURE_SRC = \ LIBGRPC_UNSECURE_SRC = \
src/core/surface/init_unsecure.c \
src/core/channel/call_op_string.c \ src/core/channel/call_op_string.c \
src/core/channel/census_filter.c \ src/core/channel/census_filter.c \
src/core/channel/channel_args.c \ src/core/channel/channel_args.c \
@ -2902,6 +2910,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/surface/server.c \ src/core/surface/server.c \
src/core/surface/server_chttp2.c \ src/core/surface/server_chttp2.c \
src/core/surface/server_create.c \ src/core/surface/server_create.c \
src/core/surface/surface_trace.c \
src/core/transport/chttp2/alpn.c \ src/core/transport/chttp2/alpn.c \
src/core/transport/chttp2/bin_encoder.c \ src/core/transport/chttp2/bin_encoder.c \
src/core/transport/chttp2/frame_data.c \ src/core/transport/chttp2/frame_data.c \
@ -2964,6 +2973,7 @@ ifneq ($(NO_DEPS),true)
-include $(LIBGRPC_UNSECURE_OBJS:.o=.dep) -include $(LIBGRPC_UNSECURE_OBJS:.o=.dep)
endif endif
$(OBJDIR)/$(CONFIG)/src/core/surface/init_unsecure.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/call_op_string.o: $(OBJDIR)/$(CONFIG)/src/core/channel/call_op_string.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/census_filter.o: $(OBJDIR)/$(CONFIG)/src/core/channel/census_filter.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/channel_args.o: $(OBJDIR)/$(CONFIG)/src/core/channel/channel_args.o:
@ -3038,6 +3048,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/metadata_array.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o: $(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/surface_trace.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o: $(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o:
@ -8231,13 +8242,24 @@ $(BINDIR)/$(CONFIG)/qps_client_async: openssl_dep_error
else else
$(BINDIR)/$(CONFIG)/qps_client_async: $(QPS_CLIENT_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/qps_client_async: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/qps_client_async: $(PROTOBUF_DEP) $(QPS_CLIENT_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_client_async $(Q) $(LDXX) $(LDFLAGS) $(QPS_CLIENT_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_client_async
endif endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/qps/client_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
@ -8308,13 +8330,24 @@ $(BINDIR)/$(CONFIG)/qps_server_async: openssl_dep_error
else else
$(BINDIR)/$(CONFIG)/qps_server_async: $(QPS_SERVER_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
$(BINDIR)/$(CONFIG)/qps_server_async: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/qps_server_async: $(PROTOBUF_DEP) $(QPS_SERVER_ASYNC_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@" $(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@` $(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_server_async $(Q) $(LDXX) $(LDFLAGS) $(QPS_SERVER_ASYNC_OBJS) $(GTEST_LIB) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_server_async
endif endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/qps/qpstest.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/cpp/qps/server_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(OBJDIR)/$(CONFIG)/test/cpp/qps/server_async.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
@ -18160,4 +18193,3 @@ endif
.PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install-headers install-headers_c install-headers_cxx install-shared install-shared_c install-shared_cxx install-static install-static_c install-static_cxx strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean .PHONY: all strip tools dep_error openssl_dep_error openssl_dep_message git_update stop buildtests buildtests_c buildtests_cxx test test_c test_cxx install install_c install_cxx install-headers install-headers_c install-headers_cxx install-shared install-shared_c install-shared_cxx install-static install-static_c install-static_cxx strip strip-shared strip-static strip_c strip-shared_c strip-static_c strip_cxx strip-shared_cxx strip-static_cxx dep_c dep_cxx bins_dep_c bins_dep_cxx clean

@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/grpc/grpc.svg?branch=master)](https://travis-ci.org/grpc/grpc)
[gRPC - An RPC library and framework](http://github.com/grpc/grpc) [gRPC - An RPC library and framework](http://github.com/grpc/grpc)
=================================== ===================================

@ -134,6 +134,7 @@
"src/core/surface/client.h", "src/core/surface/client.h",
"src/core/surface/completion_queue.h", "src/core/surface/completion_queue.h",
"src/core/surface/event_string.h", "src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/server.h", "src/core/surface/server.h",
"src/core/surface/surface_trace.h", "src/core/surface/surface_trace.h",
"src/core/transport/chttp2/bin_encoder.h", "src/core/transport/chttp2/bin_encoder.h",
@ -234,6 +235,7 @@
"src/core/surface/server.c", "src/core/surface/server.c",
"src/core/surface/server_chttp2.c", "src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c", "src/core/surface/server_create.c",
"src/core/surface/surface_trace.c",
"src/core/transport/chttp2/alpn.c", "src/core/transport/chttp2/alpn.c",
"src/core/transport/chttp2/bin_encoder.c", "src/core/transport/chttp2/bin_encoder.c",
"src/core/transport/chttp2/frame_data.c", "src/core/transport/chttp2/frame_data.c",
@ -383,6 +385,7 @@
"src/core/security/secure_transport_setup.c", "src/core/security/secure_transport_setup.c",
"src/core/security/security_context.c", "src/core/security/security_context.c",
"src/core/security/server_secure_chttp2.c", "src/core/security/server_secure_chttp2.c",
"src/core/surface/init_secure.c",
"src/core/surface/secure_channel_create.c", "src/core/surface/secure_channel_create.c",
"src/core/tsi/fake_transport_security.c", "src/core/tsi/fake_transport_security.c",
"src/core/tsi/ssl_transport_security.c", "src/core/tsi/ssl_transport_security.c",
@ -425,6 +428,9 @@
"name": "grpc_unsecure", "name": "grpc_unsecure",
"build": "all", "build": "all",
"language": "c", "language": "c",
"src": [
"src/core/surface/init_unsecure.c"
],
"deps": [ "deps": [
"gpr" "gpr"
], ],
@ -597,6 +603,7 @@
}, },
{ {
"name": "census_statistics_multiple_writers_circular_buffer_test", "name": "census_statistics_multiple_writers_circular_buffer_test",
"flaky": true,
"build": "test", "build": "test",
"language": "c", "language": "c",
"src": [ "src": [
@ -607,8 +614,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "census_statistics_multiple_writers_test", "name": "census_statistics_multiple_writers_test",
@ -654,6 +660,7 @@
}, },
{ {
"name": "census_statistics_small_log_test", "name": "census_statistics_small_log_test",
"flaky": true,
"build": "test", "build": "test",
"language": "c", "language": "c",
"src": [ "src": [
@ -664,8 +671,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "census_stats_store_test", "name": "census_stats_store_test",
@ -893,8 +899,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "fling_test", "name": "fling_test",
@ -908,8 +913,7 @@
"grpc", "grpc",
"gpr_test_util", "gpr_test_util",
"gpr" "gpr"
], ]
"flaky": true
}, },
{ {
"name": "gen_hpack_tables", "name": "gen_hpack_tables",

@ -37,51 +37,37 @@
namespace grpc { namespace grpc {
enum StatusCode { enum StatusCode {
/* Not an error; returned on success /* Not an error; returned on success */
HTTP Mapping: 200 OK */
OK = 0, OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller). */
HTTP Mapping: 499 Client Closed Request */
CANCELLED = 1, CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information errors raised by APIs that do not return enough error information
may be converted to this error. may be converted to this error. */
HTTP Mapping: 500 Internal Server Error */
UNKNOWN = 2, UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name). */
HTTP Mapping: 400 Bad Request */
INVALID_ARGUMENT = 3, INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long successful response from a server could have been delayed long
enough for the deadline to expire. enough for the deadline to expire. */
HTTP Mapping: 504 Gateway Timeout */
DEADLINE_EXCEEDED = 4, DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found. */
HTTP Mapping: 404 Not Found */
NOT_FOUND = 5, NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists. */
HTTP Mapping: 409 Conflict */
ALREADY_EXISTS = 6, ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
@ -89,21 +75,15 @@ enum StatusCode {
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). instead for those errors). */
HTTP Mapping: 403 Forbidden */
PERMISSION_DENIED = 7, PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation. */
HTTP Mapping: 401 Unauthorized */
UNAUTHENTICATED = 16, UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space. */
HTTP Mapping: 429 Too Many Requests */
RESOURCE_EXHAUSTED = 8, RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
@ -124,23 +104,14 @@ enum StatusCode {
(d) Use FAILED_PRECONDITION if the client performs conditional (d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting server does not match the condition. E.g., conflicting
read-modify-write on the same resource. read-modify-write on the same resource. */
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
FAILED_PRECONDITION = 9, FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 409 Conflict */
ABORTED = 10, ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
@ -157,21 +128,15 @@ enum StatusCode {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when a space can easily look for an OUT_OF_RANGE error to detect when
they are done. they are done. */
HTTP Mapping: 400 Bad Request */
OUT_OF_RANGE = 11, OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service. */
HTTP Mapping: 501 Not Implemented */
UNIMPLEMENTED = 12, UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken. */
HTTP Mapping: 500 Internal Server Error */
INTERNAL = 13, INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
@ -179,14 +144,10 @@ enum StatusCode {
a backoff. a backoff.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 503 Service Unavailable */
UNAVAILABLE = 14, UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption. */
HTTP Mapping: 500 Internal Server Error */
DATA_LOSS = 15, DATA_LOSS = 15,
/* Force users to include a default branch: */ /* Force users to include a default branch: */

@ -39,51 +39,37 @@ extern "C" {
#endif #endif
typedef enum { typedef enum {
/* Not an error; returned on success /* Not an error; returned on success */
HTTP Mapping: 200 OK */
GRPC_STATUS_OK = 0, GRPC_STATUS_OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller). */
HTTP Mapping: 499 Client Closed Request */
GRPC_STATUS_CANCELLED = 1, GRPC_STATUS_CANCELLED = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information errors raised by APIs that do not return enough error information
may be converted to this error. may be converted to this error. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_UNKNOWN = 2, GRPC_STATUS_UNKNOWN = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name). */
HTTP Mapping: 400 Bad Request */
GRPC_STATUS_INVALID_ARGUMENT = 3, GRPC_STATUS_INVALID_ARGUMENT = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long successful response from a server could have been delayed long
enough for the deadline to expire. enough for the deadline to expire. */
HTTP Mapping: 504 Gateway Timeout */
GRPC_STATUS_DEADLINE_EXCEEDED = 4, GRPC_STATUS_DEADLINE_EXCEEDED = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found. */
HTTP Mapping: 404 Not Found */
GRPC_STATUS_NOT_FOUND = 5, GRPC_STATUS_NOT_FOUND = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists. */
HTTP Mapping: 409 Conflict */
GRPC_STATUS_ALREADY_EXISTS = 6, GRPC_STATUS_ALREADY_EXISTS = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
@ -91,21 +77,15 @@ typedef enum {
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). instead for those errors). */
HTTP Mapping: 403 Forbidden */
GRPC_STATUS_PERMISSION_DENIED = 7, GRPC_STATUS_PERMISSION_DENIED = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation. */
HTTP Mapping: 401 Unauthorized */
GRPC_STATUS_UNAUTHENTICATED = 16, GRPC_STATUS_UNAUTHENTICATED = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space. */
HTTP Mapping: 429 Too Many Requests */
GRPC_STATUS_RESOURCE_EXHAUSTED = 8, GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
@ -126,23 +106,14 @@ typedef enum {
(d) Use FAILED_PRECONDITION if the client performs conditional (d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting server does not match the condition. E.g., conflicting
read-modify-write on the same resource. read-modify-write on the same resource. */
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
GRPC_STATUS_FAILED_PRECONDITION = 9, GRPC_STATUS_FAILED_PRECONDITION = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 409 Conflict */
GRPC_STATUS_ABORTED = 10, GRPC_STATUS_ABORTED = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
@ -159,21 +130,15 @@ typedef enum {
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when a space can easily look for an OUT_OF_RANGE error to detect when
they are done. they are done. */
HTTP Mapping: 400 Bad Request */
GRPC_STATUS_OUT_OF_RANGE = 11, GRPC_STATUS_OUT_OF_RANGE = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service. */
HTTP Mapping: 501 Not Implemented */
GRPC_STATUS_UNIMPLEMENTED = 12, GRPC_STATUS_UNIMPLEMENTED = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_INTERNAL = 13, GRPC_STATUS_INTERNAL = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
@ -181,14 +146,10 @@ typedef enum {
a backoff. a backoff.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 503 Service Unavailable */
GRPC_STATUS_UNAVAILABLE = 14, GRPC_STATUS_UNAVAILABLE = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption. */
HTTP Mapping: 500 Internal Server Error */
GRPC_STATUS_DATA_LOSS = 15, GRPC_STATUS_DATA_LOSS = 15,
/* Force users to include a default branch: */ /* Force users to include a default branch: */

@ -237,54 +237,70 @@ bool PrintServerFactory(const ServiceDescriptor* service, Printer* out) {
"Service", service->name()); "Service", service->name());
{ {
IndentScope raii_create_server_indent(out); IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message; map<string, string> method_description_constructors;
out->Print("method_implementations = {\n"); map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) { for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out); const MethodDescriptor* method = service->method(i);
const MethodDescriptor* meth = service->method(i); const string method_description_constructor =
string meth_type = string(method->client_streaming() ? "stream_" : "unary_") +
string(meth->client_streaming() ? "stream" : "unary") + string(method->server_streaming() ? "stream_" : "unary_") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline"; "service_description";
out->Print("\"$Method$\": utilities.$Type$(servicer.$Method$),\n", pair<string, string> input_message_module_and_class;
"Method", meth->name(), if (!GetModuleAndMessagePath(method->input_type(),
"Type", meth_type); &input_message_module_and_class)) {
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* input_type = meth->input_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(input_type, &module_and_message)) {
return false; return false;
} }
method_to_module_and_message.insert( pair<string, string> output_message_module_and_class;
make_pair(meth->name(), module_and_message)); if (!GetModuleAndMessagePath(method->output_type(),
&output_message_module_and_class)) {
return false;
} }
out->Print("}\n"); // Import the modules that define the messages used in RPCs.
// Ensure that we've imported all of the relevant messages. out->Print("import $Module$\n", "Module",
for (auto& meth_vals : method_to_module_and_message) { input_message_module_and_class.first);
out->Print("import $Module$\n", out->Print("import $Module$\n", "Module",
"Module", meth_vals.second.first); output_message_module_and_class.first);
method_description_constructors.insert(
make_pair(method->name(), method_description_constructor));
input_message_modules_and_classes.insert(
make_pair(method->name(), input_message_module_and_class));
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
} }
out->Print("request_deserializers = {\n"); out->Print("method_service_descriptions = {\n");
for (auto& meth_vals : method_to_module_and_message) { for (auto& name_and_description_constructor :
IndentScope raii_serializers_indent(out); method_description_constructors) {
string full_input_type_path = meth_vals.second.first + "." + IndentScope raii_descriptions_indent(out);
meth_vals.second.second; const string method_name = name_and_description_constructor.first;
out->Print("\"$Method$\": $Type$.FromString,\n", auto input_message_module_and_class =
"Method", meth_vals.first, input_message_modules_and_classes.find(method_name);
"Type", full_input_type_path); auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print("servicer.$Method$,\n", "Method", method_name);
out->Print(
"$InputTypeModule$.$InputTypeClass$.FromString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.SerializeToString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
} }
out->Print("}\n"); out->Print("),\n");
out->Print("response_serializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n",
"Method", meth_vals.first);
} }
out->Print("}\n"); out->Print("}\n");
out->Print("link = fore.activated_fore_link(port, request_deserializers, " // out->Print("return implementations.insecure_server("
"response_serializers, root_certificates, key_chain_pairs)\n"); // "method_service_descriptions, port)\n");
out->Print("return implementations.assemble_service(" out->Print(
"method_implementations, link)\n"); "return implementations.secure_server("
"method_service_descriptions, port, root_certificates,"
" key_chain_pairs)\n");
} }
return true; return true;
} }
@ -296,66 +312,74 @@ bool PrintStubFactory(const ServiceDescriptor* service, Printer* out) {
out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n"); out->Print(dict, "def early_adopter_create_$Service$_stub(host, port):\n");
{ {
IndentScope raii_create_server_indent(out); IndentScope raii_create_server_indent(out);
map<string, pair<string, string>> method_to_module_and_message; map<string, string> method_description_constructors;
out->Print("method_implementations = {\n"); map<string, pair<string, string>> input_message_modules_and_classes;
map<string, pair<string, string>> output_message_modules_and_classes;
for (int i = 0; i < service->method_count(); ++i) { for (int i = 0; i < service->method_count(); ++i) {
IndentScope raii_implementations_indent(out); const MethodDescriptor* method = service->method(i);
const MethodDescriptor* meth = service->method(i); const string method_description_constructor =
string meth_type = string(method->client_streaming() ? "stream_" : "unary_") +
string(meth->client_streaming() ? "stream" : "unary") + string(method->server_streaming() ? "stream_" : "unary_") +
string(meth->server_streaming() ? "_stream" : "_unary") + "_inline"; "invocation_description";
// TODO(atash): once the expected input to assemble_dynamic_inline_stub is pair<string, string> input_message_module_and_class;
// cleaned up, change this to the expected argument's dictionary values. if (!GetModuleAndMessagePath(method->input_type(),
out->Print("\"$Method$\": utilities.$Type$(None),\n", &input_message_module_and_class)) {
"Method", meth->name(),
"Type", meth_type);
// Maintain information on the input type of the service method for later
// use in constructing the service assembly's activated fore link.
const Descriptor* output_type = meth->output_type();
pair<string, string> module_and_message;
if (!GetModuleAndMessagePath(output_type, &module_and_message)) {
return false; return false;
} }
method_to_module_and_message.insert( pair<string, string> output_message_module_and_class;
make_pair(meth->name(), module_and_message)); if (!GetModuleAndMessagePath(method->output_type(),
&output_message_module_and_class)) {
return false;
} }
out->Print("}\n"); // Import the modules that define the messages used in RPCs.
// Ensure that we've imported all of the relevant messages. out->Print("import $Module$\n", "Module",
for (auto& meth_vals : method_to_module_and_message) { input_message_module_and_class.first);
out->Print("import $Module$\n", out->Print("import $Module$\n", "Module",
"Module", meth_vals.second.first); output_message_module_and_class.first);
method_description_constructors.insert(
make_pair(method->name(), method_description_constructor));
input_message_modules_and_classes.insert(
make_pair(method->name(), input_message_module_and_class));
output_message_modules_and_classes.insert(
make_pair(method->name(), output_message_module_and_class));
} }
out->Print("response_deserializers = {\n"); out->Print("method_invocation_descriptions = {\n");
for (auto& meth_vals : method_to_module_and_message) { for (auto& name_and_description_constructor :
IndentScope raii_serializers_indent(out); method_description_constructors) {
string full_output_type_path = meth_vals.second.first + "." + IndentScope raii_descriptions_indent(out);
meth_vals.second.second; const string method_name = name_and_description_constructor.first;
out->Print("\"$Method$\": $Type$.FromString,\n", auto input_message_module_and_class =
"Method", meth_vals.first, input_message_modules_and_classes.find(method_name);
"Type", full_output_type_path); auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor",
name_and_description_constructor.second);
{
IndentScope raii_description_arguments_indent(out);
out->Print(
"$InputTypeModule$.$InputTypeClass$.SerializeToString,\n",
"InputTypeModule", input_message_module_and_class->second.first,
"InputTypeClass", input_message_module_and_class->second.second);
out->Print(
"$OutputTypeModule$.$OutputTypeClass$.FromString,\n",
"OutputTypeModule", output_message_module_and_class->second.first,
"OutputTypeClass", output_message_module_and_class->second.second);
} }
out->Print("}\n"); out->Print("),\n");
out->Print("request_serializers = {\n");
for (auto& meth_vals : method_to_module_and_message) {
IndentScope raii_serializers_indent(out);
out->Print("\"$Method$\": lambda x: x.SerializeToString(),\n",
"Method", meth_vals.first);
} }
out->Print("}\n"); out->Print("}\n");
out->Print("link = rear.activated_rear_link(" out->Print(
"host, port, request_serializers, response_deserializers)\n"); "return implementations.insecure_stub("
out->Print("return implementations.assemble_dynamic_inline_stub(" "method_invocation_descriptions, host, port)\n");
"method_implementations, link)\n");
} }
return true; return true;
} }
bool PrintPreamble(const FileDescriptor* file, Printer* out) { bool PrintPreamble(const FileDescriptor* file, Printer* out) {
out->Print("import abc\n"); out->Print("import abc\n");
out->Print("from grpc._adapter import fore\n"); out->Print("from grpc.early_adopter import implementations\n");
out->Print("from grpc._adapter import rear\n"); out->Print("from grpc.early_adopter import utilities\n");
out->Print("from grpc.framework.assembly import implementations\n");
out->Print("from grpc.framework.assembly import utilities\n");
return true; return true;
} }

@ -36,6 +36,8 @@
#include <stdlib.h> #include <stdlib.h>
int grpc_trace_channel = 0;
/* Memory layouts. /* Memory layouts.
Channel stack is laid out as: { Channel stack is laid out as: {

@ -298,7 +298,9 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem,
void grpc_call_element_send_cancel(grpc_call_element *cur_elem); void grpc_call_element_send_cancel(grpc_call_element *cur_elem);
void grpc_call_element_send_finish(grpc_call_element *cur_elem); void grpc_call_element_send_finish(grpc_call_element *cur_elem);
extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \ #define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_bits & GRPC_TRACE_CHANNEL) grpc_call_log_op(sev, elem, op) if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */ #endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */

@ -48,12 +48,12 @@
/* the protobuf library will (by default) start warning at 100megs */ /* the protobuf library will (by default) start warning at 100megs */
#define DEFAULT_MAX_MESSAGE_LENGTH (100 * 1024 * 1024) #define DEFAULT_MAX_MESSAGE_LENGTH (100 * 1024 * 1024)
typedef struct { typedef struct connected_channel_channel_data {
grpc_transport *transport; grpc_transport *transport;
gpr_uint32 max_message_length; gpr_uint32 max_message_length;
} channel_data; } channel_data;
typedef struct { typedef struct connected_channel_call_data {
grpc_call_element *elem; grpc_call_element *elem;
grpc_stream_op_buffer outgoing_sopb; grpc_stream_op_buffer outgoing_sopb;

@ -39,8 +39,21 @@
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/core/support/env.h" #include "src/core/support/env.h"
#if GRPC_ENABLE_TRACING typedef struct tracer {
gpr_uint32 grpc_trace_bits = 0; const char *name;
int *flag;
struct tracer *next;
} tracer;
static tracer *tracers;
void grpc_register_tracer(const char *name, int *flag) {
tracer *t = gpr_malloc(sizeof(*t));
t->name = name;
t->flag = flag;
t->next = tracers;
*flag = 0;
tracers = t;
}
static void add(const char *beg, const char *end, char ***ss, size_t *ns) { static void add(const char *beg, const char *end, char ***ss, size_t *ns) {
size_t n = *ns; size_t n = *ns;
@ -67,28 +80,28 @@ static void parse(const char *s) {
char **strings = NULL; char **strings = NULL;
size_t nstrings = 0; size_t nstrings = 0;
size_t i; size_t i;
tracer *t;
split(s, &strings, &nstrings); split(s, &strings, &nstrings);
grpc_trace_bits = 0;
for (i = 0; i < nstrings; i++) { for (i = 0; i < nstrings; i++) {
const char *s = strings[i]; const char *s = strings[i];
if (0 == strcmp(s, "surface")) { if (0 == strcmp(s, "all")) {
grpc_trace_bits |= GRPC_TRACE_SURFACE; for (t = tracers; t; t = t->next) {
} else if (0 == strcmp(s, "channel")) { *t->flag = 1;
grpc_trace_bits |= GRPC_TRACE_CHANNEL; }
} else if (0 == strcmp(s, "tcp")) {
grpc_trace_bits |= GRPC_TRACE_TCP;
} else if (0 == strcmp(s, "secure_endpoint")) {
grpc_trace_bits |= GRPC_TRACE_SECURE_ENDPOINT;
} else if (0 == strcmp(s, "http")) {
grpc_trace_bits |= GRPC_TRACE_HTTP;
} else if (0 == strcmp(s, "all")) {
grpc_trace_bits = -1;
} else { } else {
int found = 0;
for (t = tracers; t; t = t->next) {
if (0 == strcmp(s, t->name)) {
*t->flag = 1;
found = 1;
}
}
if (!found) {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s); gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
} }
} }
}
for (i = 0; i < nstrings; i++) { for (i = 0; i < nstrings; i++) {
gpr_free(strings[i]); gpr_free(strings[i]);
@ -96,17 +109,15 @@ static void parse(const char *s) {
gpr_free(strings); gpr_free(strings);
} }
void grpc_init_trace_bits() { void grpc_tracer_init(const char *env_var) {
char *e = gpr_getenv("GRPC_TRACE"); char *e = gpr_getenv(env_var);
if (e == NULL) { if (e != NULL) {
grpc_trace_bits = 0;
} else {
parse(e); parse(e);
gpr_free(e); gpr_free(e);
} }
while (tracers) {
tracer *t = tracers;
tracers = t->next;
gpr_free(t);
}
} }
#else
void grpc_init_trace_bits() {
}
#endif

@ -36,25 +36,7 @@
#include <grpc/support/port_platform.h> #include <grpc/support/port_platform.h>
/* set to zero to remove all debug trace code */ void grpc_register_tracer(const char *name, int *flag);
#ifndef GRPC_ENABLE_TRACING void grpc_tracer_init(const char *env_var_name);
# define GRPC_ENABLE_TRACING 1
#endif
typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
extern gpr_uint32 grpc_trace_bits;
#else
# define grpc_trace_bits 0
#endif
void grpc_init_trace_bits();
#endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */ #endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */

@ -36,11 +36,14 @@
#ifdef GPR_POSIX_SOCKET #ifdef GPR_POSIX_SOCKET
#include "src/core/iomgr/iomgr_posix.h" #include "src/core/iomgr/iomgr_posix.h"
#include "src/core/debug/trace.h"
#include "src/core/iomgr/fd_posix.h" #include "src/core/iomgr/fd_posix.h"
#include "src/core/iomgr/tcp_posix.h"
void grpc_iomgr_platform_init(void) { void grpc_iomgr_platform_init(void) {
grpc_fd_global_init(); grpc_fd_global_init();
grpc_pollset_global_init(); grpc_pollset_global_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
} }
void grpc_iomgr_platform_shutdown(void) { void grpc_iomgr_platform_shutdown(void) {

@ -63,6 +63,8 @@ typedef struct grpc_tcp_slice_state {
int memory_owned; /* True if slices array is owned */ int memory_owned; /* True if slices array is owned */
} grpc_tcp_slice_state; } grpc_tcp_slice_state;
int grpc_tcp_trace = 0;
static void slice_state_init(grpc_tcp_slice_state *state, gpr_slice *slices, static void slice_state_init(grpc_tcp_slice_state *state, gpr_slice *slices,
size_t nslices, size_t valid_slices) { size_t nslices, size_t valid_slices) {
state->slices = slices; state->slices = slices;
@ -294,7 +296,7 @@ static void call_read_cb(grpc_tcp *tcp, gpr_slice *slices, size_t nslices,
grpc_endpoint_cb_status status) { grpc_endpoint_cb_status status) {
grpc_endpoint_read_cb cb = tcp->read_cb; grpc_endpoint_read_cb cb = tcp->read_cb;
if (grpc_trace_bits & GRPC_TRACE_TCP) { if (grpc_tcp_trace) {
size_t i; size_t i;
gpr_log(GPR_DEBUG, "read: status=%d", status); gpr_log(GPR_DEBUG, "read: status=%d", status);
for (i = 0; i < nslices; i++) { for (i = 0; i < nslices; i++) {
@ -495,7 +497,7 @@ static grpc_endpoint_write_status grpc_tcp_write(grpc_endpoint *ep,
grpc_tcp *tcp = (grpc_tcp *)ep; grpc_tcp *tcp = (grpc_tcp *)ep;
grpc_endpoint_write_status status; grpc_endpoint_write_status status;
if (grpc_trace_bits & GRPC_TRACE_TCP) { if (grpc_tcp_trace) {
size_t i; size_t i;
for (i = 0; i < nslices; i++) { for (i = 0; i < nslices; i++) {

@ -49,6 +49,8 @@
#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192
extern int grpc_tcp_trace;
/* Create a tcp endpoint given a file desciptor and a read slice size. /* Create a tcp endpoint given a file desciptor and a read slice size.
Takes ownership of fd. */ Takes ownership of fd. */
grpc_endpoint *grpc_tcp_create(grpc_fd *fd, size_t read_slice_size); grpc_endpoint *grpc_tcp_create(grpc_fd *fd, size_t read_slice_size);

@ -65,6 +65,8 @@ typedef struct {
gpr_refcount ref; gpr_refcount ref;
} secure_endpoint; } secure_endpoint;
int grpc_trace_secure_endpoint = 0;
static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); } static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); }
static void destroy(secure_endpoint *secure_ep) { static void destroy(secure_endpoint *secure_ep) {
@ -96,7 +98,7 @@ static void flush_read_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur,
static void call_read_cb(secure_endpoint *ep, gpr_slice *slices, size_t nslices, static void call_read_cb(secure_endpoint *ep, gpr_slice *slices, size_t nslices,
grpc_endpoint_cb_status error) { grpc_endpoint_cb_status error) {
if (grpc_trace_bits & GRPC_TRACE_SECURE_ENDPOINT) { if (grpc_trace_secure_endpoint) {
size_t i; size_t i;
for (i = 0; i < nslices; i++) { for (i = 0; i < nslices; i++) {
char *data = char *data =
@ -231,7 +233,7 @@ static grpc_endpoint_write_status endpoint_write(grpc_endpoint *secure_ep,
grpc_endpoint_write_status status; grpc_endpoint_write_status status;
GPR_ASSERT(ep->output_buffer.count == 0); GPR_ASSERT(ep->output_buffer.count == 0);
if (grpc_trace_bits & GRPC_TRACE_SECURE_ENDPOINT) { if (grpc_trace_secure_endpoint) {
for (i = 0; i < nslices; i++) { for (i = 0; i < nslices; i++) {
char *data = char *data =
gpr_hexdump((char *)GPR_SLICE_START_PTR(slices[i]), gpr_hexdump((char *)GPR_SLICE_START_PTR(slices[i]),

@ -39,6 +39,8 @@
struct tsi_frame_protector; struct tsi_frame_protector;
extern int grpc_trace_secure_endpoint;
/* Takes ownership of protector and to_wrap, and refs leftover_slices. */ /* Takes ownership of protector and to_wrap, and refs leftover_slices. */
grpc_endpoint *grpc_secure_endpoint_create( grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *to_wrap, struct tsi_frame_protector *protector, grpc_endpoint *to_wrap,

@ -71,6 +71,7 @@ struct grpc_completion_queue {
grpc_pollset pollset; grpc_pollset pollset;
/* 0 initially, 1 once we've begun shutting down */ /* 0 initially, 1 once we've begun shutting down */
int shutdown; int shutdown;
int shutdown_called;
/* Head of a linked list of queued events (prev points to the last element) */ /* Head of a linked list of queued events (prev points to the last element) */
event *queue; event *queue;
/* Fixed size chained hash table of events for pluck() */ /* Fixed size chained hash table of events for pluck() */
@ -107,7 +108,6 @@ static event *add_locked(grpc_completion_queue *cc, grpc_completion_type type,
grpc_event_finish_func on_finish, void *user_data) { grpc_event_finish_func on_finish, void *user_data) {
event *ev = gpr_malloc(sizeof(event)); event *ev = gpr_malloc(sizeof(event));
gpr_uintptr bucket = ((gpr_uintptr)tag) % NUM_TAG_BUCKETS; gpr_uintptr bucket = ((gpr_uintptr)tag) % NUM_TAG_BUCKETS;
GPR_ASSERT(!cc->shutdown);
ev->base.type = type; ev->base.type = type;
ev->base.tag = tag; ev->base.tag = tag;
ev->base.call = call; ev->base.call = call;
@ -150,6 +150,7 @@ static void end_op_locked(grpc_completion_queue *cc,
#endif #endif
if (gpr_unref(&cc->refs)) { if (gpr_unref(&cc->refs)) {
GPR_ASSERT(!cc->shutdown); GPR_ASSERT(!cc->shutdown);
GPR_ASSERT(cc->shutdown_called);
cc->shutdown = 1; cc->shutdown = 1;
gpr_cv_broadcast(GRPC_POLLSET_CV(&cc->pollset)); gpr_cv_broadcast(GRPC_POLLSET_CV(&cc->pollset));
} }
@ -380,6 +381,10 @@ grpc_event *grpc_completion_queue_pluck(grpc_completion_queue *cc, void *tag,
/* Shutdown simply drops a ref that we reserved at creation time; if we drop /* Shutdown simply drops a ref that we reserved at creation time; if we drop
to zero here, then enter shutdown mode and wake up any waiters */ to zero here, then enter shutdown mode and wake up any waiters */
void grpc_completion_queue_shutdown(grpc_completion_queue *cc) { void grpc_completion_queue_shutdown(grpc_completion_queue *cc) {
gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset));
cc->shutdown_called = 1;
gpr_mu_unlock(GRPC_POLLSET_MU(&cc->pollset));
if (gpr_unref(&cc->refs)) { if (gpr_unref(&cc->refs)) {
gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset)); gpr_mu_lock(GRPC_POLLSET_MU(&cc->pollset));
GPR_ASSERT(!cc->shutdown); GPR_ASSERT(!cc->shutdown);

@ -35,6 +35,10 @@
#include "src/core/iomgr/iomgr.h" #include "src/core/iomgr/iomgr.h"
#include "src/core/debug/trace.h" #include "src/core/debug/trace.h"
#include "src/core/statistics/census_interface.h" #include "src/core/statistics/census_interface.h"
#include "src/core/channel/channel_stack.h"
#include "src/core/surface/init.h"
#include "src/core/surface/surface_trace.h"
#include "src/core/transport/chttp2_transport.h"
static gpr_once g_init = GPR_ONCE_INIT; static gpr_once g_init = GPR_ONCE_INIT;
static gpr_mu g_init_mu; static gpr_mu g_init_mu;
@ -50,7 +54,11 @@ void grpc_init(void) {
gpr_mu_lock(&g_init_mu); gpr_mu_lock(&g_init_mu);
if (++g_initializations == 1) { if (++g_initializations == 1) {
grpc_init_trace_bits(); grpc_register_tracer("channel", &grpc_trace_channel);
grpc_register_tracer("surface", &grpc_surface_trace);
grpc_register_tracer("http", &grpc_http_trace);
grpc_security_pre_init();
grpc_tracer_init("GRPC_TRACE");
grpc_iomgr_init(); grpc_iomgr_init();
census_init(); census_init();
} }

@ -0,0 +1,39 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_CORE_SURFACE_INIT_H
#define GRPC_INTERNAL_CORE_SURFACE_INIT_H
void grpc_security_pre_init(void);
#endif /* GRPC_INTERNAL_CORE_SURFACE_INIT_H */

@ -0,0 +1,42 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/surface/init.h"
#include "src/core/debug/trace.h"
#include "src/core/security/secure_endpoint.h"
#include "src/core/tsi/transport_security_interface.h"
void grpc_security_pre_init(void) {
grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint);
grpc_register_tracer("transport_security", &tsi_tracing_enabled);
}

@ -0,0 +1,37 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/surface/init.h"
void grpc_security_pre_init(void) {
}

@ -0,0 +1,36 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/surface/surface_trace.h"
int grpc_surface_trace = 0;

@ -37,8 +37,10 @@
#include "src/core/debug/trace.h" #include "src/core/debug/trace.h"
#include <grpc/support/log.h> #include <grpc/support/log.h>
extern int grpc_surface_trace;
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \ #define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_trace_bits & GRPC_TRACE_SURFACE) { \ if (grpc_surface_trace) { \
char *_ev = grpc_event_string(event); \ char *_ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \ gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \ gpr_free(_ev); \

@ -37,6 +37,7 @@
#include "src/core/debug/trace.h" #include "src/core/debug/trace.h"
#include "src/core/transport/chttp2/frame.h" #include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/chttp2_transport.h"
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include <grpc/support/useful.h> #include <grpc/support/useful.h>
@ -218,7 +219,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
} }
} }
parser->incoming_settings[parser->id] = parser->value; parser->incoming_settings[parser->id] = parser->value;
if (grpc_trace_bits & GRPC_TRACE_HTTP) { if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id, gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id,
parser->value); parser->value);
} }

@ -37,7 +37,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "src/core/debug/trace.h"
#include "src/core/support/string.h" #include "src/core/support/string.h"
#include "src/core/transport/chttp2/frame_data.h" #include "src/core/transport/chttp2/frame_data.h"
#include "src/core/transport/chttp2/frame_goaway.h" #include "src/core/transport/chttp2/frame_goaway.h"
@ -64,11 +63,13 @@
#define CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" #define CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
#define CLIENT_CONNECT_STRLEN 24 #define CLIENT_CONNECT_STRLEN 24
int grpc_http_trace = 0;
typedef struct transport transport; typedef struct transport transport;
typedef struct stream stream; typedef struct stream stream;
#define IF_TRACING(stmt) \ #define IF_TRACING(stmt) \
if (!(grpc_trace_bits & GRPC_TRACE_HTTP)) \ if (!(grpc_http_trace)) \
; \ ; \
else \ else \
stmt stmt
@ -309,6 +310,7 @@ static void push_setting(transport *t, grpc_chttp2_setting_id id,
static int prepare_callbacks(transport *t); static int prepare_callbacks(transport *t);
static void run_callbacks(transport *t, const grpc_transport_callbacks *cb); static void run_callbacks(transport *t, const grpc_transport_callbacks *cb);
static void call_cb_closed(transport *t, const grpc_transport_callbacks *cb);
static int prepare_write(transport *t); static int prepare_write(transport *t);
static void perform_write(transport *t, grpc_endpoint *ep); static void perform_write(transport *t, grpc_endpoint *ep);
@ -516,13 +518,29 @@ static void init_transport(transport *t, grpc_transport_setup_callback setup,
static void destroy_transport(grpc_transport *gt) { static void destroy_transport(grpc_transport *gt) {
transport *t = (transport *)gt; transport *t = (transport *)gt;
gpr_mu_lock(&t->mu); lock(t);
t->destroying = 1; t->destroying = 1;
while (t->calling_back) { /* Wait for pending stuff to finish.
We need to be not calling back to ensure that closed() gets a chance to
trigger if needed during unlock() before we die.
We need to be not writing as cancellation finalization may produce some
callbacks that NEED to be made to close out some streams when t->writing
becomes 0. */
while (t->calling_back || t->writing) {
gpr_cv_wait(&t->cv, &t->mu, gpr_inf_future); gpr_cv_wait(&t->cv, &t->mu, gpr_inf_future);
} }
t->cb = NULL; drop_connection(t);
gpr_mu_unlock(&t->mu); unlock(t);
/* The drop_connection() above puts the transport into an error state, and
the follow-up unlock should then (as part of the cleanup work it does)
ensure that cb is NULL, and therefore not call back anything further.
This check validates this very subtle behavior.
It's shutdown path, so I don't believe an extra lock pair is going to be
problematic for performance. */
lock(t);
GPR_ASSERT(!t->cb);
unlock(t);
unref_transport(t); unref_transport(t);
} }
@ -680,6 +698,7 @@ static void stream_list_add_tail(transport *t, stream *s, stream_list_id id) {
} }
static void stream_list_join(transport *t, stream *s, stream_list_id id) { static void stream_list_join(transport *t, stream *s, stream_list_id id) {
if (id == PENDING_CALLBACKS) GPR_ASSERT(t->cb != NULL || t->error_state == ERROR_STATE_NONE);
if (s->included[id]) { if (s->included[id]) {
return; return;
} }
@ -738,7 +757,7 @@ static void unlock(transport *t) {
if (perform_callbacks) { if (perform_callbacks) {
t->calling_back = 1; t->calling_back = 1;
} }
if (t->error_state == ERROR_STATE_SEEN) { if (t->error_state == ERROR_STATE_SEEN && !t->writing) {
call_closed = 1; call_closed = 1;
t->calling_back = 1; t->calling_back = 1;
t->cb = NULL; /* no more callbacks */ t->cb = NULL; /* no more callbacks */
@ -772,7 +791,7 @@ static void unlock(transport *t) {
} }
if (call_closed) { if (call_closed) {
cb->closed(t->cb_user_data, &t->base); call_cb_closed(t, cb);
} }
/* write some bytes if necessary */ /* write some bytes if necessary */
@ -903,13 +922,16 @@ static void finish_write_common(transport *t, int success) {
} }
while ((s = stream_list_remove_head(t, WRITTEN_CLOSED))) { while ((s = stream_list_remove_head(t, WRITTEN_CLOSED))) {
s->sent_write_closed = 1; s->sent_write_closed = 1;
stream_list_join(t, s, PENDING_CALLBACKS); if (!s->cancelled) stream_list_join(t, s, PENDING_CALLBACKS);
} }
t->outbuf.count = 0; t->outbuf.count = 0;
t->outbuf.length = 0; t->outbuf.length = 0;
/* leave the writing flag up on shutdown to prevent further writes in unlock() /* leave the writing flag up on shutdown to prevent further writes in unlock()
from starting */ from starting */
t->writing = 0; t->writing = 0;
if (t->destroying) {
gpr_cv_signal(&t->cv);
}
if (!t->reading) { if (!t->reading) {
grpc_endpoint_destroy(t->ep); grpc_endpoint_destroy(t->ep);
t->ep = NULL; t->ep = NULL;
@ -979,7 +1001,8 @@ static void send_batch(grpc_transport *gt, grpc_stream *gs, grpc_stream_op *ops,
} else { } else {
grpc_sopb_append(&t->nuke_later_sopb, ops, ops_count); grpc_sopb_append(&t->nuke_later_sopb, ops, ops_count);
} }
if (is_last && s->outgoing_sopb.nops == 0 && s->read_closed) { if (is_last && s->outgoing_sopb.nops == 0 && s->read_closed &&
!s->published_close) {
stream_list_join(t, s, PENDING_CALLBACKS); stream_list_join(t, s, PENDING_CALLBACKS);
} }
@ -1765,6 +1788,10 @@ static void run_callbacks(transport *t, const grpc_transport_callbacks *cb) {
} }
} }
static void call_cb_closed(transport *t, const grpc_transport_callbacks *cb) {
cb->closed(t->cb_user_data, &t->base);
}
static void add_to_pollset(grpc_transport *gt, grpc_pollset *pollset) { static void add_to_pollset(grpc_transport *gt, grpc_pollset *pollset) {
transport *t = (transport *)gt; transport *t = (transport *)gt;
lock(t); lock(t);

@ -37,6 +37,8 @@
#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/endpoint.h"
#include "src/core/transport/transport.h" #include "src/core/transport/transport.h"
extern int grpc_http_trace;
void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, void grpc_create_chttp2_transport(grpc_transport_setup_callback setup,
void *arg, void *arg,
const grpc_channel_args *channel_args, const grpc_channel_args *channel_args,

@ -40,10 +40,6 @@
int tsi_tracing_enabled = 0; int tsi_tracing_enabled = 0;
void tsi_enable_tracing() {
tsi_tracing_enabled = 1;
}
/* --- Utils. --- */ /* --- Utils. --- */
char* tsi_strdup(const char* src) { char* tsi_strdup(const char* src) {

@ -63,8 +63,8 @@ const char* tsi_result_to_string(tsi_result result);
/* --- tsi tracing --- */ /* --- tsi tracing --- */
/* Call this function before any other tsi function to avoid races. */ /* Set this early to avoid races */
void tsi_enable_tracing(void); extern int tsi_tracing_enabled;
/* --- tsi_frame_protector object --- /* --- tsi_frame_protector object ---

@ -41,64 +41,44 @@ namespace Grpc.Core
/// </summary> /// </summary>
public enum StatusCode public enum StatusCode
{ {
/* Not an error; returned on success /* Not an error; returned on success */
HTTP Mapping: 200 OK */
OK = 0, OK = 0,
/* The operation was cancelled (typically by the caller). /* The operation was cancelled (typically by the caller). */
HTTP Mapping: 499 Client Closed Request */
Cancelled = 1, Cancelled = 1,
/* Unknown error. An example of where this error may be returned is /* Unknown error. An example of where this error may be returned is
if a Status value received from another address space belongs to if a Status value received from another address space belongs to
an error-space that is not known in this address space. Also an error-space that is not known in this address space. Also
errors raised by APIs that do not return enough error information errors raised by APIs that do not return enough error information
may be converted to this error. may be converted to this error. */
HTTP Mapping: 500 Internal Server Error */
Unknown = 2, Unknown = 2,
/* Client specified an invalid argument. Note that this differs /* Client specified an invalid argument. Note that this differs
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
that are problematic regardless of the state of the system that are problematic regardless of the state of the system
(e.g., a malformed file name). (e.g., a malformed file name). */
HTTP Mapping: 400 Bad Request */
InvalidArgument = 3, InvalidArgument = 3,
/* Deadline expired before operation could complete. For operations /* Deadline expired before operation could complete. For operations
that change the state of the system, this error may be returned that change the state of the system, this error may be returned
even if the operation has completed successfully. For example, a even if the operation has completed successfully. For example, a
successful response from a server could have been delayed long successful response from a server could have been delayed long
enough for the deadline to expire. enough for the deadline to expire. */
HTTP Mapping: 504 Gateway Timeout */
DeadlineExceeded = 4, DeadlineExceeded = 4,
/* Some requested entity (e.g., file or directory) was not found. /* Some requested entity (e.g., file or directory) was not found. */
HTTP Mapping: 404 Not Found */
NotFound = 5, NotFound = 5,
/* Some entity that we attempted to create (e.g., file or directory) /* Some entity that we attempted to create (e.g., file or directory)
already exists. already exists. */
HTTP Mapping: 409 Conflict */
AlreadyExists = 6, AlreadyExists = 6,
/* The caller does not have permission to execute the specified /* The caller does not have permission to execute the specified
operation. PERMISSION_DENIED must not be used for rejections operation. PERMISSION_DENIED must not be used for rejections
caused by exhausting some resource (use RESOURCE_EXHAUSTED caused by exhausting some resource (use RESOURCE_EXHAUSTED
instead for those errors). PERMISSION_DENIED must not be instead for those errors). PERMISSION_DENIED must not be
used if the caller can not be identified (use UNAUTHENTICATED used if the caller can not be identified (use UNAUTHENTICATED
instead for those errors). instead for those errors). */
HTTP Mapping: 403 Forbidden */
PermissionDenied = 7, PermissionDenied = 7,
/* The request does not have valid authentication credentials for the /* The request does not have valid authentication credentials for the
operation. operation. */
HTTP Mapping: 401 Unauthorized */
Unauthenticated = 16, Unauthenticated = 16,
/* Some resource has been exhausted, perhaps a per-user quota, or /* Some resource has been exhausted, perhaps a per-user quota, or
perhaps the entire file system is out of space. perhaps the entire file system is out of space. */
HTTP Mapping: 429 Too Many Requests */
ResourceExhausted = 8, ResourceExhausted = 8,
/* Operation was rejected because the system is not in a state /* Operation was rejected because the system is not in a state
required for the operation's execution. For example, directory required for the operation's execution. For example, directory
@ -118,22 +98,13 @@ namespace Grpc.Core
(d) Use FAILED_PRECONDITION if the client performs conditional (d) Use FAILED_PRECONDITION if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting server does not match the condition. E.g., conflicting
read-modify-write on the same resource. read-modify-write on the same resource. */
HTTP Mapping: 400 Bad Request
NOTE: HTTP spec says 412 Precondition Failed should only be used if
the request contains Etag related headers. So if the server does see
Etag related headers in the request, it may choose to return 412
instead of 400 for this error code. */
FailedPrecondition = 9, FailedPrecondition = 9,
/* The operation was aborted, typically due to a concurrency issue /* The operation was aborted, typically due to a concurrency issue
like sequencer check failures, transaction aborts, etc. like sequencer check failures, transaction aborts, etc.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 409 Conflict */
Aborted = 10, Aborted = 10,
/* Operation was attempted past the valid range. E.g., seeking or /* Operation was attempted past the valid range. E.g., seeking or
reading past end of file. reading past end of file.
@ -149,32 +120,22 @@ namespace Grpc.Core
OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
error) when it applies so that callers who are iterating through error) when it applies so that callers who are iterating through
a space can easily look for an OUT_OF_RANGE error to detect when a space can easily look for an OUT_OF_RANGE error to detect when
they are done. they are done. */
HTTP Mapping: 400 Bad Request */
OutOfRange = 11, OutOfRange = 11,
/* Operation is not implemented or not supported/enabled in this service. /* Operation is not implemented or not supported/enabled in this service. */
HTTP Mapping: 501 Not Implemented */
Unimplemented = 12, Unimplemented = 12,
/* Internal errors. Means some invariants expected by underlying /* Internal errors. Means some invariants expected by underlying
system has been broken. If you see one of these errors, system has been broken. If you see one of these errors,
something is very broken. something is very broken. */
HTTP Mapping: 500 Internal Server Error */
Internal = 13, Internal = 13,
/* The service is currently unavailable. This is a most likely a /* The service is currently unavailable. This is a most likely a
transient condition and may be corrected by retrying with transient condition and may be corrected by retrying with
a backoff. a backoff.
See litmus test above for deciding between FAILED_PRECONDITION, See litmus test above for deciding between FAILED_PRECONDITION,
ABORTED, and UNAVAILABLE. ABORTED, and UNAVAILABLE. */
HTTP Mapping: 503 Service Unavailable */
Unavailable = 14, Unavailable = 14,
/* Unrecoverable data loss or corruption. /* Unrecoverable data loss or corruption. */
HTTP Mapping: 500 Internal Server Error */
DataLoss = 15 DataLoss = 15
} }
} }

@ -47,8 +47,9 @@ _EXTENSION_INCLUDE_DIRECTORIES = (
) )
_EXTENSION_LIBRARIES = ( _EXTENSION_LIBRARIES = (
'gpr',
'grpc', 'grpc',
'gpr',
'rt',
) )
_EXTENSION_MODULE = _core.Extension( _EXTENSION_MODULE = _core.Extension(

@ -859,7 +859,7 @@ ifeq ($(INSTALL_OK),true)
@echo "Your system looks ready to go." @echo "Your system looks ready to go."
@echo @echo
else else
@echo "Your system doesn't have protoc 3.0.0+ installed. While this" @echo "We couldn't find protoc 3.0.0+ installed on your system. While this"
@echo "won't prevent grpc from working, you won't be able to compile" @echo "won't prevent grpc from working, you won't be able to compile"
@echo "and run any meaningful code with it." @echo "and run any meaningful code with it."
@echo @echo
@ -868,7 +868,8 @@ else
@echo @echo
@echo " https://github.com/google/protobuf/releases" @echo " https://github.com/google/protobuf/releases"
@echo @echo
@echo "Once you've done so, you can re-run this check by doing:" @echo "Once you've done so, or if you think this message is in error,"
@echo "you can re-run this check by doing:"
@echo @echo
@echo " make verify-install" @echo " make verify-install"
endif endif
@ -1222,4 +1223,3 @@ strip_c strip-shared_c strip-static_c \
strip_cxx strip-shared_cxx strip-static_cxx \ strip_cxx strip-shared_cxx strip-static_cxx \
dep_c dep_cxx bins_dep_c bins_dep_cxx \ dep_c dep_cxx bins_dep_c bins_dep_cxx \
clean clean

@ -37,7 +37,7 @@ import sys
import time import time
import unittest import unittest
from grpc.framework.face import exceptions from grpc.early_adopter import exceptions
from grpc.framework.foundation import future from grpc.framework.foundation import future
# Identifiers of entities we expect to find in the generated module. # Identifiers of entities we expect to find in the generated module.

@ -41,7 +41,7 @@ static void *tag(gpr_intptr i) { return (void *)i; }
int main(int argc, char **argv) { int main(int argc, char **argv) {
grpc_channel *chan; grpc_channel *chan;
grpc_call *call; grpc_call *call;
gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5); gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(2);
grpc_completion_queue *cq; grpc_completion_queue *cq;
cq_verifier *cqv; cq_verifier *cqv;
grpc_event *ev; grpc_event *ev;

@ -275,7 +275,7 @@ int main(int argc, char **argv) {
case FLING_SERVER_SEND_STATUS_FOR_STREAMING: case FLING_SERVER_SEND_STATUS_FOR_STREAMING:
/* Send status and close completed at server */ /* Send status and close completed at server */
grpc_call_destroy(call); grpc_call_destroy(call);
request_call(); if (!shutdown_started) request_call();
break; break;
case FLING_SERVER_READ_FOR_UNARY: case FLING_SERVER_READ_FOR_UNARY:
/* Finished payload read for unary. Start all reamaining /* Finished payload read for unary. Start all reamaining
@ -288,7 +288,7 @@ int main(int argc, char **argv) {
grpc_byte_buffer_destroy(payload_buffer); grpc_byte_buffer_destroy(payload_buffer);
payload_buffer = NULL; payload_buffer = NULL;
grpc_call_destroy(call); grpc_call_destroy(call);
request_call(); if (!shutdown_started) request_call();
break; break;
} }
break; break;

@ -41,6 +41,7 @@ _TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets']
_VERSION_KEYS = ['major', 'minor', 'micro', 'build'] _VERSION_KEYS = ['major', 'minor', 'micro', 'build']
_ELEM_KEYS = [ _ELEM_KEYS = [
'name', 'name',
'flaky',
'build', 'build',
'run', 'run',
'language', 'language',

@ -0,0 +1,59 @@
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Dockerfile for gRPC C# (on Mono).
FROM grpc/csharp_mono_base
# Pull the latest sources
RUN cd /var/local/git/grpc \
&& git pull --recurse-submodules \
&& git submodule update --init --recursive
# Install the gRPC C# extension library
RUN make install_grpc_csharp_ext -j12 -C /var/local/git/grpc
# TODO: download NuGet from web. The problem is there seems to be no direct link
# we could use :-)
ADD NuGet.exe NuGet.exe
# Restore the NuGet dependencies
RUN cd /var/local/git/grpc/src/csharp && mono /NuGet.exe restore Grpc.sln
# Build gRPC solution
RUN cd /var/local/git/grpc/src/csharp && xbuild Grpc.sln
# Add a cacerts directory containing the Google root pem file, allowing the
# ruby client to access the production test instance
ADD cacerts cacerts
# Add a service_account directory containing the auth creds file
ADD service_account service_account
# TODO: add command to run the interop server
CMD ["/bin/bash", "-l"]

@ -0,0 +1,53 @@
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Base Dockerfile for gRPC C# (on Mono).
#
# Includes gRPC C# installation dependencies, things that are unlikely to vary.
FROM grpc/base
# Update to a newer version of mono
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list
# Install dependencies
RUN apt-get update && apt-get install -y \
mono-devel \
nunit \
nunit-console \
monodevelop
# Get the source from GitHub
RUN git clone git@github.com:grpc/grpc.git /var/local/git/grpc
RUN cd /var/local/git/grpc && \
git pull --recurse-submodules && \
git submodule update --init --recursive
# Define the default command.
CMD ["bash","-l"]

@ -33,10 +33,9 @@ set -ex
# change to grpc repo root # change to grpc repo root
cd $(dirname $0)/../.. cd $(dirname $0)/../..
make -j6
root=`pwd` root=`pwd`
virtualenv python2.7_virtual_environment rm -rf python2.7_virtual_environment
virtualenv -p /usr/bin/python2.7 python2.7_virtual_environment
source python2.7_virtual_environment/bin/activate source python2.7_virtual_environment/bin/activate
pip install enum34==1.0.4 futures==2.2.0 protobuf==3.0.0-alpha-1 pip install enum34==1.0.4 futures==2.2.0 protobuf==3.0.0-alpha-1
CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src CFLAGS=-I$root/include LDFLAGS=-L$root/libs/opt pip install src/python/src

@ -35,7 +35,7 @@ out=`realpath ${1:-coverage}`
root=`realpath $(dirname $0)/../..` root=`realpath $(dirname $0)/../..`
tmp=`mktemp` tmp=`mktemp`
cd $root cd $root
tools/run_tests/run_tests.py -c gcov -l c c++ tools/run_tests/run_tests.py -c gcov -l c c++ || true
lcov --capture --directory . --output-file $tmp lcov --capture --directory . --output-file $tmp
genhtml $tmp --output-directory $out genhtml $tmp --output-directory $out
rm $tmp rm $tmp

@ -38,7 +38,8 @@ export LD_LIBRARY_PATH=$root/libs/opt
source python2.7_virtual_environment/bin/activate source python2.7_virtual_environment/bin/activate
# TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized. # TODO(issue 215): Properly itemize these in run_tests.py so that they can be parallelized.
# TODO(atash): Enable dynamic unused port discovery for this test. # TODO(atash): Enable dynamic unused port discovery for this test.
python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt # TODO(mlumish): Re-enable this test when we can install protoc
# python2.7 -B test/compiler/python_plugin_test.py --build_mode=opt
python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test python2.7 -B -m grpc._adapter._blocking_invocation_inline_service_test
python2.7 -B -m grpc._adapter._c_test python2.7 -B -m grpc._adapter._c_test
python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test python2.7 -B -m grpc._adapter._event_invocation_synchronous_event_service_test

@ -135,7 +135,7 @@ class PythonLanguage(object):
return [config.job_spec('tools/run_tests/run_python.sh', None)] return [config.job_spec('tools/run_tests/run_python.sh', None)]
def make_targets(self): def make_targets(self):
return[] return ['static_c']
def build_steps(self): def build_steps(self):
return [['tools/run_tests/build_python.sh']] return [['tools/run_tests/build_python.sh']]

@ -102,12 +102,12 @@
"name": "fd_posix_test" "name": "fd_posix_test"
}, },
{ {
"flaky": true, "flaky": false,
"language": "c", "language": "c",
"name": "fling_stream_test" "name": "fling_stream_test"
}, },
{ {
"flaky": true, "flaky": false,
"language": "c", "language": "c",
"name": "fling_test" "name": "fling_test"
}, },

@ -160,6 +160,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" /> <ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" /> <ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" /> <ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\server.h" /> <ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" /> <ClInclude Include="..\..\src\core\surface\surface_trace.h" />
<ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" /> <ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" />
@ -218,6 +219,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c"> <ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c"> <ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\tsi\fake_transport_security.c"> <ClCompile Include="..\..\src\core\tsi\fake_transport_security.c">
@ -374,6 +377,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c"> <ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -49,6 +49,9 @@
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c"> <ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
<Filter>src\core\security</Filter> <Filter>src\core\security</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c"> <ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClCompile> </ClCompile>
@ -283,6 +286,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter> <Filter>src\core\transport\chttp2</Filter>
</ClCompile> </ClCompile>
@ -587,6 +593,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h"> <ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\server.h"> <ClInclude Include="..\..\src\core\surface\server.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>

@ -164,6 +164,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" /> <ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" /> <ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" /> <ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\server.h" /> <ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" /> <ClInclude Include="..\..\src\core\surface\surface_trace.h" />
<ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" /> <ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" />
@ -222,6 +223,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c"> <ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c"> <ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\tsi\fake_transport_security.c"> <ClCompile Include="..\..\src\core\tsi\fake_transport_security.c">
@ -378,6 +381,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c"> <ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -49,6 +49,9 @@
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c"> <ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
<Filter>src\core\security</Filter> <Filter>src\core\security</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c"> <ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClCompile> </ClCompile>
@ -283,6 +286,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter> <Filter>src\core\transport\chttp2</Filter>
</ClCompile> </ClCompile>
@ -587,6 +593,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h"> <ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\server.h"> <ClInclude Include="..\..\src\core\surface\server.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>

@ -145,6 +145,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" /> <ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" /> <ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" /> <ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\server.h" /> <ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" /> <ClInclude Include="..\..\src\core\surface\surface_trace.h" />
<ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" /> <ClInclude Include="..\..\src\core\transport\chttp2\bin_encoder.h" />
@ -171,6 +172,8 @@
<ClInclude Include="..\..\src\core\transport\transport_impl.h" /> <ClInclude Include="..\..\src\core\transport\transport_impl.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\core\surface\init_unsecure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\channel\call_op_string.c"> <ClCompile Include="..\..\src\core\channel\call_op_string.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\channel\census_filter.c"> <ClCompile Include="..\..\src\core\channel\census_filter.c">
@ -319,6 +322,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c"> <ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\src\core\surface\init_unsecure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\channel\call_op_string.c"> <ClCompile Include="..\..\src\core\channel\call_op_string.c">
<Filter>src\core\channel</Filter> <Filter>src\core\channel</Filter>
</ClCompile> </ClCompile>
@ -223,6 +226,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c"> <ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c"> <ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter> <Filter>src\core\transport\chttp2</Filter>
</ClCompile> </ClCompile>
@ -482,6 +488,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h"> <ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\server.h"> <ClInclude Include="..\..\src\core\surface\server.h">
<Filter>src\core\surface</Filter> <Filter>src\core\surface</Filter>
</ClInclude> </ClInclude>

Loading…
Cancel
Save