Skip to content

Commit

Permalink
Pass cancellation token to grpc reader (#2133)
Browse files Browse the repository at this point in the history
  • Loading branch information
benbenwilde authored Aug 28, 2024
1 parent d7e9f80 commit b3984e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Proto.Remote/Endpoints/ServerConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ await call.RequestStream.WriteAsync(new RemoteMessage

var writer = StartWriter(combinedToken, call, cancellationTokenSource);

var reader = StartReader(call, actorSystemId, cancellationTokenSource);
var reader = StartReader(combinedToken, call, actorSystemId, cancellationTokenSource);

_logger.LogInformation("[ServerConnector][{SystemAddress}] Connected to {Address}", _system.Address,
_address);
Expand Down Expand Up @@ -299,13 +299,13 @@ private Task StartWriter(CancellationToken combinedToken, AsyncDuplexStreamingCa
});
}

private Task StartReader(AsyncDuplexStreamingCall<RemoteMessage, RemoteMessage> call, string actorSystemId, CancellationTokenSource cancellationTokenSource)
private Task StartReader(CancellationToken combinedToken, AsyncDuplexStreamingCall<RemoteMessage, RemoteMessage> call, string actorSystemId, CancellationTokenSource cancellationTokenSource)
{
return Task.Run(async () =>
{
try
{
while (await call.ResponseStream.MoveNext().ConfigureAwait(false))
while (await call.ResponseStream.MoveNext(combinedToken).ConfigureAwait(false))
{
// if (_endpoint.CancellationToken.IsCancellationRequested) continue;
var currentMessage = call.ResponseStream.Current;
Expand Down

0 comments on commit b3984e1

Please sign in to comment.