Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand All @@ -22,8 +22,6 @@
using System.Threading.Tasks;
using Grpc.Core;

// TODO(JamesNK): Remove nullable override after Grpc.Core.Api update
#pragma warning disable CS8764 // Nullability of return type doesn't match overridden member (possibly because of nullability attributes).
namespace Tests.Server.UnitTests.Helpers
{
public class TestServerCallContext : ServerCallContext
Expand Down Expand Up @@ -81,4 +79,3 @@ public static TestServerCallContext Create(Metadata? requestHeaders = null, Canc
}
}
}
#pragma warning restore CS8764 // Nullability of return type doesn't match overridden member (possibly because of nullability attributes).
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#region Copyright notice and license
#region Copyright notice and license

// Copyright 2019 The gRPC Authors
//
Expand All @@ -22,8 +22,6 @@
using System.Threading.Tasks;
using Grpc.Core;

// TODO(JamesNK): Remove nullable override after Grpc.Core.Api update
#pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
namespace Tests.Server.UnitTests.Helpers
{
public class TestServerStreamWriter<T> : IServerStreamWriter<T> where T : class
Expand Down Expand Up @@ -63,8 +61,12 @@ public IAsyncEnumerable<T> ReadAllAsync()
}
}

public Task WriteAsync(T message)
public Task WriteAsync(T message, CancellationToken cancellationToken)
{
if (cancellationToken.IsCancellationRequested)
{
return Task.FromCanceled(cancellationToken);
}
if (_serverCallContext.CancellationToken.IsCancellationRequested)
{
return Task.FromCanceled(_serverCallContext.CancellationToken);
Expand All @@ -77,6 +79,10 @@ public Task WriteAsync(T message)

return Task.CompletedTask;
}

public Task WriteAsync(T message)
{
return WriteAsync(message, CancellationToken.None);
}
}
}
#pragma warning restore CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).