Fixed dispatch double callbacks when server initialized

This commit is contained in:
Garry Newman 2020-02-26 12:42:20 +00:00
parent bf60680d87
commit b0d23eff22
2 changed files with 6 additions and 3 deletions

View File

@ -67,7 +67,7 @@ namespace Steamworks
{ {
try try
{ {
ProcessCallback( msg ); ProcessCallback( msg, pipe == ServerPipe );
} }
finally finally
{ {
@ -79,7 +79,7 @@ namespace Steamworks
/// <summary> /// <summary>
/// A callback is a general global message /// A callback is a general global message
/// </summary> /// </summary>
private static void ProcessCallback( CallbackMsg_t msg ) private static void ProcessCallback( CallbackMsg_t msg, bool isServer )
{ {
// Is this a special callback telling us that the call result is ready? // Is this a special callback telling us that the call result is ready?
if ( msg.Type == CallbackType.SteamAPICallCompleted ) if ( msg.Type == CallbackType.SteamAPICallCompleted )
@ -92,6 +92,9 @@ namespace Steamworks
{ {
foreach ( var item in list ) foreach ( var item in list )
{ {
if ( item.server != isServer )
continue;
item.action( msg.Data ); item.action( msg.Data );
} }
} }

View File

@ -68,7 +68,7 @@ namespace Steamworks
internal static void InstallEvents( bool server ) internal void InstallEvents( bool server )
{ {
Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( ConnectionStatusChanged, server ); Dispatch.Install<SteamNetConnectionStatusChangedCallback_t>( ConnectionStatusChanged, server );
} }