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,7 +41,10 @@ public static void Init( uint appid )
SteamNetworkingSockets.InstallEvents();
SteamInput.InstallEvents();
RunCallbacksAsync();
if ( asyncCallbacks )
{
RunCallbacksAsync();
}
}
static List<SteamInterface> openIterfaces = new List<SteamInterface>();
@ -73,7 +76,15 @@ internal static async void RunCallbacksAsync()
while ( IsValid )
{
await Task.Delay( 16 );
RunCallbacks();
try
{
RunCallbacks();
}
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
}
}
@ -123,14 +134,7 @@ public static void RunCallbacks()
{
if ( !IsValid ) return;
try
{
SteamAPI.RunCallbacks();
}
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
SteamAPI.RunCallbacks();
}
internal static void UnregisterCallback( IntPtr intPtr )

View File

@ -104,7 +104,10 @@ public static void Init( AppId appid, SteamServerInit init )
InstallEvents();
RunCallbacksAsync();
if ( asyncCallbacks )
{
RunCallbacksAsync();
}
}
static List<SteamInterface> openIterfaces = new List<SteamInterface>();
@ -147,7 +150,15 @@ internal static async void RunCallbacksAsync()
{
while ( IsValid )
{
RunCallbacks();
try
{
RunCallbacks();
}
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
await Task.Delay( 16 );
}
}
@ -157,14 +168,7 @@ internal static async void RunCallbacksAsync()
/// </summary>
public static void RunCallbacks()
{
try
{
SteamGameServer.RunCallbacks();
}
catch ( System.Exception e )
{
OnCallbackException?.Invoke( e );
}
SteamGameServer.RunCallbacks();
}
/// <summary>