From 52381d4af8551491b07cf84be1f5da90acca1b01 Mon Sep 17 00:00:00 2001 From: laurirasanen Date: Sun, 2 Jun 2019 13:44:04 +0300 Subject: [PATCH] Install SteamNetworkingSockets events when initializing SteamServer --- Facepunch.Steamworks/SteamNetworkingSockets.cs | 4 ++-- Facepunch.Steamworks/SteamServer.cs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Facepunch.Steamworks/SteamNetworkingSockets.cs b/Facepunch.Steamworks/SteamNetworkingSockets.cs index 2b9d9a3..03db4ac 100644 --- a/Facepunch.Steamworks/SteamNetworkingSockets.cs +++ b/Facepunch.Steamworks/SteamNetworkingSockets.cs @@ -81,9 +81,9 @@ namespace Steamworks ConnectionInterfaces = null; } - internal static void InstallEvents() + internal static void InstallEvents( bool server = false ) { - SteamNetConnectionStatusChangedCallback_t.Install( x => ConnectionStatusChanged( x ) ); + SteamNetConnectionStatusChangedCallback_t.Install( x => ConnectionStatusChanged( x ), server ); } private static void ConnectionStatusChanged( SteamNetConnectionStatusChangedCallback_t data ) diff --git a/Facepunch.Steamworks/SteamServer.cs b/Facepunch.Steamworks/SteamServer.cs index 544b43a..dd8e6db 100644 --- a/Facepunch.Steamworks/SteamServer.cs +++ b/Facepunch.Steamworks/SteamServer.cs @@ -37,8 +37,9 @@ namespace Steamworks internal static void InstallEvents() { SteamInventory.InstallEvents(); + SteamNetworkingSockets.InstallEvents(true); - ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); + ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); SteamServersConnected_t.Install( x => OnSteamServersConnected?.Invoke(), true ); SteamServerConnectFailure_t.Install( x => OnSteamServerConnectFailure?.Invoke( x.Result, x.StillRetrying ), true ); SteamServersDisconnected_t.Install( x => OnSteamServersDisconnected?.Invoke( x.Result ), true );