Don't catch and send exceptions to OnCallbackException in RunCallbacks (but do in RunCallbacksAsync)

This commit is contained in:
Garry Newman 2019-08-17 11:40:26 +01:00
parent a02d1e87a7
commit 71b977ef7e
2 changed files with 28 additions and 20 deletions

View File

@ -41,8 +41,11 @@ namespace Steamworks
SteamNetworkingSockets.InstallEvents(); SteamNetworkingSockets.InstallEvents();
SteamInput.InstallEvents(); SteamInput.InstallEvents();
if ( asyncCallbacks )
{
RunCallbacksAsync(); RunCallbacksAsync();
} }
}
static List<SteamInterface> openIterfaces = new List<SteamInterface>(); static List<SteamInterface> openIterfaces = new List<SteamInterface>();
@ -73,8 +76,16 @@ namespace Steamworks
while ( IsValid ) while ( IsValid )
{ {
await Task.Delay( 16 ); await Task.Delay( 16 );
try
{
RunCallbacks(); RunCallbacks();
} }
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
}
} }
public static void Shutdown() public static void Shutdown()
@ -123,15 +134,8 @@ namespace Steamworks
{ {
if ( !IsValid ) return; if ( !IsValid ) return;
try
{
SteamAPI.RunCallbacks(); SteamAPI.RunCallbacks();
} }
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
}
internal static void UnregisterCallback( IntPtr intPtr ) internal static void UnregisterCallback( IntPtr intPtr )
{ {

View File

@ -104,8 +104,11 @@ namespace Steamworks
InstallEvents(); InstallEvents();
if ( asyncCallbacks )
{
RunCallbacksAsync(); RunCallbacksAsync();
} }
}
static List<SteamInterface> openIterfaces = new List<SteamInterface>(); static List<SteamInterface> openIterfaces = new List<SteamInterface>();
@ -146,8 +149,16 @@ namespace Steamworks
internal static async void RunCallbacksAsync() internal static async void RunCallbacksAsync()
{ {
while ( IsValid ) while ( IsValid )
{
try
{ {
RunCallbacks(); RunCallbacks();
}
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
await Task.Delay( 16 ); await Task.Delay( 16 );
} }
} }
@ -156,16 +167,9 @@ namespace Steamworks
/// Run the callbacks. This is also called in Async callbacks. /// Run the callbacks. This is also called in Async callbacks.
/// </summary> /// </summary>
public static void RunCallbacks() public static void RunCallbacks()
{
try
{ {
SteamGameServer.RunCallbacks(); SteamGameServer.RunCallbacks();
} }
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
}
/// <summary> /// <summary>
/// Sets whether this should be marked as a dedicated server. /// Sets whether this should be marked as a dedicated server.