From 40158ed8560c9092c0f16c223f947527454e7f8a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Apr 2015 13:03:40 -0700 Subject: Optimize slice_buffer_swap --- src/core/support/slice_buffer.c | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index 3b1daa07c5..1992eeef8b 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -161,15 +161,38 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) { sb->length = 0; } -void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) { - gpr_slice_buffer temp = *a; - *a = *b; - *b = temp; +#define SWAP(type, a, b) \ + do { \ + type x = a; \ + a = b; \ + b = x; \ + } while (0) - if (a->slices == b->inlined) { +void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) { + SWAP(size_t, a->count, b->count); + SWAP(size_t, a->capacity, b->capacity); + SWAP(size_t, a->length, b->length); + + if (a->slices == a->inlined) { + if (b->slices == b->inlined) { + /* swap contents of inlined buffer */ + gpr_slice temp[GRPC_SLICE_BUFFER_INLINE_ELEMENTS]; + memcpy(temp, a->slices, b->count * sizeof(gpr_slice)); + memcpy(a->slices, b->slices, a->count * sizeof(gpr_slice)); + memcpy(b->slices, temp, b->count * sizeof(gpr_slice)); + } else { + /* a is inlined, b is not - copy a inlined into b, fix pointers */ + a->slices = b->slices; + b->slices = b->inlined; + memcpy(b->slices, a->inlined, b->count * sizeof(gpr_slice)); + } + } else if (b->slices == b->inlined) { + /* b is inlined, a is not - copy b inlined int a, fix pointers */ + b->slices = a->slices; a->slices = a->inlined; - } - if (b->slices == a->inlined) { - b->slices = b->inlined; + memcpy(a->slices, b->inlined, a->count * sizeof(gpr_slice)); + } else { + /* no inlining: easy swap */ + SWAP(gpr_slice *, a->slices, b->slices); } } -- cgit v1.2.3 From bae41c847f084fe64b5920f09d7ffbac579c507a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Apr 2015 13:22:25 -0700 Subject: Promote SWAP to GPR_SWAP --- include/grpc/support/useful.h | 7 +++++++ src/core/support/slice_buffer.c | 16 +++++----------- src/core/surface/call.c | 11 ++--------- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index 979f3d026b..e1ce0455c6 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -45,4 +45,11 @@ #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) +#define GPR_SWAP(type, a, b) \ + do { \ + type x = a; \ + a = b; \ + b = x; \ + } while (0) + #endif /* GRPC_SUPPORT_USEFUL_H */ diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index 1992eeef8b..91b5d8c98b 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -37,6 +37,7 @@ #include #include +#include /* grow a buffer; requires GRPC_SLICE_BUFFER_INLINE_ELEMENTS > 1 */ #define GROW(x) (3 * (x) / 2) @@ -161,17 +162,10 @@ void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) { sb->length = 0; } -#define SWAP(type, a, b) \ - do { \ - type x = a; \ - a = b; \ - b = x; \ - } while (0) - void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) { - SWAP(size_t, a->count, b->count); - SWAP(size_t, a->capacity, b->capacity); - SWAP(size_t, a->length, b->length); + GPR_SWAP(size_t, a->count, b->count); + GPR_SWAP(size_t, a->capacity, b->capacity); + GPR_SWAP(size_t, a->length, b->length); if (a->slices == a->inlined) { if (b->slices == b->inlined) { @@ -193,6 +187,6 @@ void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) { memcpy(a->slices, b->inlined, a->count * sizeof(gpr_slice)); } else { /* no inlining: easy swap */ - SWAP(gpr_slice *, a->slices, b->slices); + GPR_SWAP(gpr_slice *, a->slices, b->slices); } } diff --git a/src/core/surface/call.c b/src/core/surface/call.c index f358eb546a..d21bfaa592 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -238,13 +238,6 @@ struct grpc_call { #define CALL_FROM_TOP_ELEM(top_elem) \ CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem)) -#define SWAP(type, x, y) \ - do { \ - type temp = x; \ - x = y; \ - y = temp; \ - } while (0) - static void do_nothing(void *ignored, grpc_op_error also_ignored) {} static void set_deadline_alarm(grpc_call *call, gpr_timespec deadline); static void call_on_done_recv(void *call, int success); @@ -575,12 +568,12 @@ static void finish_live_ioreq_op(grpc_call *call, grpc_ioreq_op op, call->request_data[GRPC_IOREQ_RECV_STATUS_DETAILS]); break; case GRPC_IOREQ_RECV_INITIAL_METADATA: - SWAP(grpc_metadata_array, call->buffered_metadata[0], + GPR_SWAP(grpc_metadata_array, call->buffered_metadata[0], *call->request_data[GRPC_IOREQ_RECV_INITIAL_METADATA] .recv_metadata); break; case GRPC_IOREQ_RECV_TRAILING_METADATA: - SWAP(grpc_metadata_array, call->buffered_metadata[1], + GPR_SWAP(grpc_metadata_array, call->buffered_metadata[1], *call->request_data[GRPC_IOREQ_RECV_TRAILING_METADATA] .recv_metadata); break; -- cgit v1.2.3 From 7e61d52d03954b98a1ea2645b2c43d6dfe655bba Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 28 Apr 2015 13:39:21 -0700 Subject: Faster stream_op_buffer swap --- src/core/transport/stream_op.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/core/transport/stream_op.c b/src/core/transport/stream_op.c index e1a75adcb6..8996ecac35 100644 --- a/src/core/transport/stream_op.c +++ b/src/core/transport/stream_op.c @@ -59,15 +59,30 @@ void grpc_sopb_reset(grpc_stream_op_buffer *sopb) { } void grpc_sopb_swap(grpc_stream_op_buffer *a, grpc_stream_op_buffer *b) { - grpc_stream_op_buffer temp = *a; - *a = *b; - *b = temp; - - if (a->ops == b->inlined_ops) { + GPR_SWAP(size_t, a->nops, b->nops); + GPR_SWAP(size_t, a->capacity, b->capacity); + + if (a->ops == a->inlined_ops) { + if (b->ops == b->inlined_ops) { + /* swap contents of inlined buffer */ + gpr_slice temp[GRPC_SOPB_INLINE_ELEMENTS]; + memcpy(temp, a->ops, b->nops * sizeof(grpc_stream_op)); + memcpy(a->ops, b->ops, a->nops * sizeof(grpc_stream_op)); + memcpy(b->ops, temp, b->nops * sizeof(grpc_stream_op)); + } else { + /* a is inlined, b is not - copy a inlined into b, fix pointers */ + a->ops = b->ops; + b->ops = b->inlined_ops; + memcpy(b->ops, a->inlined_ops, b->nops * sizeof(grpc_stream_op)); + } + } else if (b->ops == b->inlined_ops) { + /* b is inlined, a is not - copy b inlined int a, fix pointers */ + b->ops = a->ops; a->ops = a->inlined_ops; - } - if (b->ops == a->inlined_ops) { - b->ops = b->inlined_ops; + memcpy(a->ops, b->inlined_ops, a->nops * sizeof(grpc_stream_op)); + } else { + /* no inlining: easy swap */ + GPR_SWAP(grpc_stream_op *, a->ops, b->ops); } } -- cgit v1.2.3 From a5272b6adc5fb7e8c71b7216b0f5e690980a79b2 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 30 Apr 2015 11:56:46 -0700 Subject: A new version C# API based on async/await --- src/csharp/.gitignore | 1 + src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 84 ++++++++------ src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 101 ++++++++++++++++ src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs | 101 ++++++++++++++++ src/csharp/Grpc.Core/AsyncServerStreamingCall.cs | 72 ++++++++++++ src/csharp/Grpc.Core/Call.cs | 3 + src/csharp/Grpc.Core/Calls.cs | 32 +++--- src/csharp/Grpc.Core/Channel.cs | 16 +-- src/csharp/Grpc.Core/ClientStreamingAsyncResult.cs | 69 ----------- src/csharp/Grpc.Core/Credentials.cs | 2 +- src/csharp/Grpc.Core/Grpc.Core.csproj | 20 +++- src/csharp/Grpc.Core/IAsyncStreamReader.cs | 54 +++++++++ src/csharp/Grpc.Core/IAsyncStreamWriter.cs | 54 +++++++++ src/csharp/Grpc.Core/IClientStreamWriter.cs | 53 +++++++++ src/csharp/Grpc.Core/IServerStreamWriter.cs | 48 ++++++++ src/csharp/Grpc.Core/Internal/AsyncCall.cs | 44 +++---- src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 116 ++++++++----------- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 22 ++-- src/csharp/Grpc.Core/Internal/AsyncCompletion.cs | 18 +-- .../Grpc.Core/Internal/ClientRequestStream.cs | 63 ++++++++++ .../Grpc.Core/Internal/ClientResponseStream.cs | 56 +++++++++ .../Internal/ClientStreamingInputObserver.cs | 66 ----------- src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 128 +++++++++++++++------ src/csharp/Grpc.Core/Internal/ServerCalls.cs | 63 ++++++++++ .../Grpc.Core/Internal/ServerRequestStream.cs | 56 +++++++++ .../Grpc.Core/Internal/ServerResponseStream.cs | 64 +++++++++++ .../Internal/ServerStreamingOutputObserver.cs | 71 ------------ src/csharp/Grpc.Core/Method.cs | 11 +- src/csharp/Grpc.Core/Server.cs | 6 +- src/csharp/Grpc.Core/ServerCalls.cs | 57 --------- src/csharp/Grpc.Core/ServerMethods.cs | 61 ++++++++++ src/csharp/Grpc.Core/ServerServiceDefinition.cs | 24 +++- src/csharp/Grpc.Core/Status.cs | 5 + .../Grpc.Core/Utils/AsyncStreamExtensions.cs | 111 ++++++++++++++++++ src/csharp/Grpc.Core/Utils/RecordingObserver.cs | 65 ----------- src/csharp/Grpc.Core/Utils/RecordingQueue.cs | 83 ------------- .../Grpc.Examples.Tests/MathClientServerTests.cs | 68 ++++++----- src/csharp/Grpc.Examples/MathExamples.cs | 26 ++--- src/csharp/Grpc.Examples/MathGrpc.cs | 24 ++-- src/csharp/Grpc.Examples/MathServiceImpl.cs | 67 +++-------- .../Grpc.IntegrationTesting/InteropClient.cs | 119 +++++++++---------- .../InteropClientServerTest.cs | 2 +- .../Grpc.IntegrationTesting/TestServiceGrpc.cs | 34 +++--- .../Grpc.IntegrationTesting/TestServiceImpl.cs | 77 ++++--------- 44 files changed, 1449 insertions(+), 868 deletions(-) create mode 100644 src/csharp/Grpc.Core/AsyncClientStreamingCall.cs create mode 100644 src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs create mode 100644 src/csharp/Grpc.Core/AsyncServerStreamingCall.cs delete mode 100644 src/csharp/Grpc.Core/ClientStreamingAsyncResult.cs create mode 100644 src/csharp/Grpc.Core/IAsyncStreamReader.cs create mode 100644 src/csharp/Grpc.Core/IAsyncStreamWriter.cs create mode 100644 src/csharp/Grpc.Core/IClientStreamWriter.cs create mode 100644 src/csharp/Grpc.Core/IServerStreamWriter.cs create mode 100644 src/csharp/Grpc.Core/Internal/ClientRequestStream.cs create mode 100644 src/csharp/Grpc.Core/Internal/ClientResponseStream.cs delete mode 100644 src/csharp/Grpc.Core/Internal/ClientStreamingInputObserver.cs create mode 100644 src/csharp/Grpc.Core/Internal/ServerCalls.cs create mode 100644 src/csharp/Grpc.Core/Internal/ServerRequestStream.cs create mode 100644 src/csharp/Grpc.Core/Internal/ServerResponseStream.cs delete mode 100644 src/csharp/Grpc.Core/Internal/ServerStreamingOutputObserver.cs delete mode 100644 src/csharp/Grpc.Core/ServerCalls.cs create mode 100644 src/csharp/Grpc.Core/ServerMethods.cs create mode 100644 src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs delete mode 100644 src/csharp/Grpc.Core/Utils/RecordingObserver.cs delete mode 100644 src/csharp/Grpc.Core/Utils/RecordingQueue.cs diff --git a/src/csharp/.gitignore b/src/csharp/.gitignore index dbaf60de0c..c064ff1fa6 100644 --- a/src/csharp/.gitignore +++ b/src/csharp/.gitignore @@ -1,4 +1,5 @@ *.userprefs +*.csproj.user StyleCop.Cache test-results packages diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 3da9e33e53..9e510e82a6 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -44,16 +44,18 @@ namespace Grpc.Core.Tests { public class ClientServerTest { - string host = "localhost"; + const string Host = "localhost"; + const string ServiceName = "/tests.Test"; - string serviceName = "/tests.Test"; - - Method unaryEchoStringMethod = new Method( + static readonly Method UnaryEchoStringMethod = new Method( MethodType.Unary, "/tests.Test/UnaryEchoString", Marshallers.StringMarshaller, Marshallers.StringMarshaller); + static readonly ServerServiceDefinition ServiceDefinition = ServerServiceDefinition.CreateBuilder(ServiceName) + .AddMethod(UnaryEchoStringMethod, HandleUnaryEchoString).Build(); + [TestFixtureSetUp] public void Init() { @@ -69,21 +71,39 @@ namespace Grpc.Core.Tests [Test] public void UnaryCall() { - Server server = new Server(); - server.AddServiceDefinition( - ServerServiceDefinition.CreateBuilder(serviceName) - .AddMethod(unaryEchoStringMethod, HandleUnaryEchoString).Build()); - - int port = server.AddListeningPort(host + ":0"); + var server = new Server(); + server.AddServiceDefinition(ServiceDefinition); + int port = server.AddListeningPort(Host + ":0"); server.Start(); - using (Channel channel = new Channel(host + ":" + port)) + using (Channel channel = new Channel(Host + ":" + port)) { - var call = new Call(serviceName, unaryEchoStringMethod, channel, Metadata.Empty); - + var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); Assert.AreEqual("ABC", Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken))); + } - Assert.AreEqual("abcdef", Calls.BlockingUnaryCall(call, "abcdef", default(CancellationToken))); + server.ShutdownAsync().Wait(); + } + + [Test] + public void CallOnDisposedChannel() + { + var server = new Server(); + server.AddServiceDefinition(ServiceDefinition); + int port = server.AddListeningPort(Host + ":0"); + server.Start(); + + Channel channel = new Channel(Host + ":" + port); + channel.Dispose(); + + var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); + try + { + Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); + Assert.Fail(); + } + catch (ObjectDisposedException e) + { } server.ShutdownAsync().Wait(); @@ -92,18 +112,15 @@ namespace Grpc.Core.Tests [Test] public void UnaryCallPerformance() { - Server server = new Server(); - server.AddServiceDefinition( - ServerServiceDefinition.CreateBuilder(serviceName) - .AddMethod(unaryEchoStringMethod, HandleUnaryEchoString).Build()); - - int port = server.AddListeningPort(host + ":0"); + var server = new Server(); + server.AddServiceDefinition(ServiceDefinition); + int port = server.AddListeningPort(Host + ":0"); server.Start(); - using (Channel channel = new Channel(host + ":" + port)) + using (Channel channel = new Channel(Host + ":" + port)) { - var call = new Call(serviceName, unaryEchoStringMethod, channel, Metadata.Empty); - BenchmarkUtil.RunBenchmark(100, 1000, + var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); + BenchmarkUtil.RunBenchmark(100, 100, () => { Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); }); } @@ -113,17 +130,14 @@ namespace Grpc.Core.Tests [Test] public void UnknownMethodHandler() { - Server server = new Server(); - server.AddServiceDefinition( - ServerServiceDefinition.CreateBuilder(serviceName).Build()); - - int port = server.AddListeningPort(host + ":0"); + var server = new Server(); + server.AddServiceDefinition(ServerServiceDefinition.CreateBuilder(ServiceName).Build()); + int port = server.AddListeningPort(Host + ":0"); server.Start(); - using (Channel channel = new Channel(host + ":" + port)) + using (Channel channel = new Channel(Host + ":" + port)) { - var call = new Call(serviceName, unaryEchoStringMethod, channel, Metadata.Empty); - + var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); try { Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); @@ -138,10 +152,12 @@ namespace Grpc.Core.Tests server.ShutdownAsync().Wait(); } - private void HandleUnaryEchoString(string request, IObserver responseObserver) + /// + /// Handler for unaryEchoString method. + /// + private static Task HandleUnaryEchoString(string request) { - responseObserver.OnNext(request); - responseObserver.OnCompleted(); + return Task.FromResult(request); } } } diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs new file mode 100644 index 0000000000..e81ce01ebb --- /dev/null +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -0,0 +1,101 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Return type for client streaming calls. + /// + public struct AsyncClientStreamingCall + { + readonly IClientStreamWriter requestStream; + readonly Task result; + + public AsyncClientStreamingCall(IClientStreamWriter requestStream, Task result) + { + this.requestStream = requestStream; + this.result = result; + } + + /// + /// Writes a request to RequestStream. + /// + public Task Write(TRequest message) + { + return requestStream.Write(message); + } + + /// + /// Closes the RequestStream. + /// + public Task Close() + { + return requestStream.Close(); + } + + /// + /// Asynchronous call result. + /// + public Task Result + { + get + { + return this.result; + } + } + + /// + /// Async stream to send streaming requests. + /// + public IClientStreamWriter RequestStream + { + get + { + return requestStream; + } + } + + /// + /// Allows awaiting this object directly. + /// + /// + public TaskAwaiter GetAwaiter() + { + return result.GetAwaiter(); + } + } +} diff --git a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs new file mode 100644 index 0000000000..1cb30f4779 --- /dev/null +++ b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs @@ -0,0 +1,101 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Return type for bidirectional streaming calls. + /// + public struct AsyncDuplexStreamingCall + { + readonly IClientStreamWriter requestStream; + readonly IAsyncStreamReader responseStream; + + public AsyncDuplexStreamingCall(IClientStreamWriter requestStream, IAsyncStreamReader responseStream) + { + this.requestStream = requestStream; + this.responseStream = responseStream; + } + + /// + /// Writes a request to RequestStream. + /// + public Task Write(TRequest message) + { + return requestStream.Write(message); + } + + /// + /// Closes the RequestStream. + /// + public Task Close() + { + return requestStream.Close(); + } + + /// + /// Reads a response from ResponseStream. + /// + /// + public Task ReadNext() + { + return responseStream.ReadNext(); + } + + /// + /// Async stream to read streaming responses. + /// + public IAsyncStreamReader ResponseStream + { + get + { + return responseStream; + } + } + + /// + /// Async stream to send streaming requests. + /// + public IClientStreamWriter RequestStream + { + get + { + return requestStream; + } + } + } +} diff --git a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs new file mode 100644 index 0000000000..d614916fb7 --- /dev/null +++ b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs @@ -0,0 +1,72 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Return type for server streaming calls. + /// + public struct AsyncServerStreamingCall + { + readonly IAsyncStreamReader responseStream; + + public AsyncServerStreamingCall(IAsyncStreamReader responseStream) + { + this.responseStream = responseStream; + } + + /// + /// Reads the next response from ResponseStream + /// + /// + public Task ReadNext() + { + return responseStream.ReadNext(); + } + + /// + /// Async stream to read streaming responses. + /// + public IAsyncStreamReader ResponseStream + { + get + { + return responseStream; + } + } + } +} diff --git a/src/csharp/Grpc.Core/Call.cs b/src/csharp/Grpc.Core/Call.cs index fe5f40f5e9..070dfb569d 100644 --- a/src/csharp/Grpc.Core/Call.cs +++ b/src/csharp/Grpc.Core/Call.cs @@ -37,6 +37,9 @@ using Grpc.Core.Utils; namespace Grpc.Core { + /// + /// Abstraction of a call to be invoked on a client. + /// public class Call { readonly string name; diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs index 280387b323..9365ccd9fb 100644 --- a/src/csharp/Grpc.Core/Calls.cs +++ b/src/csharp/Grpc.Core/Calls.cs @@ -39,7 +39,7 @@ using Grpc.Core.Internal; namespace Grpc.Core { /// - /// Helper methods for generated stubs to make RPC calls. + /// Helper methods for generated client stubs to make RPC calls. /// public static class Calls { @@ -56,35 +56,37 @@ namespace Grpc.Core return await asyncCall.UnaryCallAsync(req, call.Headers); } - public static void AsyncServerStreamingCall(Call call, TRequest req, IObserver outputs, CancellationToken token) + public static AsyncServerStreamingCall AsyncServerStreamingCall(Call call, TRequest req, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); - asyncCall.StartServerStreamingCall(req, outputs, call.Headers); + asyncCall.StartServerStreamingCall(req, call.Headers); + var responseStream = new ClientResponseStream(asyncCall); + return new AsyncServerStreamingCall(responseStream); } - public static ClientStreamingAsyncResult AsyncClientStreamingCall(Call call, CancellationToken token) + public static AsyncClientStreamingCall AsyncClientStreamingCall(Call call, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); - var task = asyncCall.ClientStreamingCallAsync(call.Headers); - var inputs = new ClientStreamingInputObserver(asyncCall); - return new ClientStreamingAsyncResult(task, inputs); + var resultTask = asyncCall.ClientStreamingCallAsync(call.Headers); + var requestStream = new ClientRequestStream(asyncCall); + return new AsyncClientStreamingCall(requestStream, resultTask); } - public static TResponse BlockingClientStreamingCall(Call call, IObservable inputs, CancellationToken token) - { - throw new NotImplementedException(); - } - - public static IObserver DuplexStreamingCall(Call call, IObserver outputs, CancellationToken token) + public static AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Call call, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); - asyncCall.StartDuplexStreamingCall(outputs, call.Headers); - return new ClientStreamingInputObserver(asyncCall); + asyncCall.StartDuplexStreamingCall(call.Headers); + var requestStream = new ClientRequestStream(asyncCall); + var responseStream = new ClientResponseStream(asyncCall); + return new AsyncDuplexStreamingCall(requestStream, responseStream); } + /// + /// Gets shared completion queue used for async calls. + /// private static CompletionQueueSafeHandle GetCompletionQueue() { return GrpcEnvironment.ThreadPool.CompletionQueue; diff --git a/src/csharp/Grpc.Core/Channel.cs b/src/csharp/Grpc.Core/Channel.cs index 3a42dac1d7..b47d810672 100644 --- a/src/csharp/Grpc.Core/Channel.cs +++ b/src/csharp/Grpc.Core/Channel.cs @@ -66,14 +66,6 @@ namespace Grpc.Core this.target = GetOverridenTarget(target, channelArgs); } - internal ChannelSafeHandle Handle - { - get - { - return this.handle; - } - } - public string Target { get @@ -88,6 +80,14 @@ namespace Grpc.Core GC.SuppressFinalize(this); } + internal ChannelSafeHandle Handle + { + get + { + return this.handle; + } + } + protected virtual void Dispose(bool disposing) { if (handle != null && !handle.IsInvalid) diff --git a/src/csharp/Grpc.Core/ClientStreamingAsyncResult.cs b/src/csharp/Grpc.Core/ClientStreamingAsyncResult.cs deleted file mode 100644 index 65bedb0a33..0000000000 --- a/src/csharp/Grpc.Core/ClientStreamingAsyncResult.cs +++ /dev/null @@ -1,69 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#endregion - -using System; -using System.Threading.Tasks; - -namespace Grpc.Core -{ - /// - /// Return type for client streaming async method. - /// - public struct ClientStreamingAsyncResult - { - readonly Task task; - readonly IObserver inputs; - - public ClientStreamingAsyncResult(Task task, IObserver inputs) - { - this.task = task; - this.inputs = inputs; - } - - public Task Task - { - get - { - return this.task; - } - } - - public IObserver Inputs - { - get - { - return this.inputs; - } - } - } -} diff --git a/src/csharp/Grpc.Core/Credentials.cs b/src/csharp/Grpc.Core/Credentials.cs index 15dd3ef321..e64c1e3dc1 100644 --- a/src/csharp/Grpc.Core/Credentials.cs +++ b/src/csharp/Grpc.Core/Credentials.cs @@ -37,7 +37,7 @@ using Grpc.Core.Internal; namespace Grpc.Core { /// - /// Client-side credentials. + /// Client-side credentials. Used for creation of a secure channel. /// public abstract class Credentials { diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index 0b85392e15..fee742b220 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -39,12 +39,18 @@ + + + + + + - + @@ -59,14 +65,10 @@ - - - - - + @@ -86,6 +88,12 @@ + + + + + + diff --git a/src/csharp/Grpc.Core/IAsyncStreamReader.cs b/src/csharp/Grpc.Core/IAsyncStreamReader.cs new file mode 100644 index 0000000000..61cf57f7e0 --- /dev/null +++ b/src/csharp/Grpc.Core/IAsyncStreamReader.cs @@ -0,0 +1,54 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// A stream of messages to be read. + /// + /// + public interface IAsyncStreamReader + { + /// + /// Reads a single message. Returns default(T) if the last message was already read. + /// A following read can only be started when the previous one finishes. + /// + Task ReadNext(); + } +} diff --git a/src/csharp/Grpc.Core/IAsyncStreamWriter.cs b/src/csharp/Grpc.Core/IAsyncStreamWriter.cs new file mode 100644 index 0000000000..724bae8f31 --- /dev/null +++ b/src/csharp/Grpc.Core/IAsyncStreamWriter.cs @@ -0,0 +1,54 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// A writable stream of messages. + /// + /// + public interface IAsyncStreamWriter + { + /// + /// Writes a single message. Only one write can be pending at a time. + /// + /// the message to be written. Cannot be null. + Task Write(T message); + } +} diff --git a/src/csharp/Grpc.Core/IClientStreamWriter.cs b/src/csharp/Grpc.Core/IClientStreamWriter.cs new file mode 100644 index 0000000000..6da42e9ccc --- /dev/null +++ b/src/csharp/Grpc.Core/IClientStreamWriter.cs @@ -0,0 +1,53 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Client-side writable stream of messages with Close capability. + /// + /// + public interface IClientStreamWriter : IAsyncStreamWriter + { + /// + /// Closes the stream. Can only be called once there is no pending write. No writes should follow calling this. + /// + Task Close(); + } +} diff --git a/src/csharp/Grpc.Core/IServerStreamWriter.cs b/src/csharp/Grpc.Core/IServerStreamWriter.cs new file mode 100644 index 0000000000..e76397d8a0 --- /dev/null +++ b/src/csharp/Grpc.Core/IServerStreamWriter.cs @@ -0,0 +1,48 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// A writable stream of messages that is used in server-side handlers. + /// + public interface IServerStreamWriter : IAsyncStreamWriter + { + } +} diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index bc72cb78de..fd94771ddd 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -43,7 +43,7 @@ using Grpc.Core.Utils; namespace Grpc.Core.Internal { /// - /// Handles client side native call lifecycle. + /// Manages client side native call lifecycle. /// internal class AsyncCall : AsyncCallBase { @@ -160,7 +160,7 @@ namespace Grpc.Core.Internal /// /// Starts a unary request - streamed response call. /// - public void StartServerStreamingCall(TRequest msg, IObserver readObserver, Metadata headers) + public void StartServerStreamingCall(TRequest msg, Metadata headers) { lock (myLock) { @@ -169,17 +169,13 @@ namespace Grpc.Core.Internal started = true; halfcloseRequested = true; halfclosed = true; // halfclose not confirmed yet, but it will be once finishedHandler is called. - - this.readObserver = readObserver; byte[] payload = UnsafeSerialize(msg); - + using (var metadataArray = MetadataArraySafeHandle.Create(headers)) { call.StartServerStreaming(payload, finishedHandler, metadataArray); } - - StartReceiveMessage(); } } @@ -187,7 +183,7 @@ namespace Grpc.Core.Internal /// Starts a streaming request - streaming response call. /// Use StartSendMessage and StartSendCloseFromClient to stream requests. /// - public void StartDuplexStreamingCall(IObserver readObserver, Metadata headers) + public void StartDuplexStreamingCall(Metadata headers) { lock (myLock) { @@ -195,14 +191,10 @@ namespace Grpc.Core.Internal started = true; - this.readObserver = readObserver; - using (var metadataArray = MetadataArraySafeHandle.Create(headers)) { call.StartDuplexStreaming(finishedHandler, metadataArray); } - - StartReceiveMessage(); } } @@ -210,17 +202,26 @@ namespace Grpc.Core.Internal /// Sends a streaming request. Only one pending send action is allowed at any given time. /// completionDelegate is called when the operation finishes. /// - public void StartSendMessage(TRequest msg, AsyncCompletionDelegate completionDelegate) + public void StartSendMessage(TRequest msg, AsyncCompletionDelegate completionDelegate) { StartSendMessageInternal(msg, completionDelegate); } + /// + /// Receives a streaming response. Only one pending read action is allowed at any given time. + /// completionDelegate is called when the operation finishes. + /// + public void StartReadMessage(AsyncCompletionDelegate completionDelegate) + { + StartReadMessageInternal(completionDelegate); + } + /// /// Sends halfclose, indicating client is done with streaming requests. /// Only one pending send action is allowed at any given time. /// completionDelegate is called when the operation finishes. /// - public void StartSendCloseFromClient(AsyncCompletionDelegate completionDelegate) + public void StartSendCloseFromClient(AsyncCompletionDelegate completionDelegate) { lock (myLock) { @@ -235,12 +236,12 @@ namespace Grpc.Core.Internal } /// - /// On client-side, we only fire readObserver.OnCompleted once all messages have been read + /// On client-side, we only fire readCompletionDelegate once all messages have been read /// and status has been received. /// - protected override void CompleteReadObserver() + protected override void ProcessLastRead(AsyncCompletionDelegate completionDelegate) { - if (readingDone && finishedStatus.HasValue) + if (completionDelegate != null && readingDone && finishedStatus.HasValue) { bool shouldComplete; lock (myLock) @@ -254,11 +255,11 @@ namespace Grpc.Core.Internal var status = finishedStatus.Value; if (status.StatusCode != StatusCode.OK) { - FireReadObserverOnError(new RpcException(status)); + FireCompletion(completionDelegate, default(TResponse), new RpcException(status)); } else { - FireReadObserverOnCompleted(); + FireCompletion(completionDelegate, default(TResponse), null); } } } @@ -304,15 +305,18 @@ namespace Grpc.Core.Internal { var status = ctx.GetReceivedStatus(); + AsyncCompletionDelegate origReadCompletionDelegate = null; lock (myLock) { finished = true; finishedStatus = status; + origReadCompletionDelegate = readCompletionDelegate; + ReleaseResourcesIfPossible(); } - CompleteReadObserver(); + ProcessLastRead(origReadCompletionDelegate); } } } \ No newline at end of file diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 15b0cfe249..2bde4b3720 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -44,7 +44,7 @@ namespace Grpc.Core.Internal { /// /// Base for handling both client side and server side calls. - /// Handles native call lifecycle and provides convenience methods. + /// Manages native call lifecycle and provides convenience methods. /// internal abstract class AsyncCallBase { @@ -65,16 +65,14 @@ namespace Grpc.Core.Internal protected bool errorOccured; protected bool cancelRequested; - protected AsyncCompletionDelegate sendCompletionDelegate; // Completion of a pending send or sendclose if not null. - protected bool readPending; // True if there is a read in progress. + protected AsyncCompletionDelegate sendCompletionDelegate; // Completion of a pending send or sendclose if not null. + protected AsyncCompletionDelegate readCompletionDelegate; // Completion of a pending send or sendclose if not null. + protected bool readingDone; protected bool halfcloseRequested; protected bool halfclosed; protected bool finished; // True if close has been received from the peer. - // Streaming reads will be delivered to this observer. For a call that only does unary read it may remain null. - protected IObserver readObserver; - public AsyncCallBase(Func serializer, Func deserializer) { this.serializer = Preconditions.CheckNotNull(serializer); @@ -131,10 +129,10 @@ namespace Grpc.Core.Internal } /// - /// Initiates sending a message. Only once send operation can be active at a time. + /// Initiates sending a message. Only one send operation can be active at a time. /// completionDelegate is invoked upon completion. /// - protected void StartSendMessageInternal(TWrite msg, AsyncCompletionDelegate completionDelegate) + protected void StartSendMessageInternal(TWrite msg, AsyncCompletionDelegate completionDelegate) { byte[] payload = UnsafeSerialize(msg); @@ -149,31 +147,29 @@ namespace Grpc.Core.Internal } /// - /// Requests receiving a next message. + /// Initiates reading a message. Only one read operation can be active at a time. + /// completionDelegate is invoked upon completion. /// - protected void StartReceiveMessage() + protected void StartReadMessageInternal(AsyncCompletionDelegate completionDelegate) { lock (myLock) { - Preconditions.CheckState(started); - Preconditions.CheckState(!disposed); - Preconditions.CheckState(!errorOccured); - - Preconditions.CheckState(!readingDone); - Preconditions.CheckState(!readPending); + Preconditions.CheckNotNull(completionDelegate, "Completion delegate cannot be null"); + CheckReadingAllowed(); call.StartReceiveMessage(readFinishedHandler); - readPending = true; + readCompletionDelegate = completionDelegate; } } + // TODO(jtattermusch): find more fitting name for this method. /// /// Default behavior just completes the read observer, but more sofisticated behavior might be required /// by subclasses. /// - protected virtual void CompleteReadObserver() + protected virtual void ProcessLastRead(AsyncCompletionDelegate completionDelegate) { - FireReadObserverOnCompleted(); + FireCompletion(completionDelegate, default(TRead), null); } /// @@ -213,6 +209,16 @@ namespace Grpc.Core.Internal Preconditions.CheckState(sendCompletionDelegate == null, "Only one write can be pending at a time"); } + protected void CheckReadingAllowed() + { + Preconditions.CheckState(started); + Preconditions.CheckState(!disposed); + Preconditions.CheckState(!errorOccured); + + Preconditions.CheckState(!readingDone, "Stream has already been closed."); + Preconditions.CheckState(readCompletionDelegate == null, "Only one write can be pending at a time"); + } + protected byte[] UnsafeSerialize(TWrite msg) { return serializer(msg); @@ -248,47 +254,11 @@ namespace Grpc.Core.Internal } } - protected void FireReadObserverOnNext(TRead value) - { - try - { - readObserver.OnNext(value); - } - catch (Exception e) - { - Console.WriteLine("Exception occured while invoking readObserver.OnNext: " + e); - } - } - - protected void FireReadObserverOnCompleted() + protected void FireCompletion(AsyncCompletionDelegate completionDelegate, T value, Exception error) { try { - readObserver.OnCompleted(); - } - catch (Exception e) - { - Console.WriteLine("Exception occured while invoking readObserver.OnCompleted: " + e); - } - } - - protected void FireReadObserverOnError(Exception error) - { - try - { - readObserver.OnError(error); - } - catch (Exception e) - { - Console.WriteLine("Exception occured while invoking readObserver.OnError: " + e); - } - } - - protected void FireCompletion(AsyncCompletionDelegate completionDelegate, Exception error) - { - try - { - completionDelegate(error); + completionDelegate(value, error); } catch (Exception e) { @@ -322,7 +292,7 @@ namespace Grpc.Core.Internal /// private void HandleSendFinished(bool wasError, BatchContextSafeHandleNotOwned ctx) { - AsyncCompletionDelegate origCompletionDelegate = null; + AsyncCompletionDelegate origCompletionDelegate = null; lock (myLock) { origCompletionDelegate = sendCompletionDelegate; @@ -333,11 +303,11 @@ namespace Grpc.Core.Internal if (wasError) { - FireCompletion(origCompletionDelegate, new OperationFailedException("Send failed")); + FireCompletion(origCompletionDelegate, null, new OperationFailedException("Send failed")); } else { - FireCompletion(origCompletionDelegate, null); + FireCompletion(origCompletionDelegate, null, null); } } @@ -346,7 +316,7 @@ namespace Grpc.Core.Internal /// private void HandleHalfclosed(bool wasError, BatchContextSafeHandleNotOwned ctx) { - AsyncCompletionDelegate origCompletionDelegate = null; + AsyncCompletionDelegate origCompletionDelegate = null; lock (myLock) { halfclosed = true; @@ -358,11 +328,11 @@ namespace Grpc.Core.Internal if (wasError) { - FireCompletion(origCompletionDelegate, new OperationFailedException("Halfclose failed")); + FireCompletion(origCompletionDelegate, null, new OperationFailedException("Halfclose failed")); } else { - FireCompletion(origCompletionDelegate, null); + FireCompletion(origCompletionDelegate, null, null); } } @@ -373,11 +343,19 @@ namespace Grpc.Core.Internal { var payload = ctx.GetReceivedMessage(); + AsyncCompletionDelegate origCompletionDelegate = null; lock (myLock) { - readPending = false; - if (payload == null) + origCompletionDelegate = readCompletionDelegate; + if (payload != null) { + readCompletionDelegate = null; + } + else + { + // This was the last read. Keeping the readCompletionDelegate + // to be either fired by this handler or by client-side finished + // handler. readingDone = true; } @@ -392,15 +370,11 @@ namespace Grpc.Core.Internal TRead msg; TryDeserialize(payload, out msg); - FireReadObserverOnNext(msg); - - // Start a new read. The current one has already been delivered, - // so correct ordering of reads is assured. - StartReceiveMessage(); + FireCompletion(origCompletionDelegate, msg, null); } else { - CompleteReadObserver(); + ProcessLastRead(origCompletionDelegate); } } } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index d3a2be553f..25dc15bbc0 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -43,7 +43,7 @@ using Grpc.Core.Utils; namespace Grpc.Core.Internal { /// - /// Handles server side native call lifecycle. + /// Manages server side native call lifecycle. /// internal class AsyncCallServer : AsyncCallBase { @@ -61,20 +61,17 @@ namespace Grpc.Core.Internal } /// - /// Starts a server side call. Currently, all server side calls are implemented as duplex - /// streaming call and they are adapted to the appropriate streaming arity. + /// Starts a server side call. /// - public Task ServerSideCallAsync(IObserver readObserver) + public Task ServerSideCallAsync() { lock (myLock) { Preconditions.CheckNotNull(call); started = true; - this.readObserver = readObserver; call.StartServerSide(finishedServersideHandler); - StartReceiveMessage(); return finishedServersideTcs.Task; } } @@ -83,17 +80,26 @@ namespace Grpc.Core.Internal /// Sends a streaming response. Only one pending send action is allowed at any given time. /// completionDelegate is called when the operation finishes. /// - public void StartSendMessage(TResponse msg, AsyncCompletionDelegate completionDelegate) + public void StartSendMessage(TResponse msg, AsyncCompletionDelegate completionDelegate) { StartSendMessageInternal(msg, completionDelegate); } + /// + /// Receives a streaming request. Only one pending read action is allowed at any given time. + /// completionDelegate is called when the operation finishes. + /// + public void StartReadMessage(AsyncCompletionDelegate completionDelegate) + { + StartReadMessageInternal(completionDelegate); + } + /// /// Sends call result status, also indicating server is done with streaming responses. /// Only one pending send action is allowed at any given time. /// completionDelegate is called when the operation finishes. /// - public void StartSendStatusFromServer(Status status, AsyncCompletionDelegate completionDelegate) + public void StartSendStatusFromServer(Status status, AsyncCompletionDelegate completionDelegate) { lock (myLock) { diff --git a/src/csharp/Grpc.Core/Internal/AsyncCompletion.cs b/src/csharp/Grpc.Core/Internal/AsyncCompletion.cs index 673b527fb2..c88cae98fe 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCompletion.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCompletion.cs @@ -45,22 +45,22 @@ namespace Grpc.Core.Internal /// /// If error != null, there's been an error or operation has been cancelled. /// - internal delegate void AsyncCompletionDelegate(Exception error); + internal delegate void AsyncCompletionDelegate(T result, Exception error); /// /// Helper for transforming AsyncCompletionDelegate into full-fledged Task. /// - internal class AsyncCompletionTaskSource + internal class AsyncCompletionTaskSource { - readonly TaskCompletionSource tcs = new TaskCompletionSource(); - readonly AsyncCompletionDelegate completionDelegate; + readonly TaskCompletionSource tcs = new TaskCompletionSource(); + readonly AsyncCompletionDelegate completionDelegate; public AsyncCompletionTaskSource() { - completionDelegate = new AsyncCompletionDelegate(HandleCompletion); + completionDelegate = new AsyncCompletionDelegate(HandleCompletion); } - public Task Task + public Task Task { get { @@ -68,7 +68,7 @@ namespace Grpc.Core.Internal } } - public AsyncCompletionDelegate CompletionDelegate + public AsyncCompletionDelegate CompletionDelegate { get { @@ -76,11 +76,11 @@ namespace Grpc.Core.Internal } } - private void HandleCompletion(Exception error) + private void HandleCompletion(T value, Exception error) { if (error == null) { - tcs.SetResult(null); + tcs.SetResult(value); return; } if (error is OperationCanceledException) diff --git a/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs b/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs new file mode 100644 index 0000000000..6854922a6f --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs @@ -0,0 +1,63 @@ +#region Copyright notice and license +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion +using System; +using System.Threading.Tasks; +using Grpc.Core.Internal; + +namespace Grpc.Core.Internal +{ + /// + /// Writes requests asynchronously to an underlying AsyncCall object. + /// + internal class ClientRequestStream : IClientStreamWriter + { + readonly AsyncCall call; + + public ClientRequestStream(AsyncCall call) + { + this.call = call; + } + + public Task Write(TRequest message) + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartSendMessage(message, taskSource.CompletionDelegate); + return taskSource.Task; + } + + public Task Close() + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartSendCloseFromClient(taskSource.CompletionDelegate); + return taskSource.Task; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs new file mode 100644 index 0000000000..7fa511faa8 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs @@ -0,0 +1,56 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Grpc.Core.Internal +{ + internal class ClientResponseStream : IAsyncStreamReader + { + readonly AsyncCall call; + + public ClientResponseStream(AsyncCall call) + { + this.call = call; + } + + public Task ReadNext() + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartReadMessage(taskSource.CompletionDelegate); + return taskSource.Task; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ClientStreamingInputObserver.cs b/src/csharp/Grpc.Core/Internal/ClientStreamingInputObserver.cs deleted file mode 100644 index 286c54f2c4..0000000000 --- a/src/csharp/Grpc.Core/Internal/ClientStreamingInputObserver.cs +++ /dev/null @@ -1,66 +0,0 @@ -#region Copyright notice and license -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion -using System; -using Grpc.Core.Internal; - -namespace Grpc.Core.Internal -{ - internal class ClientStreamingInputObserver : IObserver - { - readonly AsyncCall call; - - public ClientStreamingInputObserver(AsyncCall call) - { - this.call = call; - } - - public void OnCompleted() - { - var taskSource = new AsyncCompletionTaskSource(); - call.StartSendCloseFromClient(taskSource.CompletionDelegate); - // TODO: how bad is the Wait here? - taskSource.Task.Wait(); - } - - public void OnError(Exception error) - { - throw new InvalidOperationException("This should never be called."); - } - - public void OnNext(TWrite value) - { - var taskSource = new AsyncCompletionTaskSource(); - call.StartSendMessage(value, taskSource.CompletionDelegate); - // TODO: how bad is the Wait here? - taskSource.Task.Wait(); - } - } -} diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 25fd4fab8f..2ae924b4a8 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -33,6 +33,7 @@ using System; using System.Linq; +using System.Threading.Tasks; using Grpc.Core.Internal; using Grpc.Core.Utils; @@ -40,96 +41,147 @@ namespace Grpc.Core.Internal { internal interface IServerCallHandler { - void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq); + Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq); } - internal class UnaryRequestServerCallHandler : IServerCallHandler + internal class UnaryServerCallHandler : IServerCallHandler { readonly Method method; - readonly UnaryRequestServerMethod handler; + readonly UnaryServerMethod handler; - public UnaryRequestServerCallHandler(Method method, UnaryRequestServerMethod handler) + public UnaryServerCallHandler(Method method, UnaryServerMethod handler) { this.method = method; this.handler = handler; } - public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) + public async Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( method.ResponseMarshaller.Serializer, method.RequestMarshaller.Deserializer); asyncCall.Initialize(call); - - var requestObserver = new RecordingObserver(); - var finishedTask = asyncCall.ServerSideCallAsync(requestObserver); - - var request = requestObserver.ToList().Result.Single(); - var responseObserver = new ServerStreamingOutputObserver(asyncCall); - handler(request, responseObserver); - - finishedTask.Wait(); + var finishedTask = asyncCall.ServerSideCallAsync(); + var requestStream = new ServerRequestStream(asyncCall); + var responseStream = new ServerResponseStream(asyncCall); + + var request = await requestStream.ReadNext(); + // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. + Preconditions.CheckArgument(await requestStream.ReadNext() == null); + + var result = await handler(request); + await responseStream.Write(result); + await responseStream.WriteStatus(Status.DefaultSuccess); + await finishedTask; } } - internal class StreamingRequestServerCallHandler : IServerCallHandler + internal class ServerStreamingServerCallHandler : IServerCallHandler { readonly Method method; - readonly StreamingRequestServerMethod handler; + readonly ServerStreamingServerMethod handler; - public StreamingRequestServerCallHandler(Method method, StreamingRequestServerMethod handler) + public ServerStreamingServerCallHandler(Method method, ServerStreamingServerMethod handler) { this.method = method; this.handler = handler; } - public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) + public async Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) { var asyncCall = new AsyncCallServer( method.ResponseMarshaller.Serializer, method.RequestMarshaller.Deserializer); asyncCall.Initialize(call); + var finishedTask = asyncCall.ServerSideCallAsync(); + var requestStream = new ServerRequestStream(asyncCall); + var responseStream = new ServerResponseStream(asyncCall); + + var request = await requestStream.ReadNext(); + // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. + Preconditions.CheckArgument(await requestStream.ReadNext() == null); - var responseObserver = new ServerStreamingOutputObserver(asyncCall); - var requestObserver = handler(responseObserver); - var finishedTask = asyncCall.ServerSideCallAsync(requestObserver); - finishedTask.Wait(); + await handler(request, responseStream); + await responseStream.WriteStatus(Status.DefaultSuccess); + await finishedTask; } } - internal class NoSuchMethodCallHandler : IServerCallHandler + internal class ClientStreamingServerCallHandler : IServerCallHandler { - public void StartCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) - { - // We don't care about the payload type here. - var asyncCall = new AsyncCallServer( - (payload) => payload, (payload) => payload); - - asyncCall.Initialize(call); + readonly Method method; + readonly ClientStreamingServerMethod handler; - var finishedTask = asyncCall.ServerSideCallAsync(new NullObserver()); + public ClientStreamingServerCallHandler(Method method, ClientStreamingServerMethod handler) + { + this.method = method; + this.handler = handler; + } - // TODO: check result of the completion status. - asyncCall.StartSendStatusFromServer(new Status(StatusCode.Unimplemented, "No such method."), new AsyncCompletionDelegate((error) => { })); + public async Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) + { + var asyncCall = new AsyncCallServer( + method.ResponseMarshaller.Serializer, + method.RequestMarshaller.Deserializer); - finishedTask.Wait(); + asyncCall.Initialize(call); + var finishedTask = asyncCall.ServerSideCallAsync(); + var requestStream = new ServerRequestStream(asyncCall); + var responseStream = new ServerResponseStream(asyncCall); + + var result = await handler(requestStream); + await responseStream.Write(result); + await responseStream.WriteStatus(Status.DefaultSuccess); + await finishedTask; } } - internal class NullObserver : IObserver + internal class DuplexStreamingServerCallHandler : IServerCallHandler { - public void OnCompleted() + readonly Method method; + readonly DuplexStreamingServerMethod handler; + + public DuplexStreamingServerCallHandler(Method method, DuplexStreamingServerMethod handler) { + this.method = method; + this.handler = handler; } - public void OnError(Exception error) + public async Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) { + var asyncCall = new AsyncCallServer( + method.ResponseMarshaller.Serializer, + method.RequestMarshaller.Deserializer); + + asyncCall.Initialize(call); + var finishedTask = asyncCall.ServerSideCallAsync(); + var requestStream = new ServerRequestStream(asyncCall); + var responseStream = new ServerResponseStream(asyncCall); + + await handler(requestStream, responseStream); + await responseStream.WriteStatus(Status.DefaultSuccess); + await finishedTask; } + } - public void OnNext(T value) + internal class NoSuchMethodCallHandler : IServerCallHandler + { + public async Task HandleCall(string methodName, CallSafeHandle call, CompletionQueueSafeHandle cq) { + // We don't care about the payload type here. + var asyncCall = new AsyncCallServer( + (payload) => payload, (payload) => payload); + + asyncCall.Initialize(call); + var finishedTask = asyncCall.ServerSideCallAsync(); + var requestStream = new ServerRequestStream(asyncCall); + var responseStream = new ServerResponseStream(asyncCall); + await responseStream.WriteStatus(new Status(StatusCode.Unimplemented, "No such method.")); + // TODO(jtattermusch): if we don't read what client has sent, the server call never gets disposed. + await requestStream.ToList(); + await finishedTask; } } } diff --git a/src/csharp/Grpc.Core/Internal/ServerCalls.cs b/src/csharp/Grpc.Core/Internal/ServerCalls.cs new file mode 100644 index 0000000000..5c6b335c7f --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/ServerCalls.cs @@ -0,0 +1,63 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Threading; +using System.Threading.Tasks; +using Grpc.Core; + +namespace Grpc.Core.Internal +{ + internal static class ServerCalls + { + public static IServerCallHandler UnaryCall(Method method, UnaryServerMethod handler) + { + return new UnaryServerCallHandler(method, handler); + } + + public static IServerCallHandler ClientStreamingCall(Method method, ClientStreamingServerMethod handler) + { + return new ClientStreamingServerCallHandler(method, handler); + } + + public static IServerCallHandler ServerStreamingCall(Method method, ServerStreamingServerMethod handler) + { + return new ServerStreamingServerCallHandler(method, handler); + } + + public static IServerCallHandler DuplexStreamingCall(Method method, DuplexStreamingServerMethod handler) + { + return new DuplexStreamingServerCallHandler(method, handler); + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs new file mode 100644 index 0000000000..aa311059c3 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs @@ -0,0 +1,56 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Grpc.Core.Internal +{ + internal class ServerRequestStream : IAsyncStreamReader + { + readonly AsyncCallServer call; + + public ServerRequestStream(AsyncCallServer call) + { + this.call = call; + } + + public Task ReadNext() + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartReadMessage(taskSource.CompletionDelegate); + return taskSource.Task; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs b/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs new file mode 100644 index 0000000000..686017c048 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs @@ -0,0 +1,64 @@ +#region Copyright notice and license +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#endregion + +using System; +using System.Threading.Tasks; +using Grpc.Core.Internal; + +namespace Grpc.Core.Internal +{ + /// + /// Writes responses asynchronously to an underlying AsyncCallServer object. + /// + internal class ServerResponseStream : IServerStreamWriter + { + readonly AsyncCallServer call; + + public ServerResponseStream(AsyncCallServer call) + { + this.call = call; + } + + public Task Write(TResponse message) + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartSendMessage(message, taskSource.CompletionDelegate); + return taskSource.Task; + } + + public Task WriteStatus(Status status) + { + var taskSource = new AsyncCompletionTaskSource(); + call.StartSendStatusFromServer(status, taskSource.CompletionDelegate); + return taskSource.Task; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/ServerStreamingOutputObserver.cs b/src/csharp/Grpc.Core/Internal/ServerStreamingOutputObserver.cs deleted file mode 100644 index 97b62d0569..0000000000 --- a/src/csharp/Grpc.Core/Internal/ServerStreamingOutputObserver.cs +++ /dev/null @@ -1,71 +0,0 @@ -#region Copyright notice and license -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#endregion -using System; -using Grpc.Core.Internal; - -namespace Grpc.Core.Internal -{ - /// - /// Observer that writes all arriving messages to a call abstraction (in blocking fashion) - /// and then halfcloses the call. Used for server-side call handling. - /// - internal class ServerStreamingOutputObserver : IObserver - { - readonly AsyncCallServer call; - - public ServerStreamingOutputObserver(AsyncCallServer call) - { - this.call = call; - } - - public void OnCompleted() - { - var taskSource = new AsyncCompletionTaskSource(); - call.StartSendStatusFromServer(new Status(StatusCode.OK, ""), taskSource.CompletionDelegate); - // TODO: how bad is the Wait here? - taskSource.Task.Wait(); - } - - public void OnError(Exception error) - { - // TODO: implement this... - throw new InvalidOperationException("This should never be called."); - } - - public void OnNext(TResponse value) - { - var taskSource = new AsyncCompletionTaskSource(); - call.StartSendMessage(value, taskSource.CompletionDelegate); - // TODO: how bad is the Wait here? - taskSource.Task.Wait(); - } - } -} diff --git a/src/csharp/Grpc.Core/Method.cs b/src/csharp/Grpc.Core/Method.cs index 4f97eeef37..156e780c7d 100644 --- a/src/csharp/Grpc.Core/Method.cs +++ b/src/csharp/Grpc.Core/Method.cs @@ -35,12 +35,15 @@ using System; namespace Grpc.Core { + /// + /// Method types supported by gRPC. + /// public enum MethodType { - Unary, - ClientStreaming, - ServerStreaming, - DuplexStreaming + Unary, // Unary request, unary response. + ClientStreaming, // Streaming request, unary response. + ServerStreaming, // Unary request, streaming response. + DuplexStreaming // Streaming request, streaming response. } /// diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index e686cdddef..a3000cee46 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -181,7 +181,7 @@ namespace Grpc.Core /// /// Selects corresponding handler for given call and handles the call. /// - private void InvokeCallHandler(CallSafeHandle call, string method) + private async Task InvokeCallHandler(CallSafeHandle call, string method) { try { @@ -190,7 +190,7 @@ namespace Grpc.Core { callHandler = new NoSuchMethodCallHandler(); } - callHandler.StartCall(method, call, GetCompletionQueue()); + await callHandler.HandleCall(method, call, GetCompletionQueue()); } catch (Exception e) { @@ -218,7 +218,7 @@ namespace Grpc.Core // after server shutdown, the callback returns with null call if (!call.IsInvalid) { - Task.Run(() => InvokeCallHandler(call, method)); + Task.Run(async () => await InvokeCallHandler(call, method)); } AllowOneRpc(); diff --git a/src/csharp/Grpc.Core/ServerCalls.cs b/src/csharp/Grpc.Core/ServerCalls.cs deleted file mode 100644 index dcae99446f..0000000000 --- a/src/csharp/Grpc.Core/ServerCalls.cs +++ /dev/null @@ -1,57 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#endregion - -using System; -using Grpc.Core.Internal; - -namespace Grpc.Core -{ - // TODO: perhaps add also serverSideStreaming and clientSideStreaming - - public delegate void UnaryRequestServerMethod(TRequest request, IObserver responseObserver); - - public delegate IObserver StreamingRequestServerMethod(IObserver responseObserver); - - internal static class ServerCalls - { - public static IServerCallHandler UnaryRequestCall(Method method, UnaryRequestServerMethod handler) - { - return new UnaryRequestServerCallHandler(method, handler); - } - - public static IServerCallHandler StreamingRequestCall(Method method, StreamingRequestServerMethod handler) - { - return new StreamingRequestServerCallHandler(method, handler); - } - } -} diff --git a/src/csharp/Grpc.Core/ServerMethods.cs b/src/csharp/Grpc.Core/ServerMethods.cs new file mode 100644 index 0000000000..6646bb5a89 --- /dev/null +++ b/src/csharp/Grpc.Core/ServerMethods.cs @@ -0,0 +1,61 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Threading; +using System.Threading.Tasks; + +using Grpc.Core.Internal; + +namespace Grpc.Core +{ + /// + /// Server-side handler for unary call. + /// + public delegate Task UnaryServerMethod(TRequest request); + + /// + /// Server-side handler for client streaming call. + /// + public delegate Task ClientStreamingServerMethod(IAsyncStreamReader requestStream); + + /// + /// Server-side handler for server streaming call. + /// + public delegate Task ServerStreamingServerMethod(TRequest request, IServerStreamWriter responseStream); + + /// + /// Server-side handler for bidi streaming call. + /// + public delegate Task DuplexStreamingServerMethod(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); +} diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs index f08c7d88f3..01b1dc8f7b 100644 --- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs +++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs @@ -75,17 +75,33 @@ namespace Grpc.Core public Builder AddMethod( Method method, - UnaryRequestServerMethod handler) + UnaryServerMethod handler) { - callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryRequestCall(method, handler)); + callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler)); return this; } public Builder AddMethod( Method method, - StreamingRequestServerMethod handler) + ClientStreamingServerMethod handler) { - callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.StreamingRequestCall(method, handler)); + callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler)); + return this; + } + + public Builder AddMethod( + Method method, + ServerStreamingServerMethod handler) + { + callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler)); + return this; + } + + public Builder AddMethod( + Method method, + DuplexStreamingServerMethod handler) + { + callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler)); return this; } diff --git a/src/csharp/Grpc.Core/Status.cs b/src/csharp/Grpc.Core/Status.cs index 7d76aec4d1..b588170694 100644 --- a/src/csharp/Grpc.Core/Status.cs +++ b/src/csharp/Grpc.Core/Status.cs @@ -39,6 +39,11 @@ namespace Grpc.Core /// public struct Status { + /// + /// Default result of a successful RPC. StatusCode=OK, empty details message. + /// + public static readonly Status DefaultSuccess = new Status(StatusCode.OK, ""); + readonly StatusCode statusCode; readonly string detail; diff --git a/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs new file mode 100644 index 0000000000..f915155f8a --- /dev/null +++ b/src/csharp/Grpc.Core/Utils/AsyncStreamExtensions.cs @@ -0,0 +1,111 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Grpc.Core.Utils +{ + /// + /// Extension methods that simplify work with gRPC streaming calls. + /// + public static class AsyncStreamExtensions + { + /// + /// Reads the entire stream and executes an async action for each element. + /// + public static async Task ForEach(this IAsyncStreamReader streamReader, Func asyncAction) + where T : class + { + while (true) + { + var elem = await streamReader.ReadNext(); + if (elem == null) + { + break; + } + await asyncAction(elem); + } + } + + /// + /// Reads the entire stream and creates a list containing all the elements read. + /// + public static async Task> ToList(this IAsyncStreamReader streamReader) + where T : class + { + var result = new List(); + while (true) + { + var elem = await streamReader.ReadNext(); + if (elem == null) + { + break; + } + result.Add(elem); + } + return result; + } + + /// + /// Writes all elements from given enumerable to the stream. + /// Closes the stream afterwards unless close = false. + /// + public static async Task WriteAll(this IClientStreamWriter streamWriter, IEnumerable elements, bool close = true) + where T : class + { + foreach (var element in elements) + { + await streamWriter.Write(element); + } + if (close) + { + await streamWriter.Close(); + } + } + + /// + /// Writes all elements from given enumerable to the stream. + /// + public static async Task WriteAll(this IServerStreamWriter streamWriter, IEnumerable elements) + where T : class + { + foreach (var element in elements) + { + await streamWriter.Write(element); + } + } + } +} diff --git a/src/csharp/Grpc.Core/Utils/RecordingObserver.cs b/src/csharp/Grpc.Core/Utils/RecordingObserver.cs deleted file mode 100644 index 7b43ab8ad5..0000000000 --- a/src/csharp/Grpc.Core/Utils/RecordingObserver.cs +++ /dev/null @@ -1,65 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#endregion - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Grpc.Core.Utils -{ - public class RecordingObserver : IObserver - { - TaskCompletionSource> tcs = new TaskCompletionSource>(); - List data = new List(); - - public void OnCompleted() - { - tcs.SetResult(data); - } - - public void OnError(Exception error) - { - tcs.SetException(error); - } - - public void OnNext(T value) - { - data.Add(value); - } - - public Task> ToList() - { - return tcs.Task; - } - } -} diff --git a/src/csharp/Grpc.Core/Utils/RecordingQueue.cs b/src/csharp/Grpc.Core/Utils/RecordingQueue.cs deleted file mode 100644 index 9749168af0..0000000000 --- a/src/csharp/Grpc.Core/Utils/RecordingQueue.cs +++ /dev/null @@ -1,83 +0,0 @@ -#region Copyright notice and license - -// Copyright 2015, Google Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#endregion - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading.Tasks; - -namespace Grpc.Core.Utils -{ - // TODO: replace this by something that implements IAsyncEnumerator. - /// - /// Observer that allows us to await incoming messages one-by-one. - /// The implementation is not ideal and class will be probably replaced - /// by something more versatile in the future. - /// - public class RecordingQueue : IObserver - { - readonly BlockingCollection queue = new BlockingCollection(); - TaskCompletionSource tcs = new TaskCompletionSource(); - - public void OnCompleted() - { - tcs.SetResult(null); - } - - public void OnError(Exception error) - { - tcs.SetException(error); - } - - public void OnNext(T value) - { - queue.Add(value); - } - - public BlockingCollection Queue - { - get - { - return queue; - } - } - - public Task Finished - { - get - { - return tcs.Task; - } - } - } -} diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index fa5d6688a6..332795e0e5 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -63,7 +63,7 @@ namespace math.Tests server.Start(); channel = new Channel(host + ":" + port); - // TODO: get rid of the custom header here once we have dedicated tests + // TODO(jtattermusch): get rid of the custom header here once we have dedicated tests // for header support. var stubConfig = new StubConfiguration((headerBuilder) => { @@ -97,55 +97,67 @@ namespace math.Tests Assert.AreEqual(0, response.Remainder); } - // TODO: test division by zero + // TODO(jtattermusch): test division by zero [Test] public void DivAsync() { - DivReply response = client.DivAsync(new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build()).Result; - Assert.AreEqual(3, response.Quotient); - Assert.AreEqual(1, response.Remainder); + Task.Run(async () => + { + DivReply response = await client.DivAsync(new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build()); + Assert.AreEqual(3, response.Quotient); + Assert.AreEqual(1, response.Remainder); + }).Wait(); } [Test] public void Fib() { - var recorder = new RecordingObserver(); - client.Fib(new FibArgs.Builder { Limit = 6 }.Build(), recorder); + Task.Run(async () => + { + var call = client.Fib(new FibArgs.Builder { Limit = 6 }.Build()); - CollectionAssert.AreEqual(new List { 1, 1, 2, 3, 5, 8 }, - recorder.ToList().Result.ConvertAll((n) => n.Num_)); + var responses = await call.ResponseStream.ToList(); + CollectionAssert.AreEqual(new List { 1, 1, 2, 3, 5, 8 }, + responses.ConvertAll((n) => n.Num_)); + }).Wait(); } // TODO: test Fib with limit=0 and cancellation [Test] public void Sum() { - var clientStreamingResult = client.Sum(); - var numList = new List { 10, 20, 30 }.ConvertAll( - n => Num.CreateBuilder().SetNum_(n).Build()); - numList.Subscribe(clientStreamingResult.Inputs); - - Assert.AreEqual(60, clientStreamingResult.Task.Result.Num_); + Task.Run(async () => + { + var call = client.Sum(); + var numbers = new List { 10, 20, 30 }.ConvertAll( + n => Num.CreateBuilder().SetNum_(n).Build()); + + await call.RequestStream.WriteAll(numbers); + var result = await call.Result; + Assert.AreEqual(60, result.Num_); + }).Wait(); } [Test] public void DivMany() { - List divArgsList = new List + Task.Run(async () => { - new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build(), - new DivArgs.Builder { Dividend = 100, Divisor = 21 }.Build(), - new DivArgs.Builder { Dividend = 7, Divisor = 2 }.Build() - }; - - var recorder = new RecordingObserver(); - var requestObserver = client.DivMany(recorder); - divArgsList.Subscribe(requestObserver); - var result = recorder.ToList().Result; - - CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.ConvertAll((divReply) => divReply.Quotient)); - CollectionAssert.AreEqual(new long[] { 1, 16, 1 }, result.ConvertAll((divReply) => divReply.Remainder)); + var divArgsList = new List + { + new DivArgs.Builder { Dividend = 10, Divisor = 3 }.Build(), + new DivArgs.Builder { Dividend = 100, Divisor = 21 }.Build(), + new DivArgs.Builder { Dividend = 7, Divisor = 2 }.Build() + }; + + var call = client.DivMany(); + await call.RequestStream.WriteAll(divArgsList); + var result = await call.ResponseStream.ToList(); + + CollectionAssert.AreEqual(new long[] { 3, 4, 3 }, result.ConvertAll((divReply) => divReply.Quotient)); + CollectionAssert.AreEqual(new long[] { 1, 16, 1 }, result.ConvertAll((divReply) => divReply.Remainder)); + }).Wait(); } } } diff --git a/src/csharp/Grpc.Examples/MathExamples.cs b/src/csharp/Grpc.Examples/MathExamples.cs index 032372b2a1..dba5a7736c 100644 --- a/src/csharp/Grpc.Examples/MathExamples.cs +++ b/src/csharp/Grpc.Examples/MathExamples.cs @@ -61,9 +61,8 @@ namespace math public static async Task FibExample(MathGrpc.IMathServiceClient stub) { - var recorder = new RecordingObserver(); - stub.Fib(new FibArgs.Builder { Limit = 5 }.Build(), recorder); - List result = await recorder.ToList(); + var call = stub.Fib(new FibArgs.Builder { Limit = 5 }.Build()); + List result = await call.ResponseStream.ToList(); Console.WriteLine("Fib Result: " + string.Join("|", result)); } @@ -76,9 +75,9 @@ namespace math new Num.Builder { Num_ = 3 }.Build() }; - var clientStreamingResult = stub.Sum(); - numbers.Subscribe(clientStreamingResult.Inputs); - Console.WriteLine("Sum Result: " + await clientStreamingResult.Task); + var call = stub.Sum(); + await call.RequestStream.WriteAll(numbers); + Console.WriteLine("Sum Result: " + await call.Result); } public static async Task DivManyExample(MathGrpc.IMathServiceClient stub) @@ -89,12 +88,9 @@ namespace math new DivArgs.Builder { Dividend = 100, Divisor = 21 }.Build(), new DivArgs.Builder { Dividend = 7, Divisor = 2 }.Build() }; - - var recorder = new RecordingObserver(); - var inputs = stub.DivMany(recorder); - divArgsList.Subscribe(inputs); - var result = await recorder.ToList(); - Console.WriteLine("DivMany Result: " + string.Join("|", result)); + var call = stub.DivMany(); + await call.RequestStream.WriteAll(divArgsList); + Console.WriteLine("DivMany Result: " + string.Join("|", await call.ResponseStream.ToList())); } public static async Task DependendRequestsExample(MathGrpc.IMathServiceClient stub) @@ -106,9 +102,9 @@ namespace math new Num.Builder { Num_ = 3 }.Build() }; - var clientStreamingResult = stub.Sum(); - numbers.Subscribe(clientStreamingResult.Inputs); - Num sum = await clientStreamingResult.Task; + var sumCall = stub.Sum(); + await sumCall.RequestStream.WriteAll(numbers); + Num sum = await sumCall.Result; DivReply result = await stub.DivAsync(new DivArgs.Builder { Dividend = sum.Num_, Divisor = numbers.Count }.Build()); Console.WriteLine("Avg Result: " + result); diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 24e6a1de8e..60408b9018 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -82,11 +82,11 @@ namespace math Task DivAsync(DivArgs request, CancellationToken token = default(CancellationToken)); - void Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); + AsyncServerStreamingCall Fib(FibArgs request, CancellationToken token = default(CancellationToken)); - ClientStreamingAsyncResult Sum(CancellationToken token = default(CancellationToken)); + AsyncClientStreamingCall Sum(CancellationToken token = default(CancellationToken)); - IObserver DivMany(IObserver responseObserver, CancellationToken token = default(CancellationToken)); + AsyncDuplexStreamingCall DivMany(CancellationToken token = default(CancellationToken)); } public class MathServiceClientStub : AbstractStub, IMathServiceClient @@ -111,35 +111,35 @@ namespace math return Calls.AsyncUnaryCall(call, request, token); } - public void Fib(FibArgs request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncServerStreamingCall Fib(FibArgs request, CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, FibMethod); - Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + return Calls.AsyncServerStreamingCall(call, request, token); } - public ClientStreamingAsyncResult Sum(CancellationToken token = default(CancellationToken)) + public AsyncClientStreamingCall Sum(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, SumMethod); return Calls.AsyncClientStreamingCall(call, token); } - public IObserver DivMany(IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncDuplexStreamingCall DivMany(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, DivManyMethod); - return Calls.DuplexStreamingCall(call, responseObserver, token); + return Calls.AsyncDuplexStreamingCall(call, token); } } // server-side interface public interface IMathService { - void Div(DivArgs request, IObserver responseObserver); + Task Div(DivArgs request); - void Fib(FibArgs request, IObserver responseObserver); + Task Fib(FibArgs request, IServerStreamWriter responseStream); - IObserver Sum(IObserver responseObserver); + Task Sum(IAsyncStreamReader requestStream); - IObserver DivMany(IObserver responseObserver); + Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); } public static ServerServiceDefinition BindService(IMathService serviceImpl) diff --git a/src/csharp/Grpc.Examples/MathServiceImpl.cs b/src/csharp/Grpc.Examples/MathServiceImpl.cs index 0b2357e0fa..83ec2a8c3d 100644 --- a/src/csharp/Grpc.Examples/MathServiceImpl.cs +++ b/src/csharp/Grpc.Examples/MathServiceImpl.cs @@ -36,6 +36,7 @@ using System.Collections.Generic; using System.Reactive.Linq; using System.Threading; using System.Threading.Tasks; +using Grpc.Core; using Grpc.Core.Utils; namespace math @@ -45,18 +46,16 @@ namespace math /// public class MathServiceImpl : MathGrpc.IMathService { - public void Div(DivArgs request, IObserver responseObserver) + public Task Div(DivArgs request) { - var response = DivInternal(request); - responseObserver.OnNext(response); - responseObserver.OnCompleted(); + return Task.FromResult(DivInternal(request)); } - public void Fib(FibArgs request, IObserver responseObserver) + public async Task Fib(FibArgs request, IServerStreamWriter responseStream) { if (request.Limit <= 0) { - // TODO: support cancellation.... + // TODO(jtattermusch): support cancellation throw new NotImplementedException("Not implemented yet"); } @@ -64,34 +63,27 @@ namespace math { foreach (var num in FibInternal(request.Limit)) { - responseObserver.OnNext(num); + await responseStream.Write(num); } - responseObserver.OnCompleted(); } } - public IObserver Sum(IObserver responseObserver) + public async Task Sum(IAsyncStreamReader requestStream) { - var recorder = new RecordingObserver(); - Task.Factory.StartNew(() => + long sum = 0; + await requestStream.ForEach(async num => { - List inputs = recorder.ToList().Result; - - long sum = 0; - foreach (Num num in inputs) - { - sum += num.Num_; - } - - responseObserver.OnNext(Num.CreateBuilder().SetNum_(sum).Build()); - responseObserver.OnCompleted(); + sum += num.Num_; }); - return recorder; + return Num.CreateBuilder().SetNum_(sum).Build(); } - public IObserver DivMany(IObserver responseObserver) + public async Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) { - return new DivObserver(responseObserver); + await requestStream.ForEach(async divArgs => + { + await responseStream.Write(DivInternal(divArgs)); + }); } static DivReply DivInternal(DivArgs args) @@ -114,31 +106,6 @@ namespace math b = temp + b; yield return new Num.Builder { Num_ = a }.Build(); } - } - - private class DivObserver : IObserver - { - readonly IObserver responseObserver; - - public DivObserver(IObserver responseObserver) - { - this.responseObserver = responseObserver; - } - - public void OnCompleted() - { - responseObserver.OnCompleted(); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnNext(DivArgs value) - { - responseObserver.OnNext(DivInternal(value)); - } - } + } } } diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 1fbae374b1..573ab30452 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -34,6 +34,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using System.Threading.Tasks; using Google.ProtocolBuffers; using grpc.testing; @@ -199,113 +200,115 @@ namespace Grpc.IntegrationTesting public static void RunClientStreaming(TestServiceGrpc.ITestServiceClient client) { - Console.WriteLine("running client_streaming"); + Task.Run(async () => + { + Console.WriteLine("running client_streaming"); - var bodySizes = new List { 27182, 8, 1828, 45904 }; + var bodySizes = new List { 27182, 8, 1828, 45904 }.ConvertAll((size) => StreamingInputCallRequest.CreateBuilder().SetPayload(CreateZerosPayload(size)).Build()); - var context = client.StreamingInputCall(); - foreach (var size in bodySizes) - { - context.Inputs.OnNext( - StreamingInputCallRequest.CreateBuilder().SetPayload(CreateZerosPayload(size)).Build()); - } - context.Inputs.OnCompleted(); + var call = client.StreamingInputCall(); + await call.RequestStream.WriteAll(bodySizes); - var response = context.Task.Result; - Assert.AreEqual(74922, response.AggregatedPayloadSize); - Console.WriteLine("Passed!"); + var response = await call.Result; + Assert.AreEqual(74922, response.AggregatedPayloadSize); + Console.WriteLine("Passed!"); + }).Wait(); } public static void RunServerStreaming(TestServiceGrpc.ITestServiceClient client) { - Console.WriteLine("running server_streaming"); + Task.Run(async () => + { + Console.WriteLine("running server_streaming"); - var bodySizes = new List { 31415, 9, 2653, 58979 }; + var bodySizes = new List { 31415, 9, 2653, 58979 }; - var request = StreamingOutputCallRequest.CreateBuilder() + var request = StreamingOutputCallRequest.CreateBuilder() .SetResponseType(PayloadType.COMPRESSABLE) .AddRangeResponseParameters(bodySizes.ConvertAll( - (size) => ResponseParameters.CreateBuilder().SetSize(size).Build())) + (size) => ResponseParameters.CreateBuilder().SetSize(size).Build())) .Build(); - var recorder = new RecordingObserver(); - client.StreamingOutputCall(request, recorder); + var call = client.StreamingOutputCall(request); - var responseList = recorder.ToList().Result; - - foreach (var res in responseList) - { - Assert.AreEqual(PayloadType.COMPRESSABLE, res.Payload.Type); - } - CollectionAssert.AreEqual(bodySizes, responseList.ConvertAll((item) => item.Payload.Body.Length)); - Console.WriteLine("Passed!"); + var responseList = await call.ResponseStream.ToList(); + foreach (var res in responseList) + { + Assert.AreEqual(PayloadType.COMPRESSABLE, res.Payload.Type); + } + CollectionAssert.AreEqual(bodySizes, responseList.ConvertAll((item) => item.Payload.Body.Length)); + Console.WriteLine("Passed!"); + }).Wait(); } public static void RunPingPong(TestServiceGrpc.ITestServiceClient client) { - Console.WriteLine("running ping_pong"); + Task.Run(async () => + { + Console.WriteLine("running ping_pong"); - var recorder = new RecordingQueue(); - var inputs = client.FullDuplexCall(recorder); + var call = client.FullDuplexCall(); - StreamingOutputCallResponse response; + StreamingOutputCallResponse response; - inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + await call.RequestStream.Write(StreamingOutputCallRequest.CreateBuilder() .SetResponseType(PayloadType.COMPRESSABLE) .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415)) .SetPayload(CreateZerosPayload(27182)).Build()); - response = recorder.Queue.Take(); - Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); - Assert.AreEqual(31415, response.Payload.Body.Length); + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(31415, response.Payload.Body.Length); - inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + await call.RequestStream.Write(StreamingOutputCallRequest.CreateBuilder() .SetResponseType(PayloadType.COMPRESSABLE) .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(9)) .SetPayload(CreateZerosPayload(8)).Build()); - response = recorder.Queue.Take(); - Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); - Assert.AreEqual(9, response.Payload.Body.Length); + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(9, response.Payload.Body.Length); - inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + await call.RequestStream.Write(StreamingOutputCallRequest.CreateBuilder() .SetResponseType(PayloadType.COMPRESSABLE) .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(2653)) .SetPayload(CreateZerosPayload(1828)).Build()); - response = recorder.Queue.Take(); - Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); - Assert.AreEqual(2653, response.Payload.Body.Length); + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(2653, response.Payload.Body.Length); - inputs.OnNext(StreamingOutputCallRequest.CreateBuilder() + await call.RequestStream.Write(StreamingOutputCallRequest.CreateBuilder() .SetResponseType(PayloadType.COMPRESSABLE) .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(58979)) .SetPayload(CreateZerosPayload(45904)).Build()); - response = recorder.Queue.Take(); - Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); - Assert.AreEqual(58979, response.Payload.Body.Length); + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(58979, response.Payload.Body.Length); - inputs.OnCompleted(); + await call.RequestStream.Close(); - recorder.Finished.Wait(); - Assert.AreEqual(0, recorder.Queue.Count); + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(null, response); - Console.WriteLine("Passed!"); + Console.WriteLine("Passed!"); + }).Wait(); } public static void RunEmptyStream(TestServiceGrpc.ITestServiceClient client) { - Console.WriteLine("running empty_stream"); - - var recorder = new RecordingObserver(); - var inputs = client.FullDuplexCall(recorder); - inputs.OnCompleted(); + Task.Run(async () => + { + Console.WriteLine("running empty_stream"); + var call = client.FullDuplexCall(); + await call.Close(); - var responseList = recorder.ToList().Result; - Assert.AreEqual(0, responseList.Count); + var responseList = await call.ResponseStream.ToList(); + Assert.AreEqual(0, responseList.Count); - Console.WriteLine("Passed!"); + Console.WriteLine("Passed!"); + }).Wait(); } public static void RunServiceAccountCreds(TestServiceGrpc.ITestServiceClient client) diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index 1e76d3df21..e929b76b5e 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -87,7 +87,7 @@ namespace Grpc.IntegrationTesting [Test] public void LargeUnary() { - InteropClient.RunEmptyUnary(client); + InteropClient.RunLargeUnary(client); } [Test] diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs index f63e0361a4..d1f8aa12c7 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs @@ -100,13 +100,13 @@ namespace grpc.testing Task UnaryCallAsync(SimpleRequest request, CancellationToken token = default(CancellationToken)); - void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)); + AsyncServerStreamingCall StreamingOutputCall(StreamingOutputCallRequest request, CancellationToken token = default(CancellationToken)); - ClientStreamingAsyncResult StreamingInputCall(CancellationToken token = default(CancellationToken)); + AsyncClientStreamingCall StreamingInputCall(CancellationToken token = default(CancellationToken)); - IObserver FullDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)); + AsyncDuplexStreamingCall FullDuplexCall(CancellationToken token = default(CancellationToken)); - IObserver HalfDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)); + AsyncDuplexStreamingCall HalfDuplexCall(CancellationToken token = default(CancellationToken)); } public class TestServiceClientStub : AbstractStub, ITestServiceClient @@ -143,45 +143,45 @@ namespace grpc.testing return Calls.AsyncUnaryCall(call, request, token); } - public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncServerStreamingCall StreamingOutputCall(StreamingOutputCallRequest request, CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, StreamingOutputCallMethod); - Calls.AsyncServerStreamingCall(call, request, responseObserver, token); + return Calls.AsyncServerStreamingCall(call, request, token); } - public ClientStreamingAsyncResult StreamingInputCall(CancellationToken token = default(CancellationToken)) + public AsyncClientStreamingCall StreamingInputCall(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, StreamingInputCallMethod); return Calls.AsyncClientStreamingCall(call, token); } - public IObserver FullDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncDuplexStreamingCall FullDuplexCall(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, FullDuplexCallMethod); - return Calls.DuplexStreamingCall(call, responseObserver, token); + return Calls.AsyncDuplexStreamingCall(call, token); } - public IObserver HalfDuplexCall(IObserver responseObserver, CancellationToken token = default(CancellationToken)) + public AsyncDuplexStreamingCall HalfDuplexCall(CancellationToken token = default(CancellationToken)) { var call = CreateCall(ServiceName, HalfDuplexCallMethod); - return Calls.DuplexStreamingCall(call, responseObserver, token); + return Calls.AsyncDuplexStreamingCall(call, token); } } // server-side interface public interface ITestService { - void EmptyCall(Empty request, IObserver responseObserver); + Task EmptyCall(Empty request); - void UnaryCall(SimpleRequest request, IObserver responseObserver); + Task UnaryCall(SimpleRequest request); - void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver); + Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter responseStream); - IObserver StreamingInputCall(IObserver responseObserver); + Task StreamingInputCall(IAsyncStreamReader requestStream); - IObserver FullDuplexCall(IObserver responseObserver); + Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); - IObserver HalfDuplexCall(IObserver responseObserver); + Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); } public static ServerServiceDefinition BindService(ITestService serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs index 661b31b0ee..8b0cf3a2d0 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs @@ -36,6 +36,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Google.ProtocolBuffers; +using Grpc.Core; using Grpc.Core.Utils; namespace grpc.testing @@ -45,88 +46,54 @@ namespace grpc.testing /// public class TestServiceImpl : TestServiceGrpc.ITestService { - public void EmptyCall(Empty request, IObserver responseObserver) + public Task EmptyCall(Empty request) { - responseObserver.OnNext(Empty.DefaultInstance); - responseObserver.OnCompleted(); + return Task.FromResult(Empty.DefaultInstance); } - public void UnaryCall(SimpleRequest request, IObserver responseObserver) + public Task UnaryCall(SimpleRequest request) { var response = SimpleResponse.CreateBuilder() .SetPayload(CreateZerosPayload(request.ResponseSize)).Build(); - // TODO: check we support ReponseType - responseObserver.OnNext(response); - responseObserver.OnCompleted(); + return Task.FromResult(response); } - public void StreamingOutputCall(StreamingOutputCallRequest request, IObserver responseObserver) + public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter responseStream) { foreach (var responseParam in request.ResponseParametersList) { var response = StreamingOutputCallResponse.CreateBuilder() .SetPayload(CreateZerosPayload(responseParam.Size)).Build(); - responseObserver.OnNext(response); + await responseStream.Write(response); } - responseObserver.OnCompleted(); } - public IObserver StreamingInputCall(IObserver responseObserver) + public async Task StreamingInputCall(IAsyncStreamReader requestStream) { - var recorder = new RecordingObserver(); - Task.Run(() => + int sum = 0; + await requestStream.ForEach(async request => { - int sum = 0; - foreach (var req in recorder.ToList().Result) - { - sum += req.Payload.Body.Length; - } - var response = StreamingInputCallResponse.CreateBuilder() - .SetAggregatedPayloadSize(sum).Build(); - responseObserver.OnNext(response); - responseObserver.OnCompleted(); + sum += request.Payload.Body.Length; }); - return recorder; + return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build(); } - public IObserver FullDuplexCall(IObserver responseObserver) + public async Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) { - return new FullDuplexObserver(responseObserver); - } - - public IObserver HalfDuplexCall(IObserver responseObserver) - { - throw new NotImplementedException(); - } - - private class FullDuplexObserver : IObserver - { - readonly IObserver responseObserver; - - public FullDuplexObserver(IObserver responseObserver) - { - this.responseObserver = responseObserver; - } - - public void OnCompleted() + await requestStream.ForEach(async request => { - responseObserver.OnCompleted(); - } - - public void OnError(Exception error) - { - throw new NotImplementedException(); - } - - public void OnNext(StreamingOutputCallRequest value) - { - foreach (var responseParam in value.ResponseParametersList) + foreach (var responseParam in request.ResponseParametersList) { var response = StreamingOutputCallResponse.CreateBuilder() .SetPayload(CreateZerosPayload(responseParam.Size)).Build(); - responseObserver.OnNext(response); + await responseStream.Write(response); } - } + }); + } + + public async Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + { + throw new NotImplementedException(); } private static Payload CreateZerosPayload(int size) -- cgit v1.2.3 From e5c446004f2c1d3e2f2e5f0963f99332c6c94bc4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 1 May 2015 11:12:34 -0700 Subject: Added basic support for cancellation --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 219 +++++++++++++++------ src/csharp/Grpc.Core/Calls.cs | 17 +- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 6 + src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 83 ++++++-- .../Grpc.IntegrationTesting/InteropClient.cs | 65 ++++++ .../InteropClientServerTest.cs | 12 +- 6 files changed, 322 insertions(+), 80 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 9e510e82a6..c91efe53b4 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -47,23 +47,59 @@ namespace Grpc.Core.Tests const string Host = "localhost"; const string ServiceName = "/tests.Test"; - static readonly Method UnaryEchoStringMethod = new Method( + static readonly Method EchoMethod = new Method( MethodType.Unary, - "/tests.Test/UnaryEchoString", + "/tests.Test/Echo", + Marshallers.StringMarshaller, + Marshallers.StringMarshaller); + + static readonly Method ConcatAndEchoMethod = new Method( + MethodType.ClientStreaming, + "/tests.Test/ConcatAndEcho", + Marshallers.StringMarshaller, + Marshallers.StringMarshaller); + + static readonly Method NonexistentMethod = new Method( + MethodType.Unary, + "/tests.Test/NonexistentMethod", Marshallers.StringMarshaller, Marshallers.StringMarshaller); static readonly ServerServiceDefinition ServiceDefinition = ServerServiceDefinition.CreateBuilder(ServiceName) - .AddMethod(UnaryEchoStringMethod, HandleUnaryEchoString).Build(); + .AddMethod(EchoMethod, EchoHandler) + .AddMethod(ConcatAndEchoMethod, ConcatAndEchoHandler) + .Build(); + + Server server; + Channel channel; [TestFixtureSetUp] + public void InitClass() + { + GrpcEnvironment.Initialize(); + } + + [SetUp] public void Init() { GrpcEnvironment.Initialize(); + + server = new Server(); + server.AddServiceDefinition(ServiceDefinition); + int port = server.AddListeningPort(Host + ":0"); + server.Start(); + channel = new Channel(Host + ":" + port); } - [TestFixtureTearDown] + [TearDown] public void Cleanup() + { + channel.Dispose(); + server.ShutdownAsync().Wait(); + } + + [TestFixtureTearDown] + public void CleanupClass() { GrpcEnvironment.Shutdown(); } @@ -71,93 +107,160 @@ namespace Grpc.Core.Tests [Test] public void UnaryCall() { - var server = new Server(); - server.AddServiceDefinition(ServiceDefinition); - int port = server.AddListeningPort(Host + ":0"); - server.Start(); - - using (Channel channel = new Channel(Host + ":" + port)) - { - var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); - Assert.AreEqual("ABC", Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken))); - } - - server.ShutdownAsync().Wait(); + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); + Assert.AreEqual("ABC", Calls.BlockingUnaryCall(call, "ABC", CancellationToken.None)); } [Test] - public void CallOnDisposedChannel() + public void UnaryCall_ServerHandlerThrows() { - var server = new Server(); - server.AddServiceDefinition(ServiceDefinition); - int port = server.AddListeningPort(Host + ":0"); - server.Start(); - - Channel channel = new Channel(Host + ":" + port); - channel.Dispose(); - - var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); try { - Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); - Assert.Fail(); + Calls.BlockingUnaryCall(call, "THROW", CancellationToken.None); + Assert.Fail(); } - catch (ObjectDisposedException e) + catch (RpcException e) { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); } + } - server.ShutdownAsync().Wait(); + [Test] + public void AsyncUnaryCall() + { + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); + var result = Calls.AsyncUnaryCall(call, "ABC", CancellationToken.None).Result; + Assert.AreEqual("ABC", result); } [Test] - public void UnaryCallPerformance() + public void AsyncUnaryCall_ServerHandlerThrows() { - var server = new Server(); - server.AddServiceDefinition(ServiceDefinition); - int port = server.AddListeningPort(Host + ":0"); - server.Start(); + Task.Run(async () => + { + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); + try + { + await Calls.AsyncUnaryCall(call, "THROW", CancellationToken.None); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + } + }).Wait(); + } - using (Channel channel = new Channel(Host + ":" + port)) + [Test] + public void ClientStreamingCall() + { + Task.Run(async () => { - var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); - BenchmarkUtil.RunBenchmark(100, 100, - () => { Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); }); - } + var call = new Call(ServiceName, ConcatAndEchoMethod, channel, Metadata.Empty); + var callResult = Calls.AsyncClientStreamingCall(call, CancellationToken.None); - server.ShutdownAsync().Wait(); + await callResult.RequestStream.WriteAll(new string[] { "A", "B", "C" }); + Assert.AreEqual("ABC", await callResult.Result); + }).Wait(); } [Test] - public void UnknownMethodHandler() + public void ClientStreamingCall_ServerHandlerThrows() { - var server = new Server(); - server.AddServiceDefinition(ServerServiceDefinition.CreateBuilder(ServiceName).Build()); - int port = server.AddListeningPort(Host + ":0"); - server.Start(); + Task.Run(async () => + { + var call = new Call(ServiceName, ConcatAndEchoMethod, channel, Metadata.Empty); + var callResult = Calls.AsyncClientStreamingCall(call, CancellationToken.None); + // TODO(jtattermusch): if we send "A", "THROW", "C", server hangs. + await callResult.RequestStream.WriteAll(new string[] { "A", "B", "THROW" }); + + try + { + await callResult.Result; + } + catch(RpcException e) + { + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + } + }).Wait(); + } - using (Channel channel = new Channel(Host + ":" + port)) + [Test] + public void ClientStreamingCall_CancelAfterBegin() + { + Task.Run(async () => { - var call = new Call(ServiceName, UnaryEchoStringMethod, channel, Metadata.Empty); + var call = new Call(ServiceName, ConcatAndEchoMethod, channel, Metadata.Empty); + + var cts = new CancellationTokenSource(); + var callResult = Calls.AsyncClientStreamingCall(call, cts.Token); + cts.Cancel(); + try { - Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); - Assert.Fail(); + await callResult.Result; } - catch (RpcException e) + catch(RpcException e) { - Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode); + Assert.AreEqual(StatusCode.Cancelled, e.Status.StatusCode); } + }).Wait(); + } + + [Test] + public void UnaryCall_DisposedChannel() + { + channel.Dispose(); + + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); + Assert.Throws(typeof(ObjectDisposedException), () => Calls.BlockingUnaryCall(call, "ABC", CancellationToken.None)); + } + + [Test] + public void UnaryCallPerformance() + { + var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); + BenchmarkUtil.RunBenchmark(100, 100, + () => { Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); }); + } + + [Test] + public void UnknownMethodHandler() + { + var call = new Call(ServiceName, NonexistentMethod, channel, Metadata.Empty); + try + { + Calls.BlockingUnaryCall(call, "ABC", default(CancellationToken)); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Unimplemented, e.Status.StatusCode); } + } - server.ShutdownAsync().Wait(); + private static async Task EchoHandler(string request) + { + if (request == "THROW") + { + throw new Exception("This was thrown on purpose by a test"); + } + return request; } - /// - /// Handler for unaryEchoString method. - /// - private static Task HandleUnaryEchoString(string request) + private static async Task ConcatAndEchoHandler(IAsyncStreamReader requestStream) { - return Task.FromResult(request); + string result = ""; + await requestStream.ForEach(async (request) => + { + if (request == "THROW") + { + throw new Exception("This was thrown on purpose by a test"); + } + result += request; + }); + return result; } } } diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs index 9365ccd9fb..c2397290fd 100644 --- a/src/csharp/Grpc.Core/Calls.cs +++ b/src/csharp/Grpc.Core/Calls.cs @@ -46,6 +46,8 @@ namespace Grpc.Core public static TResponse BlockingUnaryCall(Call call, TRequest req, CancellationToken token) { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); + // TODO(jtattermusch): this gives a race that cancellation can be requested before the call even starts. + RegisterCancellationCallback(asyncCall, token); return asyncCall.UnaryCall(call.Channel, call.Name, req, call.Headers); } @@ -53,7 +55,9 @@ namespace Grpc.Core { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); - return await asyncCall.UnaryCallAsync(req, call.Headers); + var asyncResult = asyncCall.UnaryCallAsync(req, call.Headers); + RegisterCancellationCallback(asyncCall, token); + return await asyncResult; } public static AsyncServerStreamingCall AsyncServerStreamingCall(Call call, TRequest req, CancellationToken token) @@ -61,6 +65,7 @@ namespace Grpc.Core var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.StartServerStreamingCall(req, call.Headers); + RegisterCancellationCallback(asyncCall, token); var responseStream = new ClientResponseStream(asyncCall); return new AsyncServerStreamingCall(responseStream); } @@ -70,6 +75,7 @@ namespace Grpc.Core var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); var resultTask = asyncCall.ClientStreamingCallAsync(call.Headers); + RegisterCancellationCallback(asyncCall, token); var requestStream = new ClientRequestStream(asyncCall); return new AsyncClientStreamingCall(requestStream, resultTask); } @@ -79,11 +85,20 @@ namespace Grpc.Core var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); asyncCall.StartDuplexStreamingCall(call.Headers); + RegisterCancellationCallback(asyncCall, token); var requestStream = new ClientRequestStream(asyncCall); var responseStream = new ClientResponseStream(asyncCall); return new AsyncDuplexStreamingCall(requestStream, responseStream); } + private static void RegisterCancellationCallback(AsyncCall asyncCall, CancellationToken token) + { + if (token.CanBeCanceled) + { + token.Register( () => asyncCall.Cancel() ); + } + } + /// /// Gets shared completion queue used for async calls. /// diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 25dc15bbc0..449009336f 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -121,6 +121,12 @@ namespace Grpc.Core.Internal { finished = true; + if (readCompletionDelegate == null) + { + // allow disposal of native call + readingDone = true; + } + ReleaseResourcesIfPossible(); } // TODO: handle error ... diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 2ae924b4a8..0416eada34 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -66,13 +66,21 @@ namespace Grpc.Core.Internal var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); - var request = await requestStream.ReadNext(); - // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. - Preconditions.CheckArgument(await requestStream.ReadNext() == null); - - var result = await handler(request); - await responseStream.Write(result); - await responseStream.WriteStatus(Status.DefaultSuccess); + Status status = Status.DefaultSuccess; + try + { + var request = await requestStream.ReadNext(); + // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. + Preconditions.CheckArgument(await requestStream.ReadNext() == null); + var result = await handler(request); + await responseStream.Write(result); + } + catch (Exception e) + { + Console.WriteLine("Exception occured in handler: " + e); + status = HandlerUtils.StatusFromException(e); + } + await responseStream.WriteStatus(status); await finishedTask; } } @@ -99,12 +107,21 @@ namespace Grpc.Core.Internal var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); - var request = await requestStream.ReadNext(); - // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. - Preconditions.CheckArgument(await requestStream.ReadNext() == null); - - await handler(request, responseStream); - await responseStream.WriteStatus(Status.DefaultSuccess); + Status status = Status.DefaultSuccess; + try + { + var request = await requestStream.ReadNext(); + // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. + Preconditions.CheckArgument(await requestStream.ReadNext() == null); + + await handler(request, responseStream); + } + catch (Exception e) + { + Console.WriteLine("Exception occured in handler: " + e); + status = HandlerUtils.StatusFromException(e); + } + await responseStream.WriteStatus(status); await finishedTask; } } @@ -131,9 +148,18 @@ namespace Grpc.Core.Internal var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); - var result = await handler(requestStream); - await responseStream.Write(result); - await responseStream.WriteStatus(Status.DefaultSuccess); + Status status = Status.DefaultSuccess; + try + { + var result = await handler(requestStream); + await responseStream.Write(result); + } + catch (Exception e) + { + Console.WriteLine("Exception occured in handler: " + e); + status = HandlerUtils.StatusFromException(e); + } + await responseStream.WriteStatus(status); await finishedTask; } } @@ -160,8 +186,17 @@ namespace Grpc.Core.Internal var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); - await handler(requestStream, responseStream); - await responseStream.WriteStatus(Status.DefaultSuccess); + Status status = Status.DefaultSuccess; + try + { + await handler(requestStream, responseStream); + } + catch (Exception e) + { + Console.WriteLine("Exception occured in handler: " + e); + status = HandlerUtils.StatusFromException(e); + } + await responseStream.WriteStatus(status); await finishedTask; } } @@ -173,15 +208,25 @@ namespace Grpc.Core.Internal // We don't care about the payload type here. var asyncCall = new AsyncCallServer( (payload) => payload, (payload) => payload); - + asyncCall.Initialize(call); var finishedTask = asyncCall.ServerSideCallAsync(); var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); + await responseStream.WriteStatus(new Status(StatusCode.Unimplemented, "No such method.")); // TODO(jtattermusch): if we don't read what client has sent, the server call never gets disposed. await requestStream.ToList(); await finishedTask; } } + + internal static class HandlerUtils + { + public static Status StatusFromException(Exception e) + { + // TODO(jtattermusch): what is the right status code here? + return new Status(StatusCode.Unknown, "Exception was thrown by handler."); + } + } } diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 573ab30452..440702d06f 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -34,6 +34,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using System.Threading; using System.Threading.Tasks; using Google.ProtocolBuffers; @@ -166,6 +167,12 @@ namespace Grpc.IntegrationTesting case "compute_engine_creds": RunComputeEngineCreds(client); break; + case "cancel_after_begin": + RunCancelAfterBegin(client); + break; + case "cancel_after_first_response": + RunCancelAfterFirstResponse(client); + break; case "benchmark_empty_unary": RunBenchmarkEmptyUnary(client); break; @@ -351,6 +358,64 @@ namespace Grpc.IntegrationTesting Console.WriteLine("Passed!"); } + public static void RunCancelAfterBegin(TestServiceGrpc.ITestServiceClient client) + { + Task.Run(async () => + { + Console.WriteLine("running cancel_after_begin"); + + var cts = new CancellationTokenSource(); + var call = client.StreamingInputCall(cts.Token); + cts.Cancel(); + + try + { + var response = await call.Result; + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Cancelled, e.Status.StatusCode); + } + Console.WriteLine("Passed!"); + }).Wait(); + } + + public static void RunCancelAfterFirstResponse(TestServiceGrpc.ITestServiceClient client) + { + Task.Run(async () => + { + Console.WriteLine("running cancel_after_first_response"); + + var cts = new CancellationTokenSource(); + var call = client.FullDuplexCall(cts.Token); + + StreamingOutputCallResponse response; + + await call.RequestStream.Write(StreamingOutputCallRequest.CreateBuilder() + .SetResponseType(PayloadType.COMPRESSABLE) + .AddResponseParameters(ResponseParameters.CreateBuilder().SetSize(31415)) + .SetPayload(CreateZerosPayload(27182)).Build()); + + response = await call.ResponseStream.ReadNext(); + Assert.AreEqual(PayloadType.COMPRESSABLE, response.Payload.Type); + Assert.AreEqual(31415, response.Payload.Body.Length); + + cts.Cancel(); + + try + { + response = await call.ResponseStream.ReadNext(); + Assert.Fail(); + } + catch (RpcException e) + { + Assert.AreEqual(StatusCode.Cancelled, e.Status.StatusCode); + } + Console.WriteLine("Passed!"); + }).Wait(); + } + // This is not an official interop test, but it's useful. public static void RunBenchmarkEmptyUnary(TestServiceGrpc.ITestServiceClient client) { diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index e929b76b5e..45380227c2 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -114,8 +114,16 @@ namespace Grpc.IntegrationTesting InteropClient.RunEmptyStream(client); } - // TODO: add cancel_after_begin + [Test] + public void CancelAfterBegin() + { + InteropClient.RunCancelAfterBegin(client); + } - // TODO: add cancel_after_first_response + [Test] + public void CancelAfterFirstResponse() + { + InteropClient.RunCancelAfterFirstResponse(client); + } } } -- cgit v1.2.3 From 618647dc7402c65631573d67b1500114ffb74197 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 1 May 2015 11:23:28 -0700 Subject: fixed some stylecop warnings --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 4 ++-- src/csharp/Grpc.Core/Calls.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index c91efe53b4..8c4b92fbad 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -179,7 +179,7 @@ namespace Grpc.Core.Tests { await callResult.Result; } - catch(RpcException e) + catch (RpcException e) { Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); } @@ -201,7 +201,7 @@ namespace Grpc.Core.Tests { await callResult.Result; } - catch(RpcException e) + catch (RpcException e) { Assert.AreEqual(StatusCode.Cancelled, e.Status.StatusCode); } diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs index c2397290fd..a8d2b9498e 100644 --- a/src/csharp/Grpc.Core/Calls.cs +++ b/src/csharp/Grpc.Core/Calls.cs @@ -95,7 +95,7 @@ namespace Grpc.Core { if (token.CanBeCanceled) { - token.Register( () => asyncCall.Cancel() ); + token.Register(() => asyncCall.Cancel()); } } -- cgit v1.2.3 From 1b54fcf31b32ae8c7f07ae733e781c184791a7c2 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 1 May 2015 14:30:16 -0700 Subject: added stats with number of active native calls, useful for debugging --- src/csharp/Grpc.Core/Grpc.Core.csproj | 4 +- src/csharp/Grpc.Core/GrpcEnvironment.cs | 16 +++++++ src/csharp/Grpc.Core/Internal/AsyncCall.cs | 6 +++ src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 5 ++ src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 6 +++ src/csharp/Grpc.Core/Internal/AtomicCounter.cs | 61 ++++++++++++++++++++++++ src/csharp/Grpc.Core/Internal/DebugStats.cs | 45 +++++++++++++++++ 7 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 src/csharp/Grpc.Core/Internal/AtomicCounter.cs create mode 100644 src/csharp/Grpc.Core/Internal/DebugStats.cs diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index fee742b220..9c91541d90 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -5,7 +5,7 @@ Debug AnyCPU - 10.0.0 + 8.0.30703 2.0 {CCC4440E-49F7-4790-B0AF-FEABB0837AE7} Library @@ -94,6 +94,8 @@ + + diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs index 9c10a42e23..2e9e5a2ef6 100644 --- a/src/csharp/Grpc.Core/GrpcEnvironment.cs +++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs @@ -86,6 +86,8 @@ namespace Grpc.Core { instance.Close(); instance = null; + + CheckDebugStats(); } } } @@ -132,5 +134,19 @@ namespace Grpc.Core // TODO: use proper logging here Console.WriteLine("GRPC shutdown."); } + + private static void CheckDebugStats() + { + var remainingClientCalls = DebugStats.ActiveClientCalls.Count; + if (remainingClientCalls != 0) + { + Console.WriteLine("Warning: Detected {0} client calls that weren't disposed properly.", remainingClientCalls); + } + var remainingServerCalls = DebugStats.ActiveServerCalls.Count; + if (remainingServerCalls != 0) + { + Console.WriteLine("Warning: Detected {0} server calls that weren't disposed properly.", remainingServerCalls); + } + } } } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index fd94771ddd..3532f7347a 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -67,6 +67,7 @@ namespace Grpc.Core.Internal public void Initialize(Channel channel, CompletionQueueSafeHandle cq, string methodName) { var call = CallSafeHandle.Create(channel.Handle, cq, methodName, channel.Target, Timespec.InfFuture); + DebugStats.ActiveClientCalls.Increment(); InitializeInternal(call); } @@ -265,6 +266,11 @@ namespace Grpc.Core.Internal } } + protected override void OnReleaseResources() + { + DebugStats.ActiveClientCalls.Decrement(); + } + /// /// Handler for unary response completion. /// diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 2bde4b3720..b911cdcc87 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -191,6 +191,7 @@ namespace Grpc.Core.Internal private void ReleaseResources() { + OnReleaseResources(); if (call != null) { call.Dispose(); @@ -199,6 +200,10 @@ namespace Grpc.Core.Internal disposed = true; } + protected virtual void OnReleaseResources() + { + } + protected void CheckSendingAllowed() { Preconditions.CheckState(started); diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 449009336f..4775f2d07b 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -57,6 +57,7 @@ namespace Grpc.Core.Internal public void Initialize(CallSafeHandle call) { + DebugStats.ActiveServerCalls.Increment(); InitializeInternal(call); } @@ -112,6 +113,11 @@ namespace Grpc.Core.Internal } } + protected override void OnReleaseResources() + { + DebugStats.ActiveServerCalls.Decrement(); + } + /// /// Handles the server side close completion. /// diff --git a/src/csharp/Grpc.Core/Internal/AtomicCounter.cs b/src/csharp/Grpc.Core/Internal/AtomicCounter.cs new file mode 100644 index 0000000000..7ccda225dc --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/AtomicCounter.cs @@ -0,0 +1,61 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Threading; + +namespace Grpc.Core.Internal +{ + internal class AtomicCounter + { + long counter = 0; + + public void Increment() + { + Interlocked.Increment(ref counter); + } + + public void Decrement() + { + Interlocked.Decrement(ref counter); + } + + public long Count + { + get + { + return counter; + } + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/DebugStats.cs b/src/csharp/Grpc.Core/Internal/DebugStats.cs new file mode 100644 index 0000000000..476914f751 --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/DebugStats.cs @@ -0,0 +1,45 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Threading; + +namespace Grpc.Core.Internal +{ + internal static class DebugStats + { + public static readonly AtomicCounter ActiveClientCalls = new AtomicCounter(); + + public static readonly AtomicCounter ActiveServerCalls = new AtomicCounter(); + } +} -- cgit v1.2.3 From 8c2dd9d864cb874f8fbe577faf8c3f72e6a077e4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 4 May 2015 09:20:43 -0700 Subject: Fixes for C# cancellation support --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 28 +++--------- src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 17 ++++++-- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 11 +++-- .../Internal/BatchContextSafeHandleNotOwned.cs | 8 ++++ src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 51 +++++++++++++++++++--- src/csharp/Grpc.Core/Status.cs | 5 +++ .../Grpc.IntegrationTesting/InteropClient.cs | 2 + src/csharp/ext/grpc_csharp_ext.c | 6 +++ 8 files changed, 93 insertions(+), 35 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 8c4b92fbad..26a1a683ba 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -165,27 +165,6 @@ namespace Grpc.Core.Tests }).Wait(); } - [Test] - public void ClientStreamingCall_ServerHandlerThrows() - { - Task.Run(async () => - { - var call = new Call(ServiceName, ConcatAndEchoMethod, channel, Metadata.Empty); - var callResult = Calls.AsyncClientStreamingCall(call, CancellationToken.None); - // TODO(jtattermusch): if we send "A", "THROW", "C", server hangs. - await callResult.RequestStream.WriteAll(new string[] { "A", "B", "THROW" }); - - try - { - await callResult.Result; - } - catch (RpcException e) - { - Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); - } - }).Wait(); - } - [Test] public void ClientStreamingCall_CancelAfterBegin() { @@ -195,6 +174,9 @@ namespace Grpc.Core.Tests var cts = new CancellationTokenSource(); var callResult = Calls.AsyncClientStreamingCall(call, cts.Token); + + // TODO(jtattermusch): we need this to ensure call has been initiated once we cancel it. + await Task.Delay(1000); cts.Cancel(); try @@ -260,7 +242,9 @@ namespace Grpc.Core.Tests } result += request; }); - return result; + // simulate processing takes some time. + await Task.Delay(250); + return result; } } } diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index b911cdcc87..7cf0f6ff84 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -180,7 +180,8 @@ namespace Grpc.Core.Internal { if (!disposed && call != null) { - if (halfclosed && readingDone && finished) + bool noMoreSendCompletions = halfclosed || (cancelRequested && sendCompletionDelegate == null); + if (noMoreSendCompletions && readingDone && finished) { ReleaseResources(); return true; @@ -207,8 +208,9 @@ namespace Grpc.Core.Internal protected void CheckSendingAllowed() { Preconditions.CheckState(started); - Preconditions.CheckState(!disposed); Preconditions.CheckState(!errorOccured); + CheckNotCancelled(); + Preconditions.CheckState(!disposed); Preconditions.CheckState(!halfcloseRequested, "Already halfclosed."); Preconditions.CheckState(sendCompletionDelegate == null, "Only one write can be pending at a time"); @@ -221,7 +223,14 @@ namespace Grpc.Core.Internal Preconditions.CheckState(!errorOccured); Preconditions.CheckState(!readingDone, "Stream has already been closed."); - Preconditions.CheckState(readCompletionDelegate == null, "Only one write can be pending at a time"); + Preconditions.CheckState(readCompletionDelegate == null, "Only one read can be pending at a time"); + } + + protected void CheckNotCancelled() { + if (cancelRequested) + { + throw new OperationCanceledException("Remote call has been cancelled."); + } } protected byte[] UnsafeSerialize(TWrite msg) @@ -292,6 +301,8 @@ namespace Grpc.Core.Internal }); } + + /// /// Handles send completion. /// diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 4775f2d07b..3c66c67dcc 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -123,18 +123,23 @@ namespace Grpc.Core.Internal /// private void HandleFinishedServerside(bool wasError, BatchContextSafeHandleNotOwned ctx) { + bool cancelled = ctx.GetReceivedCloseOnServerCancelled(); + lock (myLock) { finished = true; - if (readCompletionDelegate == null) + if (cancelled) { - // allow disposal of native call - readingDone = true; + // Once we cancel, we don't have to care that much + // about reads and writes. + Cancel(); } ReleaseResourcesIfPossible(); } + // TODO(jtattermusch): check if call was cancelled. + // TODO: handle error ... finishedServersideTcs.SetResult(null); diff --git a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandleNotOwned.cs b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandleNotOwned.cs index 3c54753756..b562abaa7a 100644 --- a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandleNotOwned.cs +++ b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandleNotOwned.cs @@ -61,6 +61,9 @@ namespace Grpc.Core.Internal [DllImport("grpc_csharp_ext.dll")] static extern IntPtr grpcsharp_batch_context_server_rpc_new_method(BatchContextSafeHandleNotOwned ctx); // returns const char* + [DllImport("grpc_csharp_ext.dll")] + static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandleNotOwned ctx); + public BatchContextSafeHandleNotOwned(IntPtr handle) : base(false) { SetHandle(handle); @@ -94,5 +97,10 @@ namespace Grpc.Core.Internal { return Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this)); } + + public bool GetReceivedCloseOnServerCancelled() + { + return grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0; + } } } \ No newline at end of file diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 0416eada34..01b2a11369 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -80,7 +80,14 @@ namespace Grpc.Core.Internal Console.WriteLine("Exception occured in handler: " + e); status = HandlerUtils.StatusFromException(e); } - await responseStream.WriteStatus(status); + try + { + await responseStream.WriteStatus(status); + } + catch (OperationCanceledException) + { + // Call has been already cancelled. + } await finishedTask; } } @@ -121,7 +128,15 @@ namespace Grpc.Core.Internal Console.WriteLine("Exception occured in handler: " + e); status = HandlerUtils.StatusFromException(e); } - await responseStream.WriteStatus(status); + + try + { + await responseStream.WriteStatus(status); + } + catch (OperationCanceledException) + { + // Call has been already cancelled. + } await finishedTask; } } @@ -151,15 +166,30 @@ namespace Grpc.Core.Internal Status status = Status.DefaultSuccess; try { - var result = await handler(requestStream); - await responseStream.Write(result); - } + var result = await handler(requestStream); + try + { + await responseStream.Write(result); + } + catch (OperationCanceledException) + { + status = Status.DefaultCancelled; + } + } catch (Exception e) { Console.WriteLine("Exception occured in handler: " + e); status = HandlerUtils.StatusFromException(e); } - await responseStream.WriteStatus(status); + + try + { + await responseStream.WriteStatus(status); + } + catch (OperationCanceledException) + { + // Call has been already cancelled. + } await finishedTask; } } @@ -196,7 +226,14 @@ namespace Grpc.Core.Internal Console.WriteLine("Exception occured in handler: " + e); status = HandlerUtils.StatusFromException(e); } - await responseStream.WriteStatus(status); + try + { + await responseStream.WriteStatus(status); + } + catch (OperationCanceledException) + { + // Call has been already cancelled. + } await finishedTask; } } diff --git a/src/csharp/Grpc.Core/Status.cs b/src/csharp/Grpc.Core/Status.cs index b588170694..754f6cb3ca 100644 --- a/src/csharp/Grpc.Core/Status.cs +++ b/src/csharp/Grpc.Core/Status.cs @@ -44,6 +44,11 @@ namespace Grpc.Core /// public static readonly Status DefaultSuccess = new Status(StatusCode.OK, ""); + /// + /// Default result of a cancelled RPC. StatusCode=Cancelled, empty details message. + /// + public static readonly Status DefaultCancelled = new Status(StatusCode.Cancelled, ""); + readonly StatusCode statusCode; readonly string detail; diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs index 440702d06f..a433659a08 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs @@ -366,6 +366,8 @@ namespace Grpc.IntegrationTesting var cts = new CancellationTokenSource(); var call = client.StreamingInputCall(cts.Token); + // TODO(jtattermusch): we need this to ensure call has been initiated once we cancel it. + await Task.Delay(1000); cts.Cancel(); try diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index fb8b75798d..a8cc1b29a4 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -277,6 +277,12 @@ grpcsharp_batch_context_server_rpc_new_method( return ctx->server_rpc_new.call_details.method; } +GPR_EXPORT gpr_int32 GPR_CALLTYPE +grpcsharp_batch_context_recv_close_on_server_cancelled( + const grpcsharp_batch_context *ctx) { + return (gpr_int32) ctx->recv_close_on_server_cancelled; +} + /* Init & shutdown */ GPR_EXPORT void GPR_CALLTYPE grpcsharp_init(void) { grpc_init(); } -- cgit v1.2.3 From 32d95b9744567c9ead050d154181fadbcd0c8ea7 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 4 May 2015 17:56:32 -0700 Subject: remove duplicate initialize --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 26a1a683ba..caa6220f2c 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -82,8 +82,6 @@ namespace Grpc.Core.Tests [SetUp] public void Init() { - GrpcEnvironment.Initialize(); - server = new Server(); server.AddServiceDefinition(ServiceDefinition); int port = server.AddListeningPort(Host + ":0"); @@ -137,7 +135,7 @@ namespace Grpc.Core.Tests [Test] public void AsyncUnaryCall_ServerHandlerThrows() { - Task.Run(async () => + Task.Run(async () => { var call = new Call(ServiceName, EchoMethod, channel, Metadata.Empty); try @@ -147,7 +145,7 @@ namespace Grpc.Core.Tests } catch (RpcException e) { - Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); + Assert.AreEqual(StatusCode.Unknown, e.Status.StatusCode); } }).Wait(); } -- cgit v1.2.3 From a8447711be717a53fc52a3a14dd33fdb85fc80f2 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 4 May 2015 17:56:52 -0700 Subject: stylecop fixes --- src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 7cf0f6ff84..fc5bee40e2 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -226,7 +226,8 @@ namespace Grpc.Core.Internal Preconditions.CheckState(readCompletionDelegate == null, "Only one read can be pending at a time"); } - protected void CheckNotCancelled() { + protected void CheckNotCancelled() + { if (cancelRequested) { throw new OperationCanceledException("Remote call has been cancelled."); @@ -301,8 +302,6 @@ namespace Grpc.Core.Internal }); } - - /// /// Handles send completion. /// -- cgit v1.2.3 From 93ec3712e6eb15168e0f679b198cbb1d5dacaa97 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 5 May 2015 09:41:03 -0700 Subject: Enable test that got forgotten --- Makefile | 218 ++++++++++++++++++++- test/core/end2end/gen_build_json.py | 3 +- ...t_response_with_trailing_metadata_and_payload.c | 7 +- tools/run_tests/tests.json | 99 ++++++++++ vsprojects/Grpc.mak | 34 +++- 5 files changed, 353 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 244a211652..e48b38ad1f 100644 --- a/Makefile +++ b/Makefile @@ -709,6 +709,7 @@ chttp2_fake_security_registered_call_test: $(BINDIR)/$(CONFIG)/chttp2_fake_secur chttp2_fake_security_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test chttp2_fake_security_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test chttp2_fake_security_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test +chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test chttp2_fake_security_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test chttp2_fake_security_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test chttp2_fake_security_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test @@ -735,6 +736,7 @@ chttp2_fullstack_registered_call_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_regi chttp2_fullstack_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test chttp2_fullstack_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test chttp2_fullstack_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test +chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test chttp2_fullstack_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test chttp2_fullstack_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test chttp2_fullstack_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test @@ -761,6 +763,7 @@ chttp2_fullstack_uds_registered_call_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_ chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test chttp2_fullstack_uds_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test chttp2_fullstack_uds_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test +chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test chttp2_fullstack_uds_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test chttp2_fullstack_uds_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test chttp2_fullstack_uds_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test @@ -787,6 +790,7 @@ chttp2_simple_ssl_fullstack_registered_call_test: $(BINDIR)/$(CONFIG)/chttp2_sim chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test chttp2_simple_ssl_fullstack_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test +chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test chttp2_simple_ssl_fullstack_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test chttp2_simple_ssl_fullstack_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test chttp2_simple_ssl_fullstack_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test @@ -813,6 +817,7 @@ chttp2_simple_ssl_with_oauth2_fullstack_registered_call_test: $(BINDIR)/$(CONFIG chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test +chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test @@ -839,6 +844,7 @@ chttp2_socket_pair_registered_call_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test chttp2_socket_pair_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test chttp2_socket_pair_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test +chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test chttp2_socket_pair_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test chttp2_socket_pair_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test chttp2_socket_pair_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test @@ -865,6 +871,7 @@ chttp2_socket_pair_one_byte_at_a_time_registered_call_test: $(BINDIR)/$(CONFIG)/ chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test +chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test @@ -891,6 +898,7 @@ chttp2_fullstack_registered_call_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fulls chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test chttp2_fullstack_request_response_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test +chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test chttp2_fullstack_request_with_large_metadata_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test chttp2_fullstack_request_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_unsecure_test chttp2_fullstack_simple_delayed_request_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_unsecure_test @@ -917,6 +925,7 @@ chttp2_fullstack_uds_registered_call_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_f chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test chttp2_fullstack_uds_request_response_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_test +chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test chttp2_fullstack_uds_request_with_large_metadata_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test chttp2_fullstack_uds_request_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_unsecure_test chttp2_fullstack_uds_simple_delayed_request_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_unsecure_test @@ -943,6 +952,7 @@ chttp2_socket_pair_registered_call_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_soc chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test chttp2_socket_pair_request_response_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test +chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test chttp2_socket_pair_request_with_large_metadata_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test chttp2_socket_pair_request_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_unsecure_test chttp2_socket_pair_simple_delayed_request_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_unsecure_test @@ -969,6 +979,7 @@ chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test: $(BINDIR)/$ chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test +chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test: $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test @@ -1060,13 +1071,13 @@ plugins: $(PROTOC_PLUGINS) privatelibs: privatelibs_c privatelibs_cxx -privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_bad_hostname.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_message_length.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_registered_call.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_with_high_initial_sequence_number.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a +privatelibs_c: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_bad_hostname.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_accept_and_writes_closed.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_after_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_before_invoke.a $(LIBDIR)/$(CONFIG)/libend2end_test_cancel_in_a_vacuum.a $(LIBDIR)/$(CONFIG)/libend2end_test_census_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_disappearing_server.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_inflight_calls.a $(LIBDIR)/$(CONFIG)/libend2end_test_early_server_shutdown_finishes_tags.a $(LIBDIR)/$(CONFIG)/libend2end_test_empty_batch.a $(LIBDIR)/$(CONFIG)/libend2end_test_graceful_server_shutdown.a $(LIBDIR)/$(CONFIG)/libend2end_test_invoke_large_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_concurrent_streams.a $(LIBDIR)/$(CONFIG)/libend2end_test_max_message_length.a $(LIBDIR)/$(CONFIG)/libend2end_test_no_op.a $(LIBDIR)/$(CONFIG)/libend2end_test_ping_pong_streaming.a $(LIBDIR)/$(CONFIG)/libend2end_test_registered_call.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_binary_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_payload.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_delayed_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request.a $(LIBDIR)/$(CONFIG)/libend2end_test_simple_request_with_high_initial_sequence_number.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a privatelibs_cxx: $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libinterop_client_helper.a $(LIBDIR)/$(CONFIG)/libinterop_client_main.a $(LIBDIR)/$(CONFIG)/libinterop_server_helper.a $(LIBDIR)/$(CONFIG)/libinterop_server_main.a $(LIBDIR)/$(CONFIG)/libqps.a buildtests: buildtests_c buildtests_cxx -buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_tls_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/timers_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test +buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_tls_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/timers_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_smoke_test $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test @@ -1247,6 +1258,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test || ( echo test chttp2_fake_security_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fake_security_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test || ( echo test chttp2_fake_security_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fake_security_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test || ( echo test chttp2_fake_security_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fake_security_request_with_payload_test" @@ -1299,6 +1312,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test || ( echo test chttp2_fullstack_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test || ( echo test chttp2_fullstack_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test || ( echo test chttp2_fullstack_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_with_payload_test" @@ -1351,6 +1366,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test || ( echo test chttp2_fullstack_uds_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test || ( echo test chttp2_fullstack_uds_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test || ( echo test chttp2_fullstack_uds_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_with_payload_test" @@ -1403,6 +1420,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test || ( echo test chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_fullstack_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test || ( echo test chttp2_simple_ssl_fullstack_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_fullstack_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test || ( echo test chttp2_simple_ssl_fullstack_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_fullstack_request_with_payload_test" @@ -1455,6 +1474,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test || ( echo test chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test || ( echo test chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test || ( echo test chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test" @@ -1507,6 +1528,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test || ( echo test chttp2_socket_pair_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test || ( echo test chttp2_socket_pair_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test || ( echo test chttp2_socket_pair_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_with_payload_test" @@ -1559,6 +1582,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test" @@ -1611,6 +1636,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test || ( echo test chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_response_with_payload_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test || ( echo test chttp2_fullstack_request_response_with_payload_unsecure_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test || ( echo test chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_with_large_metadata_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test || ( echo test chttp2_fullstack_request_with_large_metadata_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_request_with_payload_unsecure_test" @@ -1663,6 +1690,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test || ( echo test chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_response_with_payload_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_test || ( echo test chttp2_fullstack_uds_request_response_with_payload_unsecure_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test || ( echo test chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_with_large_metadata_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test || ( echo test chttp2_fullstack_uds_request_with_large_metadata_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_fullstack_uds_request_with_payload_unsecure_test" @@ -1715,6 +1744,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test || ( echo test chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_response_with_payload_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test || ( echo test chttp2_socket_pair_request_response_with_payload_unsecure_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test || ( echo test chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_with_large_metadata_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test || ( echo test chttp2_socket_pair_request_with_large_metadata_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_request_with_payload_unsecure_test" @@ -1767,6 +1798,8 @@ test_c: buildtests_c $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test failed ; exit 1 ) + $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test" + $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test" $(Q) $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test || ( echo test chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test failed ; exit 1 ) $(E) "[RUN] Testing chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test" @@ -4229,6 +4262,29 @@ ifneq ($(NO_DEPS),true) endif +LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_SRC = \ + test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c \ + + +LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_SRC)))) + +$(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a: $(ZLIB_DEP) $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_OBJS) + $(E) "[AR] Creating $@" + $(Q) mkdir -p `dirname $@` + $(Q) rm -f $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a + $(Q) $(AR) rcs $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_OBJS) +ifeq ($(SYSTEM),Darwin) + $(Q) ranlib $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a +endif + + + + +ifneq ($(NO_DEPS),true) +-include $(LIBEND2END_TEST_REQUEST_RESPONSE_WITH_TRAILING_METADATA_AND_PAYLOAD_OBJS:.o=.dep) +endif + + LIBEND2END_TEST_REQUEST_WITH_LARGE_METADATA_SRC = \ test/core/end2end/tests/request_with_large_metadata.c \ @@ -7877,6 +7933,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fake_security.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -8345,6 +8419,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -8813,6 +8905,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -9281,6 +9391,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -9749,6 +9877,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_simple_ssl_with_oauth2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -10217,6 +10363,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -10685,6 +10849,24 @@ endif +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL with ALPN. + +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test: openssl_dep_error + +else + +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libend2end_certs.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test + +endif + + + + ifeq ($(NO_SECURE),true) # You can't build secure targets if you don't have OpenSSL with ALPN. @@ -10943,6 +11125,14 @@ $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test +$(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test + + + + $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` @@ -11151,6 +11341,14 @@ $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_ +$(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test + + + + $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_fullstack_uds.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` @@ -11359,6 +11557,14 @@ $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_te +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test + + + + $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` @@ -11567,6 +11773,14 @@ $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_ +$(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_response_with_trailing_metadata_and_payload.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test + + + + $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test: $(LIBDIR)/$(CONFIG)/libend2end_fixture_chttp2_socket_pair_one_byte_at_a_time.a $(LIBDIR)/$(CONFIG)/libend2end_test_request_with_large_metadata.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` diff --git a/test/core/end2end/gen_build_json.py b/test/core/end2end/gen_build_json.py index 1d981cd3ad..dfe9c1d360 100755 --- a/test/core/end2end/gen_build_json.py +++ b/test/core/end2end/gen_build_json.py @@ -65,15 +65,16 @@ END2END_TESTS = { 'max_message_length': True, 'no_op': True, 'ping_pong_streaming': True, + 'registered_call': True, 'request_response_with_binary_metadata_and_payload': True, 'request_response_with_metadata_and_payload': True, 'request_response_with_payload': True, + 'request_response_with_trailing_metadata_and_payload': True, 'request_with_large_metadata': True, 'request_with_payload': True, 'simple_delayed_request': True, 'simple_request': True, 'simple_request_with_high_initial_sequence_number': True, - 'registered_call': True, } diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index b7834a1e6c..75240e7c6f 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -114,9 +114,9 @@ static void test_request_response_with_metadata_and_payload( grpc_byte_buffer *response_payload = grpc_byte_buffer_create(&response_payload_slice, 1); gpr_timespec deadline = five_seconds_time(); - grpc_metadata meta_c[2] = {{"key1", "val1", 4}, {"key2", "val2", 4}}; - grpc_metadata meta_s[2] = {{"key3", "val3", 4}, {"key4", "val4", 4}}; - grpc_metadata meta_t[2] = {{"key5", "val5", 4}, {"key6", "val6", 4}}; + grpc_metadata meta_c[2] = {{"key1", "val1", 4, {{NULL, NULL, NULL}}}, {"key2", "val2", 4, {{NULL, NULL, NULL}}}}; + grpc_metadata meta_s[2] = {{"key3", "val3", 4, {{NULL, NULL, NULL}}}, {"key4", "val4", 4, {{NULL, NULL, NULL}}}}; + grpc_metadata meta_t[2] = {{"key5", "val5", 4, {{NULL, NULL, NULL}}}, {"key6", "val6", 4, {{NULL, NULL, NULL}}}}; grpc_end2end_test_fixture f = begin_test(config, __FUNCTION__, NULL, NULL); cq_verifier *v_client = cq_verifier_create(f.client_cq); cq_verifier *v_server = cq_verifier_create(f.server_cq); @@ -205,7 +205,6 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr")); - GPR_ASSERT(was_cancelled == 1); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, "hello world")); GPR_ASSERT(byte_buffer_eq_string(response_payload_recv, "hello you")); GPR_ASSERT(contains_metadata(&request_metadata_recv, "key1", "val1")); diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 7dc9d179f8..6a1b4a41b2 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -873,6 +873,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -1107,6 +1116,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -1341,6 +1359,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -1575,6 +1602,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -1809,6 +1845,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -2043,6 +2088,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -2277,6 +2331,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -2511,6 +2574,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -2745,6 +2817,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -2979,6 +3060,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", @@ -3213,6 +3303,15 @@ "posix" ] }, + { + "flaky": false, + "language": "c", + "name": "chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test", + "platforms": [ + "windows", + "posix" + ] + }, { "flaky": false, "language": "c", diff --git a/vsprojects/Grpc.mak b/vsprojects/Grpc.mak index e3d9637bd4..882f14b433 100644 --- a/vsprojects/Grpc.mak +++ b/vsprojects/Grpc.mak @@ -58,7 +58,7 @@ $(OUT_DIR): buildtests: buildtests_c buildtests_cxx -buildtests_c: alarm_heap_test.exe alarm_list_test.exe alarm_test.exe alpn_test.exe bin_encoder_test.exe census_hash_table_test.exe census_statistics_multiple_writers_circular_buffer_test.exe census_statistics_multiple_writers_test.exe census_statistics_performance_test.exe census_statistics_quick_test.exe census_statistics_small_log_test.exe census_stub_test.exe census_window_stats_test.exe chttp2_status_conversion_test.exe chttp2_stream_encoder_test.exe chttp2_stream_map_test.exe fd_posix_test.exe fling_client.exe fling_server.exe fling_stream_test.exe fling_test.exe gpr_cancellable_test.exe gpr_cmdline_test.exe gpr_env_test.exe gpr_file_test.exe gpr_histogram_test.exe gpr_host_port_test.exe gpr_log_test.exe gpr_slice_buffer_test.exe gpr_slice_test.exe gpr_string_test.exe gpr_sync_test.exe gpr_thd_test.exe gpr_time_test.exe gpr_tls_test.exe gpr_useful_test.exe grpc_base64_test.exe grpc_byte_buffer_reader_test.exe grpc_channel_stack_test.exe grpc_completion_queue_test.exe grpc_credentials_test.exe grpc_json_token_test.exe grpc_stream_op_test.exe hpack_parser_test.exe hpack_table_test.exe httpcli_format_request_test.exe httpcli_parser_test.exe httpcli_test.exe json_rewrite.exe json_rewrite_test.exe json_test.exe lame_client_test.exe message_compress_test.exe multi_init_test.exe murmur_hash_test.exe no_server_test.exe poll_kick_posix_test.exe resolve_address_test.exe secure_endpoint_test.exe sockaddr_utils_test.exe tcp_client_posix_test.exe tcp_posix_test.exe tcp_server_posix_test.exe time_averaged_stats_test.exe time_test.exe timeout_encoding_test.exe timers_test.exe transport_metadata_test.exe transport_security_test.exe chttp2_fullstack_bad_hostname_unsecure_test.exe chttp2_fullstack_cancel_after_accept_unsecure_test.exe chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_fullstack_cancel_after_invoke_unsecure_test.exe chttp2_fullstack_cancel_before_invoke_unsecure_test.exe chttp2_fullstack_cancel_in_a_vacuum_unsecure_test.exe chttp2_fullstack_census_simple_request_unsecure_test.exe chttp2_fullstack_disappearing_server_unsecure_test.exe chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_fullstack_empty_batch_unsecure_test.exe chttp2_fullstack_graceful_server_shutdown_unsecure_test.exe chttp2_fullstack_invoke_large_request_unsecure_test.exe chttp2_fullstack_max_concurrent_streams_unsecure_test.exe chttp2_fullstack_max_message_length_unsecure_test.exe chttp2_fullstack_no_op_unsecure_test.exe chttp2_fullstack_ping_pong_streaming_unsecure_test.exe chttp2_fullstack_registered_call_unsecure_test.exe chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_fullstack_request_response_with_payload_unsecure_test.exe chttp2_fullstack_request_with_large_metadata_unsecure_test.exe chttp2_fullstack_request_with_payload_unsecure_test.exe chttp2_fullstack_simple_delayed_request_unsecure_test.exe chttp2_fullstack_simple_request_unsecure_test.exe chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_fullstack_uds_bad_hostname_unsecure_test.exe chttp2_fullstack_uds_cancel_after_accept_unsecure_test.exe chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_fullstack_uds_cancel_after_invoke_unsecure_test.exe chttp2_fullstack_uds_cancel_before_invoke_unsecure_test.exe chttp2_fullstack_uds_cancel_in_a_vacuum_unsecure_test.exe chttp2_fullstack_uds_census_simple_request_unsecure_test.exe chttp2_fullstack_uds_disappearing_server_unsecure_test.exe chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_fullstack_uds_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_fullstack_uds_empty_batch_unsecure_test.exe chttp2_fullstack_uds_graceful_server_shutdown_unsecure_test.exe chttp2_fullstack_uds_invoke_large_request_unsecure_test.exe chttp2_fullstack_uds_max_concurrent_streams_unsecure_test.exe chttp2_fullstack_uds_max_message_length_unsecure_test.exe chttp2_fullstack_uds_no_op_unsecure_test.exe chttp2_fullstack_uds_ping_pong_streaming_unsecure_test.exe chttp2_fullstack_uds_registered_call_unsecure_test.exe chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_fullstack_uds_request_response_with_payload_unsecure_test.exe chttp2_fullstack_uds_request_with_large_metadata_unsecure_test.exe chttp2_fullstack_uds_request_with_payload_unsecure_test.exe chttp2_fullstack_uds_simple_delayed_request_unsecure_test.exe chttp2_fullstack_uds_simple_request_unsecure_test.exe chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_socket_pair_bad_hostname_unsecure_test.exe chttp2_socket_pair_cancel_after_accept_unsecure_test.exe chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_socket_pair_cancel_after_invoke_unsecure_test.exe chttp2_socket_pair_cancel_before_invoke_unsecure_test.exe chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test.exe chttp2_socket_pair_census_simple_request_unsecure_test.exe chttp2_socket_pair_disappearing_server_unsecure_test.exe chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_socket_pair_empty_batch_unsecure_test.exe chttp2_socket_pair_graceful_server_shutdown_unsecure_test.exe chttp2_socket_pair_invoke_large_request_unsecure_test.exe chttp2_socket_pair_max_concurrent_streams_unsecure_test.exe chttp2_socket_pair_max_message_length_unsecure_test.exe chttp2_socket_pair_no_op_unsecure_test.exe chttp2_socket_pair_ping_pong_streaming_unsecure_test.exe chttp2_socket_pair_registered_call_unsecure_test.exe chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_request_response_with_payload_unsecure_test.exe chttp2_socket_pair_request_with_large_metadata_unsecure_test.exe chttp2_socket_pair_request_with_payload_unsecure_test.exe chttp2_socket_pair_simple_delayed_request_unsecure_test.exe chttp2_socket_pair_simple_request_unsecure_test.exe chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test.exe +buildtests_c: alarm_heap_test.exe alarm_list_test.exe alarm_test.exe alpn_test.exe bin_encoder_test.exe census_hash_table_test.exe census_statistics_multiple_writers_circular_buffer_test.exe census_statistics_multiple_writers_test.exe census_statistics_performance_test.exe census_statistics_quick_test.exe census_statistics_small_log_test.exe census_stub_test.exe census_window_stats_test.exe chttp2_status_conversion_test.exe chttp2_stream_encoder_test.exe chttp2_stream_map_test.exe fd_posix_test.exe fling_client.exe fling_server.exe fling_stream_test.exe fling_test.exe gpr_cancellable_test.exe gpr_cmdline_test.exe gpr_env_test.exe gpr_file_test.exe gpr_histogram_test.exe gpr_host_port_test.exe gpr_log_test.exe gpr_slice_buffer_test.exe gpr_slice_test.exe gpr_string_test.exe gpr_sync_test.exe gpr_thd_test.exe gpr_time_test.exe gpr_tls_test.exe gpr_useful_test.exe grpc_base64_test.exe grpc_byte_buffer_reader_test.exe grpc_channel_stack_test.exe grpc_completion_queue_test.exe grpc_credentials_test.exe grpc_json_token_test.exe grpc_stream_op_test.exe hpack_parser_test.exe hpack_table_test.exe httpcli_format_request_test.exe httpcli_parser_test.exe httpcli_test.exe json_rewrite.exe json_rewrite_test.exe json_test.exe lame_client_test.exe message_compress_test.exe multi_init_test.exe murmur_hash_test.exe no_server_test.exe poll_kick_posix_test.exe resolve_address_test.exe secure_endpoint_test.exe sockaddr_utils_test.exe tcp_client_posix_test.exe tcp_posix_test.exe tcp_server_posix_test.exe time_averaged_stats_test.exe time_test.exe timeout_encoding_test.exe timers_test.exe transport_metadata_test.exe transport_security_test.exe chttp2_fullstack_bad_hostname_unsecure_test.exe chttp2_fullstack_cancel_after_accept_unsecure_test.exe chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_fullstack_cancel_after_invoke_unsecure_test.exe chttp2_fullstack_cancel_before_invoke_unsecure_test.exe chttp2_fullstack_cancel_in_a_vacuum_unsecure_test.exe chttp2_fullstack_census_simple_request_unsecure_test.exe chttp2_fullstack_disappearing_server_unsecure_test.exe chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_fullstack_empty_batch_unsecure_test.exe chttp2_fullstack_graceful_server_shutdown_unsecure_test.exe chttp2_fullstack_invoke_large_request_unsecure_test.exe chttp2_fullstack_max_concurrent_streams_unsecure_test.exe chttp2_fullstack_max_message_length_unsecure_test.exe chttp2_fullstack_no_op_unsecure_test.exe chttp2_fullstack_ping_pong_streaming_unsecure_test.exe chttp2_fullstack_registered_call_unsecure_test.exe chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_fullstack_request_response_with_payload_unsecure_test.exe chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test.exe chttp2_fullstack_request_with_large_metadata_unsecure_test.exe chttp2_fullstack_request_with_payload_unsecure_test.exe chttp2_fullstack_simple_delayed_request_unsecure_test.exe chttp2_fullstack_simple_request_unsecure_test.exe chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_fullstack_uds_bad_hostname_unsecure_test.exe chttp2_fullstack_uds_cancel_after_accept_unsecure_test.exe chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_fullstack_uds_cancel_after_invoke_unsecure_test.exe chttp2_fullstack_uds_cancel_before_invoke_unsecure_test.exe chttp2_fullstack_uds_cancel_in_a_vacuum_unsecure_test.exe chttp2_fullstack_uds_census_simple_request_unsecure_test.exe chttp2_fullstack_uds_disappearing_server_unsecure_test.exe chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_fullstack_uds_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_fullstack_uds_empty_batch_unsecure_test.exe chttp2_fullstack_uds_graceful_server_shutdown_unsecure_test.exe chttp2_fullstack_uds_invoke_large_request_unsecure_test.exe chttp2_fullstack_uds_max_concurrent_streams_unsecure_test.exe chttp2_fullstack_uds_max_message_length_unsecure_test.exe chttp2_fullstack_uds_no_op_unsecure_test.exe chttp2_fullstack_uds_ping_pong_streaming_unsecure_test.exe chttp2_fullstack_uds_registered_call_unsecure_test.exe chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_fullstack_uds_request_response_with_payload_unsecure_test.exe chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test.exe chttp2_fullstack_uds_request_with_large_metadata_unsecure_test.exe chttp2_fullstack_uds_request_with_payload_unsecure_test.exe chttp2_fullstack_uds_simple_delayed_request_unsecure_test.exe chttp2_fullstack_uds_simple_request_unsecure_test.exe chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_socket_pair_bad_hostname_unsecure_test.exe chttp2_socket_pair_cancel_after_accept_unsecure_test.exe chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_socket_pair_cancel_after_invoke_unsecure_test.exe chttp2_socket_pair_cancel_before_invoke_unsecure_test.exe chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test.exe chttp2_socket_pair_census_simple_request_unsecure_test.exe chttp2_socket_pair_disappearing_server_unsecure_test.exe chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_socket_pair_empty_batch_unsecure_test.exe chttp2_socket_pair_graceful_server_shutdown_unsecure_test.exe chttp2_socket_pair_invoke_large_request_unsecure_test.exe chttp2_socket_pair_max_concurrent_streams_unsecure_test.exe chttp2_socket_pair_max_message_length_unsecure_test.exe chttp2_socket_pair_no_op_unsecure_test.exe chttp2_socket_pair_ping_pong_streaming_unsecure_test.exe chttp2_socket_pair_registered_call_unsecure_test.exe chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_request_response_with_payload_unsecure_test.exe chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_request_with_large_metadata_unsecure_test.exe chttp2_socket_pair_request_with_payload_unsecure_test.exe chttp2_socket_pair_simple_delayed_request_unsecure_test.exe chttp2_socket_pair_simple_request_unsecure_test.exe chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test.exe chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test.exe echo All tests built. buildtests_cxx: interop_client.exe interop_server.exe @@ -864,6 +864,14 @@ chttp2_fullstack_request_response_with_payload_unsecure_test: chttp2_fullstack_r echo Running chttp2_fullstack_request_response_with_payload_unsecure_test $(OUT_DIR)\chttp2_fullstack_request_response_with_payload_unsecure_test.exe +chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) + echo Building chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test.exe" Debug\end2end_fixture_chttp2_fullstack.lib Debug\end2end_test_request_response_with_trailing_metadata_and_payload.lib Debug\grpc_test_util_unsecure.lib Debug\grpc_unsecure.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) +chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test: chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + echo Running chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test + $(OUT_DIR)\chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + chttp2_fullstack_request_with_large_metadata_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) echo Building chttp2_fullstack_request_with_large_metadata_unsecure_test $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ @@ -1072,6 +1080,14 @@ chttp2_fullstack_uds_request_response_with_payload_unsecure_test: chttp2_fullsta echo Running chttp2_fullstack_uds_request_response_with_payload_unsecure_test $(OUT_DIR)\chttp2_fullstack_uds_request_response_with_payload_unsecure_test.exe +chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) + echo Building chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test.exe" Debug\end2end_fixture_chttp2_fullstack_uds.lib Debug\end2end_test_request_response_with_trailing_metadata_and_payload.lib Debug\grpc_test_util_unsecure.lib Debug\grpc_unsecure.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) +chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test: chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + echo Running chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test + $(OUT_DIR)\chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + chttp2_fullstack_uds_request_with_large_metadata_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) echo Building chttp2_fullstack_uds_request_with_large_metadata_unsecure_test $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ @@ -1280,6 +1296,14 @@ chttp2_socket_pair_request_response_with_payload_unsecure_test: chttp2_socket_pa echo Running chttp2_socket_pair_request_response_with_payload_unsecure_test $(OUT_DIR)\chttp2_socket_pair_request_response_with_payload_unsecure_test.exe +chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) + echo Building chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test.exe" Debug\end2end_fixture_chttp2_socket_pair.lib Debug\end2end_test_request_response_with_trailing_metadata_and_payload.lib Debug\grpc_test_util_unsecure.lib Debug\grpc_unsecure.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) +chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test: chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + echo Running chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test + $(OUT_DIR)\chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + chttp2_socket_pair_request_with_large_metadata_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) echo Building chttp2_socket_pair_request_with_large_metadata_unsecure_test $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ @@ -1488,6 +1512,14 @@ chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_tes echo Running chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test $(OUT_DIR)\chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test.exe +chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) + echo Building chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test + $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ + $(LINK) $(LFLAGS) /OUT:"$(OUT_DIR)\chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test.exe" Debug\end2end_fixture_chttp2_socket_pair_one_byte_at_a_time.lib Debug\end2end_test_request_response_with_trailing_metadata_and_payload.lib Debug\grpc_test_util_unsecure.lib Debug\grpc_unsecure.lib Debug\gpr_test_util.lib Debug\gpr.lib $(LIBS) +chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test: chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + echo Running chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test + $(OUT_DIR)\chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test.exe + chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test.exe: build_grpc_test_util $(OUT_DIR) echo Building chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test $(CC) $(CFLAGS) /Fo:$(OUT_DIR)\ -- cgit v1.2.3 From bd9f924f1673cdffbbcaa2c5bfa9b8bfb9f38b1b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 1 May 2015 16:24:41 -0700 Subject: Basic profiler analyzer --- tools/profile_analyzer/profile_analyzer.py | 87 ++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 tools/profile_analyzer/profile_analyzer.py diff --git a/tools/profile_analyzer/profile_analyzer.py b/tools/profile_analyzer/profile_analyzer.py new file mode 100755 index 0000000000..f15277491f --- /dev/null +++ b/tools/profile_analyzer/profile_analyzer.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +# Copyright 2015, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +""" +Read GRPC basic profiles, analyze the data. + +Usage: + bins/basicprof/qps_smoke_test > log + cat log | tools/profile_analyzer/profile_analyzer.py +""" + + +import collections +import re +import sys + +# Create a regex to parse output of the C core basic profiler, +# as defined in src/core/profiling/basic_timers.c. +_RE_LINE = re.compile(r'GRPC_LAT_PROF ' + + r'([0-9]+\.[0-9]+) 0x([0-9a-f]+) ([{}.]) ([0-9]+) ' + + r'([^ ]+) ([^ ]+) ([0-9]+)') + +Entry = collections.namedtuple( + 'Entry', + ['time', 'thread', 'type', 'tag', 'id', 'file', 'line']) + +def entries(): + for line in sys.stdin: + m = _RE_LINE.match(line) + if not m: continue + yield Entry(time=float(m.group(1)), + thread=m.group(2), + type=m.group(3), + tag=int(m.group(4)), + id=m.group(5), + file=m.group(6), + line=m.group(7)) + +threads = collections.defaultdict(lambda: collections.defaultdict(list)) +times = collections.defaultdict(list) + +for entry in entries(): + thread = threads[entry.thread] + if entry.type == '{': + thread[entry.tag].append(entry) + elif entry.type == '}': + last = thread[entry.tag].pop() + times[entry.tag].append(entry.time - last.time) + +def percentile(vals, pct): + return sorted(vals)[int(len(vals) * pct / 100.0)] + +print 'tag 50%/90%/95%/99% us' +for tag in sorted(times.keys()): + vals = times[tag] + print '%d %.2f/%.2f/%.2f/%.2f' % (tag, + percentile(vals, 50), + percentile(vals, 90), + percentile(vals, 95), + percentile(vals, 99)) -- cgit v1.2.3 From ef42ea21b1dacb28caa61df71523c58fc96b6318 Mon Sep 17 00:00:00 2001 From: Nathaniel Manista Date: Tue, 5 May 2015 21:16:17 +0000 Subject: Make headers of TODO interop test priorities --- doc/interop-test-descriptions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/interop-test-descriptions.md b/doc/interop-test-descriptions.md index f67cefadd1..e20f5b1b6d 100644 --- a/doc/interop-test-descriptions.md +++ b/doc/interop-test-descriptions.md @@ -532,7 +532,7 @@ pushback (i.e., attempts to send succeed only after appropriate delays). ### TODO Tests -High priority: +#### High priority: Propagation of status code and message (yangg) @@ -553,7 +553,7 @@ OAuth2 tokens + JWT signing key (GCE->prod only) (abhishek) Metadata: client headers, server headers + trailers, binary+ascii (chenw) -Normal priority: +#### Normal priority: Cancel before start (ctiller) @@ -565,7 +565,7 @@ Timeout but completed before expire (zhaoq) Multiple thousand simultaneous calls timeout on same Channel (ctiller) -Lower priority: +#### Lower priority: Flow control. Pushback at client for large messages (abhishek) @@ -580,7 +580,7 @@ Multiple thousand simultaneous calls on different Channels (ctiller) Failed TLS hostname verification (ejona?) -To priorize: +#### To priorize: Start streaming RPC but don't send any requests, server responds -- cgit v1.2.3 From ab4ad8590b45db6ad6dd96ef954e7e33861c712c Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 5 May 2015 14:46:23 -0700 Subject: add command for the rest of PHP interop test --- tools/gce_setup/grpc_docker.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index ecce0e2983..d3a7bdef28 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -1250,6 +1250,20 @@ grpc_interop_gen_php_cmd() { echo $the_cmd } +# constructs the full dockerized php gce=>prod interop test cmd. +# +# call-seq: +# flags= .... # generic flags to include the command +# cmd=$($grpc_gen_test_cmd $flags) +grpc_cloud_prod_gen_php_cmd() { + local env_flag="-e SSL_CERT_FILE=/cacerts/roots.pem " + local cmd_prefix="sudo docker run $env_flag grpc/php"; + local test_script="/var/local/git/grpc/src/php/bin/interop_client.sh"; + local gfe_flags=$(_grpc_prod_gfe_flags); + local the_cmd="$cmd_prefix $test_script $gfe_flags $@"; + echo $the_cmd +} + # constructs the full dockerized php service_account auth interop test cmd. # # call-seq: -- cgit v1.2.3 From 73423ae76d1ffcec73af4a504aaac6884f3df49e Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Tue, 5 May 2015 17:11:04 -0700 Subject: Added important (!) profiling mark. It's meant to have a special status in the analysis, whereby latencies from important marks to all their enclosing BEGIN ({) and END (}) markings will be measured. --- src/core/profiling/basic_timers.c | 14 +++++++++++++- src/core/profiling/stap_probes.d | 1 + src/core/profiling/stap_timers.c | 5 +++++ src/core/profiling/timers.h | 12 ++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/core/profiling/basic_timers.c b/src/core/profiling/basic_timers.c index 866833f225..124a8d6621 100644 --- a/src/core/profiling/basic_timers.c +++ b/src/core/profiling/basic_timers.c @@ -45,7 +45,12 @@ #include #include -typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type; +typedef enum { + BEGIN = '{', + END = '}', + MARK = '.', + IMPORTANT = '!' +} marker_type; typedef struct grpc_timer_entry { grpc_precise_clock tm; @@ -101,6 +106,13 @@ void grpc_timer_add_mark(int tag, void* id, const char* file, int line) { } } +void grpc_timer_add_important_mark(int tag, void* id, const char* file, + int line) { + if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { + grpc_timers_log_add(tag, IMPORTANT, id, file, line); + } +} + void grpc_timer_begin(int tag, void* id, const char* file, int line) { if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { grpc_timers_log_add(tag, BEGIN, id, file, line); diff --git a/src/core/profiling/stap_probes.d b/src/core/profiling/stap_probes.d index 374eeedd6c..153de91752 100644 --- a/src/core/profiling/stap_probes.d +++ b/src/core/profiling/stap_probes.d @@ -1,5 +1,6 @@ provider _stap { probe add_mark(int tag); + probe add_important_mark(int tag); probe timing_ns_begin(int tag); probe timing_ns_end(int tag); }; diff --git a/src/core/profiling/stap_timers.c b/src/core/profiling/stap_timers.c index 6e3a965dae..064c86e794 100644 --- a/src/core/profiling/stap_timers.c +++ b/src/core/profiling/stap_timers.c @@ -46,6 +46,11 @@ void grpc_timer_add_mark(int tag, void* id, const char* file, int line) { _STAP_ADD_MARK(tag); } +void grpc_timer_add_important_mark(int tag, void* id, const char* file, + int line) { + _STAP_ADD_IMPORTANT_MARK(tag); +} + void grpc_timer_begin(int tag, void* id, const char* file, int line) { _STAP_TIMING_NS_BEGIN(tag); } diff --git a/src/core/profiling/timers.h b/src/core/profiling/timers.h index 0b0f7152e7..4fb465c237 100644 --- a/src/core/profiling/timers.h +++ b/src/core/profiling/timers.h @@ -42,6 +42,8 @@ void grpc_timers_global_init(void); void grpc_timers_global_destroy(void); void grpc_timer_add_mark(int tag, void *id, const char *file, int line); +void grpc_timer_add_important_mark(int tag, void *id, const char *file, + int line); void grpc_timer_begin(int tag, void *id, const char *file, int line); void grpc_timer_end(int tag, void *id, const char *file, int line); @@ -82,6 +84,10 @@ enum grpc_profiling_tags { do { \ } while (0) +#define GRPC_TIMER_IMPORTANT_MARK(tag, id) \ + do { \ + } while (0) + #define GRPC_TIMER_BEGIN(tag, id) \ do { \ } while (0) @@ -102,6 +108,12 @@ enum grpc_profiling_tags { grpc_timer_add_mark(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \ } +#define GRPC_TIMER_IMPORTANT_MARK(tag, id) \ + if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \ + grpc_timer_add_important_mark(tag, ((void *)(gpr_intptr)(id)), __FILE__, \ + __LINE__); \ + } + #define GRPC_TIMER_BEGIN(tag, id) \ if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \ grpc_timer_begin(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \ -- cgit v1.2.3 From 5b2ea2979b9fe27cf50d60325ad8a3ae26d46cf6 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 6 May 2015 09:57:49 -0700 Subject: Added support for important mark (!) analysis. For example, an input of GRPC_LAT_PROF 1316908107613.015869 0x7fd35f7fe700 { 205 (nil) src/core/iomgr/tcp_posix.c 1 GRPC_LAT_PROF 1316908107614.015869 0x7fd35f7fe700 { 205 (nil) src/core/iomgr/tcp_posix.c 2 GRPC_LAT_PROF 1316908107615.015869 0x7fd35f7fe700 ! 999999 (nil) src/core/iomgr/tcp_posix.c 3 GRPC_LAT_PROF 1316908107616.015869 0x7fd35f7fe700 } 205 (nil) src/core/iomgr/tcp_posix.c 4 GRPC_LAT_PROF 1316908107617.015869 0x7fd35f7fe700 ! 999999 (nil) src/core/iomgr/tcp_posix.c 5 GRPC_LAT_PROF 1316908107618.015869 0x7fd35f7fe700 } 205 (nil) src/core/iomgr/tcp_posix.c 6 results in tag 50%/90%/95%/99% us 205 5.00/5.00/5.00/5.00 Important marks: ================ 999999 @ src/core/iomgr/tcp_posix.c:3 205 { (src/core/iomgr/tcp_posix.c:1): 2.000 us 205 { (src/core/iomgr/tcp_posix.c:2): 1.000 us 205 } (src/core/iomgr/tcp_posix.c:4): -1.000 us 205 } (src/core/iomgr/tcp_posix.c:6): -3.000 us 999999 @ src/core/iomgr/tcp_posix.c:5 205 { (src/core/iomgr/tcp_posix.c:1): 4.000 us 205 } (src/core/iomgr/tcp_posix.c:6): -1.000 us --- tools/profile_analyzer/profile_analyzer.py | 56 ++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/tools/profile_analyzer/profile_analyzer.py b/tools/profile_analyzer/profile_analyzer.py index f15277491f..00b1079466 100755 --- a/tools/profile_analyzer/profile_analyzer.py +++ b/tools/profile_analyzer/profile_analyzer.py @@ -38,19 +38,43 @@ Usage: import collections +import itertools import re import sys # Create a regex to parse output of the C core basic profiler, # as defined in src/core/profiling/basic_timers.c. _RE_LINE = re.compile(r'GRPC_LAT_PROF ' + - r'([0-9]+\.[0-9]+) 0x([0-9a-f]+) ([{}.]) ([0-9]+) ' + + r'([0-9]+\.[0-9]+) 0x([0-9a-f]+) ([{}.!]) ([0-9]+) ' + r'([^ ]+) ([^ ]+) ([0-9]+)') Entry = collections.namedtuple( 'Entry', ['time', 'thread', 'type', 'tag', 'id', 'file', 'line']) + +class ImportantMark(object): + def __init__(self, entry, stack): + self._entry = entry + self._pre_stack = stack + self._post_stack = list() + self._n = len(stack) # we'll also compute times to that many closing }s + + @property + def entry(self): + return self._entry + + def append_post_entry(self, entry): + if self._n > 0: + self._post_stack.append(entry) + self._n -= 1 + + def get_deltas(self): + pre_and_post_stacks = itertools.chain(self._pre_stack, self._post_stack) + return collections.OrderedDict((stack_entry, + (self._entry.time - stack_entry.time)) + for stack_entry in pre_and_post_stacks) + def entries(): for line in sys.stdin: m = _RE_LINE.match(line) @@ -66,13 +90,27 @@ def entries(): threads = collections.defaultdict(lambda: collections.defaultdict(list)) times = collections.defaultdict(list) +# Indexed by the mark's tag. Items in the value list correspond to the mark in +# different stack situations. +important_marks = collections.defaultdict(list) + for entry in entries(): thread = threads[entry.thread] if entry.type == '{': thread[entry.tag].append(entry) + if entry.type == '!': + # Save a snapshot of the current stack inside a new ImportantMark instance. + # Get all entries with type '{' from "thread". + stack = [e for entries_for_tag in thread.values() + for e in entries_for_tag if e.type == '{'] + important_marks[entry.tag].append(ImportantMark(entry, stack)) elif entry.type == '}': last = thread[entry.tag].pop() times[entry.tag].append(entry.time - last.time) + # Update accounting for important marks. + for imarks_for_tag in important_marks.itervalues(): + for imark in imarks_for_tag: + imark.append_post_entry(entry) def percentile(vals, pct): return sorted(vals)[int(len(vals) * pct / 100.0)] @@ -80,8 +118,22 @@ def percentile(vals, pct): print 'tag 50%/90%/95%/99% us' for tag in sorted(times.keys()): vals = times[tag] - print '%d %.2f/%.2f/%.2f/%.2f' % (tag, + print '%d %.2f/%.2f/%.2f/%.2f' % (tag, percentile(vals, 50), percentile(vals, 90), percentile(vals, 95), percentile(vals, 99)) + +print +print 'Important marks:' +print '================' +for tag, imark_for_tag in important_marks.iteritems(): + for imark in imarks_for_tag: + deltas = imark.get_deltas() + print '{tag} @ {file}:{line}'.format(**imark.entry._asdict()) + for entry, time_delta_us in deltas.iteritems(): + format_dict = entry._asdict() + format_dict['time_delta_us'] = time_delta_us + print '{tag} {type} ({file}:{line}): {time_delta_us:12.3f} us'.format( + **format_dict) + print -- cgit v1.2.3 From f2fb07dafc5ef88a6fcd5c4f98c75ffa7f7a3f72 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Wed, 6 May 2015 10:22:35 -0700 Subject: Pin the version of rubocop used in grpc.gemspec --- src/ruby/grpc.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ruby/grpc.gemspec b/src/ruby/grpc.gemspec index 19b3e21cb6..3ddb7fac18 100755 --- a/src/ruby/grpc.gemspec +++ b/src/ruby/grpc.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake', '~> 10.4' s.add_development_dependency 'rake-compiler', '~> 0.9' s.add_development_dependency 'rspec', '~> 3.2' - s.add_development_dependency 'rubocop', '~> 0.30' + s.add_development_dependency 'rubocop', '~> 0.30.0' s.extensions = %w(ext/grpc/extconf.rb) end -- cgit v1.2.3 From 62d0b28a76fae1467758833220f2452ddfaf4ef8 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Wed, 6 May 2015 13:09:25 -0700 Subject: update php composer.lock --- src/php/composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/php/composer.lock b/src/php/composer.lock index c2d723def4..8d0c8de437 100644 --- a/src/php/composer.lock +++ b/src/php/composer.lock @@ -1,7 +1,7 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], "hash": "bb81ea5f72ddea2f594a172ff0f3b44d", @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/google/google-auth-library-php.git", - "reference": "35f87159b327fa6416266948c1747c585a4ae3ad" + "reference": "70ff1c9b27b1678827465c72ce81a067e1653442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/35f87159b327fa6416266948c1747c585a4ae3ad", - "reference": "35f87159b327fa6416266948c1747c585a4ae3ad", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/70ff1c9b27b1678827465c72ce81a067e1653442", + "reference": "70ff1c9b27b1678827465c72ce81a067e1653442", "shasum": "" }, "require": { @@ -94,7 +94,7 @@ "google", "oauth2" ], - "time": "2015-04-30 11:57:19" + "time": "2015-05-06 16:31:42" }, { "name": "guzzlehttp/guzzle", -- cgit v1.2.3 From 5c1368e20050b56822ccdc9e4bc77aecd50caf1d Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Wed, 6 May 2015 13:19:20 -0700 Subject: Ensuring test logs are not over written between runs. --- tools/gce_setup/cloud_prod_runner.sh | 11 ++++++----- tools/gce_setup/interop_test_runner.sh | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index 812be4061c..5f3b61eb52 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -32,7 +32,7 @@ thisfile=$(readlink -ne "${BASH_SOURCE[0]}") current_time=$(date "+%Y-%m-%d-%H-%M-%S") result_file_name=cloud_prod_result.$current_time.html echo $result_file_name -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log_history +log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_log_history main() { source grpc_docker.sh @@ -46,10 +46,10 @@ main() { log_file_name=cloud_{$test_case}_{$client}.txt if grpc_cloud_prod_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt fi done @@ -61,10 +61,10 @@ main() { log_file_name=cloud_{$test_case}_{$client}.txt if grpc_cloud_prod_auth_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt fi done @@ -72,6 +72,7 @@ main() { if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html gsutil cp /tmp/cloud_prod_result.txt gs://stoked-keyword-656-output/cloud_prod_result.txt + gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_log_history gs://stoked-keyword-656-output/log gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/cloud_prod_result.html gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/result_history/$result_file_name rm /tmp/cloud_prod_result.txt diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index b9f026e545..ff3d536930 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -32,7 +32,7 @@ thisfile=$(readlink -ne "${BASH_SOURCE[0]}") current_time=$(date "+%Y-%m-%d-%H-%M-%S") result_file_name=interop_result.$current_time.html echo $result_file_name -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log_history +log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_log_history main() { source grpc_docker.sh @@ -48,10 +48,10 @@ main() { log_file_name=interop_{$test_case}_{$client}_{$server}.txt if grpc_interop_test $test_case grpc-docker-testclients $client grpc-docker-server $server > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/inteorp_log_history/$log_file_name echo " ['$test_case', '$client', '$server', true, 'log']," >> /tmp/interop_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/log_history/$log_file_name + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_log_history/$log_file_name echo " ['$test_case', '$client', '$server', false, 'log']," >> /tmp/interop_result.txt fi done @@ -60,6 +60,7 @@ main() { if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then cat pre.html /tmp/interop_result.txt post.html > /tmp/interop_result.html gsutil cp /tmp/interop_result.txt gs://stoked-keyword-656-output/interop_result.txt + gsutil cp -R gs://stoked-keyword-656-output/interop_log_history gs://stoked-keyword-656-output/log gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/interop_result.html gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/result_history/$result_file_name rm /tmp/interop_result.txt -- cgit v1.2.3 From 594856fe64d04911e0655a729f6ef85994c7f2d4 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 6 May 2015 14:09:44 -0700 Subject: Fix: Server side call with both streams closed doesnt get properly finalized --- src/core/transport/chttp2_transport.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index dae1b1e1b7..885838ec5d 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -823,24 +823,26 @@ static void unlock(transport *t) { finish_reads(t); /* gather any callbacks that need to be made */ - if (!t->calling_back && cb) { + if (!t->calling_back) { perform_callbacks = prepare_callbacks(t); if (perform_callbacks) { t->calling_back = 1; } - if (t->error_state == ERROR_STATE_SEEN && !t->writing) { - call_closed = 1; - t->calling_back = 1; - t->cb = NULL; /* no more callbacks */ - t->error_state = ERROR_STATE_NOTIFIED; - } - if (t->num_pending_goaways) { - goaways = t->pending_goaways; - num_goaways = t->num_pending_goaways; - t->pending_goaways = NULL; - t->num_pending_goaways = 0; - t->cap_pending_goaways = 0; - t->calling_back = 1; + if (cb) { + if (t->error_state == ERROR_STATE_SEEN && !t->writing && !t->calling_back) { + call_closed = 1; + t->calling_back = 1; + t->cb = NULL; /* no more callbacks */ + t->error_state = ERROR_STATE_NOTIFIED; + } + if (t->num_pending_goaways) { + goaways = t->pending_goaways; + num_goaways = t->num_pending_goaways; + t->pending_goaways = NULL; + t->num_pending_goaways = 0; + t->cap_pending_goaways = 0; + t->calling_back = 1; + } } } -- cgit v1.2.3 From 030ca38635eafc6fdc23eb942596d9f06a3ce5d7 Mon Sep 17 00:00:00 2001 From: Donna Dionne Date: Wed, 6 May 2015 15:09:58 -0700 Subject: more division of logs to make it easier to analyze test results. --- tools/gce_setup/cloud_prod_runner.sh | 22 ++++++++++++---------- tools/gce_setup/interop_test_runner.sh | 14 ++++++++------ 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/tools/gce_setup/cloud_prod_runner.sh b/tools/gce_setup/cloud_prod_runner.sh index 5f3b61eb52..c044d638c4 100755 --- a/tools/gce_setup/cloud_prod_runner.sh +++ b/tools/gce_setup/cloud_prod_runner.sh @@ -32,7 +32,8 @@ thisfile=$(readlink -ne "${BASH_SOURCE[0]}") current_time=$(date "+%Y-%m-%d-%H-%M-%S") result_file_name=cloud_prod_result.$current_time.html echo $result_file_name -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_log_history +pass_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_pass_log_history +fail_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/cloud_prod_fail_log_history main() { source grpc_docker.sh @@ -46,11 +47,11 @@ main() { log_file_name=cloud_{$test_case}_{$client}.txt if grpc_cloud_prod_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name - echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_pass_log_history/$log_file_name + echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name - echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_fail_log_history/$log_file_name + echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt fi done done @@ -61,18 +62,19 @@ main() { log_file_name=cloud_{$test_case}_{$client}.txt if grpc_cloud_prod_auth_test $test_case grpc-docker-testclients $client > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name - echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_pass_log_history/$log_file_name + echo " ['$test_case', '$client', 'prod', true, 'log']," >> /tmp/cloud_prod_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_log_history/$log_file_name - echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/cloud_prod_fail_log_history/$log_file_name + echo " ['$test_case', '$client', 'prod', false, 'log']," >> /tmp/cloud_prod_result.txt fi done done if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then cat pre.html /tmp/cloud_prod_result.txt post.html > /tmp/cloud_prod_result.html gsutil cp /tmp/cloud_prod_result.txt gs://stoked-keyword-656-output/cloud_prod_result.txt - gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_log_history gs://stoked-keyword-656-output/log + gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_pass_log_history gs://stoked-keyword-656-output/log + gsutil cp -R gs://stoked-keyword-656-output/cloud_prod_fail_log_history gs://stoked-keyword-656-output/log gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/cloud_prod_result.html gsutil cp /tmp/cloud_prod_result.html gs://stoked-keyword-656-output/result_history/$result_file_name rm /tmp/cloud_prod_result.txt diff --git a/tools/gce_setup/interop_test_runner.sh b/tools/gce_setup/interop_test_runner.sh index ff3d536930..6ff3731985 100755 --- a/tools/gce_setup/interop_test_runner.sh +++ b/tools/gce_setup/interop_test_runner.sh @@ -32,7 +32,8 @@ thisfile=$(readlink -ne "${BASH_SOURCE[0]}") current_time=$(date "+%Y-%m-%d-%H-%M-%S") result_file_name=interop_result.$current_time.html echo $result_file_name -log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_log_history +pass_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_pass_log_history +fail_log_link=https://pantheon.corp.google.com/m/cloudstorage/b/stoked-keyword-656-output/o/log/interop_fail_log_history main() { source grpc_docker.sh @@ -48,11 +49,11 @@ main() { log_file_name=interop_{$test_case}_{$client}_{$server}.txt if grpc_interop_test $test_case grpc-docker-testclients $client grpc-docker-server $server > /tmp/$log_file_name 2>&1 then - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/inteorp_log_history/$log_file_name - echo " ['$test_case', '$client', '$server', true, 'log']," >> /tmp/interop_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_pass_log_history/$log_file_name + echo " ['$test_case', '$client', '$server', true, 'log']," >> /tmp/interop_result.txt else - gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_log_history/$log_file_name - echo " ['$test_case', '$client', '$server', false, 'log']," >> /tmp/interop_result.txt + gsutil cp /tmp/$log_file_name gs://stoked-keyword-656-output/interop_fail_log_history/$log_file_name + echo " ['$test_case', '$client', '$server', false, 'log']," >> /tmp/interop_result.txt fi done done @@ -60,7 +61,8 @@ main() { if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then cat pre.html /tmp/interop_result.txt post.html > /tmp/interop_result.html gsutil cp /tmp/interop_result.txt gs://stoked-keyword-656-output/interop_result.txt - gsutil cp -R gs://stoked-keyword-656-output/interop_log_history gs://stoked-keyword-656-output/log + gsutil cp -R gs://stoked-keyword-656-output/interop_pass_log_history gs://stoked-keyword-656-output/log + gsutil cp -R gs://stoked-keyword-656-output/interop_fail_log_history gs://stoked-keyword-656-output/log gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/interop_result.html gsutil cp /tmp/interop_result.html gs://stoked-keyword-656-output/result_history/$result_file_name rm /tmp/interop_result.txt -- cgit v1.2.3 From b96d0015840cbb5a22212cb70852fc8b99a67a81 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 6 May 2015 15:33:23 -0700 Subject: Validate that headers contain legal bytes --- include/grpc/grpc.h | 4 +++- src/core/surface/call.c | 37 +++++++++++++++++++++++++++++-------- src/core/transport/metadata.c | 16 ++++++++++++++++ src/core/transport/metadata.h | 3 +++ 4 files changed, 51 insertions(+), 9 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9bb826f323..3348653956 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -140,7 +140,9 @@ typedef enum grpc_call_error { /* there is already an outstanding read/write operation on the call */ GRPC_CALL_ERROR_TOO_MANY_OPERATIONS, /* the flags value was illegal for this call */ - GRPC_CALL_ERROR_INVALID_FLAGS + GRPC_CALL_ERROR_INVALID_FLAGS, + /* invalid metadata was passed to this call */ + GRPC_CALL_ERROR_INVALID_METADATA } grpc_call_error; /* Result of a grpc operation */ diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 7ab9142947..9ee91785e8 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -739,14 +739,9 @@ static void call_on_done_recv(void *pc, int success) { GRPC_TIMER_BEGIN(GRPC_PTAG_CALL_ON_DONE_RECV, 0); } -static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, - grpc_metadata *metadata) { +static int prepare_application_metadata(grpc_call *call, size_t count, + grpc_metadata *metadata) { size_t i; - grpc_mdelem_list out; - if (count == 0) { - out.head = out.tail = NULL; - return out; - } for (i = 0; i < count; i++) { grpc_metadata *md = &metadata[i]; grpc_metadata *next_md = (i == count - 1) ? NULL : &metadata[i + 1]; @@ -756,9 +751,27 @@ static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, l->md = grpc_mdelem_from_string_and_buffer(call->metadata_context, md->key, (const gpr_uint8 *)md->value, md->value_length); + if (!grpc_mdstr_is_legal_header(l->md->key)) { + gpr_log(GPR_ERROR, "attempt to send invalid metadata key"); + return 0; + } else if (!grpc_mdstr_is_bin_suffixed(l->md->key) && + !grpc_mdstr_is_legal_header(l->md->value)) { + gpr_log(GPR_ERROR, "attempt to send invalid metadata value"); + return 0; + } l->next = next_md ? (grpc_linked_mdelem *)&next_md->internal_data : NULL; l->prev = prev_md ? (grpc_linked_mdelem *)&prev_md->internal_data : NULL; } + return 1; +} + +static grpc_mdelem_list chain_metadata_from_app(grpc_call *call, size_t count, + grpc_metadata *metadata) { + grpc_mdelem_list out; + if (count == 0) { + out.head = out.tail = NULL; + return out; + } out.head = (grpc_linked_mdelem *)&(metadata[0].internal_data); out.tail = (grpc_linked_mdelem *)&(metadata[count - 1].internal_data); return out; @@ -954,8 +967,16 @@ static grpc_call_error start_ioreq(grpc_call *call, const grpc_ioreq *reqs, } else if (call->request_set[op] == REQSET_DONE) { return start_ioreq_error(call, have_ops, GRPC_CALL_ERROR_ALREADY_INVOKED); } - have_ops |= 1u << op; data = reqs[i].data; + if (op == GRPC_IOREQ_SEND_INITIAL_METADATA || + op == GRPC_IOREQ_SEND_TRAILING_METADATA) { + if (!prepare_application_metadata(call, data.send_metadata.count, + data.send_metadata.metadata)) { + return start_ioreq_error(call, have_ops, + GRPC_CALL_ERROR_INVALID_METADATA); + } + } + have_ops |= 1u << op; call->request_data[op] = data; call->request_set[op] = set; diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index 74e94b2c24..c80d67823f 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -569,3 +569,19 @@ void grpc_mdctx_locked_mdelem_unref(grpc_mdctx *ctx, grpc_mdelem *gmd) { } void grpc_mdctx_unlock(grpc_mdctx *ctx) { unlock(ctx); } + +int grpc_mdstr_is_legal_header(grpc_mdstr *s) { + /* TODO(ctiller): consider caching this, or computing it on construction */ + const gpr_uint8 *p = GPR_SLICE_START_PTR(s->slice); + const gpr_uint8 *e = GPR_SLICE_END_PTR(s->slice); + for (; p != e; p++) { + if (*p < 32 || *p > 126) return 0; + } + return 1; +} + +int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s) { + /* TODO(ctiller): consider caching this */ + return grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(s->slice), + GPR_SLICE_LENGTH(s->slice)); +} diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index 21b8ae2b78..e7508718f5 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -135,6 +135,9 @@ void grpc_mdelem_unref(grpc_mdelem *md); Does not promise that the returned string has no embedded nulls however. */ const char *grpc_mdstr_as_c_string(grpc_mdstr *s); +int grpc_mdstr_is_legal_header(grpc_mdstr *s); +int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s); + /* Batch mode metadata functions. These API's have equivalents above, but allow taking the mdctx just once, performing a bunch of work, and then leaving the mdctx. */ -- cgit v1.2.3 From 2da029647803aa26e393faa1422beecae7d1805a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 6 May 2015 16:14:25 -0700 Subject: Eliminate need for SIGPIPE handling --- include/grpc/support/port_platform.h | 4 ++++ src/core/iomgr/socket_utils_common_posix.c | 13 +++++++++++++ src/core/iomgr/socket_utils_posix.h | 5 +++++ src/core/iomgr/tcp_client_posix.c | 3 ++- src/core/iomgr/tcp_posix.c | 8 +++++++- src/core/iomgr/tcp_server_posix.c | 5 ++++- test/core/util/test_config.c | 4 ---- test/cpp/qps/smoke_test.cc | 1 - 8 files changed, 35 insertions(+), 8 deletions(-) diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 671648a976..df7861c7b6 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -80,6 +80,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 #elif defined(__linux__) #ifndef _BSD_SOURCE #define _BSD_SOURCE @@ -124,6 +125,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -155,6 +157,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ @@ -180,6 +183,7 @@ #define GPR_POSIX_SYNC 1 #define GPR_POSIX_TIME 1 #define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 #ifdef _LP64 #define GPR_ARCH_64 1 #else /* _LP64 */ diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/iomgr/socket_utils_common_posix.c index 3c8cafa315..a9af594700 100644 --- a/src/core/iomgr/socket_utils_common_posix.c +++ b/src/core/iomgr/socket_utils_common_posix.c @@ -76,6 +76,19 @@ int grpc_set_socket_nonblocking(int fd, int non_blocking) { return 1; } +int grpc_set_socket_no_sigpipe_if_possible(int fd) { +#ifdef GPR_HAVE_SO_NOSIGPIPE + int val = 1; + int newval; + socklen_t intlen = sizeof(newval); + return 0 == setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val)) && + 0 == getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &newval, &intlen) && + (newval != 0) == val; +#else + return 1; +#endif +} + /* set a socket to close on exec */ int grpc_set_socket_cloexec(int fd, int close_on_exec) { int oldflags = fcntl(fd, F_GETFD, 0); diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/iomgr/socket_utils_posix.h index c161082afc..d2a315b462 100644 --- a/src/core/iomgr/socket_utils_posix.h +++ b/src/core/iomgr/socket_utils_posix.h @@ -63,6 +63,11 @@ int grpc_set_socket_low_latency(int fd, int low_latency); state to library users, we turn off IPv6 sockets. */ int grpc_ipv6_loopback_available(void); +/* Tries to set SO_NOSIGPIPE if available on this platform. + Returns 1 on success, 0 on failure. + If SO_NO_SIGPIPE is not available, returns 1. */ +int grpc_set_socket_no_sigpipe_if_possible(int fd); + /* An enum to keep track of IPv4/IPv6 socket modes. Currently, this information is only used when a socket is first created, but diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/iomgr/tcp_client_posix.c index e20cc3d1b2..2401fe00e4 100644 --- a/src/core/iomgr/tcp_client_posix.c +++ b/src/core/iomgr/tcp_client_posix.c @@ -69,7 +69,8 @@ static int prepare_socket(const struct sockaddr *addr, int fd) { } if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || - (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1))) { + (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1)) || + !grpc_set_socket_no_sigpipe_if_possible(fd)) { gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, strerror(errno)); goto error; diff --git a/src/core/iomgr/tcp_posix.c b/src/core/iomgr/tcp_posix.c index 06725fbc89..f7dae5f86c 100644 --- a/src/core/iomgr/tcp_posix.c +++ b/src/core/iomgr/tcp_posix.c @@ -53,6 +53,12 @@ #include #include +#ifdef GPR_HAVE_MSG_NOSIGNAL +#define SENDMSG_FLAGS MSG_NOSIGNAL +#else +#define SENDMSG_FLAGS 0 +#endif + /* Holds a slice array and associated state. */ typedef struct grpc_tcp_slice_state { gpr_slice *slices; /* Array of slices */ @@ -461,7 +467,7 @@ static grpc_endpoint_write_status grpc_tcp_flush(grpc_tcp *tcp) { GRPC_TIMER_BEGIN(GRPC_PTAG_SENDMSG, 0); do { /* TODO(klempner): Cork if this is a partial write */ - sent_length = sendmsg(tcp->fd, &msg, 0); + sent_length = sendmsg(tcp->fd, &msg, SENDMSG_FLAGS); } while (sent_length < 0 && errno == EINTR); GRPC_TIMER_END(GRPC_PTAG_SENDMSG, 0); diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/iomgr/tcp_server_posix.c index 7e31f2d7a5..d1cd8a769c 100644 --- a/src/core/iomgr/tcp_server_posix.c +++ b/src/core/iomgr/tcp_server_posix.c @@ -235,7 +235,8 @@ static int prepare_socket(int fd, const struct sockaddr *addr, int addr_len) { if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) || (addr->sa_family != AF_UNIX && (!grpc_set_socket_low_latency(fd, 1) || - !grpc_set_socket_reuse_addr(fd, 1)))) { + !grpc_set_socket_reuse_addr(fd, 1))) || + !grpc_set_socket_no_sigpipe_if_possible(fd)) { gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd, strerror(errno)); goto error; @@ -296,6 +297,8 @@ static void on_read(void *arg, int success) { } } + grpc_set_socket_no_sigpipe_if_possible(fd); + sp->server->cb( sp->server->cb_arg, grpc_tcp_create(grpc_fd_create(fd), GRPC_TCP_DEFAULT_READ_SLICE_SIZE)); diff --git a/test/core/util/test_config.c b/test/core/util/test_config.c index 1f0f0175b1..be69fcf675 100644 --- a/test/core/util/test_config.c +++ b/test/core/util/test_config.c @@ -49,10 +49,6 @@ static int seed(void) { return _getpid(); } #endif void grpc_test_init(int argc, char **argv) { -#ifndef GPR_WIN32 - /* disable SIGPIPE */ - signal(SIGPIPE, SIG_IGN); -#endif gpr_log(GPR_DEBUG, "test slowdown: machine=%f build=%f total=%f", GRPC_TEST_SLOWDOWN_MACHINE_FACTOR, GRPC_TEST_SLOWDOWN_BUILD_FACTOR, GRPC_TEST_SLOWDOWN_FACTOR); diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc index 2c60a9997c..1a44833940 100644 --- a/test/cpp/qps/smoke_test.cc +++ b/test/cpp/qps/smoke_test.cc @@ -138,7 +138,6 @@ static void RunQPS() { } // namespace grpc int main(int argc, char** argv) { - signal(SIGPIPE, SIG_IGN); using namespace grpc::testing; RunSynchronousStreamingPingPong(); RunSynchronousUnaryPingPong(); -- cgit v1.2.3 From 1d74de996c9c9cbd1686d6e9367c0a5571190fc3 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 7 May 2015 08:19:49 -0700 Subject: Cleanup unlock() a little --- src/core/transport/chttp2_transport.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 885838ec5d..ea24796f35 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -824,12 +824,9 @@ static void unlock(transport *t) { /* gather any callbacks that need to be made */ if (!t->calling_back) { - perform_callbacks = prepare_callbacks(t); - if (perform_callbacks) { - t->calling_back = 1; - } + t->calling_back = perform_callbacks = prepare_callbacks(t); if (cb) { - if (t->error_state == ERROR_STATE_SEEN && !t->writing && !t->calling_back) { + if (t->error_state == ERROR_STATE_SEEN && !t->writing) { call_closed = 1; t->calling_back = 1; t->cb = NULL; /* no more callbacks */ -- cgit v1.2.3 From 9b9a877eae6406867ae1f03204066639b8a73593 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 6 May 2015 14:43:51 -0700 Subject: change todo comment --- src/csharp/Grpc.Core/Internal/AsyncCallServer.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs index 3c66c67dcc..171d0c799d 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallServer.cs @@ -138,9 +138,7 @@ namespace Grpc.Core.Internal ReleaseResourcesIfPossible(); } - // TODO(jtattermusch): check if call was cancelled. - - // TODO: handle error ... + // TODO(jtattermusch): handle error finishedServersideTcs.SetResult(null); } -- cgit v1.2.3 From bdb1b4863bf0d03fb08f240677a7aa3726bb3f1c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 6 May 2015 14:46:25 -0700 Subject: add a generic constraint for TRequest and TResponse to require a class --- src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 4 +++- src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs | 4 +++- src/csharp/Grpc.Core/AsyncServerStreamingCall.cs | 3 ++- src/csharp/Grpc.Core/Call.cs | 2 ++ src/csharp/Grpc.Core/Calls.cs | 10 ++++++++++ src/csharp/Grpc.Core/IAsyncStreamReader.cs | 3 ++- src/csharp/Grpc.Core/IAsyncStreamWriter.cs | 1 + src/csharp/Grpc.Core/IClientStreamWriter.cs | 1 + src/csharp/Grpc.Core/IServerStreamWriter.cs | 1 + src/csharp/Grpc.Core/Internal/ClientRequestStream.cs | 2 ++ src/csharp/Grpc.Core/Internal/ClientResponseStream.cs | 2 ++ src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 8 ++++++++ src/csharp/Grpc.Core/Internal/ServerCalls.cs | 8 ++++++++ src/csharp/Grpc.Core/Internal/ServerRequestStream.cs | 2 ++ src/csharp/Grpc.Core/Internal/ServerResponseStream.cs | 2 ++ src/csharp/Grpc.Core/ServerMethods.cs | 16 ++++++++++++---- src/csharp/Grpc.Core/ServerServiceDefinition.cs | 8 ++++++++ src/csharp/Grpc.Core/Stub/AbstractStub.cs | 2 ++ 18 files changed, 71 insertions(+), 8 deletions(-) diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index e81ce01ebb..b95776f66d 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -40,7 +40,9 @@ namespace Grpc.Core /// /// Return type for client streaming calls. /// - public struct AsyncClientStreamingCall + public sealed class AsyncClientStreamingCall + where TRequest : class + where TResponse : class { readonly IClientStreamWriter requestStream; readonly Task result; diff --git a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs index 1cb30f4779..ee05437416 100644 --- a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs @@ -40,7 +40,9 @@ namespace Grpc.Core /// /// Return type for bidirectional streaming calls. /// - public struct AsyncDuplexStreamingCall + public sealed class AsyncDuplexStreamingCall + where TRequest : class + where TResponse : class { readonly IClientStreamWriter requestStream; readonly IAsyncStreamReader responseStream; diff --git a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs index d614916fb7..73b9614985 100644 --- a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs @@ -40,7 +40,8 @@ namespace Grpc.Core /// /// Return type for server streaming calls. /// - public struct AsyncServerStreamingCall + public sealed class AsyncServerStreamingCall + where TResponse : class { readonly IAsyncStreamReader responseStream; diff --git a/src/csharp/Grpc.Core/Call.cs b/src/csharp/Grpc.Core/Call.cs index 070dfb569d..771cc083da 100644 --- a/src/csharp/Grpc.Core/Call.cs +++ b/src/csharp/Grpc.Core/Call.cs @@ -41,6 +41,8 @@ namespace Grpc.Core /// Abstraction of a call to be invoked on a client. /// public class Call + where TRequest : class + where TResponse : class { readonly string name; readonly Marshaller requestMarshaller; diff --git a/src/csharp/Grpc.Core/Calls.cs b/src/csharp/Grpc.Core/Calls.cs index a8d2b9498e..ba42a2d4f8 100644 --- a/src/csharp/Grpc.Core/Calls.cs +++ b/src/csharp/Grpc.Core/Calls.cs @@ -44,6 +44,8 @@ namespace Grpc.Core public static class Calls { public static TResponse BlockingUnaryCall(Call call, TRequest req, CancellationToken token) + where TRequest : class + where TResponse : class { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); // TODO(jtattermusch): this gives a race that cancellation can be requested before the call even starts. @@ -52,6 +54,8 @@ namespace Grpc.Core } public static async Task AsyncUnaryCall(Call call, TRequest req, CancellationToken token) + where TRequest : class + where TResponse : class { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); @@ -61,6 +65,8 @@ namespace Grpc.Core } public static AsyncServerStreamingCall AsyncServerStreamingCall(Call call, TRequest req, CancellationToken token) + where TRequest : class + where TResponse : class { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); @@ -71,6 +77,8 @@ namespace Grpc.Core } public static AsyncClientStreamingCall AsyncClientStreamingCall(Call call, CancellationToken token) + where TRequest : class + where TResponse : class { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); @@ -81,6 +89,8 @@ namespace Grpc.Core } public static AsyncDuplexStreamingCall AsyncDuplexStreamingCall(Call call, CancellationToken token) + where TRequest : class + where TResponse : class { var asyncCall = new AsyncCall(call.RequestMarshaller.Serializer, call.ResponseMarshaller.Deserializer); asyncCall.Initialize(call.Channel, GetCompletionQueue(), call.Name); diff --git a/src/csharp/Grpc.Core/IAsyncStreamReader.cs b/src/csharp/Grpc.Core/IAsyncStreamReader.cs index 61cf57f7e0..699741cd05 100644 --- a/src/csharp/Grpc.Core/IAsyncStreamReader.cs +++ b/src/csharp/Grpc.Core/IAsyncStreamReader.cs @@ -44,9 +44,10 @@ namespace Grpc.Core /// /// public interface IAsyncStreamReader + where T : class { /// - /// Reads a single message. Returns default(T) if the last message was already read. + /// Reads a single message. Returns null if the last message was already read. /// A following read can only be started when the previous one finishes. /// Task ReadNext(); diff --git a/src/csharp/Grpc.Core/IAsyncStreamWriter.cs b/src/csharp/Grpc.Core/IAsyncStreamWriter.cs index 724bae8f31..4bd8bfb8df 100644 --- a/src/csharp/Grpc.Core/IAsyncStreamWriter.cs +++ b/src/csharp/Grpc.Core/IAsyncStreamWriter.cs @@ -44,6 +44,7 @@ namespace Grpc.Core /// /// public interface IAsyncStreamWriter + where T : class { /// /// Writes a single message. Only one write can be pending at a time. diff --git a/src/csharp/Grpc.Core/IClientStreamWriter.cs b/src/csharp/Grpc.Core/IClientStreamWriter.cs index 6da42e9ccc..0847a928e6 100644 --- a/src/csharp/Grpc.Core/IClientStreamWriter.cs +++ b/src/csharp/Grpc.Core/IClientStreamWriter.cs @@ -44,6 +44,7 @@ namespace Grpc.Core /// /// public interface IClientStreamWriter : IAsyncStreamWriter + where T : class { /// /// Closes the stream. Can only be called once there is no pending write. No writes should follow calling this. diff --git a/src/csharp/Grpc.Core/IServerStreamWriter.cs b/src/csharp/Grpc.Core/IServerStreamWriter.cs index e76397d8a0..199a585a3f 100644 --- a/src/csharp/Grpc.Core/IServerStreamWriter.cs +++ b/src/csharp/Grpc.Core/IServerStreamWriter.cs @@ -43,6 +43,7 @@ namespace Grpc.Core /// A writable stream of messages that is used in server-side handlers. /// public interface IServerStreamWriter : IAsyncStreamWriter + where T : class { } } diff --git a/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs b/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs index 6854922a6f..1697058732 100644 --- a/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs +++ b/src/csharp/Grpc.Core/Internal/ClientRequestStream.cs @@ -38,6 +38,8 @@ namespace Grpc.Core.Internal /// Writes requests asynchronously to an underlying AsyncCall object. /// internal class ClientRequestStream : IClientStreamWriter + where TRequest : class + where TResponse : class { readonly AsyncCall call; diff --git a/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs index 7fa511faa8..b2378cade6 100644 --- a/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs +++ b/src/csharp/Grpc.Core/Internal/ClientResponseStream.cs @@ -38,6 +38,8 @@ using System.Threading.Tasks; namespace Grpc.Core.Internal { internal class ClientResponseStream : IAsyncStreamReader + where TRequest : class + where TResponse : class { readonly AsyncCall call; diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 01b2a11369..2bef6e68b7 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -45,6 +45,8 @@ namespace Grpc.Core.Internal } internal class UnaryServerCallHandler : IServerCallHandler + where TRequest : class + where TResponse : class { readonly Method method; readonly UnaryServerMethod handler; @@ -93,6 +95,8 @@ namespace Grpc.Core.Internal } internal class ServerStreamingServerCallHandler : IServerCallHandler + where TRequest : class + where TResponse : class { readonly Method method; readonly ServerStreamingServerMethod handler; @@ -142,6 +146,8 @@ namespace Grpc.Core.Internal } internal class ClientStreamingServerCallHandler : IServerCallHandler + where TRequest : class + where TResponse : class { readonly Method method; readonly ClientStreamingServerMethod handler; @@ -195,6 +201,8 @@ namespace Grpc.Core.Internal } internal class DuplexStreamingServerCallHandler : IServerCallHandler + where TRequest : class + where TResponse : class { readonly Method method; readonly DuplexStreamingServerMethod handler; diff --git a/src/csharp/Grpc.Core/Internal/ServerCalls.cs b/src/csharp/Grpc.Core/Internal/ServerCalls.cs index 5c6b335c7f..81279678b9 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCalls.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCalls.cs @@ -41,21 +41,29 @@ namespace Grpc.Core.Internal internal static class ServerCalls { public static IServerCallHandler UnaryCall(Method method, UnaryServerMethod handler) + where TRequest : class + where TResponse : class { return new UnaryServerCallHandler(method, handler); } public static IServerCallHandler ClientStreamingCall(Method method, ClientStreamingServerMethod handler) + where TRequest : class + where TResponse : class { return new ClientStreamingServerCallHandler(method, handler); } public static IServerCallHandler ServerStreamingCall(Method method, ServerStreamingServerMethod handler) + where TRequest : class + where TResponse : class { return new ServerStreamingServerCallHandler(method, handler); } public static IServerCallHandler DuplexStreamingCall(Method method, DuplexStreamingServerMethod handler) + where TRequest : class + where TResponse : class { return new DuplexStreamingServerCallHandler(method, handler); } diff --git a/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs index aa311059c3..d9ee0c815b 100644 --- a/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs +++ b/src/csharp/Grpc.Core/Internal/ServerRequestStream.cs @@ -38,6 +38,8 @@ using System.Threading.Tasks; namespace Grpc.Core.Internal { internal class ServerRequestStream : IAsyncStreamReader + where TRequest : class + where TResponse : class { readonly AsyncCallServer call; diff --git a/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs b/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs index 686017c048..da688d504f 100644 --- a/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs +++ b/src/csharp/Grpc.Core/Internal/ServerResponseStream.cs @@ -39,6 +39,8 @@ namespace Grpc.Core.Internal /// Writes responses asynchronously to an underlying AsyncCallServer object. /// internal class ServerResponseStream : IServerStreamWriter + where TRequest : class + where TResponse : class { readonly AsyncCallServer call; diff --git a/src/csharp/Grpc.Core/ServerMethods.cs b/src/csharp/Grpc.Core/ServerMethods.cs index 6646bb5a89..291835671f 100644 --- a/src/csharp/Grpc.Core/ServerMethods.cs +++ b/src/csharp/Grpc.Core/ServerMethods.cs @@ -42,20 +42,28 @@ namespace Grpc.Core /// /// Server-side handler for unary call. /// - public delegate Task UnaryServerMethod(TRequest request); + public delegate Task UnaryServerMethod(TRequest request) + where TRequest : class + where TResponse : class; /// /// Server-side handler for client streaming call. /// - public delegate Task ClientStreamingServerMethod(IAsyncStreamReader requestStream); + public delegate Task ClientStreamingServerMethod(IAsyncStreamReader requestStream) + where TRequest : class + where TResponse : class; /// /// Server-side handler for server streaming call. /// - public delegate Task ServerStreamingServerMethod(TRequest request, IServerStreamWriter responseStream); + public delegate Task ServerStreamingServerMethod(TRequest request, IServerStreamWriter responseStream) + where TRequest : class + where TResponse : class; /// /// Server-side handler for bidi streaming call. /// - public delegate Task DuplexStreamingServerMethod(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); + public delegate Task DuplexStreamingServerMethod(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + where TRequest : class + where TResponse : class; } diff --git a/src/csharp/Grpc.Core/ServerServiceDefinition.cs b/src/csharp/Grpc.Core/ServerServiceDefinition.cs index 01b1dc8f7b..81846beb2f 100644 --- a/src/csharp/Grpc.Core/ServerServiceDefinition.cs +++ b/src/csharp/Grpc.Core/ServerServiceDefinition.cs @@ -76,6 +76,8 @@ namespace Grpc.Core public Builder AddMethod( Method method, UnaryServerMethod handler) + where TRequest : class + where TResponse : class { callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.UnaryCall(method, handler)); return this; @@ -84,6 +86,8 @@ namespace Grpc.Core public Builder AddMethod( Method method, ClientStreamingServerMethod handler) + where TRequest : class + where TResponse : class { callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ClientStreamingCall(method, handler)); return this; @@ -92,6 +96,8 @@ namespace Grpc.Core public Builder AddMethod( Method method, ServerStreamingServerMethod handler) + where TRequest : class + where TResponse : class { callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.ServerStreamingCall(method, handler)); return this; @@ -100,6 +106,8 @@ namespace Grpc.Core public Builder AddMethod( Method method, DuplexStreamingServerMethod handler) + where TRequest : class + where TResponse : class { callHandlers.Add(GetFullMethodName(serviceName, method.Name), ServerCalls.DuplexStreamingCall(method, handler)); return this; diff --git a/src/csharp/Grpc.Core/Stub/AbstractStub.cs b/src/csharp/Grpc.Core/Stub/AbstractStub.cs index cf5ab958c5..4a8b254357 100644 --- a/src/csharp/Grpc.Core/Stub/AbstractStub.cs +++ b/src/csharp/Grpc.Core/Stub/AbstractStub.cs @@ -64,6 +64,8 @@ namespace Grpc.Core /// Creates a new call to given method. /// protected Call CreateCall(string serviceName, Method method) + where TRequest : class + where TResponse : class { var headerBuilder = Metadata.CreateBuilder(); config.HeaderInterceptor(headerBuilder); -- cgit v1.2.3 From 8ab1f7ed3d2f8af7702df95139a6b62aa76b5f0e Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 6 May 2015 15:56:30 -0700 Subject: added concept of ServerCallContext, that is passed to all server-side handlers --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 4 +- src/csharp/Grpc.Core/Grpc.Core.csproj | 1 + src/csharp/Grpc.Core/Internal/ServerCallHandler.cs | 12 +++-- src/csharp/Grpc.Core/ServerCallContext.cs | 56 ++++++++++++++++++++++ src/csharp/Grpc.Core/ServerMethods.cs | 8 ++-- src/csharp/Grpc.Examples/MathGrpc.cs | 8 ++-- src/csharp/Grpc.Examples/MathServiceImpl.cs | 8 ++-- .../Grpc.IntegrationTesting/TestServiceGrpc.cs | 12 ++--- .../Grpc.IntegrationTesting/TestServiceImpl.cs | 12 ++--- 9 files changed, 91 insertions(+), 30 deletions(-) create mode 100644 src/csharp/Grpc.Core/ServerCallContext.cs diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index caa6220f2c..4eb542fae8 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -220,7 +220,7 @@ namespace Grpc.Core.Tests } } - private static async Task EchoHandler(string request) + private static async Task EchoHandler(ServerCallContext context, string request) { if (request == "THROW") { @@ -229,7 +229,7 @@ namespace Grpc.Core.Tests return request; } - private static async Task ConcatAndEchoHandler(IAsyncStreamReader requestStream) + private static async Task ConcatAndEchoHandler(ServerCallContext context, IAsyncStreamReader requestStream) { string result = ""; await requestStream.ForEach(async (request) => diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index 9c91541d90..f5f2cf5f22 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -96,6 +96,7 @@ + diff --git a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs index 2bef6e68b7..95d8e97869 100644 --- a/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs +++ b/src/csharp/Grpc.Core/Internal/ServerCallHandler.cs @@ -74,7 +74,8 @@ namespace Grpc.Core.Internal var request = await requestStream.ReadNext(); // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. Preconditions.CheckArgument(await requestStream.ReadNext() == null); - var result = await handler(request); + var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context + var result = await handler(context, request); await responseStream.Write(result); } catch (Exception e) @@ -125,7 +126,8 @@ namespace Grpc.Core.Internal // TODO(jtattermusch): we need to read the full stream so that native callhandle gets deallocated. Preconditions.CheckArgument(await requestStream.ReadNext() == null); - await handler(request, responseStream); + var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context + await handler(context, request, responseStream); } catch (Exception e) { @@ -168,11 +170,12 @@ namespace Grpc.Core.Internal var finishedTask = asyncCall.ServerSideCallAsync(); var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); + var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context Status status = Status.DefaultSuccess; try { - var result = await handler(requestStream); + var result = await handler(context, requestStream); try { await responseStream.Write(result); @@ -223,11 +226,12 @@ namespace Grpc.Core.Internal var finishedTask = asyncCall.ServerSideCallAsync(); var requestStream = new ServerRequestStream(asyncCall); var responseStream = new ServerResponseStream(asyncCall); + var context = new ServerCallContext(); // TODO(jtattermusch): initialize the context Status status = Status.DefaultSuccess; try { - await handler(requestStream, responseStream); + await handler(context, requestStream, responseStream); } catch (Exception e) { diff --git a/src/csharp/Grpc.Core/ServerCallContext.cs b/src/csharp/Grpc.Core/ServerCallContext.cs new file mode 100644 index 0000000000..e873b3e88a --- /dev/null +++ b/src/csharp/Grpc.Core/ServerCallContext.cs @@ -0,0 +1,56 @@ +#region Copyright notice and license + +// Copyright 2015, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Grpc.Core +{ + /// + /// Context for a server-side call. + /// + public sealed class ServerCallContext + { + + // TODO(jtattermusch): add cancellationToken + + // TODO(jtattermusch): add deadline info + + // TODO(jtattermusch): expose initial metadata sent by client for reading + + // TODO(jtattermusch): expose method to send initial metadata back to client + + // TODO(jtattermusch): allow setting status and trailing metadata to send after handler completes. + } +} diff --git a/src/csharp/Grpc.Core/ServerMethods.cs b/src/csharp/Grpc.Core/ServerMethods.cs index 291835671f..377b78eb30 100644 --- a/src/csharp/Grpc.Core/ServerMethods.cs +++ b/src/csharp/Grpc.Core/ServerMethods.cs @@ -42,28 +42,28 @@ namespace Grpc.Core /// /// Server-side handler for unary call. /// - public delegate Task UnaryServerMethod(TRequest request) + public delegate Task UnaryServerMethod(ServerCallContext context, TRequest request) where TRequest : class where TResponse : class; /// /// Server-side handler for client streaming call. /// - public delegate Task ClientStreamingServerMethod(IAsyncStreamReader requestStream) + public delegate Task ClientStreamingServerMethod(ServerCallContext context, IAsyncStreamReader requestStream) where TRequest : class where TResponse : class; /// /// Server-side handler for server streaming call. /// - public delegate Task ServerStreamingServerMethod(TRequest request, IServerStreamWriter responseStream) + public delegate Task ServerStreamingServerMethod(ServerCallContext context, TRequest request, IServerStreamWriter responseStream) where TRequest : class where TResponse : class; /// /// Server-side handler for bidi streaming call. /// - public delegate Task DuplexStreamingServerMethod(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + public delegate Task DuplexStreamingServerMethod(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream) where TRequest : class where TResponse : class; } diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 60408b9018..03f5c31cb7 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -133,13 +133,13 @@ namespace math // server-side interface public interface IMathService { - Task Div(DivArgs request); + Task Div(ServerCallContext context, DivArgs request); - Task Fib(FibArgs request, IServerStreamWriter responseStream); + Task Fib(ServerCallContext context, FibArgs request, IServerStreamWriter responseStream); - Task Sum(IAsyncStreamReader requestStream); + Task Sum(ServerCallContext context, IAsyncStreamReader requestStream); - Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); + Task DivMany(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream); } public static ServerServiceDefinition BindService(IMathService serviceImpl) diff --git a/src/csharp/Grpc.Examples/MathServiceImpl.cs b/src/csharp/Grpc.Examples/MathServiceImpl.cs index 83ec2a8c3d..800dee8735 100644 --- a/src/csharp/Grpc.Examples/MathServiceImpl.cs +++ b/src/csharp/Grpc.Examples/MathServiceImpl.cs @@ -46,12 +46,12 @@ namespace math /// public class MathServiceImpl : MathGrpc.IMathService { - public Task Div(DivArgs request) + public Task Div(ServerCallContext context, DivArgs request) { return Task.FromResult(DivInternal(request)); } - public async Task Fib(FibArgs request, IServerStreamWriter responseStream) + public async Task Fib(ServerCallContext context, FibArgs request, IServerStreamWriter responseStream) { if (request.Limit <= 0) { @@ -68,7 +68,7 @@ namespace math } } - public async Task Sum(IAsyncStreamReader requestStream) + public async Task Sum(ServerCallContext context, IAsyncStreamReader requestStream) { long sum = 0; await requestStream.ForEach(async num => @@ -78,7 +78,7 @@ namespace math return Num.CreateBuilder().SetNum_(sum).Build(); } - public async Task DivMany(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + public async Task DivMany(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream) { await requestStream.ForEach(async divArgs => { diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs index d1f8aa12c7..9f14dad6c0 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestServiceGrpc.cs @@ -171,17 +171,17 @@ namespace grpc.testing // server-side interface public interface ITestService { - Task EmptyCall(Empty request); + Task EmptyCall(ServerCallContext context, Empty request); - Task UnaryCall(SimpleRequest request); + Task UnaryCall(ServerCallContext context, SimpleRequest request); - Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter responseStream); + Task StreamingOutputCall(ServerCallContext context, StreamingOutputCallRequest request, IServerStreamWriter responseStream); - Task StreamingInputCall(IAsyncStreamReader requestStream); + Task StreamingInputCall(ServerCallContext context, IAsyncStreamReader requestStream); - Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); + Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream); - Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream); + Task HalfDuplexCall(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream); } public static ServerServiceDefinition BindService(ITestService serviceImpl) diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs index 8b0cf3a2d0..40f32b5a88 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs @@ -46,19 +46,19 @@ namespace grpc.testing /// public class TestServiceImpl : TestServiceGrpc.ITestService { - public Task EmptyCall(Empty request) + public Task EmptyCall(ServerCallContext context, Empty request) { return Task.FromResult(Empty.DefaultInstance); } - public Task UnaryCall(SimpleRequest request) + public Task UnaryCall(ServerCallContext context, SimpleRequest request) { var response = SimpleResponse.CreateBuilder() .SetPayload(CreateZerosPayload(request.ResponseSize)).Build(); return Task.FromResult(response); } - public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter responseStream) + public async Task StreamingOutputCall(ServerCallContext context, StreamingOutputCallRequest request, IServerStreamWriter responseStream) { foreach (var responseParam in request.ResponseParametersList) { @@ -68,7 +68,7 @@ namespace grpc.testing } } - public async Task StreamingInputCall(IAsyncStreamReader requestStream) + public async Task StreamingInputCall(ServerCallContext context, IAsyncStreamReader requestStream) { int sum = 0; await requestStream.ForEach(async request => @@ -78,7 +78,7 @@ namespace grpc.testing return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build(); } - public async Task FullDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + public async Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream) { await requestStream.ForEach(async request => { @@ -91,7 +91,7 @@ namespace grpc.testing }); } - public async Task HalfDuplexCall(IAsyncStreamReader requestStream, IServerStreamWriter responseStream) + public async Task HalfDuplexCall(ServerCallContext context, IAsyncStreamReader requestStream, IServerStreamWriter responseStream) { throw new NotImplementedException(); } -- cgit v1.2.3 From 03e82e2cdffbc0d4c19cea9d16e24d0dbf353376 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 6 May 2015 16:37:12 -0700 Subject: Split address passed to AddListeningPort into host and port --- src/csharp/Grpc.Core.Tests/ClientServerTest.cs | 2 +- src/csharp/Grpc.Core.Tests/ServerTest.cs | 2 +- src/csharp/Grpc.Core/Server.cs | 53 +++++++++++++++------- src/csharp/Grpc.Examples.MathServer/MathServer.cs | 2 +- .../Grpc.Examples.Tests/MathClientServerTests.cs | 2 +- .../InteropClientServerTest.cs | 2 +- .../Grpc.IntegrationTesting/InteropServer.cs | 9 ++-- 7 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 4eb542fae8..b69b933aba 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -84,7 +84,7 @@ namespace Grpc.Core.Tests { server = new Server(); server.AddServiceDefinition(ServiceDefinition); - int port = server.AddListeningPort(Host + ":0"); + int port = server.AddListeningPort(Host, Server.PickUnusedPort); server.Start(); channel = new Channel(Host + ":" + port); } diff --git a/src/csharp/Grpc.Core.Tests/ServerTest.cs b/src/csharp/Grpc.Core.Tests/ServerTest.cs index 2a1855da67..02c773c9cc 100644 --- a/src/csharp/Grpc.Core.Tests/ServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ServerTest.cs @@ -47,7 +47,7 @@ namespace Grpc.Core.Tests GrpcEnvironment.Initialize(); Server server = new Server(); - server.AddListeningPort("localhost:0"); + server.AddListeningPort("localhost", Server.PickUnusedPort); server.Start(); server.ShutdownAsync().Wait(); diff --git a/src/csharp/Grpc.Core/Server.cs b/src/csharp/Grpc.Core/Server.cs index a3000cee46..0df46bb25b 100644 --- a/src/csharp/Grpc.Core/Server.cs +++ b/src/csharp/Grpc.Core/Server.cs @@ -47,6 +47,11 @@ namespace Grpc.Core /// public class Server { + /// + /// Pass this value as port to have the server choose an unused listening port for you. + /// + public const int PickUnusedPort = 0; + // TODO(jtattermusch) : make sure the delegate doesn't get garbage collected while // native callbacks are in the completion queue. readonly ServerShutdownCallbackDelegate serverShutdownHandler; @@ -89,29 +94,25 @@ namespace Grpc.Core /// Add a non-secure port on which server should listen. /// Only call this before Start(). /// - public int AddListeningPort(string addr) + /// The port on which server will be listening. + /// the host + /// the port. If zero, an unused port is chosen automatically. + public int AddListeningPort(string host, int port) { - lock (myLock) - { - Preconditions.CheckState(!startRequested); - return handle.AddListeningPort(addr); - } + return AddListeningPortInternal(host, port, null); } /// - /// Add a secure port on which server should listen. + /// Add a non-secure port on which server should listen. /// Only call this before Start(). /// - public int AddListeningPort(string addr, ServerCredentials credentials) + /// The port on which server will be listening. + /// the host + /// the port. If zero, , an unused port is chosen automatically. + public int AddListeningPort(string host, int port, ServerCredentials credentials) { - lock (myLock) - { - Preconditions.CheckState(!startRequested); - using (var nativeCredentials = credentials.ToNativeCredentials()) - { - return handle.AddListeningPort(addr, nativeCredentials); - } - } + Preconditions.CheckNotNull(credentials); + return AddListeningPortInternal(host, port, credentials); } /// @@ -164,6 +165,26 @@ namespace Grpc.Core handle.Dispose(); } + private int AddListeningPortInternal(string host, int port, ServerCredentials credentials) + { + lock (myLock) + { + Preconditions.CheckState(!startRequested); + var address = string.Format("{0}:{1}", host, port); + if (credentials != null) + { + using (var nativeCredentials = credentials.ToNativeCredentials()) + { + return handle.AddListeningPort(address, nativeCredentials); + } + } + else + { + return handle.AddListeningPort(address); + } + } + } + /// /// Allows one new RPC call to be received by server. /// diff --git a/src/csharp/Grpc.Examples.MathServer/MathServer.cs b/src/csharp/Grpc.Examples.MathServer/MathServer.cs index abc7ef05e4..cfde9b42c7 100644 --- a/src/csharp/Grpc.Examples.MathServer/MathServer.cs +++ b/src/csharp/Grpc.Examples.MathServer/MathServer.cs @@ -46,7 +46,7 @@ namespace math Server server = new Server(); server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); - int port = server.AddListeningPort(host + ":23456"); + int port = server.AddListeningPort(host, 23456); server.Start(); Console.WriteLine("MathServer listening on port " + port); diff --git a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs index 332795e0e5..4ada95edd6 100644 --- a/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs +++ b/src/csharp/Grpc.Examples.Tests/MathClientServerTests.cs @@ -59,7 +59,7 @@ namespace math.Tests server = new Server(); server.AddServiceDefinition(MathGrpc.BindService(new MathServiceImpl())); - int port = server.AddListeningPort(host + ":0"); + int port = server.AddListeningPort(host, Server.PickUnusedPort); server.Start(); channel = new Channel(host + ":" + port); diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs index 45380227c2..9e49ce0d17 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs @@ -59,7 +59,7 @@ namespace Grpc.IntegrationTesting server = new Server(); server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl())); - int port = server.AddListeningPort(host + ":0", TestCredentials.CreateTestServerCredentials()); + int port = server.AddListeningPort(host, Server.PickUnusedPort, TestCredentials.CreateTestServerCredentials()); server.Start(); var channelArgs = ChannelArgs.CreateBuilder() diff --git a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs index ad5200774f..ca54aed041 100644 --- a/src/csharp/Grpc.IntegrationTesting/InteropServer.cs +++ b/src/csharp/Grpc.IntegrationTesting/InteropServer.cs @@ -93,16 +93,17 @@ namespace Grpc.IntegrationTesting var server = new Server(); server.AddServiceDefinition(TestServiceGrpc.BindService(new TestServiceImpl())); - string addr = "0.0.0.0:" + options.port; + string host = "0.0.0.0"; + int port = options.port.Value; if (options.useTls) { - server.AddListeningPort(addr, TestCredentials.CreateTestServerCredentials()); + server.AddListeningPort(host, port, TestCredentials.CreateTestServerCredentials()); } else { - server.AddListeningPort(addr); + server.AddListeningPort(host, options.port.Value); } - Console.WriteLine("Running server on " + addr); + Console.WriteLine("Running server on " + string.Format("{0}:{1}", host, port)); server.Start(); server.ShutdownTask.Wait(); -- cgit v1.2.3 From aa518cc3bfd5305aaa6448e6dfcf2cfe7d11a51b Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Thu, 7 May 2015 10:02:49 -0700 Subject: Add 'installDist' task to grpc-java Docker build This will allow us to not run Gradle every time we run an integration test. --- tools/dockerfile/grpc_java/Dockerfile | 2 +- tools/dockerfile/grpc_java/build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/dockerfile/grpc_java/Dockerfile b/tools/dockerfile/grpc_java/Dockerfile index 6b2612b9b2..fa67cb2627 100644 --- a/tools/dockerfile/grpc_java/Dockerfile +++ b/tools/dockerfile/grpc_java/Dockerfile @@ -34,7 +34,7 @@ RUN git clone --recursive --depth 1 https://github.com/grpc/grpc-java.git /var/l RUN cd /var/local/git/grpc-java/lib/netty && \ mvn -pl codec-http2 -am -DskipTests install clean RUN cd /var/local/git/grpc-java && \ - ./gradlew build + ./gradlew build installDist # Specify the default command such that the interop server runs on its known testing port CMD ["/var/local/git/grpc-java/run-test-server.sh", "--use_tls=true", "--port=8030"] diff --git a/tools/dockerfile/grpc_java/build.sh b/tools/dockerfile/grpc_java/build.sh index 04212ceec2..ce35018533 100755 --- a/tools/dockerfile/grpc_java/build.sh +++ b/tools/dockerfile/grpc_java/build.sh @@ -4,6 +4,6 @@ cp -R /var/local/git-clone /var/local/git cd /var/local/git/grpc-java/lib/netty && \ mvn -pl codec-http2 -am -DskipTests install clean cd /var/local/git/grpc-java && \ - ./gradlew build + ./gradlew build installDist echo 'build finished' -- cgit v1.2.3 From 04cba6041fe8545474e464a62fa2604d87dbdeef Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 7 May 2015 10:39:36 -0700 Subject: bump php composer.lock again because of auth library fix --- src/php/composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/php/composer.lock b/src/php/composer.lock index 8d0c8de437..dce150ce43 100644 --- a/src/php/composer.lock +++ b/src/php/composer.lock @@ -57,12 +57,12 @@ "source": { "type": "git", "url": "https://github.com/google/google-auth-library-php.git", - "reference": "70ff1c9b27b1678827465c72ce81a067e1653442" + "reference": "732e11f276216932dcfa3bbc46a644164c2bdf70" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/70ff1c9b27b1678827465c72ce81a067e1653442", - "reference": "70ff1c9b27b1678827465c72ce81a067e1653442", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/732e11f276216932dcfa3bbc46a644164c2bdf70", + "reference": "732e11f276216932dcfa3bbc46a644164c2bdf70", "shasum": "" }, "require": { @@ -94,7 +94,7 @@ "google", "oauth2" ], - "time": "2015-05-06 16:31:42" + "time": "2015-05-07 17:24:56" }, { "name": "guzzlehttp/guzzle", -- cgit v1.2.3 From ab62f47be227eb8e5e6e24286fcc940cd87aec96 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 7 May 2015 10:56:09 -0700 Subject: remove composer.lock file --- src/php/.gitignore | 2 +- src/php/composer.lock | 315 -------------------------------------------------- 2 files changed, 1 insertion(+), 316 deletions(-) delete mode 100644 src/php/composer.lock diff --git a/src/php/.gitignore b/src/php/.gitignore index 0bb5f8e956..36c8721d53 100644 --- a/src/php/.gitignore +++ b/src/php/.gitignore @@ -18,4 +18,4 @@ missing mkinstalldirs ext/grpc/ltmain.sh - +composer.lock diff --git a/src/php/composer.lock b/src/php/composer.lock deleted file mode 100644 index dce150ce43..0000000000 --- a/src/php/composer.lock +++ /dev/null @@ -1,315 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "bb81ea5f72ddea2f594a172ff0f3b44d", - "packages": [ - { - "name": "firebase/php-jwt", - "version": "2.0.0", - "target-dir": "Firebase/PHP-JWT", - "source": { - "type": "git", - "url": "https://github.com/firebase/php-jwt.git", - "reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/ffcfd888ce1e4f2d70cac2dc9b7301038332fe57", - "reference": "ffcfd888ce1e4f2d70cac2dc9b7301038332fe57", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "Authentication/", - "Exceptions/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Neuman Vong", - "email": "neuman+pear@twilio.com", - "role": "Developer" - }, - { - "name": "Anant Narayanan", - "email": "anant@php.net", - "role": "Developer" - } - ], - "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", - "homepage": "https://github.com/firebase/php-jwt", - "time": "2015-04-01 18:46:38" - }, - { - "name": "google/auth", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/google/google-auth-library-php.git", - "reference": "732e11f276216932dcfa3bbc46a644164c2bdf70" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/732e11f276216932dcfa3bbc46a644164c2bdf70", - "reference": "732e11f276216932dcfa3bbc46a644164c2bdf70", - "shasum": "" - }, - "require": { - "firebase/php-jwt": "2.0.0", - "guzzlehttp/guzzle": "5.2.*", - "php": ">=5.4" - }, - "require-dev": { - "phplint/phplint": "0.0.1", - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ], - "psr-4": { - "Google\\Auth\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "description": "Google Auth Library for PHP", - "homepage": "http://github.com/google/google-auth-library-php", - "keywords": [ - "Authentication", - "google", - "oauth2" - ], - "time": "2015-05-07 17:24:56" - }, - { - "name": "guzzlehttp/guzzle", - "version": "5.2.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "475b29ccd411f2fa8a408e64576418728c032cfa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/475b29ccd411f2fa8a408e64576418728c032cfa", - "reference": "475b29ccd411f2fa8a408e64576418728c032cfa", - "shasum": "" - }, - "require": { - "guzzlehttp/ringphp": "~1.0", - "php": ">=5.4.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0", - "psr/log": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2015-01-28 01:03:29" - }, - { - "name": "guzzlehttp/ringphp", - "version": "1.0.7", - "source": { - "type": "git", - "url": "https://github.com/guzzle/RingPHP.git", - "reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/52d868f13570a9a56e5fce6614e0ec75d0f13ac2", - "reference": "52d868f13570a9a56e5fce6614e0ec75d0f13ac2", - "shasum": "" - }, - "require": { - "guzzlehttp/streams": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "time": "2015-03-30 01:43:20" - }, - { - "name": "guzzlehttp/streams", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "time": "2014-10-12 19:18:40" - }, - { - "name": "react/promise", - "version": "v2.2.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef", - "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@googlemail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "time": "2014-12-30 13:32:42" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "google/auth": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.5.0" - }, - "platform-dev": [] -} -- cgit v1.2.3 From ff73231610b5245f12191a8c0608f53689549ab5 Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Thu, 7 May 2015 13:49:08 -0700 Subject: ignore PHP vendor/ folder --- src/php/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/php/.gitignore b/src/php/.gitignore index 36c8721d53..ecde2ca4c6 100644 --- a/src/php/.gitignore +++ b/src/php/.gitignore @@ -19,3 +19,4 @@ mkinstalldirs ext/grpc/ltmain.sh composer.lock +vendor/ -- cgit v1.2.3 From b8a5f866f252df574342c3d64d3887cda4cddcaf Mon Sep 17 00:00:00 2001 From: Yang Gao Date: Thu, 7 May 2015 16:26:33 -0700 Subject: do not request another call if server is shutdown --- src/cpp/server/server.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 08c956601c..1ff9ff4b32 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -446,8 +446,12 @@ void Server::RunRpc() { ScheduleCallback(); if (ok) { SyncRequest::CallData cd(this, mrd); - mrd->Request(server_); - + { + grpc::unique_lock lock(mu_); + if (!shutdown_) { + mrd->Request(server_); + } + } cd.Run(); } } -- cgit v1.2.3 From 909e098168768560cee8d84a3727233d8371087b Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Thu, 7 May 2015 17:12:59 -0700 Subject: Flagging the QPS binaries as tools, instead of non-runnable tests. --- Makefile | 8 ++++---- build.json | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e48b38ad1f..fa6f9f537d 100644 --- a/Makefile +++ b/Makefile @@ -1079,7 +1079,7 @@ buildtests: buildtests_c buildtests_cxx buildtests_c: privatelibs_c $(BINDIR)/$(CONFIG)/alarm_heap_test $(BINDIR)/$(CONFIG)/alarm_list_test $(BINDIR)/$(CONFIG)/alarm_test $(BINDIR)/$(CONFIG)/alpn_test $(BINDIR)/$(CONFIG)/bin_encoder_test $(BINDIR)/$(CONFIG)/census_hash_table_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_circular_buffer_test $(BINDIR)/$(CONFIG)/census_statistics_multiple_writers_test $(BINDIR)/$(CONFIG)/census_statistics_performance_test $(BINDIR)/$(CONFIG)/census_statistics_quick_test $(BINDIR)/$(CONFIG)/census_statistics_small_log_test $(BINDIR)/$(CONFIG)/census_stub_test $(BINDIR)/$(CONFIG)/census_window_stats_test $(BINDIR)/$(CONFIG)/chttp2_status_conversion_test $(BINDIR)/$(CONFIG)/chttp2_stream_encoder_test $(BINDIR)/$(CONFIG)/chttp2_stream_map_test $(BINDIR)/$(CONFIG)/dualstack_socket_test $(BINDIR)/$(CONFIG)/fd_posix_test $(BINDIR)/$(CONFIG)/fling_client $(BINDIR)/$(CONFIG)/fling_server $(BINDIR)/$(CONFIG)/fling_stream_test $(BINDIR)/$(CONFIG)/fling_test $(BINDIR)/$(CONFIG)/gpr_cancellable_test $(BINDIR)/$(CONFIG)/gpr_cmdline_test $(BINDIR)/$(CONFIG)/gpr_env_test $(BINDIR)/$(CONFIG)/gpr_file_test $(BINDIR)/$(CONFIG)/gpr_histogram_test $(BINDIR)/$(CONFIG)/gpr_host_port_test $(BINDIR)/$(CONFIG)/gpr_log_test $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test $(BINDIR)/$(CONFIG)/gpr_slice_test $(BINDIR)/$(CONFIG)/gpr_string_test $(BINDIR)/$(CONFIG)/gpr_sync_test $(BINDIR)/$(CONFIG)/gpr_thd_test $(BINDIR)/$(CONFIG)/gpr_time_test $(BINDIR)/$(CONFIG)/gpr_tls_test $(BINDIR)/$(CONFIG)/gpr_useful_test $(BINDIR)/$(CONFIG)/grpc_base64_test $(BINDIR)/$(CONFIG)/grpc_byte_buffer_reader_test $(BINDIR)/$(CONFIG)/grpc_channel_stack_test $(BINDIR)/$(CONFIG)/grpc_completion_queue_test $(BINDIR)/$(CONFIG)/grpc_credentials_test $(BINDIR)/$(CONFIG)/grpc_json_token_test $(BINDIR)/$(CONFIG)/grpc_stream_op_test $(BINDIR)/$(CONFIG)/hpack_parser_test $(BINDIR)/$(CONFIG)/hpack_table_test $(BINDIR)/$(CONFIG)/httpcli_format_request_test $(BINDIR)/$(CONFIG)/httpcli_parser_test $(BINDIR)/$(CONFIG)/httpcli_test $(BINDIR)/$(CONFIG)/json_rewrite $(BINDIR)/$(CONFIG)/json_rewrite_test $(BINDIR)/$(CONFIG)/json_test $(BINDIR)/$(CONFIG)/lame_client_test $(BINDIR)/$(CONFIG)/message_compress_test $(BINDIR)/$(CONFIG)/multi_init_test $(BINDIR)/$(CONFIG)/murmur_hash_test $(BINDIR)/$(CONFIG)/no_server_test $(BINDIR)/$(CONFIG)/poll_kick_posix_test $(BINDIR)/$(CONFIG)/resolve_address_test $(BINDIR)/$(CONFIG)/secure_endpoint_test $(BINDIR)/$(CONFIG)/sockaddr_utils_test $(BINDIR)/$(CONFIG)/tcp_client_posix_test $(BINDIR)/$(CONFIG)/tcp_posix_test $(BINDIR)/$(CONFIG)/tcp_server_posix_test $(BINDIR)/$(CONFIG)/time_averaged_stats_test $(BINDIR)/$(CONFIG)/time_test $(BINDIR)/$(CONFIG)/timeout_encoding_test $(BINDIR)/$(CONFIG)/timers_test $(BINDIR)/$(CONFIG)/transport_metadata_test $(BINDIR)/$(CONFIG)/transport_security_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fake_security_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_no_op_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_simple_ssl_with_oauth2_fullstack_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_fullstack_uds_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_simple_request_with_high_initial_sequence_number_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_bad_hostname_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_accept_and_writes_closed_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_after_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_before_invoke_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_cancel_in_a_vacuum_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_census_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_disappearing_server_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_inflight_calls_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_early_server_shutdown_finishes_tags_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_empty_batch_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_graceful_server_shutdown_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_invoke_large_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_concurrent_streams_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_max_message_length_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_no_op_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_ping_pong_streaming_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_registered_call_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_binary_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_response_with_trailing_metadata_and_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_large_metadata_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_request_with_payload_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_delayed_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_unsecure_test $(BINDIR)/$(CONFIG)/chttp2_socket_pair_one_byte_at_a_time_simple_request_with_high_initial_sequence_number_unsecure_test -buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_smoke_test $(BINDIR)/$(CONFIG)/qps_worker $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test +buildtests_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/async_end2end_test $(BINDIR)/$(CONFIG)/channel_arguments_test $(BINDIR)/$(CONFIG)/cli_call_test $(BINDIR)/$(CONFIG)/credentials_test $(BINDIR)/$(CONFIG)/cxx_time_test $(BINDIR)/$(CONFIG)/end2end_test $(BINDIR)/$(CONFIG)/generic_end2end_test $(BINDIR)/$(CONFIG)/grpc_cli $(BINDIR)/$(CONFIG)/interop_client $(BINDIR)/$(CONFIG)/interop_server $(BINDIR)/$(CONFIG)/interop_test $(BINDIR)/$(CONFIG)/qps_smoke_test $(BINDIR)/$(CONFIG)/status_test $(BINDIR)/$(CONFIG)/thread_pool_test test: test_c test_cxx @@ -1840,7 +1840,7 @@ test_python: static_c $(Q) tools/run_tests/run_tests.py -lpython -c$(CONFIG) -tools: privatelibs $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token +tools: privatelibs $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_fetch_oauth2 $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/qps_driver $(BINDIR)/$(CONFIG)/qps_worker buildbenchmarks: privatelibs $(BINDIR)/$(CONFIG)/grpc_completion_queue_benchmark $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark @@ -7379,7 +7379,7 @@ else $(BINDIR)/$(CONFIG)/qps_driver: $(PROTOBUF_DEP) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/qps_driver + $(Q) $(LDXX) $(LDFLAGS) $(QPS_DRIVER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_driver endif @@ -7459,7 +7459,7 @@ else $(BINDIR)/$(CONFIG)/qps_worker: $(PROTOBUF_DEP) $(QPS_WORKER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(E) "[LD] Linking $@" $(Q) mkdir -p `dirname $@` - $(Q) $(LDXX) $(LDFLAGS) $(QPS_WORKER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/qps_worker + $(Q) $(LDXX) $(LDFLAGS) $(QPS_WORKER_OBJS) $(LIBDIR)/$(CONFIG)/libqps.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_config.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/qps_worker endif diff --git a/build.json b/build.json index 10fd72d99e..e795d9af1a 100644 --- a/build.json +++ b/build.json @@ -2053,8 +2053,7 @@ }, { "name": "qps_driver", - "build": "test", - "run": false, + "build": "tool", "language": "c++", "src": [ "test/cpp/qps/qps_driver.cc" @@ -2090,8 +2089,7 @@ }, { "name": "qps_worker", - "build": "test", - "run": false, + "build": "tool", "language": "c++", "headers": [ "test/cpp/qps/client.h", -- cgit v1.2.3 From fdb75f58e7ed1f9b9c80b5798e0bcbc7cca8918e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 07:37:15 -0700 Subject: Port Node to new API --- src/node/ext/server.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index 3c2396b810..8cc9f774f7 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -161,7 +161,7 @@ NAN_METHOD(Server::New) { grpc_server *wrapped_server; grpc_completion_queue *queue = CompletionQueueAsyncWorker::GetQueue(); if (args[0]->IsUndefined()) { - wrapped_server = grpc_server_create(queue, NULL); + wrapped_server = grpc_server_create(NULL); } else if (args[0]->IsObject()) { Handle args_hash(args[0]->ToObject()); Handle keys(args_hash->GetOwnPropertyNames()); @@ -190,11 +190,12 @@ NAN_METHOD(Server::New) { return NanThrowTypeError("Arg values must be strings"); } } - wrapped_server = grpc_server_create(queue, &channel_args); + wrapped_server = grpc_server_create(&channel_args); free(channel_args.args); } else { return NanThrowTypeError("Server expects an object"); } + grpc_server_register_completion_queue(wrapped_server, queue); Server *server = new Server(wrapped_server); server->Wrap(args.This()); NanReturnValue(args.This()); -- cgit v1.2.3 From 997fab6874cf953e45757c732f940bd95519df2a Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 07:39:04 -0700 Subject: Port Ruby to new API --- src/ruby/ext/grpc/rb_server.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index bc0878af05..85ada1958b 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -123,7 +123,7 @@ static VALUE grpc_rb_server_init(VALUE self, VALUE cqueue, VALUE channel_args) { TypedData_Get_Struct(self, grpc_rb_server, &grpc_rb_server_data_type, wrapper); grpc_rb_hash_convert_to_channel_args(channel_args, &args); - srv = grpc_server_create(cq, &args); + srv = grpc_server_create(&args); if (args.args != NULL) { xfree(args.args); /* Allocated by grpc_rb_hash_convert_to_channel_args */ @@ -131,6 +131,7 @@ static VALUE grpc_rb_server_init(VALUE self, VALUE cqueue, VALUE channel_args) { if (srv == NULL) { rb_raise(rb_eRuntimeError, "could not create a gRPC server, not sure why"); } + grpc_server_register_completion_queue(srv, cq); wrapper->wrapped = srv; /* Add the cq as the server's mark object. This ensures the ruby cq can't be @@ -218,6 +219,7 @@ static VALUE grpc_rb_server_request_call(VALUE self, VALUE cqueue, err = grpc_server_request_call( s->wrapped, &call, &st.details, &st.md_ary, grpc_rb_get_wrapped_completion_queue(cqueue), + grpc_rb_get_wrapped_completion_queue(cqueue), ROBJECT(tag_new)); if (err != GRPC_CALL_OK) { grpc_request_call_stack_cleanup(&st); -- cgit v1.2.3 From a5e15f446ebe44ff1cb12896e040c7f94503d5fd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 07:40:47 -0700 Subject: Port Python to new API --- src/python/src/grpc/_adapter/_server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/python/src/grpc/_adapter/_server.c b/src/python/src/grpc/_adapter/_server.c index e7c5917724..a6c20bf132 100644 --- a/src/python/src/grpc/_adapter/_server.c +++ b/src/python/src/grpc/_adapter/_server.c @@ -51,8 +51,9 @@ static int pygrpc_server_init(Server *self, PyObject *args, PyObject *kwds) { &completion_queue)) { return -1; } - self->c_server = grpc_server_create( - completion_queue->c_completion_queue, NULL); + self->c_server = grpc_server_create(NULL); + grpc_server_register_completion_queue(self->c_server, + completion_queue->c_completion_queue); self->completion_queue = completion_queue; Py_INCREF(completion_queue); return 0; @@ -122,7 +123,7 @@ static const PyObject *pygrpc_server_service(Server *self, PyObject *tag) { call_error = grpc_server_request_call( self->c_server, &c_tag->call->c_call, &c_tag->call->call_details, &c_tag->call->recv_metadata, self->completion_queue->c_completion_queue, - c_tag); + self->completion_queue->c_completion_queue, c_tag); result = pygrpc_translate_call_error(call_error); if (result != NULL) { -- cgit v1.2.3 From 4d706b8dbc042fa758d63e4e3e18ef9ced5c499b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 07:42:13 -0700 Subject: Port C# to new API --- src/csharp/ext/grpc_csharp_ext.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index a8cc1b29a4..6cefacece2 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -673,7 +673,9 @@ grpcsharp_call_start_serverside(grpc_call *call, callback_funcptr callback) { GPR_EXPORT grpc_server *GPR_CALLTYPE grpcsharp_server_create(grpc_completion_queue *cq, const grpc_channel_args *args) { - return grpc_server_create(cq, args); + grpc_server *server = grpc_server_create(args); + grpc_server_register_completion_queue(server, cq); + return server; } GPR_EXPORT gpr_int32 GPR_CALLTYPE @@ -706,7 +708,7 @@ grpcsharp_server_request_call(grpc_server *server, grpc_completion_queue *cq, return grpc_server_request_call( server, &(ctx->server_rpc_new.call), &(ctx->server_rpc_new.call_details), - &(ctx->server_rpc_new.request_metadata), cq, ctx); + &(ctx->server_rpc_new.request_metadata), cq, cq, ctx); } /* Security */ -- cgit v1.2.3 From a33acb702150d63b895626bbe5a5619360421e7d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 08:02:55 -0700 Subject: Correct C++ build errors --- src/cpp/server/server.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index f00bcf61af..62f4020d7e 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -322,7 +322,6 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { request_(request), stream_(stream), call_cq_(call_cq), - notification_cq_(notification_cq), ctx_(ctx), generic_ctx_(nullptr), server_(server), @@ -345,7 +344,6 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { request_(nullptr), stream_(stream), call_cq_(call_cq), - notification_cq_(notification_cq), ctx_(nullptr), generic_ctx_(ctx), server_(server), @@ -415,7 +413,6 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag { grpc::protobuf::Message* const request_; ServerAsyncStreamingInterface* const stream_; CompletionQueue* const call_cq_; - ServerCompletionQueue* const notification_cq_; ServerContext* const ctx_; GenericServerContext* const generic_ctx_; Server* const server_; @@ -462,7 +459,7 @@ void Server::RunRpc() { { grpc::unique_lock lock(mu_); if (!shutdown_) { - mrd->Request(server_); + mrd->Request(server_, cq_.cq()); } } cd.Run(); -- cgit v1.2.3 From 054d1dec073e4c95758ceaeef5b16e09481c377e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 08:03:04 -0700 Subject: Correct Node build errors --- src/node/ext/server.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index 8cc9f774f7..eb97f7348b 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -213,6 +213,7 @@ NAN_METHOD(Server::RequestCall) { grpc_call_error error = grpc_server_request_call( server->wrapped_server, &op->call, &op->details, &op->request_metadata, CompletionQueueAsyncWorker::GetQueue(), + CompletionQueueAsyncWorker::GetQueue(), new struct tag(new NanCallback(args[0].As()), ops.release(), shared_ptr(nullptr))); if (error != GRPC_CALL_OK) { -- cgit v1.2.3 From 9daab242adccada4623085f34e14d68c1a373d21 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 8 May 2015 08:06:45 -0700 Subject: Fix C test build --- .../tests/request_response_with_trailing_metadata_and_payload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c index 75240e7c6f..b4b377b606 100644 --- a/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c +++ b/test/core/end2end/tests/request_response_with_trailing_metadata_and_payload.c @@ -169,7 +169,8 @@ static void test_request_response_with_metadata_and_payload( GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(f.server, &s, &call_details, &request_metadata_recv, - f.server_cq, tag(101))); + f.server_cq, f.server_cq, + tag(101))); cq_expect_completion(v_server, tag(101), GRPC_OP_OK); cq_verify(v_server); -- cgit v1.2.3