diff options
author | David Garcia Quintas <dgq@google.com> | 2017-11-02 16:33:36 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2017-11-02 16:36:49 -0700 |
commit | 88933d803b148b02ecb7aad9a0395a72439d578f (patch) | |
tree | 97368c74ba0da51a69c8a1d14333097869d4bcb7 /src/csharp/Grpc.Core | |
parent | 2a95bf4d9a108a6bf7c8d081039d4bb1fd92fb71 (diff) | |
parent | 05547052d0394224515ac43364ce3a80467a5edc (diff) |
Merge branch 'master' of github.com:grpc/grpc into grpclb_pick_from_shutdown_rr
Diffstat (limited to 'src/csharp/Grpc.Core')
-rw-r--r-- | src/csharp/Grpc.Core/AsyncClientStreamingCall.cs | 16 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs | 16 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/AsyncServerStreamingCall.cs | 14 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/AsyncUnaryCall.cs | 15 | ||||
-rwxr-xr-x | src/csharp/Grpc.Core/Grpc.Core.csproj | 3 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/Internal/AsyncCall.cs | 6 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs | 9 | ||||
-rwxr-xr-x | src/csharp/Grpc.Core/Version.csproj.include | 2 | ||||
-rw-r--r-- | src/csharp/Grpc.Core/VersionInfo.cs | 4 |
9 files changed, 69 insertions, 16 deletions
diff --git a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs index 087b685963..f59989655e 100644 --- a/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncClientStreamingCall.cs @@ -36,7 +36,21 @@ namespace Grpc.Core readonly Func<Metadata> getTrailersFunc; readonly Action disposeAction; - internal AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction) + /// <summary> + /// Creates a new AsyncClientStreamingCall object with the specified properties. + /// </summary> + /// <param name="requestStream">Stream of request values.</param> + /// <param name="responseAsync">The response of the asynchronous call.</param> + /// <param name="responseHeadersAsync">Response headers of the asynchronous call.</param> + /// <param name="getStatusFunc">Delegate returning the status of the call.</param> + /// <param name="getTrailersFunc">Delegate returning the trailing metadata of the call.</param> + /// <param name="disposeAction">Delegate to invoke when Dispose is called on the call object.</param> + public AsyncClientStreamingCall(IClientStreamWriter<TRequest> requestStream, + Task<TResponse> responseAsync, + Task<Metadata> responseHeadersAsync, + Func<Status> getStatusFunc, + Func<Metadata> getTrailersFunc, + Action disposeAction) { this.requestStream = requestStream; this.responseAsync = responseAsync; diff --git a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs index ce49fb1596..1cb1a91859 100644 --- a/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncDuplexStreamingCall.cs @@ -35,7 +35,21 @@ namespace Grpc.Core readonly Func<Metadata> getTrailersFunc; readonly Action disposeAction; - internal AsyncDuplexStreamingCall(IClientStreamWriter<TRequest> requestStream, IAsyncStreamReader<TResponse> responseStream, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction) + /// <summary> + /// Creates a new AsyncDuplexStreamingCall object with the specified properties. + /// </summary> + /// <param name="requestStream">Stream of request values.</param> + /// <param name="responseStream">Stream of response values.</param> + /// <param name="responseHeadersAsync">Response headers of the asynchronous call.</param> + /// <param name="getStatusFunc">Delegate returning the status of the call.</param> + /// <param name="getTrailersFunc">Delegate returning the trailing metadata of the call.</param> + /// <param name="disposeAction">Delegate to invoke when Dispose is called on the call object.</param> + public AsyncDuplexStreamingCall(IClientStreamWriter<TRequest> requestStream, + IAsyncStreamReader<TResponse> responseStream, + Task<Metadata> responseHeadersAsync, + Func<Status> getStatusFunc, + Func<Metadata> getTrailersFunc, + Action disposeAction) { this.requestStream = requestStream; this.responseStream = responseStream; diff --git a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs index fbc97b8148..4303b0b1b0 100644 --- a/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs +++ b/src/csharp/Grpc.Core/AsyncServerStreamingCall.cs @@ -33,7 +33,19 @@ namespace Grpc.Core readonly Func<Metadata> getTrailersFunc; readonly Action disposeAction; - internal AsyncServerStreamingCall(IAsyncStreamReader<TResponse> responseStream, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction) + /// <summary> + /// Creates a new AsyncDuplexStreamingCall object with the specified properties. + /// </summary> + /// <param name="responseStream">Stream of response values.</param> + /// <param name="responseHeadersAsync">Response headers of the asynchronous call.</param> + /// <param name="getStatusFunc">Delegate returning the status of the call.</param> + /// <param name="getTrailersFunc">Delegate returning the trailing metadata of the call.</param> + /// <param name="disposeAction">Delegate to invoke when Dispose is called on the call object.</param> + public AsyncServerStreamingCall(IAsyncStreamReader<TResponse> responseStream, + Task<Metadata> responseHeadersAsync, + Func<Status> getStatusFunc, + Func<Metadata> getTrailersFunc, + Action disposeAction) { this.responseStream = responseStream; this.responseHeadersAsync = responseHeadersAsync; diff --git a/src/csharp/Grpc.Core/AsyncUnaryCall.cs b/src/csharp/Grpc.Core/AsyncUnaryCall.cs index 6348f3c5fd..17747f86ca 100644 --- a/src/csharp/Grpc.Core/AsyncUnaryCall.cs +++ b/src/csharp/Grpc.Core/AsyncUnaryCall.cs @@ -34,7 +34,20 @@ namespace Grpc.Core readonly Func<Metadata> getTrailersFunc; readonly Action disposeAction; - internal AsyncUnaryCall(Task<TResponse> responseAsync, Task<Metadata> responseHeadersAsync, Func<Status> getStatusFunc, Func<Metadata> getTrailersFunc, Action disposeAction) + + /// <summary> + /// Creates a new AsyncUnaryCall object with the specified properties. + /// </summary> + /// <param name="responseAsync">The response of the asynchronous call.</param> + /// <param name="responseHeadersAsync">Response headers of the asynchronous call.</param> + /// <param name="getStatusFunc">Delegate returning the status of the call.</param> + /// <param name="getTrailersFunc">Delegate returning the trailing metadata of the call.</param> + /// <param name="disposeAction">Delegate to invoke when Dispose is called on the call object.</param> + public AsyncUnaryCall(Task<TResponse> responseAsync, + Task<Metadata> responseHeadersAsync, + Func<Status> getStatusFunc, + Func<Metadata> getTrailersFunc, + Action disposeAction) { this.responseAsync = responseAsync; this.responseHeadersAsync = responseHeadersAsync; diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index dde800aadd..d9950b2f20 100755 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -14,7 +14,6 @@ <PackageTags>gRPC RPC Protocol HTTP/2</PackageTags> <PackageProjectUrl>https://github.com/grpc/grpc</PackageProjectUrl> <PackageLicenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</PackageLicenseUrl> - <NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.5' ">1.6.0</NetStandardImplicitPackageVersion> <IncludeSymbols>true</IncludeSymbols> <IncludeSource>true</IncludeSource> <GenerateDocumentationFile>true</GenerateDocumentationFile> @@ -65,7 +64,7 @@ <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' "> <PackageReference Include="System.Runtime.Loader" Version="4.0.0" /> <PackageReference Include="System.Threading.Thread" Version="4.0.0" /> - <PackageReference Include="System.Threading.ThreadPool" Version="4.0.0" /> + <PackageReference Include="System.Threading.ThreadPool" Version="4.0.10" /> </ItemGroup> <Import Project="NativeDeps.csproj.include" /> diff --git a/src/csharp/Grpc.Core/Internal/AsyncCall.cs b/src/csharp/Grpc.Core/Internal/AsyncCall.cs index 17109de587..09fb722c81 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCall.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCall.cs @@ -34,6 +34,9 @@ namespace Grpc.Core.Internal readonly CallInvocationDetails<TRequest, TResponse> details; readonly INativeCall injectedNativeCall; // for testing + // Dispose of to de-register cancellation token registration + IDisposable cancellationTokenRegistration; + // Completion of a pending unary response if not null. TaskCompletionSource<TResponse> unaryResponseTcs; @@ -320,6 +323,7 @@ namespace Grpc.Core.Internal protected override void OnAfterReleaseResources() { details.Channel.RemoveCallReference(this); + cancellationTokenRegistration?.Dispose(); } protected override bool IsClient @@ -405,7 +409,7 @@ namespace Grpc.Core.Internal var token = details.Options.CancellationToken; if (token.CanBeCanceled) { - token.Register(() => this.Cancel()); + cancellationTokenRegistration = token.Register(() => this.Cancel()); } } diff --git a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs index b56bdbb23f..a8cb357181 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs @@ -61,12 +61,9 @@ namespace Grpc.Core.Internal try { - var context = new AuthInterceptorContext(Marshal.PtrToStringAnsi(serviceUrlPtr), - Marshal.PtrToStringAnsi(methodNamePtr)); - // Don't await, we are in a native callback and need to return. - #pragma warning disable 4014 - GetMetadataAsync(context, callbackPtr, userDataPtr); - #pragma warning restore 4014 + var context = new AuthInterceptorContext(Marshal.PtrToStringAnsi(serviceUrlPtr), Marshal.PtrToStringAnsi(methodNamePtr)); + // Make a guarantee that credentials_notify_from_plugin is invoked async to be compliant with c-core API. + ThreadPool.QueueUserWorkItem(async (stateInfo) => await GetMetadataAsync(context, callbackPtr, userDataPtr)); } catch (Exception e) { diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 124ecab14c..b9ceaf8254 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ <!-- This file is generated --> <Project> <PropertyGroup> - <GrpcCsharpVersion>1.7.0-dev</GrpcCsharpVersion> + <GrpcCsharpVersion>1.8.0-dev</GrpcCsharpVersion> <GoogleProtobufVersion>3.3.0</GoogleProtobufVersion> </PropertyGroup> </Project> diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 588cc84516..dab938821f 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// <summary> /// Current <c>AssemblyFileVersion</c> of gRPC C# assemblies /// </summary> - public const string CurrentAssemblyFileVersion = "1.7.0.0"; + public const string CurrentAssemblyFileVersion = "1.8.0.0"; /// <summary> /// Current version of gRPC C# /// </summary> - public const string CurrentVersion = "1.7.0-dev"; + public const string CurrentVersion = "1.8.0-dev"; } } |