mirror of
https://github.com/ppy/osu.git
synced 2026-06-01 11:50:35 +08:00
Fix unobserved timeouts still showing to user
As reported in https://osu.ppy.sh/community/forums/topics/2174881?n=1.
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Net.WebSockets;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using osu.Framework.Extensions.ExceptionExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
@@ -23,12 +23,10 @@ namespace osu.Game.Online.Multiplayer
|
||||
|
||||
onError?.Invoke(exception);
|
||||
|
||||
if (exception is WebSocketException wse && wse.Message == @"The remote party closed the WebSocket connection without completing the close handshake.")
|
||||
{
|
||||
// OnlineStatusNotifier is already letting users know about interruptions to connections.
|
||||
// Silence these because it gets very spammy otherwise.
|
||||
// OnlineStatusNotifier is already letting users know about interruptions to connections.
|
||||
// Silence these because it gets very spammy otherwise.
|
||||
if (SentryLogger.IsLocalUserConnectivityException(exception))
|
||||
return;
|
||||
}
|
||||
|
||||
if (exception.GetHubExceptionMessage() is string message)
|
||||
{
|
||||
|
||||
@@ -239,6 +239,9 @@ namespace osu.Game.Utils
|
||||
|
||||
private bool shouldSubmitException(Exception exception)
|
||||
{
|
||||
if (IsLocalUserConnectivityException(exception))
|
||||
return false;
|
||||
|
||||
switch (exception)
|
||||
{
|
||||
// disk I/O failures, invalid formats, etc.
|
||||
@@ -253,27 +256,7 @@ namespace osu.Game.Utils
|
||||
case SharpCompress.Common.InvalidFormatException:
|
||||
return false;
|
||||
|
||||
// connectivity failures
|
||||
|
||||
case TimeoutException te:
|
||||
return !te.Message.Contains(@"elapsed without receiving a message from the server");
|
||||
|
||||
case WebException we:
|
||||
switch (we.Status)
|
||||
{
|
||||
// more statuses may need to be blocked as we come across them.
|
||||
case WebExceptionStatus.Timeout:
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WebSocketException:
|
||||
case SocketException:
|
||||
return false;
|
||||
|
||||
// stuff that should really never make it to sentry
|
||||
|
||||
case APIAccess.WebRequestFlushedException:
|
||||
case TaskCanceledException:
|
||||
return false;
|
||||
@@ -282,6 +265,25 @@ namespace osu.Game.Utils
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsLocalUserConnectivityException(Exception exception)
|
||||
{
|
||||
switch (exception)
|
||||
{
|
||||
case TimeoutException te:
|
||||
return te.Message.Contains(@"elapsed without receiving a message from the server");
|
||||
|
||||
case WebException we:
|
||||
// more statuses may need to be blocked as we come across them.
|
||||
return we.Status == WebExceptionStatus.Timeout;
|
||||
|
||||
case WebSocketException:
|
||||
case SocketException:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Disposal
|
||||
|
||||
public void Dispose()
|
||||
|
||||
Reference in New Issue
Block a user