Skip to content

Commit

Permalink
Merge pull request #403 from Cysharp/hotfix/IgnoreOperationCanceledEx…
Browse files Browse the repository at this point in the history
…ception

Ignore OperationCanceledException thrown when a client disconnects.
  • Loading branch information
mayuki authored Feb 1, 2021
2 parents e085093 + cc99251 commit 2b9a65c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/MagicOnion.Server/Hubs/StreamingHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ public async Task<DuplexStreamingResult<byte[], byte[]>> Connect()
await OnConnecting();
await HandleMessageAsync();
}
catch (OperationCanceledException)
{
// NOTE: If DuplexStreaming is disconnected by the client, OperationCanceledException will be thrown.
// However, such behavior is expected. the exception can be ignored.
}
catch (IOException ex) when (ex.InnerException is ConnectionAbortedException)
{
// NOTE: If DuplexStreaming is disconnected by the client, IOException will be thrown.
Expand Down

0 comments on commit 2b9a65c

Please sign in to comment.