Skip to content

Commit

Permalink
Account for OperationCanceledException
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Sep 26, 2021
1 parent 16b8115 commit 491f56d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion osu.Game.Rulesets.Sentakki/IO/GameplayEventBroadcaster.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.IO.Pipes;
using System.Net.Sockets;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -34,7 +35,13 @@ private async void attemptConnection()
isWaitingForClient = true;

try { await pipeServer.WaitForConnectionAsync(cancellationToken).ConfigureAwait(false); }
catch (TaskCanceledException) { return; }
catch (Exception e)
{
// The operation was canceled. Gracefully shutdown;
if (e is TaskCanceledException || (e is SocketException se && se.SocketErrorCode == SocketError.OperationAborted))
return;
throw;
}

isWaitingForClient = false;

Expand Down

0 comments on commit 491f56d

Please sign in to comment.