Merge remote-tracking branch 'upstream/master' into stream_compression_config

pull/11782/head
Muxi Yan 8 years ago
commit 7c62a35c6f
  1. 6
      BUILD
  2. 2
      CMakeLists.txt
  3. 4
      Makefile
  4. 4
      build.yaml
  5. 2
      doc/g_stands_for.md
  6. 5
      examples/csharp/helloworld-from-cli/global.json
  7. 7
      gRPC-Core.podspec
  8. 2
      gRPC-ProtoRPC.podspec
  9. 2
      gRPC-RxLibrary.podspec
  10. 2
      gRPC.podspec
  11. 2473
      grpc.gyp
  12. 92
      include/grpc++/impl/codegen/async_unary_call.h
  13. 28
      include/grpc++/impl/codegen/call.h
  14. 2
      package.json
  15. 4
      package.xml
  16. 1
      src/compiler/csharp_generator.cc
  17. 122
      src/core/ext/transport/chttp2/transport/chttp2_transport.c
  18. 177
      src/core/ext/transport/chttp2/transport/flow_control.c
  19. 32
      src/core/ext/transport/chttp2/transport/internal.h
  20. 9
      src/core/lib/iomgr/ev_epoll1_linux.c
  21. 17
      src/core/lib/security/credentials/jwt/jwt_verifier.c
  22. 8
      src/core/lib/security/credentials/oauth2/oauth2_credentials.c
  23. 2
      src/core/lib/surface/version.c
  24. 10
      src/core/lib/transport/bdp_estimator.c
  25. 10
      src/core/lib/transport/bdp_estimator.h
  26. 2
      src/cpp/common/version_cc.cc
  27. 1
      src/csharp/Grpc.Auth/Grpc.Auth.csproj
  28. 1
      src/csharp/Grpc.Core.Testing/Grpc.Core.Testing.csproj
  29. 52
      src/csharp/Grpc.Core.Tests/ClientServerTest.cs
  30. 4
      src/csharp/Grpc.Core.Tests/CompressionTest.cs
  31. 8
      src/csharp/Grpc.Core.Tests/ContextPropagationTest.cs
  32. 1
      src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
  33. 4
      src/csharp/Grpc.Core.Tests/HalfcloseTest.cs
  34. 5
      src/csharp/Grpc.Core.Tests/Internal/CompletionQueueEventTest.cs
  35. 3
      src/csharp/Grpc.Core.Tests/Internal/TimespecTest.cs
  36. 14
      src/csharp/Grpc.Core.Tests/MockServiceHelper.cs
  37. 4
      src/csharp/Grpc.Core.Tests/PerformanceTest.cs
  38. 8
      src/csharp/Grpc.Core.Tests/ResponseHeadersTest.cs
  39. 17
      src/csharp/Grpc.Core.Tests/ThreadingModelTest.cs
  40. 8
      src/csharp/Grpc.Core.Tests/TimeoutsTest.cs
  41. 1
      src/csharp/Grpc.Core/Grpc.Core.csproj
  42. 2
      src/csharp/Grpc.Core/Internal/AtomicCounter.cs
  43. 3
      src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs
  44. 37
      src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs
  45. 2
      src/csharp/Grpc.Core/Version.csproj.include
  46. 4
      src/csharp/Grpc.Core/VersionInfo.cs
  47. 1
      src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj
  48. 1
      src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj
  49. 1
      src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj
  50. 6
      src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs
  51. 1
      src/csharp/Grpc.Examples/Grpc.Examples.csproj
  52. 1
      src/csharp/Grpc.Examples/MathGrpc.cs
  53. 3
      src/csharp/Grpc.Examples/MathServiceImpl.cs
  54. 1
      src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
  55. 4
      src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
  56. 1
      src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj
  57. 1
      src/csharp/Grpc.HealthCheck/HealthGrpc.cs
  58. 1
      src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
  59. 1
      src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj
  60. 1
      src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
  61. 1
      src/csharp/Grpc.IntegrationTesting.StressClient/Grpc.IntegrationTesting.StressClient.csproj
  62. 248
      src/csharp/Grpc.IntegrationTesting/Control.cs
  63. 6
      src/csharp/Grpc.IntegrationTesting/CustomErrorDetailsTest.cs
  64. 6
      src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
  65. 1
      src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
  66. 4
      src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
  67. 1
      src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs
  68. 4
      src/csharp/Grpc.IntegrationTesting/RunnerClientServerTest.cs
  69. 1
      src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
  70. 10
      src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
  71. 1
      src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
  72. 5
      src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
  73. 1
      src/csharp/Grpc.Microbenchmarks/Grpc.Microbenchmarks.csproj
  74. 1
      src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj
  75. 4
      src/csharp/Grpc.Reflection.Tests/ReflectionClientServerTest.cs
  76. 1
      src/csharp/Grpc.Reflection/Grpc.Reflection.csproj
  77. 1
      src/csharp/Grpc.Reflection/ReflectionGrpc.cs
  78. 3
      src/csharp/Grpc.Reflection/ReflectionServiceImpl.cs
  79. 2
      src/csharp/build_packages_dotnetcli.bat
  80. 4
      src/csharp/build_packages_dotnetcli.sh
  81. 5
      src/csharp/global.json
  82. 4
      src/node/health_check/package.json
  83. 2
      src/node/tools/package.json
  84. 2
      src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
  85. 2
      src/objective-c/GRPCClient/private/version.h
  86. 6
      src/objective-c/tests/build_one_example.sh
  87. 22
      src/objective-c/tests/run_tests.sh
  88. 2
      src/php/composer.json
  89. 2
      src/php/ext/grpc/version.h
  90. 28
      src/php/lib/Grpc/ServerStreamingCall.php
  91. 28
      src/php/lib/Grpc/UnaryCall.php
  92. 2
      src/python/grpcio/grpc/_grpcio_metadata.py
  93. 2
      src/python/grpcio/grpc_version.py
  94. 2
      src/python/grpcio_health_checking/grpc_version.py
  95. 2
      src/python/grpcio_reflection/grpc_version.py
  96. 2
      src/python/grpcio_tests/grpc_version.py
  97. 6
      src/ruby/lib/grpc/generic/rpc_desc.rb
  98. 2
      src/ruby/lib/grpc/version.rb
  99. 38
      src/ruby/spec/generic/rpc_desc_spec.rb
  100. 2
      src/ruby/tools/version.rb
  101. Some files were not shown because too many files have changed in this diff Show More

@ -34,11 +34,11 @@ load(
)
# This should be updated along with build.yaml
g_stands_for = "gregarious"
g_stands_for = "gambit"
core_version = "4.0.0-dev"
version = "1.5.0-dev"
version = "1.7.0-dev"
GPR_PUBLIC_HDRS = [
"include/grpc/support/alloc.h",
@ -593,9 +593,9 @@ grpc_cc_library(
"src/core/lib/iomgr/ev_windows.c",
"src/core/lib/iomgr/exec_ctx.c",
"src/core/lib/iomgr/executor.c",
"src/core/lib/iomgr/gethostname_fallback.c",
"src/core/lib/iomgr/gethostname_host_name_max.c",
"src/core/lib/iomgr/gethostname_sysconf.c",
"src/core/lib/iomgr/gethostname_fallback.c",
"src/core/lib/iomgr/iocp_windows.c",
"src/core/lib/iomgr/iomgr.c",
"src/core/lib/iomgr/iomgr_posix.c",

@ -24,7 +24,7 @@
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME "grpc")
set(PACKAGE_VERSION "1.5.0-dev")
set(PACKAGE_VERSION "1.7.0-dev")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/")

@ -411,8 +411,8 @@ Q = @
endif
CORE_VERSION = 4.0.0-dev
CPP_VERSION = 1.5.0-dev
CSHARP_VERSION = 1.5.0-dev
CPP_VERSION = 1.7.0-dev
CSHARP_VERSION = 1.7.0-dev
CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES))
CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)

@ -13,8 +13,8 @@ settings:
'#09': Per-language overrides are possible with (eg) ruby_version tag here
'#10': See the expand_version.py for all the quirks here
core_version: 4.0.0-dev
g_stands_for: gregarious
version: 1.5.0-dev
g_stands_for: gambit
version: 1.7.0-dev
filegroups:
- name: census
public_headers:

@ -9,3 +9,5 @@ future), and the corresponding version numbers that used them:
- 1.2 'g' stands for 'green'
- 1.3 'g' stands for 'gentle'
- 1.4 'g' stands for 'gregarious'
- 1.6 'g' stands for 'garcia'
- 1.7 'g' stands for 'gambit'

@ -0,0 +1,5 @@
{
"sdk": {
"version": "1.0.0"
}
}

@ -22,7 +22,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-Core'
version = '1.5.0-dev'
version = '1.7.0-dev'
s.version = version
s.summary = 'Core cross-platform gRPC library, written in C'
s.homepage = 'https://grpc.io'
@ -994,4 +994,9 @@ Pod::Spec.new do |s|
'test/core/util/port.c',
'test/core/util/port_server_client.{c,h}'
end
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?
s.prepare_command = <<-END_OF_COMMAND
find src/core/ -type f -exec sed -E -i '.back' 's;#include "third_party/nanopb/(.*)";#include <nanopb/\\1>;g' {} \\\;
END_OF_COMMAND
end

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-ProtoRPC'
version = '1.5.0-dev'
version = '1.7.0-dev'
s.version = version
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
s.homepage = 'https://grpc.io'

@ -21,7 +21,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC-RxLibrary'
version = '1.5.0-dev'
version = '1.7.0-dev'
s.version = version
s.summary = 'Reactive Extensions library for iOS/OSX.'
s.homepage = 'https://grpc.io'

@ -20,7 +20,7 @@
Pod::Spec.new do |s|
s.name = 'gRPC'
version = '1.5.0-dev'
version = '1.7.0-dev'
s.version = version
s.summary = 'gRPC client library for iOS/OSX'
s.homepage = 'https://grpc.io'

2473
grpc.gyp

File diff suppressed because it is too large Load Diff

@ -87,28 +87,6 @@ class ClientAsyncResponseReader final
ClientAsyncResponseReader(call, context, request);
}
/// TODO(vjpai): Delete the below constructor
/// PLEASE DO NOT USE THIS CONSTRUCTOR IN NEW CODE
/// This code is only present as a short-term workaround
/// for users that bypassed the code-generator and directly
/// created this struct rather than properly using a stub.
/// This code will not remain a valid public constructor for long.
template <class W>
ClientAsyncResponseReader(ChannelInterface* channel, CompletionQueue* cq,
const RpcMethod& method, ClientContext* context,
const W& request)
: context_(context),
call_(channel->CreateCall(method, context, cq)),
collection_(std::make_shared<Ops>()) {
collection_->init_buf.SetCollection(collection_);
collection_->init_buf.SendInitialMetadata(
context->send_initial_metadata_, context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(collection_->init_buf.SendMessage(request).ok());
collection_->init_buf.ClientSendClose();
call_.PerformOps(&collection_->init_buf);
}
// always allocated against a call arena, no memory free required
static void operator delete(void* ptr, std::size_t size) {
assert(size == sizeof(ClientAsyncResponseReader));
@ -119,22 +97,13 @@ class ClientAsyncResponseReader final
///
/// Side effect:
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the serve.
/// possible initial and trailing metadata sent from the server.
void ReadInitialMetadata(void* tag) {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
Ops* o = &ops_;
// TODO(vjpai): Remove the collection_ specialization as soon
// as the public constructor is deleted
if (collection_) {
o = collection_.get();
collection_->meta_buf.SetCollection(collection_);
}
o->meta_buf.set_output_tag(tag);
o->meta_buf.RecvInitialMetadata(context_);
call_.PerformOps(&o->meta_buf);
meta_buf.set_output_tag(tag);
meta_buf.RecvInitialMetadata(context_);
call_.PerformOps(&meta_buf);
}
/// See \a ClientAysncResponseReaderInterface::Finish for semantics.
@ -143,23 +112,14 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(R* msg, Status* status, void* tag) {
Ops* o = &ops_;
// TODO(vjpai): Remove the collection_ specialization as soon
// as the public constructor is deleted
if (collection_) {
o = collection_.get();
collection_->finish_buf.SetCollection(collection_);
}
o->finish_buf.set_output_tag(tag);
finish_buf.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
o->finish_buf.RecvInitialMetadata(context_);
finish_buf.RecvInitialMetadata(context_);
}
o->finish_buf.RecvMessage(msg);
o->finish_buf.AllowNoMessage();
o->finish_buf.ClientRecvStatus(context_, status);
call_.PerformOps(&o->finish_buf);
finish_buf.RecvMessage(msg);
finish_buf.AllowNoMessage();
finish_buf.ClientRecvStatus(context_, status);
call_.PerformOps(&finish_buf);
}
private:
@ -169,33 +129,25 @@ class ClientAsyncResponseReader final
template <class W>
ClientAsyncResponseReader(Call call, ClientContext* context, const W& request)
: context_(context), call_(call) {
ops_.init_buf.SendInitialMetadata(context->send_initial_metadata_,
context->initial_metadata_flags());
init_buf.SendInitialMetadata(context->send_initial_metadata_,
context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(ops_.init_buf.SendMessage(request).ok());
ops_.init_buf.ClientSendClose();
call_.PerformOps(&ops_.init_buf);
GPR_CODEGEN_ASSERT(init_buf.SendMessage(request).ok());
init_buf.ClientSendClose();
call_.PerformOps(&init_buf);
}
// disable operator new
static void* operator new(std::size_t size);
static void* operator new(std::size_t size, void* p) { return p; }
// TODO(vjpai): Remove the reference to CallOpSetCollectionInterface
// as soon as the related workaround (public constructor) is deleted
struct Ops : public CallOpSetCollectionInterface {
SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpClientSendClose>
init_buf;
CallOpSet<CallOpRecvInitialMetadata> meta_buf;
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
CallOpClientRecvStatus>
finish_buf;
} ops_;
// TODO(vjpai): Remove the collection_ as soon as the related workaround
// (public constructor) is deleted
std::shared_ptr<Ops> collection_;
SneakyCallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpClientSendClose>
init_buf;
CallOpSet<CallOpRecvInitialMetadata> meta_buf;
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>,
CallOpClientRecvStatus>
finish_buf;
};
/// Async server-side API for handling unary calls, where the single

@ -584,14 +584,6 @@ class CallOpClientRecvStatus {
grpc_slice error_message_;
};
/// TODO(vjpai): Remove the existence of CallOpSetCollectionInterface
/// and references to it. This code is deprecated-on-arrival and is
/// only added for users that bypassed the code-generator.
class CallOpSetCollectionInterface {
public:
virtual ~CallOpSetCollectionInterface() {}
};
/// An abstract collection of call ops, used to generate the
/// grpc_call_op structure to pass down to the lower layers,
/// and as it is-a CompletionQueueTag, also massages the final
@ -602,18 +594,6 @@ class CallOpSetInterface : public CompletionQueueTag {
/// Fills in grpc_op, starting from ops[*nops] and moving
/// upwards.
virtual void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) = 0;
/// TODO(vjpai): Remove the SetCollection method and comment. This is only
/// a short-term workaround for users that bypassed the code generator
/// Mark this as belonging to a collection if needed
void SetCollection(std::shared_ptr<CallOpSetCollectionInterface> collection) {
collection_ = collection;
}
protected:
/// TODO(vjpai): Remove the collection_ field once the idea of bypassing the
/// code generator is forbidden. This is already deprecated
std::shared_ptr<CallOpSetCollectionInterface> collection_;
};
/// Primary implementaiton of CallOpSetInterface.
@ -654,13 +634,7 @@ class CallOpSet : public CallOpSetInterface,
this->Op6::FinishOp(status);
*tag = return_tag_;
// TODO(vjpai): Remove the reference to collection_ once the idea of
// bypassing the code generator is forbidden. It is already deprecated
grpc_call* call = call_;
collection_.reset();
g_core_codegen_interface->grpc_call_unref(call);
g_core_codegen_interface->grpc_call_unref(call_);
return true;
}

@ -1,6 +1,6 @@
{
"name": "grpc",
"version": "1.5.0-dev",
"version": "1.7.0-dev",
"author": "Google Inc.",
"description": "gRPC Library for Node",
"homepage": "https://grpc.io/",

@ -13,8 +13,8 @@
<date>2017-05-22</date>
<time>16:06:07</time>
<version>
<release>1.5.0dev</release>
<api>1.5.0dev</api>
<release>1.7.0dev</release>
<api>1.7.0dev</api>
</version>
<stability>
<release>beta</release>

@ -670,6 +670,7 @@ grpc::string GetServices(const FileDescriptor *file, bool generate_client,
out.Print(leading_comments.c_str());
}
out.Print("#pragma warning disable 1591\n");
out.Print("#region Designer generated code\n");
out.Print("\n");
out.Print("using System;\n");

@ -304,10 +304,10 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
keepalive_watchdog_fired_locked, t,
grpc_combiner_scheduler(t->combiner));
grpc_bdp_estimator_init(&t->bdp_estimator, t->peer_string);
t->last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC);
grpc_bdp_estimator_init(&t->flow_control.bdp_estimator, t->peer_string);
t->flow_control.last_pid_update = gpr_now(GPR_CLOCK_MONOTONIC);
grpc_pid_controller_init(
&t->pid_controller,
&t->flow_control.pid_controller,
(grpc_pid_controller_args){.gain_p = 4,
.gain_i = 8,
.gain_d = 0,
@ -340,7 +340,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
t->force_send_settings = 1 << GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;
t->sent_local_settings = 0;
t->write_buffer_size = DEFAULT_WINDOW;
t->enable_bdp_probe = true;
t->flow_control.enable_bdp_probe = true;
if (is_client) {
grpc_slice_buffer_add(&t->outbuf, grpc_slice_from_copied_string(
@ -457,7 +457,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
(grpc_integer_options){0, 0, MAX_WRITE_BUFFER_SIZE});
} else if (0 ==
strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) {
t->enable_bdp_probe = grpc_channel_arg_get_integer(
t->flow_control.enable_bdp_probe = grpc_channel_arg_get_integer(
&channel_args->args[i], (grpc_integer_options){1, 0, 1});
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_KEEPALIVE_TIME_MS)) {
@ -2262,46 +2262,27 @@ void grpc_chttp2_act_on_flowctl_action(grpc_exec_ctx *exec_ctx,
case GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE:
break;
}
}
static void update_bdp(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
double bdp_dbl) {
// initial window size bounded [1,2^31-1], but we set the min to 128.
int32_t bdp = GPR_CLAMP((int32_t)bdp_dbl, 128, INT32_MAX);
int64_t delta =
(int64_t)bdp -
(int64_t)t->settings[GRPC_LOCAL_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];
if (delta == 0 || (delta > -bdp / 10 && delta < bdp / 10)) {
return;
}
if (GRPC_TRACER_ON(grpc_bdp_estimator_trace) ||
GRPC_TRACER_ON(grpc_flowctl_trace)) {
gpr_log(GPR_DEBUG, "%s | %p[%s] | update initial window size to %d",
t->peer_string, t, t->is_client ? "cli" : "svr", (int)bdp);
}
queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
(uint32_t)bdp);
}
static void update_frame(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
double bw_dbl, double bdp_dbl) {
int32_t bdp = (int32_t)GPR_CLAMP(bdp_dbl, 128.0, INT32_MAX);
int32_t target = (int32_t)GPR_MAX(bw_dbl / 1000, bdp);
// frame size is bounded [2^14,2^24-1]
int32_t frame_size = GPR_CLAMP(target, 16384, 16777215);
int64_t delta = (int64_t)frame_size -
(int64_t)t->settings[GRPC_LOCAL_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE];
if (delta == 0 || (delta > -frame_size / 10 && delta < frame_size / 10)) {
return;
if (action.send_setting_update != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) {
if (action.initial_window_size > 0) {
queue_setting_update(exec_ctx, t,
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
(uint32_t)action.initial_window_size);
}
if (action.max_frame_size > 0) {
queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
(uint32_t)action.max_frame_size);
}
if (action.send_setting_update == GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY) {
grpc_chttp2_initiate_write(exec_ctx, t, "immediate setting update");
}
}
if (GRPC_TRACER_ON(grpc_bdp_estimator_trace)) {
gpr_log(GPR_DEBUG, "%s: update max_frame size to %d", t->peer_string,
(int)frame_size);
if (action.need_ping) {
GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
grpc_bdp_estimator_schedule_ping(&t->flow_control.bdp_estimator);
send_ping_locked(exec_ctx, t,
GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE,
&t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
}
queue_setting_update(exec_ctx, t, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE,
(uint32_t)frame_size);
}
static grpc_error *try_http_parsing(grpc_exec_ctx *exec_ctx,
@ -2339,7 +2320,6 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
GPR_TIMER_BEGIN("reading_action_locked", 0);
grpc_chttp2_transport *t = tp;
bool need_bdp_ping = false;
GRPC_ERROR_REF(error);
@ -2358,11 +2338,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
grpc_error *errors[3] = {GRPC_ERROR_REF(error), GRPC_ERROR_NONE,
GRPC_ERROR_NONE};
for (; i < t->read_buffer.count && errors[1] == GRPC_ERROR_NONE; i++) {
if (grpc_bdp_estimator_add_incoming_bytes(
&t->bdp_estimator,
(int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]))) {
need_bdp_ping = true;
}
grpc_bdp_estimator_add_incoming_bytes(
&t->flow_control.bdp_estimator,
(int64_t)GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
errors[1] =
grpc_chttp2_perform_read(exec_ctx, t, t->read_buffer.slices[i]);
}
@ -2409,45 +2387,9 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
if (keep_reading) {
grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
&t->read_action_locked);
if (t->enable_bdp_probe) {
if (need_bdp_ping) {
GRPC_CHTTP2_REF_TRANSPORT(t, "bdp_ping");
grpc_bdp_estimator_schedule_ping(&t->bdp_estimator);
send_ping_locked(exec_ctx, t,
GRPC_CHTTP2_PING_BEFORE_TRANSPORT_WINDOW_UPDATE,
&t->start_bdp_ping_locked, &t->finish_bdp_ping_locked);
}
int64_t estimate = -1;
double bdp_guess = -1;
if (grpc_bdp_estimator_get_estimate(&t->bdp_estimator, &estimate)) {
double target = 1 + log2((double)estimate);
double memory_pressure = grpc_resource_quota_get_memory_pressure(
grpc_resource_user_quota(grpc_endpoint_get_resource_user(t->ep)));
if (memory_pressure > 0.8) {
target *= 1 - GPR_MIN(1, (memory_pressure - 0.8) / 0.1);
}
double bdp_error =
target - grpc_pid_controller_last(&t->pid_controller);
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec dt_timespec = gpr_time_sub(now, t->last_pid_update);
double dt = (double)dt_timespec.tv_sec + dt_timespec.tv_nsec * 1e-9;
if (dt > 0.1) {
dt = 0.1;
}
double log2_bdp_guess =
grpc_pid_controller_update(&t->pid_controller, bdp_error, dt);
bdp_guess = pow(2, log2_bdp_guess);
update_bdp(exec_ctx, t, bdp_guess);
t->last_pid_update = now;
}
double bw = -1;
if (grpc_bdp_estimator_get_bw(&t->bdp_estimator, &bw)) {
update_frame(exec_ctx, t, bw, bdp_guess);
}
}
grpc_chttp2_act_on_flowctl_action(
exec_ctx, grpc_chttp2_flowctl_get_bdp_action(&t->flow_control), t,
NULL);
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
} else {
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action");
@ -2470,7 +2412,7 @@ static void start_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
if (t->keepalive_state == GRPC_CHTTP2_KEEPALIVE_STATE_WAITING) {
grpc_timer_cancel(exec_ctx, &t->keepalive_ping_timer);
}
grpc_bdp_estimator_start_ping(&t->bdp_estimator);
grpc_bdp_estimator_start_ping(&t->flow_control.bdp_estimator);
}
static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
@ -2479,7 +2421,7 @@ static void finish_bdp_ping_locked(grpc_exec_ctx *exec_ctx, void *tp,
if (GRPC_TRACER_ON(grpc_http_trace)) {
gpr_log(GPR_DEBUG, "%s: Complete BDP ping", t->peer_string);
}
grpc_bdp_estimator_complete_ping(&t->bdp_estimator);
grpc_bdp_estimator_complete_ping(&t->flow_control.bdp_estimator);
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "bdp_ping");
}

@ -18,6 +18,7 @@
#include "src/core/ext/transport/chttp2/transport/internal.h"
#include <math.h>
#include <string.h>
#include <grpc/support/alloc.h>
@ -39,6 +40,8 @@ typedef struct {
int64_t remote_window_delta;
int64_t local_window_delta;
int64_t announced_window_delta;
uint32_t local_init_window;
uint32_t local_max_frame;
} shadow_flow_control;
static void pretrace(shadow_flow_control* shadow_fc,
@ -54,14 +57,28 @@ static void pretrace(shadow_flow_control* shadow_fc,
}
}
static char* fmt_str(int64_t old, int64_t new) {
#define TRACE_PADDING 30
static char* fmt_int64_diff_str(int64_t old, int64_t new) {
char* str;
if (old != new) {
gpr_asprintf(&str, "%" PRId64 " -> %" PRId64 "", old, new);
} else {
gpr_asprintf(&str, "%" PRId64 "", old);
}
char* str_lp = gpr_leftpad(str, ' ', 30);
char* str_lp = gpr_leftpad(str, ' ', TRACE_PADDING);
gpr_free(str);
return str_lp;
}
static char* fmt_uint32_diff_str(uint32_t old, uint32_t new) {
char* str;
if (new > 0 && old != new) {
gpr_asprintf(&str, "%" PRIu32 " -> %" PRIu32 "", old, new);
} else {
gpr_asprintf(&str, "%" PRIu32 "", old);
}
char* str_lp = gpr_leftpad(str, ' ', TRACE_PADDING);
gpr_free(str);
return str_lp;
}
@ -75,24 +92,28 @@ static void posttrace(shadow_flow_control* shadow_fc,
uint32_t remote_window =
tfc->t->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE];
char* trw_str = fmt_str(shadow_fc->remote_window, tfc->remote_window);
char* tlw_str = fmt_str(shadow_fc->target_window,
grpc_chttp2_target_announced_window(tfc));
char* taw_str = fmt_str(shadow_fc->announced_window, tfc->announced_window);
char* trw_str =
fmt_int64_diff_str(shadow_fc->remote_window, tfc->remote_window);
char* tlw_str = fmt_int64_diff_str(shadow_fc->target_window,
grpc_chttp2_target_announced_window(tfc));
char* taw_str =
fmt_int64_diff_str(shadow_fc->announced_window, tfc->announced_window);
char* srw_str;
char* slw_str;
char* saw_str;
if (sfc != NULL) {
srw_str = fmt_str(shadow_fc->remote_window_delta + remote_window,
sfc->remote_window_delta + remote_window);
slw_str = fmt_str(shadow_fc->local_window_delta + acked_local_window,
sfc->local_window_delta + acked_local_window);
saw_str = fmt_str(shadow_fc->announced_window_delta + acked_local_window,
sfc->announced_window_delta + acked_local_window);
srw_str = fmt_int64_diff_str(shadow_fc->remote_window_delta + remote_window,
sfc->remote_window_delta + remote_window);
slw_str =
fmt_int64_diff_str(shadow_fc->local_window_delta + acked_local_window,
sfc->local_window_delta + acked_local_window);
saw_str = fmt_int64_diff_str(
shadow_fc->announced_window_delta + acked_local_window,
sfc->announced_window_delta + acked_local_window);
} else {
srw_str = gpr_leftpad("", ' ', 30);
slw_str = gpr_leftpad("", ' ', 30);
saw_str = gpr_leftpad("", ' ', 30);
srw_str = gpr_leftpad("", ' ', TRACE_PADDING);
slw_str = gpr_leftpad("", ' ', TRACE_PADDING);
saw_str = gpr_leftpad("", ' ', TRACE_PADDING);
}
gpr_log(GPR_DEBUG,
"%p[%u][%s] | %s | trw:%s, ttw:%s, taw:%s, srw:%s, slw:%s, saw:%s",
@ -120,10 +141,21 @@ static char* urgency_to_string(grpc_chttp2_flowctl_urgency urgency) {
GPR_UNREACHABLE_CODE(return "unknown");
}
static void trace_action(grpc_chttp2_flowctl_action action) {
gpr_log(GPR_DEBUG, "transport: %s, stream: %s",
static void trace_action(grpc_chttp2_transport_flowctl* tfc,
grpc_chttp2_flowctl_action action) {
char* iw_str = fmt_uint32_diff_str(
tfc->t->settings[GRPC_SENT_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE],
action.initial_window_size);
char* mf_str = fmt_uint32_diff_str(
tfc->t->settings[GRPC_SENT_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
action.max_frame_size);
gpr_log(GPR_DEBUG, "t[%s], s[%s], settings[%s] iw:%s mf:%s",
urgency_to_string(action.send_transport_update),
urgency_to_string(action.send_stream_update));
urgency_to_string(action.send_stream_update),
urgency_to_string(action.send_setting_update), iw_str, mf_str);
gpr_free(iw_str);
gpr_free(mf_str);
}
#define PRETRACE(tfc, sfc) \
@ -131,11 +163,12 @@ static void trace_action(grpc_chttp2_flowctl_action action) {
GRPC_FLOW_CONTROL_IF_TRACING(pretrace(&shadow_fc, tfc, sfc))
#define POSTTRACE(tfc, sfc, reason) \
GRPC_FLOW_CONTROL_IF_TRACING(posttrace(&shadow_fc, tfc, sfc, reason))
#define TRACEACTION(action) GRPC_FLOW_CONTROL_IF_TRACING(trace_action(action))
#define TRACEACTION(tfc, action) \
GRPC_FLOW_CONTROL_IF_TRACING(trace_action(tfc, action))
#else
#define PRETRACE(tfc, sfc)
#define POSTTRACE(tfc, sfc, reason)
#define TRACEACTION(action)
#define TRACEACTION(tfc, action)
#endif
/* How many bytes of incoming flow control would we like to advertise */
@ -342,15 +375,58 @@ void grpc_chttp2_flowctl_destroy_stream(grpc_chttp2_transport_flowctl* tfc,
announced_window_delta_preupdate(tfc, sfc);
}
// Returns an urgency with which to make an update
static grpc_chttp2_flowctl_urgency delta_is_significant(
const grpc_chttp2_transport_flowctl* tfc, int32_t value,
grpc_chttp2_setting_id setting_id) {
int64_t delta = (int64_t)value -
(int64_t)tfc->t->settings[GRPC_LOCAL_SETTINGS][setting_id];
// TODO(ncteisen): tune this
if (delta != 0 && (delta <= -value / 5 || delta >= value / 5)) {
return GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE;
} else {
return GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED;
}
}
// Takes in a target and uses the pid controller to return a stabilized
// guess at the new bdp.
static double get_pid_controller_guess(grpc_chttp2_transport_flowctl* tfc,
double target) {
double bdp_error = target - grpc_pid_controller_last(&tfc->pid_controller);
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec dt_timespec = gpr_time_sub(now, tfc->last_pid_update);
double dt = (double)dt_timespec.tv_sec + dt_timespec.tv_nsec * 1e-9;
if (dt > 0.1) {
dt = 0.1;
}
double log2_bdp_guess =
grpc_pid_controller_update(&tfc->pid_controller, bdp_error, dt);
tfc->last_pid_update = now;
return pow(2, log2_bdp_guess);
}
// Take in a target and modifies it based on the memory pressure of the system
static double get_target_under_memory_pressure(
grpc_chttp2_transport_flowctl* tfc, double target) {
// do not increase window under heavy memory pressure.
double memory_pressure = grpc_resource_quota_get_memory_pressure(
grpc_resource_user_quota(grpc_endpoint_get_resource_user(tfc->t->ep)));
if (memory_pressure > 0.8) {
target *= 1 - GPR_MIN(1, (memory_pressure - 0.8) / 0.1);
}
return target;
}
grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action(
const grpc_chttp2_transport_flowctl* tfc,
const grpc_chttp2_stream_flowctl* sfc) {
grpc_chttp2_transport_flowctl* tfc, grpc_chttp2_stream_flowctl* sfc) {
grpc_chttp2_flowctl_action action;
memset(&action, 0, sizeof(action));
uint32_t target_announced_window = grpc_chttp2_target_announced_window(tfc);
if (tfc->announced_window < target_announced_window / 2) {
action.send_transport_update = GRPC_CHTTP2_FLOWCTL_UPDATE_IMMEDIATELY;
}
// TODO(ncteisen): tune this
if (sfc != NULL && !sfc->s->read_closed) {
uint32_t sent_init_window =
tfc->t->settings[GRPC_SENT_SETTINGS]
@ -364,6 +440,61 @@ grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action(
action.send_stream_update = GRPC_CHTTP2_FLOWCTL_QUEUE_UPDATE;
}
}
TRACEACTION(action);
TRACEACTION(tfc, action);
return action;
}
grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_bdp_action(
grpc_chttp2_transport_flowctl* tfc) {
grpc_chttp2_flowctl_action action;
memset(&action, 0, sizeof(action));
if (tfc->enable_bdp_probe) {
action.need_ping = grpc_bdp_estimator_need_ping(&tfc->bdp_estimator);
// get bdp estimate and update initial_window accordingly.
int64_t estimate = -1;
int32_t bdp = -1;
if (grpc_bdp_estimator_get_estimate(&tfc->bdp_estimator, &estimate)) {
double target = 1 + log2((double)estimate);
// target might change based on how much memory pressure we are under
// TODO(ncteisen): experiment with setting target to be huge under low
// memory pressure.
target = get_target_under_memory_pressure(tfc, target);
// run our target through the pid controller to stabilize change.
// TODO(ncteisen): experiment with other controllers here.
double bdp_guess = get_pid_controller_guess(tfc, target);
// Though initial window 'could' drop to 0, we keep the floor at 128
bdp = GPR_MAX((int32_t)bdp_guess, 128);
grpc_chttp2_flowctl_urgency init_window_update_urgency =
delta_is_significant(tfc, bdp,
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE);
if (init_window_update_urgency != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) {
action.send_setting_update = init_window_update_urgency;
action.initial_window_size = (uint32_t)bdp;
}
}
// get bandwidth estimate and update max_frame accordingly.
double bw_dbl = -1;
if (grpc_bdp_estimator_get_bw(&tfc->bdp_estimator, &bw_dbl)) {
// we target the max of BDP or bandwidth in microseconds.
int32_t frame_size =
GPR_CLAMP(GPR_MAX((int32_t)bw_dbl / 1000, bdp), 16384, 16777215);
grpc_chttp2_flowctl_urgency frame_size_urgency = delta_is_significant(
tfc, frame_size, GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE);
if (frame_size_urgency != GRPC_CHTTP2_FLOWCTL_NO_ACTION_NEEDED) {
if (frame_size_urgency > action.send_setting_update) {
action.send_setting_update = frame_size_urgency;
}
action.max_frame_size = (uint32_t)frame_size;
}
}
}
TRACEACTION(tfc, action);
return action;
}

@ -238,7 +238,17 @@ typedef struct {
* to send WINDOW_UPDATE frames. */
int64_t announced_window;
// read only pointer back to transport for certain data
/** should we probe bdp? */
bool enable_bdp_probe;
/* bdp estimation */
grpc_bdp_estimator bdp_estimator;
/* pid controller */
grpc_pid_controller pid_controller;
gpr_timespec last_pid_update;
// pointer back to transport for tracing
const grpc_chttp2_transport *t;
} grpc_chttp2_transport_flowctl;
@ -261,9 +271,6 @@ struct grpc_chttp2_transport {
/** is there a read request to the endpoint outstanding? */
uint8_t endpoint_reading;
/** should we probe bdp? */
bool enable_bdp_probe;
grpc_chttp2_optimization_target opt_target;
/** various lists of streams */
@ -358,13 +365,6 @@ struct grpc_chttp2_transport {
grpc_chttp2_transport_flowctl flow_control;
/* bdp estimation */
grpc_bdp_estimator bdp_estimator;
/* pid controller */
grpc_pid_controller pid_controller;
gpr_timespec last_pid_update;
/* deframing */
grpc_chttp2_deframe_transport_state deframe_state;
uint8_t incoming_frame_type;
@ -704,13 +704,19 @@ typedef enum {
typedef struct {
grpc_chttp2_flowctl_urgency send_stream_update;
grpc_chttp2_flowctl_urgency send_transport_update;
grpc_chttp2_flowctl_urgency send_setting_update;
uint32_t initial_window_size;
uint32_t max_frame_size;
bool need_ping;
} grpc_chttp2_flowctl_action;
// Reads the flow control data and returns and actionable struct that will tell
// chttp2 exactly what it needs to do
grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_action(
const grpc_chttp2_transport_flowctl *tfc,
const grpc_chttp2_stream_flowctl *sfc);
grpc_chttp2_transport_flowctl *tfc, grpc_chttp2_stream_flowctl *sfc);
grpc_chttp2_flowctl_action grpc_chttp2_flowctl_get_bdp_action(
grpc_chttp2_transport_flowctl *tfc);
// Takes in a flow control action and performs all the needed operations.
void grpc_chttp2_act_on_flowctl_action(grpc_exec_ctx *exec_ctx,

@ -406,7 +406,14 @@ static void pollset_init(grpc_pollset *pollset, gpr_mu **mu) {
gpr_mu_init(&pollset->mu);
*mu = &pollset->mu;
pollset->neighbourhood = &g_neighbourhoods[choose_neighbourhood()];
pollset->reassigning_neighbourhood = false;
pollset->root_worker = NULL;
pollset->kicked_without_poller = false;
pollset->seen_inactive = true;
pollset->shutting_down = false;
pollset->shutdown_closure = NULL;
pollset->begin_refs = 0;
pollset->next = pollset->prev = NULL;
}
static void pollset_destroy(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset) {
@ -1043,8 +1050,6 @@ static const grpc_event_engine_vtable vtable = {
/* It is possible that GLIBC has epoll but the underlying kernel doesn't.
* Create a dummy epoll_fd to make sure epoll support is available */
const grpc_event_engine_vtable *grpc_init_epoll1_linux(bool explicit_request) {
/* TODO(sreek): Temporarily disable this poller unless explicitly requested
* via GRPC_POLL_STRATEGY */
if (!explicit_request) {
return NULL;
}

@ -442,7 +442,7 @@ static EVP_PKEY *extract_pkey_from_x509(const char *x509_str) {
end:
BIO_free(bio);
if (x509 != NULL) X509_free(x509);
X509_free(x509);
return result;
}
@ -496,6 +496,8 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json,
const grpc_json *key_prop;
RSA *rsa = NULL;
EVP_PKEY *result = NULL;
BIGNUM *tmp_n = NULL;
BIGNUM *tmp_e = NULL;
GPR_ASSERT(kty != NULL && json != NULL);
if (strcmp(kty, "RSA") != 0) {
@ -507,8 +509,6 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json,
gpr_log(GPR_ERROR, "Could not create rsa key.");
goto end;
}
BIGNUM *tmp_n = NULL;
BIGNUM *tmp_e = NULL;
for (key_prop = json->child; key_prop != NULL; key_prop = key_prop->next) {
if (strcmp(key_prop->key, "n") == 0) {
tmp_n =
@ -528,11 +528,16 @@ static EVP_PKEY *pkey_from_jwk(grpc_exec_ctx *exec_ctx, const grpc_json *json,
gpr_log(GPR_ERROR, "Cannot set RSA key from inputs.");
goto end;
}
/* RSA_set0_key takes ownership on success. */
tmp_n = NULL;
tmp_e = NULL;
result = EVP_PKEY_new();
EVP_PKEY_set1_RSA(result, rsa); /* uprefs rsa. */
end:
if (rsa != NULL) RSA_free(rsa);
RSA_free(rsa);
BN_free(tmp_n);
BN_free(tmp_e);
return result;
}
@ -618,7 +623,7 @@ static int verify_jwt_signature(EVP_PKEY *key, const char *alg,
result = 1;
end:
if (md_ctx != NULL) EVP_MD_CTX_destroy(md_ctx);
EVP_MD_CTX_destroy(md_ctx);
return result;
}
@ -658,7 +663,7 @@ static void on_keys_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
end:
if (json != NULL) grpc_json_destroy(json);
if (verification_key != NULL) EVP_PKEY_free(verification_key);
EVP_PKEY_free(verification_key);
ctx->user_cb(exec_ctx, ctx->user_data, status, claims);
verifier_cb_ctx_destroy(exec_ctx, ctx);
}

@ -296,10 +296,10 @@ static bool oauth2_token_fetcher_get_request_metadata(
gpr_mu_unlock(&c->mu);
if (start_fetch) {
grpc_call_credentials_ref(creds);
c->fetch_func(exec_ctx, grpc_credentials_metadata_request_create(creds),
&c->httpcli_context, &c->pollent,
on_oauth2_token_fetcher_http_response,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), refresh_threshold));
c->fetch_func(
exec_ctx, grpc_credentials_metadata_request_create(creds),
&c->httpcli_context, &c->pollent, on_oauth2_token_fetcher_http_response,
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), refresh_threshold));
}
return false;
}

@ -23,4 +23,4 @@
const char *grpc_version_string(void) { return "4.0.0-dev"; }
const char *grpc_g_stands_for(void) { return "gregarious"; }
const char *grpc_g_stands_for(void) { return "gambit"; }

@ -33,20 +33,24 @@ void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name) {
estimator->bw_est = 0;
}
bool grpc_bdp_estimator_get_estimate(grpc_bdp_estimator *estimator,
bool grpc_bdp_estimator_get_estimate(const grpc_bdp_estimator *estimator,
int64_t *estimate) {
*estimate = estimator->estimate;
return true;
}
bool grpc_bdp_estimator_get_bw(grpc_bdp_estimator *estimator, double *bw) {
bool grpc_bdp_estimator_get_bw(const grpc_bdp_estimator *estimator,
double *bw) {
*bw = estimator->bw_est;
return true;
}
bool grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator,
void grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator,
int64_t num_bytes) {
estimator->accumulator += num_bytes;
}
bool grpc_bdp_estimator_need_ping(const grpc_bdp_estimator *estimator) {
switch (estimator->ping_state) {
case GRPC_BDP_PING_UNSCHEDULED:
return true;

@ -47,13 +47,15 @@ typedef struct grpc_bdp_estimator {
void grpc_bdp_estimator_init(grpc_bdp_estimator *estimator, const char *name);
// Returns true if a reasonable estimate could be obtained
bool grpc_bdp_estimator_get_estimate(grpc_bdp_estimator *estimator,
bool grpc_bdp_estimator_get_estimate(const grpc_bdp_estimator *estimator,
int64_t *estimate);
// Returns true if a reasonable estimate could be obtained
bool grpc_bdp_estimator_get_bw(grpc_bdp_estimator *estimator, double *bw);
// Tracks new bytes read.
bool grpc_bdp_estimator_get_bw(const grpc_bdp_estimator *estimator, double *bw);
// Returns true if the user should schedule a ping
bool grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator,
void grpc_bdp_estimator_add_incoming_bytes(grpc_bdp_estimator *estimator,
int64_t num_bytes);
// Returns true if the user should schedule a ping
bool grpc_bdp_estimator_need_ping(const grpc_bdp_estimator *estimator);
// Schedule a ping: call in response to receiving a true from
// grpc_bdp_estimator_add_incoming_bytes once a ping has been scheduled by a
// transport (but not necessarily started)

@ -22,5 +22,5 @@
#include <grpc++/grpc++.h>
namespace grpc {
grpc::string Version() { return "1.5.0-dev"; }
grpc::string Version() { return "1.7.0-dev"; }
}

@ -19,6 +19,7 @@
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -19,6 +19,7 @@
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -57,9 +57,9 @@ namespace Grpc.Core.Tests
[Test]
public async Task UnaryCall()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
return request;
return Task.FromResult(request);
});
Assert.AreEqual("ABC", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "ABC"));
@ -124,10 +124,10 @@ namespace Grpc.Core.Tests
[Test]
public void UnaryCall_ServerHandlerSetsStatus()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
context.Status = new Status(StatusCode.Unauthenticated, "");
return "";
return Task.FromResult("");
});
var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
@ -142,11 +142,11 @@ namespace Grpc.Core.Tests
[Test]
public void UnaryCall_ServerHandlerSetsStatusAndTrailers()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
context.Status = new Status(StatusCode.Unauthenticated, "");
context.ResponseTrailers.Add("xyz", "xyz-value");
return "";
return Task.FromResult("");
});
var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
@ -168,9 +168,10 @@ namespace Grpc.Core.Tests
helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) =>
{
string result = "";
await requestStream.ForEachAsync(async (request) =>
await requestStream.ForEachAsync((request) =>
{
result += request;
return TaskUtils.CompletedTask;
});
await Task.Delay(100);
return result;
@ -203,9 +204,7 @@ namespace Grpc.Core.Tests
[Test]
public async Task ServerStreamingCall_EndOfStreamIsIdempotent()
{
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) =>
{
});
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) => TaskUtils.CompletedTask);
var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), "");
@ -214,11 +213,12 @@ namespace Grpc.Core.Tests
}
[Test]
public async Task ServerStreamingCall_ErrorCanBeAwaitedTwice()
public void ServerStreamingCall_ErrorCanBeAwaitedTwice()
{
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) =>
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) =>
{
context.Status = new Status(StatusCode.InvalidArgument, "");
return TaskUtils.CompletedTask;
});
var call = Calls.AsyncServerStreamingCall(helper.CreateServerStreamingCall(), "");
@ -232,9 +232,9 @@ namespace Grpc.Core.Tests
}
[Test]
public async Task ServerStreamingCall_TrailersFromMultipleSourcesGetConcatenated()
public void ServerStreamingCall_TrailersFromMultipleSourcesGetConcatenated()
{
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) =>
helper.ServerStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) =>
{
context.ResponseTrailers.Add("xyz", "xyz-value");
throw new RpcException(new Status(StatusCode.InvalidArgument, ""), new Metadata { {"abc", "abc-value"} });
@ -343,7 +343,7 @@ namespace Grpc.Core.Tests
[Test]
public async Task AsyncUnaryCall_EchoMetadata()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
foreach (Metadata.Entry metadataEntry in context.RequestHeaders)
{
@ -352,7 +352,7 @@ namespace Grpc.Core.Tests
context.ResponseTrailers.Add(metadataEntry);
}
}
return "";
return Task.FromResult("");
});
var headers = new Metadata
@ -395,10 +395,10 @@ namespace Grpc.Core.Tests
{
// some japanese and chinese characters
var nonAsciiString = "\u30a1\u30a2\u30a3 \u62b5\u6297\u662f\u5f92\u52b3\u7684";
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
context.Status = new Status(StatusCode.Unknown, nonAsciiString);
return "";
return Task.FromResult("");
});
var ex = Assert.Throws<RpcException>(() => Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
@ -409,9 +409,9 @@ namespace Grpc.Core.Tests
[Test]
public void ServerCallContext_PeerInfoPresent()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
return context.Peer;
return Task.FromResult(context.Peer);
});
string peer = Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc");
@ -421,11 +421,11 @@ namespace Grpc.Core.Tests
[Test]
public void ServerCallContext_HostAndMethodPresent()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.IsTrue(context.Host.Contains(Host));
Assert.AreEqual("/tests.Test/Unary", context.Method);
return "PASS";
return Task.FromResult("PASS");
});
Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
}
@ -433,11 +433,11 @@ namespace Grpc.Core.Tests
[Test]
public void ServerCallContext_AuthContextNotPopulated()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.IsFalse(context.AuthContext.IsPeerAuthenticated);
Assert.AreEqual(0, context.AuthContext.Properties.Count());
return "PASS";
return Task.FromResult("PASS");
});
Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc"));
}
@ -445,9 +445,9 @@ namespace Grpc.Core.Tests
[Test]
public async Task Channel_WaitForStateChangedAsync()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
return request;
return Task.FromResult(request);
});
Assert.ThrowsAsync(typeof(TaskCanceledException),

@ -55,10 +55,10 @@ namespace Grpc.Core.Tests
[Test]
public void WriteOptions_Unary()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
context.WriteOptions = new WriteOptions(WriteFlags.NoCompress);
return request;
return Task.FromResult(request);
});
var callOptions = new CallOptions(writeOptions: new WriteOptions(WriteFlags.NoCompress));

@ -106,11 +106,11 @@ namespace Grpc.Core.Tests
public async Task PropagateDeadline()
{
var deadline = DateTime.UtcNow.AddDays(7);
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.IsTrue(context.Deadline < deadline.AddMinutes(1));
Assert.IsTrue(context.Deadline > deadline.AddMinutes(-1));
return "PASS";
return Task.FromResult("PASS");
});
helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) =>
@ -135,10 +135,10 @@ namespace Grpc.Core.Tests
[Test]
public async Task SuppressDeadlinePropagation()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.AreEqual(DateTime.MaxValue, context.Deadline);
return "PASS";
return Task.FromResult("PASS");
});
helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) =>

@ -10,6 +10,7 @@
<PackageId>Grpc.Core.Tests</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -62,9 +62,9 @@ namespace Grpc.Core.Tests
[Test]
public async Task HalfcloseAfterFullclose_ClientStreamingCall()
{
helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) =>
helper.ClientStreamingHandler = new ClientStreamingServerMethod<string, string>((requestStream, context) =>
{
return "PASS";
return Task.FromResult("PASS");
});
var call = Calls.AsyncClientStreamingCall(helper.CreateClientStreamingCall());

@ -29,9 +29,12 @@ namespace Grpc.Core.Internal.Tests
public class CompletionQueueEventTest
{
[Test]
public void CreateAndDestroy()
public void CompletionQueueEventSizeIsNativeSize()
{
#pragma warning disable 0618
// We need to use the obsolete non-generic version of Marshal.SizeOf because the generic version is not available in net45
Assert.AreEqual(CompletionQueueEvent.NativeSize, Marshal.SizeOf(typeof(CompletionQueueEvent)));
#pragma warning restore 0618
}
}
}

@ -60,7 +60,10 @@ namespace Grpc.Core.Internal.Tests
[Test]
public void TimespecSizeIsNativeSize()
{
#pragma warning disable 0618
// We need to use the obsolete non-generic version of Marshal.SizeOf because the generic version is not available in net45
Assert.AreEqual(Timespec.NativeSize, Marshal.SizeOf(typeof(Timespec)));
#pragma warning restore 0618
}
[Test]

@ -96,26 +96,28 @@ namespace Grpc.Core.Tests
var defaultStatus = new Status(StatusCode.Unknown, "Default mock implementation. Please provide your own.");
unaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
unaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
context.Status = defaultStatus;
return "";
return Task.FromResult("");
});
clientStreamingHandler = new ClientStreamingServerMethod<string, string>(async (requestStream, context) =>
clientStreamingHandler = new ClientStreamingServerMethod<string, string>((requestStream, context) =>
{
context.Status = defaultStatus;
return "";
return Task.FromResult("");
});
serverStreamingHandler = new ServerStreamingServerMethod<string, string>(async (request, responseStream, context) =>
serverStreamingHandler = new ServerStreamingServerMethod<string, string>((request, responseStream, context) =>
{
context.Status = defaultStatus;
return TaskUtils.CompletedTask;
});
duplexStreamingHandler = new DuplexStreamingServerMethod<string, string>(async (requestStream, responseStream, context) =>
duplexStreamingHandler = new DuplexStreamingServerMethod<string, string>((requestStream, responseStream, context) =>
{
context.Status = defaultStatus;
return TaskUtils.CompletedTask;
});
}

@ -61,9 +61,9 @@ namespace Grpc.Core.Tests
var profiler = new BasicProfiler();
Profilers.SetForCurrentThread(profiler);
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
return request;
return Task.FromResult(request);
});
var callDetails = helper.CreateUnaryCall();

@ -138,10 +138,10 @@ namespace Grpc.Core.Tests
[Test]
public void WriteResponseHeaders_NullNotAllowed()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.ThrowsAsync(typeof(ArgumentNullException), async () => await context.WriteResponseHeadersAsync(null));
return "PASS";
return Task.FromResult("PASS");
});
Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), ""));
@ -158,7 +158,7 @@ namespace Grpc.Core.Tests
await context.WriteResponseHeadersAsync(headers);
Assert.Fail();
}
catch (InvalidOperationException expected)
catch (InvalidOperationException)
{
}
return "PASS";
@ -178,7 +178,7 @@ namespace Grpc.Core.Tests
await context.WriteResponseHeadersAsync(headers);
Assert.Fail();
}
catch (InvalidOperationException expected)
catch (InvalidOperationException)
{
}
await responseStream.WriteAsync("B");

@ -50,13 +50,14 @@ namespace Grpc.Core.Tests
[Test]
public void BlockingCallInServerHandlerDoesNotDeadlock()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
int recursionDepth = int.Parse(request);
if (recursionDepth <= 0) {
return "SUCCESS";
return Task.FromResult("SUCCESS");
}
return Calls.BlockingUnaryCall(helper.CreateUnaryCall(), (recursionDepth - 1).ToString());
var response = Calls.BlockingUnaryCall(helper.CreateUnaryCall(), (recursionDepth - 1).ToString());
return Task.FromResult(response);
});
int maxRecursionDepth = Environment.ProcessorCount * 2; // make sure we have more pending blocking calls than threads in GrpcThreadPool
@ -66,12 +67,12 @@ namespace Grpc.Core.Tests
[Test]
public void HandlerDoesNotRunOnGrpcThread()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
if (IsRunningOnGrpcThreadPool()) {
return "Server handler should not run on gRPC threadpool thread.";
return Task.FromResult("Server handler should not run on gRPC threadpool thread.");
}
return request;
return Task.FromResult(request);
});
Assert.AreEqual("ABC", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "ABC"));
@ -80,9 +81,9 @@ namespace Grpc.Core.Tests
[Test]
public async Task ContinuationDoesNotRunOnGrpcThread()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
return request;
return Task.FromResult(request);
});
await Calls.AsyncUnaryCall(helper.CreateUnaryCall(), "ABC");

@ -57,10 +57,10 @@ namespace Grpc.Core.Tests
[Test]
public void InfiniteDeadline()
{
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
Assert.AreEqual(DateTime.MaxValue, context.Deadline);
return "PASS";
return Task.FromResult("PASS");
});
// no deadline specified, check server sees infinite deadline
@ -75,13 +75,13 @@ namespace Grpc.Core.Tests
{
var clientDeadline = DateTime.UtcNow + TimeSpan.FromDays(7);
helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) =>
helper.UnaryHandler = new UnaryServerMethod<string, string>((request, context) =>
{
// A fairly relaxed check that the deadline set by client and deadline seen by server
// are in agreement. C core takes care of the work with transferring deadline over the wire,
// so we don't need an exact check here.
Assert.IsTrue(Math.Abs((clientDeadline - context.Deadline).TotalMilliseconds) < 5000);
return "PASS";
return Task.FromResult("PASS");
});
Calls.BlockingUnaryCall(helper.CreateUnaryCall(new CallOptions(deadline: clientDeadline)), "abc");
}

@ -18,6 +18,7 @@
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -64,7 +64,7 @@ namespace Grpc.Core.Internal
{
get
{
return counter;
return Interlocked.Read(ref counter);
}
}
}

@ -74,7 +74,10 @@ namespace Grpc.Core.Internal
private AuthProperty PtrToAuthProperty(IntPtr authPropertyPtr)
{
#pragma warning disable 0618
// We need to use the obsolete non-generic version of Marshal.PtrToStructure, because the generic version is not available in net45
var nativeAuthProperty = (NativeAuthProperty) Marshal.PtrToStructure(authPropertyPtr, typeof(NativeAuthProperty));
#pragma warning restore 0618
var name = Marshal.PtrToStringAnsi(nativeAuthProperty.Name);
var valueBytes = new byte[(int) nativeAuthProperty.ValueLength];
Marshal.Copy(nativeAuthProperty.Value, valueBytes, 0, (int)nativeAuthProperty.ValueLength);

@ -33,8 +33,8 @@ namespace Grpc.Core.Internal
internal class GrpcThreadPool
{
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<GrpcThreadPool>();
static readonly WaitCallback RunCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true));
static readonly WaitCallback RunCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false));
const int FinishContinuationsSleepMillis = 10;
const int MaxFinishContinuationsSleepTotalMillis = 10000;
readonly GrpcEnvironment environment;
readonly object myLock = new object();
@ -42,6 +42,9 @@ namespace Grpc.Core.Internal
readonly int poolSize;
readonly int completionQueueCount;
readonly bool inlineHandlers;
readonly WaitCallback runCompletionQueueEventCallbackSuccess;
readonly WaitCallback runCompletionQueueEventCallbackFailure;
readonly AtomicCounter queuedContinuationCounter = new AtomicCounter();
readonly List<BasicProfiler> threadProfilers = new List<BasicProfiler>(); // profilers assigned to threadpool threads
@ -64,6 +67,9 @@ namespace Grpc.Core.Internal
this.inlineHandlers = inlineHandlers;
GrpcPreconditions.CheckArgument(poolSize >= completionQueueCount,
"Thread pool size cannot be smaller than the number of completion queues used.");
this.runCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true));
this.runCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false));
}
public void Start()
@ -173,7 +179,8 @@ namespace Grpc.Core.Internal
// Use cached delegates to avoid unnecessary allocations
if (!inlineHandlers)
{
ThreadPool.QueueUserWorkItem(success ? RunCompletionQueueEventCallbackSuccess : RunCompletionQueueEventCallbackFailure, callback);
queuedContinuationCounter.Increment();
ThreadPool.QueueUserWorkItem(success ? runCompletionQueueEventCallbackSuccess : runCompletionQueueEventCallbackFailure, callback);
}
else
{
@ -187,6 +194,24 @@ namespace Grpc.Core.Internal
}
}
while (ev.type != CompletionQueueEvent.CompletionType.Shutdown);
// Continuations are running on default threadpool that consists of background threads.
// GrpcThreadPool thread (a foreground thread) will not exit unless all queued work had
// been finished to prevent terminating the continuations queued prematurely.
int sleepIterations = 0;
while (queuedContinuationCounter.Count != 0)
{
// Only happens on shutdown and having pending continuations shouldn't very common,
// so sleeping here for a little bit is fine.
if (sleepIterations >= MaxFinishContinuationsSleepTotalMillis / FinishContinuationsSleepMillis)
{
Logger.Warning("Shutting down gRPC thread [{0}] with unfinished callbacks (Timed out waiting for callbacks to finish).",
Thread.CurrentThread.Name);
break;
}
Thread.Sleep(FinishContinuationsSleepMillis);
sleepIterations ++;
}
}
private static IReadOnlyCollection<CompletionQueueSafeHandle> CreateCompletionQueueList(GrpcEnvironment environment, int completionQueueCount)
@ -200,7 +225,7 @@ namespace Grpc.Core.Internal
return list.AsReadOnly();
}
private static void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
private void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
{
try
{
@ -210,6 +235,10 @@ namespace Grpc.Core.Internal
{
Logger.Error(e, "Exception occured while invoking completion delegate");
}
finally
{
queuedContinuationCounter.Decrement();
}
}
}
}

@ -1,7 +1,7 @@
<!-- This file is generated -->
<Project>
<PropertyGroup>
<GrpcCsharpVersion>1.5.0-dev</GrpcCsharpVersion>
<GrpcCsharpVersion>1.7.0-dev</GrpcCsharpVersion>
<GoogleProtobufVersion>3.3.0</GoogleProtobufVersion>
</PropertyGroup>
</Project>

@ -33,11 +33,11 @@ namespace Grpc.Core
/// <summary>
/// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies
/// </summary>
public const string CurrentAssemblyFileVersion = "1.5.0.0";
public const string CurrentAssemblyFileVersion = "1.7.0.0";
/// <summary>
/// Current version of gRPC C#
/// </summary>
public const string CurrentVersion = "1.5.0-dev";
public const string CurrentVersion = "1.7.0-dev";
}
}

@ -9,6 +9,7 @@
<OutputType>Exe</OutputType>
<PackageId>Grpc.Examples.MathClient</PackageId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -9,6 +9,7 @@
<OutputType>Exe</OutputType>
<PackageId>Grpc.Examples.MathServer</PackageId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -10,6 +10,7 @@
<PackageId>Grpc.Examples.Tests</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -37,7 +37,7 @@ namespace Math.Tests
Channel channel;
Math.MathClient client;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
// Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
@ -51,7 +51,7 @@ namespace Math.Tests
client = new Math.MathClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();
@ -130,7 +130,7 @@ namespace Math.Tests
}
[Test]
public async Task FibWithDeadline()
public void FibWithDeadline()
{
using (var call = client.Fib(new FibArgs { Limit = 0 },
deadline: DateTime.UtcNow.AddMilliseconds(500)))

@ -8,6 +8,7 @@
<AssemblyName>Grpc.Examples</AssemblyName>
<PackageId>Grpc.Examples</PackageId>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -15,6 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma warning disable 1591
#region Designer generated code
using System;

@ -52,9 +52,10 @@ namespace Math
public override async Task<Num> Sum(IAsyncStreamReader<Num> requestStream, ServerCallContext context)
{
long sum = 0;
await requestStream.ForEachAsync(async num =>
await requestStream.ForEachAsync(num =>
{
sum += num.Num_;
return TaskUtils.CompletedTask;
});
return new Num { Num_ = sum };
}

@ -10,6 +10,7 @@
<PackageId>Grpc.HealthCheck.Tests</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -37,7 +37,7 @@ namespace Grpc.HealthCheck.Tests
Grpc.Health.V1.Health.HealthClient client;
Grpc.HealthCheck.HealthServiceImpl serviceImpl;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
serviceImpl = new HealthServiceImpl();
@ -54,7 +54,7 @@ namespace Grpc.HealthCheck.Tests
client = new Grpc.Health.V1.Health.HealthClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();

@ -18,6 +18,7 @@
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -15,6 +15,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#pragma warning disable 1591
#region Designer generated code
using System;

@ -10,6 +10,7 @@
<PackageId>Grpc.IntegrationTesting.Client</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -11,6 +11,7 @@
<ServerGarbageCollection>true</ServerGarbageCollection>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -10,6 +10,7 @@
<PackageId>Grpc.IntegrationTesting.Server</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -10,6 +10,7 @@
<PackageId>Grpc.IntegrationTesting.StressClient</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -28,86 +28,89 @@ namespace Grpc.Testing {
"c29uUGFyYW1zEhQKDG9mZmVyZWRfbG9hZBgBIAEoASISChBDbG9zZWRMb29w",
"UGFyYW1zInsKCkxvYWRQYXJhbXMSNQoLY2xvc2VkX2xvb3AYASABKAsyHi5n",
"cnBjLnRlc3RpbmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiAB",
"KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiQwoO",
"KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiVgoO",
"U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy",
"X2hvc3Rfb3ZlcnJpZGUYAiABKAkiTQoKQ2hhbm5lbEFyZxIMCgRuYW1lGAEg",
"ASgJEhMKCXN0cl92YWx1ZRgCIAEoCUgAEhMKCWludF92YWx1ZRgDIAEoBUgA",
"QgcKBXZhbHVlItUECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY",
"ASADKAkSLQoLY2xpZW50X3R5cGUYAiABKA4yGC5ncnBjLnRl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cl9jb3JlcxgFIAMoBRI0CgdzdW1tYXJ5GAYg",
"ASgLMiMuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvUmVzdWx0U3VtbWFyeRIWCg5j",
"bGllbnRfc3VjY2VzcxgHIAMoCBIWCg5zZXJ2ZXJfc3VjY2VzcxgIIAMoCBI5",
"Cg9yZXF1ZXN0X3Jlc3VsdHMYCSADKAsyIC5ncnBjLnRlc3RpbmcuUmVxdWVz",
"dFJlc3VsdENvdW50KkEKCkNsaWVudFR5cGUSDwoLU1lOQ19DTElFTlQQABIQ",
"CgxBU1lOQ19DTElFTlQQARIQCgxPVEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJU",
"eXBlEg8KC1NZTkNfU0VSVkVSEAASEAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZ",
"TkNfR0VORVJJQ19TRVJWRVIQAhIQCgxPVEhFUl9TRVJWRVIQAypyCgdScGNU",
"eXBlEgkKBVVOQVJZEAASDQoJU1RSRUFNSU5HEAESGQoVU1RSRUFNSU5HX0ZS",
"T01fQ0xJRU5UEAISGQoVU1RSRUFNSU5HX0ZST01fU0VSVkVSEAMSFwoTU1RS",
"RUFNSU5HX0JPVEhfV0FZUxAEYgZwcm90bzM="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.PoissonParams), global::Grpc.Testing.PoissonParams.Parser, new[]{ "OfferedLoad" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride", "CredType" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs", "ThreadsPerCq", "MessagesPerStream" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig", "CoreList", "OtherServerApi", "ThreadsPerCq", "ResourceQuotaSize", "ChannelArgs" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.CoreRequest), global::Grpc.Testing.CoreRequest.Parser, null, null, null, null),
@ -115,7 +118,7 @@ namespace Grpc.Testing {
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Void), global::Grpc.Testing.Void.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenario), global::Grpc.Testing.Scenario.Parser, new[]{ "Name", "ClientConfig", "NumClients", "ServerConfig", "NumServers", "WarmupSeconds", "BenchmarkSeconds", "SpawnLocalWorkerCount" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Scenarios), global::Grpc.Testing.Scenarios.Parser, new[]{ "Scenarios_" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResultSummary), global::Grpc.Testing.ScenarioResultSummary.Parser, new[]{ "Qps", "QpsPerServerCore", "ServerSystemTime", "ServerUserTime", "ClientSystemTime", "ClientUserTime", "Latency50", "Latency90", "Latency95", "Latency99", "Latency999", "ServerCpuUsage", "SuccessfulRequestsPerSecond", "FailedRequestsPerSecond", "ClientPollsPerRequest", "ServerPollsPerRequest", "ServerQueriesPerCpuSec", "ClientQueriesPerCpuSec" }, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ScenarioResult), global::Grpc.Testing.ScenarioResult.Parser, new[]{ "Scenario", "Latencies", "ClientStats", "ServerStats", "ServerCores", "Summary", "ClientSuccess", "ServerSuccess", "RequestResults" }, null, null, null)
}));
}
@ -589,6 +592,7 @@ namespace Grpc.Testing {
public SecurityParams(SecurityParams other) : this() {
useTestCa_ = other.useTestCa_;
serverHostOverride_ = other.serverHostOverride_;
credType_ = other.credType_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -618,6 +622,17 @@ namespace Grpc.Testing {
}
}
/// <summary>Field number for the "cred_type" field.</summary>
public const int CredTypeFieldNumber = 3;
private string credType_ = "";
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public string CredType {
get { return credType_; }
set {
credType_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as SecurityParams);
@ -633,6 +648,7 @@ namespace Grpc.Testing {
}
if (UseTestCa != other.UseTestCa) return false;
if (ServerHostOverride != other.ServerHostOverride) return false;
if (CredType != other.CredType) return false;
return true;
}
@ -641,6 +657,7 @@ namespace Grpc.Testing {
int hash = 1;
if (UseTestCa != false) hash ^= UseTestCa.GetHashCode();
if (ServerHostOverride.Length != 0) hash ^= ServerHostOverride.GetHashCode();
if (CredType.Length != 0) hash ^= CredType.GetHashCode();
return hash;
}
@ -659,6 +676,10 @@ namespace Grpc.Testing {
output.WriteRawTag(18);
output.WriteString(ServerHostOverride);
}
if (CredType.Length != 0) {
output.WriteRawTag(26);
output.WriteString(CredType);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -670,6 +691,9 @@ namespace Grpc.Testing {
if (ServerHostOverride.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(ServerHostOverride);
}
if (CredType.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(CredType);
}
return size;
}
@ -684,6 +708,9 @@ namespace Grpc.Testing {
if (other.ServerHostOverride.Length != 0) {
ServerHostOverride = other.ServerHostOverride;
}
if (other.CredType.Length != 0) {
CredType = other.CredType;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -702,6 +729,10 @@ namespace Grpc.Testing {
ServerHostOverride = input.ReadString();
break;
}
case 26: {
CredType = input.ReadString();
break;
}
}
}
}
@ -1945,6 +1976,7 @@ namespace Grpc.Testing {
otherServerApi_ = other.otherServerApi_;
threadsPerCq_ = other.threadsPerCq_;
resourceQuotaSize_ = other.resourceQuotaSize_;
channelArgs_ = other.channelArgs_.Clone();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2088,6 +2120,16 @@ namespace Grpc.Testing {
}
}
/// <summary>Field number for the "channel_args" field.</summary>
public const int ChannelArgsFieldNumber = 1002;
private static readonly pb::FieldCodec<global::Grpc.Testing.ChannelArg> _repeated_channelArgs_codec
= pb::FieldCodec.ForMessage(8018, global::Grpc.Testing.ChannelArg.Parser);
private readonly pbc::RepeatedField<global::Grpc.Testing.ChannelArg> channelArgs_ = new pbc::RepeatedField<global::Grpc.Testing.ChannelArg>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::RepeatedField<global::Grpc.Testing.ChannelArg> ChannelArgs {
get { return channelArgs_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as ServerConfig);
@ -2111,6 +2153,7 @@ namespace Grpc.Testing {
if (OtherServerApi != other.OtherServerApi) return false;
if (ThreadsPerCq != other.ThreadsPerCq) return false;
if (ResourceQuotaSize != other.ResourceQuotaSize) return false;
if(!channelArgs_.Equals(other.channelArgs_)) return false;
return true;
}
@ -2127,6 +2170,7 @@ namespace Grpc.Testing {
if (OtherServerApi.Length != 0) hash ^= OtherServerApi.GetHashCode();
if (ThreadsPerCq != 0) hash ^= ThreadsPerCq.GetHashCode();
if (ResourceQuotaSize != 0) hash ^= ResourceQuotaSize.GetHashCode();
hash ^= channelArgs_.GetHashCode();
return hash;
}
@ -2174,6 +2218,7 @@ namespace Grpc.Testing {
output.WriteRawTag(200, 62);
output.WriteInt32(ResourceQuotaSize);
}
channelArgs_.WriteTo(output, _repeated_channelArgs_codec);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2207,6 +2252,7 @@ namespace Grpc.Testing {
if (ResourceQuotaSize != 0) {
size += 2 + pb::CodedOutputStream.ComputeInt32Size(ResourceQuotaSize);
}
size += channelArgs_.CalculateSize(_repeated_channelArgs_codec);
return size;
}
@ -2249,6 +2295,7 @@ namespace Grpc.Testing {
if (other.ResourceQuotaSize != 0) {
ResourceQuotaSize = other.ResourceQuotaSize;
}
channelArgs_.Add(other.channelArgs_);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -2306,6 +2353,10 @@ namespace Grpc.Testing {
ResourceQuotaSize = input.ReadInt32();
break;
}
case 8018: {
channelArgs_.AddEntriesFrom(input, _repeated_channelArgs_codec);
break;
}
}
}
}
@ -3489,6 +3540,8 @@ namespace Grpc.Testing {
failedRequestsPerSecond_ = other.failedRequestsPerSecond_;
clientPollsPerRequest_ = other.clientPollsPerRequest_;
serverPollsPerRequest_ = other.serverPollsPerRequest_;
serverQueriesPerCpuSec_ = other.serverQueriesPerCpuSec_;
clientQueriesPerCpuSec_ = other.clientQueriesPerCpuSec_;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -3702,6 +3755,31 @@ namespace Grpc.Testing {
}
}
/// <summary>Field number for the "server_queries_per_cpu_sec" field.</summary>
public const int ServerQueriesPerCpuSecFieldNumber = 17;
private double serverQueriesPerCpuSec_;
/// <summary>
/// Queries per CPU-sec over all servers or clients
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public double ServerQueriesPerCpuSec {
get { return serverQueriesPerCpuSec_; }
set {
serverQueriesPerCpuSec_ = value;
}
}
/// <summary>Field number for the "client_queries_per_cpu_sec" field.</summary>
public const int ClientQueriesPerCpuSecFieldNumber = 18;
private double clientQueriesPerCpuSec_;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public double ClientQueriesPerCpuSec {
get { return clientQueriesPerCpuSec_; }
set {
clientQueriesPerCpuSec_ = value;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as ScenarioResultSummary);
@ -3731,6 +3809,8 @@ namespace Grpc.Testing {
if (FailedRequestsPerSecond != other.FailedRequestsPerSecond) return false;
if (ClientPollsPerRequest != other.ClientPollsPerRequest) return false;
if (ServerPollsPerRequest != other.ServerPollsPerRequest) return false;
if (ServerQueriesPerCpuSec != other.ServerQueriesPerCpuSec) return false;
if (ClientQueriesPerCpuSec != other.ClientQueriesPerCpuSec) return false;
return true;
}
@ -3753,6 +3833,8 @@ namespace Grpc.Testing {
if (FailedRequestsPerSecond != 0D) hash ^= FailedRequestsPerSecond.GetHashCode();
if (ClientPollsPerRequest != 0D) hash ^= ClientPollsPerRequest.GetHashCode();
if (ServerPollsPerRequest != 0D) hash ^= ServerPollsPerRequest.GetHashCode();
if (ServerQueriesPerCpuSec != 0D) hash ^= ServerQueriesPerCpuSec.GetHashCode();
if (ClientQueriesPerCpuSec != 0D) hash ^= ClientQueriesPerCpuSec.GetHashCode();
return hash;
}
@ -3827,6 +3909,14 @@ namespace Grpc.Testing {
output.WriteRawTag(129, 1);
output.WriteDouble(ServerPollsPerRequest);
}
if (ServerQueriesPerCpuSec != 0D) {
output.WriteRawTag(137, 1);
output.WriteDouble(ServerQueriesPerCpuSec);
}
if (ClientQueriesPerCpuSec != 0D) {
output.WriteRawTag(145, 1);
output.WriteDouble(ClientQueriesPerCpuSec);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -3880,6 +3970,12 @@ namespace Grpc.Testing {
if (ServerPollsPerRequest != 0D) {
size += 2 + 8;
}
if (ServerQueriesPerCpuSec != 0D) {
size += 2 + 8;
}
if (ClientQueriesPerCpuSec != 0D) {
size += 2 + 8;
}
return size;
}
@ -3936,6 +4032,12 @@ namespace Grpc.Testing {
if (other.ServerPollsPerRequest != 0D) {
ServerPollsPerRequest = other.ServerPollsPerRequest;
}
if (other.ServerQueriesPerCpuSec != 0D) {
ServerQueriesPerCpuSec = other.ServerQueriesPerCpuSec;
}
if (other.ClientQueriesPerCpuSec != 0D) {
ClientQueriesPerCpuSec = other.ClientQueriesPerCpuSec;
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@ -4010,6 +4112,14 @@ namespace Grpc.Testing {
ServerPollsPerRequest = input.ReadDouble();
break;
}
case 137: {
ServerQueriesPerCpuSec = input.ReadDouble();
break;
}
case 145: {
ClientQueriesPerCpuSec = input.ReadDouble();
break;
}
}
}
}

@ -42,7 +42,7 @@ namespace Grpc.IntegrationTesting
Channel channel;
TestService.TestServiceClient client;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
// Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
@ -57,7 +57,7 @@ namespace Grpc.IntegrationTesting
client = new TestService.TestServiceClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();
@ -108,7 +108,7 @@ namespace Grpc.IntegrationTesting
private class CustomErrorDetailsTestServiceImpl : TestService.TestServiceBase
{
public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
try
{

@ -65,7 +65,7 @@ namespace Grpc.IntegrationTesting
}
[Test]
public async Task UnimplementedByDefault_ClientStreaming()
public void UnimplementedByDefault_ClientStreaming()
{
var call = client.StreamingInputCall();
@ -74,7 +74,7 @@ namespace Grpc.IntegrationTesting
}
[Test]
public async Task UnimplementedByDefault_ServerStreamingCall()
public void UnimplementedByDefault_ServerStreamingCall()
{
var call = client.StreamingOutputCall(new StreamingOutputCallRequest());
@ -83,7 +83,7 @@ namespace Grpc.IntegrationTesting
}
[Test]
public async Task UnimplementedByDefault_DuplexStreamingCall()
public void UnimplementedByDefault_DuplexStreamingCall()
{
var call = client.FullDuplexCall();

@ -10,6 +10,7 @@
<PackageId>Grpc.IntegrationTesting</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -38,7 +38,7 @@ namespace Grpc.IntegrationTesting
Channel channel;
TestService.TestServiceClient client;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
// Disable SO_REUSEPORT to prevent https://github.com/grpc/grpc/issues/10755
@ -58,7 +58,7 @@ namespace Grpc.IntegrationTesting
client = new TestService.TestServiceClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();

@ -21,6 +21,7 @@
// Currently, 'Gauge' (i.e a metric that represents the measured value of
// something at an instant of time) is the only metric type supported by the
// service.
#pragma warning disable 1591
#region Designer generated code
using System;

@ -35,7 +35,7 @@ namespace Grpc.IntegrationTesting
{
IServerRunner serverRunner;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
var serverConfig = new ServerConfig
@ -45,7 +45,7 @@ namespace Grpc.IntegrationTesting
serverRunner = ServerRunners.CreateStarted(serverConfig);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
serverRunner.StopAsync().Wait();

@ -17,6 +17,7 @@
//
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
#pragma warning disable 1591
#region Designer generated code
using System;

@ -41,7 +41,7 @@ namespace Grpc.IntegrationTesting
Channel channel;
TestService.TestServiceClient client;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
var rootCert = File.ReadAllText(TestCredentials.ClientCertAuthorityPath);
@ -69,7 +69,7 @@ namespace Grpc.IntegrationTesting
client = new TestService.TestServiceClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();
@ -94,15 +94,15 @@ namespace Grpc.IntegrationTesting
private class SslCredentialsTestServiceImpl : TestService.TestServiceBase
{
public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
return new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) };
return Task.FromResult(new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) });
}
public override async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context)
{
var authContext = context.AuthContext;
await requestStream.ForEachAsync(async request => {});
await requestStream.ForEachAsync(request => TaskUtils.CompletedTask);
Assert.IsTrue(authContext.IsPeerAuthenticated);
Assert.AreEqual("x509_subject_alternative_name", authContext.PeerIdentityPropertyName);

@ -18,6 +18,7 @@
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
//
#pragma warning disable 1591
#region Designer generated code
using System;

@ -63,9 +63,10 @@ namespace Grpc.Testing
await EnsureEchoMetadataAsync(context);
int sum = 0;
await requestStream.ForEachAsync(async request =>
await requestStream.ForEachAsync(request =>
{
sum += request.Payload.Body.Length;
return TaskUtils.CompletedTask;
});
return new StreamingInputCallResponse { AggregatedPayloadSize = sum };
}
@ -85,7 +86,7 @@ namespace Grpc.Testing
});
}
public override async Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
public override Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
throw new NotImplementedException();
}

@ -10,6 +10,7 @@
<PackageId>Grpc.Microbenchmarks</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -10,6 +10,7 @@
<PackageId>Grpc.Reflection.Tests</PackageId>
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);portable-net45</PackageTargetFallback>
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">1.0.4</RuntimeFrameworkVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -38,7 +38,7 @@ namespace Grpc.Reflection.Tests
ServerReflection.ServerReflectionClient client;
ReflectionServiceImpl serviceImpl;
[TestFixtureSetUp]
[OneTimeSetUp]
public void Init()
{
serviceImpl = new ReflectionServiceImpl(ServerReflection.Descriptor);
@ -55,7 +55,7 @@ namespace Grpc.Reflection.Tests
client = new ServerReflection.ServerReflectionClient(channel);
}
[TestFixtureTearDown]
[OneTimeTearDown]
public void Cleanup()
{
channel.ShutdownAsync().Wait();

@ -18,6 +18,7 @@
<IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>

@ -17,6 +17,7 @@
//
// Service exported by server reflection
//
#pragma warning disable 1591
#region Designer generated code
using System;

@ -60,6 +60,9 @@ namespace Grpc.Reflection
{
}
/// <summary>
/// Processes a stream of server reflection requests.
/// </summary>
public override async Task ServerReflectionInfo(IAsyncStreamReader<ServerReflectionRequest> requestStream, IServerStreamWriter<ServerReflectionResponse> responseStream, ServerCallContext context)
{
while (await requestStream.MoveNext())

@ -13,7 +13,7 @@
@rem limitations under the License.
@rem Current package versions
set VERSION=1.5.0-dev
set VERSION=1.7.0-dev
@rem Adjust the location of nuget.exe
set NUGET=C:\nuget\nuget.exe

@ -39,7 +39,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts
dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts
dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts
nuget pack Grpc.nuspec -Version "1.5.0-dev" -OutputDirectory ../../artifacts
nuget pack Grpc.Tools.nuspec -Version "1.5.0-dev" -OutputDirectory ../../artifacts
nuget pack Grpc.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts
nuget pack Grpc.Tools.nuspec -Version "1.7.0-dev" -OutputDirectory ../../artifacts
(cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg)

@ -0,0 +1,5 @@
{
"sdk": {
"version": "1.0.0"
}
}

@ -1,6 +1,6 @@
{
"name": "grpc-health-check",
"version": "1.5.0-dev",
"version": "1.7.0-dev",
"author": "Google Inc.",
"description": "Health check service for use with gRPC",
"repository": {
@ -15,7 +15,7 @@
}
],
"dependencies": {
"grpc": "^1.5.0-dev",
"grpc": "^1.7.0-dev",
"lodash": "^3.9.3",
"google-protobuf": "^3.0.0"
},

@ -1,6 +1,6 @@
{
"name": "grpc-tools",
"version": "1.5.0-dev",
"version": "1.7.0-dev",
"author": "Google Inc.",
"description": "Tools for developing with gRPC on Node.js",
"homepage": "https://grpc.io/",

@ -42,7 +42,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCPlugin'
v = '1.5.0-dev'
v = '1.7.0-dev'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
s.description = <<-DESC

@ -23,4 +23,4 @@
// `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.5.0-dev"
#define GRPC_OBJC_VERSION_STRING @"1.7.0-dev"

@ -37,11 +37,11 @@ rm -f Podfile.lock
pod install
set -o pipefail
XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail|\bpassed\b)'
XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )'
xcodebuild \
build \
-workspace *.xcworkspace \
-scheme $SCHEME \
-destination name="iPhone 6" \
| egrep "$XCODEBUILD_FILTER" \
| egrep -v "(GPBDictionary|GPBArray)" -
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v "^$" -

@ -38,7 +38,7 @@ trap 'kill -9 `jobs -p` ; echo "EXIT TIME: $(date)"' EXIT
# element of the pipe fails.
# TODO(jcanizales): Use xctool instead? Issue #2540.
set -o pipefail
XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail|\bpassed\b)'
XCODEBUILD_FILTER='(^CompileC |^Ld |^.*clang |^ *cd |^ *export |^Libtool |^.*libtool |^CpHeader |^ *builtin-copy )'
echo "TIME: $(date)"
xcodebuild \
-workspace Tests.xcworkspace \
@ -48,8 +48,8 @@ xcodebuild \
HOST_PORT_LOCAL=localhost:5050 \
HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com \
test \
| egrep "$XCODEBUILD_FILTER" \
| egrep -v "(GPBDictionary|GPBArray)" -
| egrep -v "$XCODEBUILD_FILTER" \
| egrep -v '^$' -
echo "TIME: $(date)"
xcodebuild \
@ -60,16 +60,12 @@ xcodebuild \
| egrep "$XCODEBUILD_FILTER" \
| egrep -v "(GPBDictionary|GPBArray)" -
# Temporarily disabled for (possible) flakiness on Jenkins.
# Fix or reenable after confirmation/disconfirmation that it is the source of
# Jenkins problem.
# echo "TIME: $(date)"
# xcodebuild \
# -workspace Tests.xcworkspace \
# -scheme CronetUnitTests \
# -destination name="iPhone 6" \
# test | xcpretty
echo "TIME: $(date)"
xcodebuild \
-workspace Tests.xcworkspace \
-scheme CronetUnitTests \
-destination name="iPhone 6" \
test | xcpretty
echo "TIME: $(date)"
xcodebuild \

@ -2,7 +2,7 @@
"name": "grpc/grpc-dev",
"description": "gRPC library for PHP - for Developement use only",
"license": "Apache-2.0",
"version": "1.5.0",
"version": "1.7.0",
"require": {
"php": ">=5.5.0",
"google/protobuf": "^v3.3.0"

@ -20,6 +20,6 @@
#ifndef VERSION_H
#define VERSION_H
#define PHP_GRPC_VERSION "1.5.0dev"
#define PHP_GRPC_VERSION "1.7.0dev"
#endif /* VERSION_H */

@ -40,13 +40,11 @@ class ServerStreamingCall extends AbstractCall
if (array_key_exists('flags', $options)) {
$message_array['flags'] = $options['flags'];
}
$event = $this->call->startBatch([
$this->call->startBatch([
OP_SEND_INITIAL_METADATA => $metadata,
OP_RECV_INITIAL_METADATA => true,
OP_SEND_MESSAGE => $message_array,
OP_SEND_CLOSE_FROM_CLIENT => true,
]);
$this->metadata = $event->metadata;
}
/**
@ -54,9 +52,15 @@ class ServerStreamingCall extends AbstractCall
*/
public function responses()
{
$response = $this->call->startBatch([
OP_RECV_MESSAGE => true,
])->message;
$batch = [OP_RECV_MESSAGE => true];
if ($this->metadata === null) {
$batch[OP_RECV_INITIAL_METADATA] = true;
}
$read_event = $this->call->startBatch($batch);
if ($this->metadata === null) {
$this->metadata = $read_event->metadata;
}
$response = $read_event->message;
while ($response !== null) {
yield $this->_deserializeResponse($response);
$response = $this->call->startBatch([
@ -81,4 +85,16 @@ class ServerStreamingCall extends AbstractCall
return $status_event->status;
}
/**
* @return mixed The metadata sent by the server
*/
public function getMetadata()
{
if ($this->metadata === null) {
$event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]);
$this->metadata = $event->metadata;
}
return $this->metadata;
}
}

@ -40,13 +40,11 @@ class UnaryCall extends AbstractCall
if (isset($options['flags'])) {
$message_array['flags'] = $options['flags'];
}
$event = $this->call->startBatch([
$this->call->startBatch([
OP_SEND_INITIAL_METADATA => $metadata,
OP_RECV_INITIAL_METADATA => true,
OP_SEND_MESSAGE => $message_array,
OP_SEND_CLOSE_FROM_CLIENT => true,
]);
$this->metadata = $event->metadata;
}
/**
@ -56,14 +54,32 @@ class UnaryCall extends AbstractCall
*/
public function wait()
{
$event = $this->call->startBatch([
$batch = [
OP_RECV_MESSAGE => true,
OP_RECV_STATUS_ON_CLIENT => true,
]);
];
if ($this->metadata === null) {
$batch[OP_RECV_INITIAL_METADATA] = true;
}
$event = $this->call->startBatch($batch);
if ($this->metadata === null) {
$this->metadata = $event->metadata;
}
$status = $event->status;
$this->trailing_metadata = $status->metadata;
return [$this->_deserializeResponse($event->message), $status];
}
/**
* @return mixed The metadata sent by the server
*/
public function getMetadata()
{
if ($this->metadata === null) {
$event = $this->call->startBatch([OP_RECV_INITIAL_METADATA => true]);
$this->metadata = $event->metadata;
}
return $this->metadata;
}
}

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!!
__version__ = """1.5.0.dev0"""
__version__ = """1.7.0.dev0"""

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
VERSION='1.5.0.dev0'
VERSION='1.7.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!!
VERSION='1.5.0.dev0'
VERSION='1.7.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!!
VERSION='1.5.0.dev0'
VERSION='1.7.0.dev0'

@ -14,4 +14,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!!
VERSION='1.5.0.dev0'
VERSION='1.7.0.dev0'

@ -99,9 +99,13 @@ module GRPC
# event. Send a status of deadline exceeded
GRPC.logger.warn("late call: #{active_call}")
send_status(active_call, DEADLINE_EXCEEDED, 'late')
rescue StandardError => e
rescue StandardError, NotImplementedError => e
# This will usuaally be an unhandled error in the handling code.
# Send back a UNKNOWN status to the client
#
# Note: this intentionally does not map NotImplementedError to
# UNIMPLEMENTED because NotImplementedError is intended for low-level
# OS interaction (e.g. syscalls) not supported by the current OS.
GRPC.logger.warn("failed handler: #{active_call}; sending status:UNKNOWN")
GRPC.logger.warn(e)
send_status(active_call, UNKNOWN, "#{e.class}: #{e.message}")

@ -14,5 +14,5 @@
# GRPC contains the General RPC module.
module GRPC
VERSION = '1.5.0.dev'
VERSION = '1.7.0.dev'
end

@ -52,6 +52,13 @@ describe GRPC::RpcDesc do
this_desc.run_server_method(@call, method(:other_error))
end
it 'sends status UNKNOWN if NotImplementedErrors are raised' do
expect(@call).to receive(:read_unary_request).once.and_return(Object.new)
expect(@call).to receive(:send_status).once.with(
UNKNOWN, not_implemented_error_msg, false, metadata: {})
this_desc.run_server_method(@call, method(:not_implemented))
end
it 'absorbs CallError with no further action' do
expect(@call).to receive(:read_unary_request).once.and_raise(CallError)
blk = proc do
@ -102,6 +109,12 @@ describe GRPC::RpcDesc do
@client_streamer.run_server_method(@call, method(:other_error_alt))
end
it 'sends status UNKNOWN if NotImplementedErrors are raised' do
expect(@call).to receive(:send_status).once.with(
UNKNOWN, not_implemented_error_msg, false, metadata: {})
@client_streamer.run_server_method(@call, method(:not_implemented_alt))
end
it 'absorbs CallError with no further action' do
expect(@call).to receive(:server_unary_response).once.and_raise(
CallError)
@ -166,6 +179,14 @@ describe GRPC::RpcDesc do
@bidi_streamer.run_server_method(@call, method(:other_error_alt))
end
it 'sends status UNKNOWN if NotImplementedErrors are raised' do
expect(@call).to receive(:run_server_bidi).and_raise(
not_implemented_error)
expect(@call).to receive(:send_status).once.with(
UNKNOWN, not_implemented_error_msg, false, metadata: {})
@bidi_streamer.run_server_method(@call, method(:not_implemented_alt))
end
it 'closes the stream if there no errors' do
expect(@call).to receive(:run_server_bidi)
expect(@call).to receive(:output_metadata).and_return(fake_md)
@ -329,8 +350,25 @@ describe GRPC::RpcDesc do
fail(ArgumentError, 'other error')
end
def not_implemented(_req, _call)
fail not_implemented_error
end
def not_implemented_alt(_call)
fail not_implemented_error
end
def arg_error_msg(error = nil)
error ||= ArgumentError.new('other error')
"#{error.class}: #{error.message}"
end
def not_implemented_error
NotImplementedError.new('some OS feature not implemented')
end
def not_implemented_error_msg(error = nil)
error ||= not_implemented_error
"#{error.class}: #{error.message}"
end
end

@ -14,6 +14,6 @@
module GRPC
module Tools
VERSION = '1.5.0.dev'
VERSION = '1.7.0.dev'
end
end

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save