From a3124e504e9861d67828c1905c9f04707b0e7d09 Mon Sep 17 00:00:00 2001 From: SeaFood Date: Sat, 22 Jul 2023 12:38:01 +0200 Subject: [PATCH] Modified SteamNetworkingSockets.CreateRelaySocketFakeIP, so that it can be passed a send buffer size Fixed SteamNetworkingMessages that was missing some static keywords --- Facepunch.Steamworks/SteamNetworkingMessages.cs | 8 ++++---- Facepunch.Steamworks/SteamNetworkingSockets.cs | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Facepunch.Steamworks/SteamNetworkingMessages.cs b/Facepunch.Steamworks/SteamNetworkingMessages.cs index 112646a..f16947e 100644 --- a/Facepunch.Steamworks/SteamNetworkingMessages.cs +++ b/Facepunch.Steamworks/SteamNetworkingMessages.cs @@ -42,10 +42,10 @@ namespace Steamworks public static Action OnSessionFailed; - public bool AcceptSessionWithUser( ref NetIdentity identity ) => Internal.AcceptSessionWithUser( ref identity ); - public bool CloseSessionWithUser( ref NetIdentity identity ) => Internal.CloseSessionWithUser( ref identity ); - public bool CloseChannelWithUser( ref NetIdentity identity, int channel ) => Internal.CloseChannelWithUser( ref identity, channel ); - public ConnectionState GetSessionConnectionInfo( ref NetIdentity identity, ref ConnectionInfo info, ref ConnectionStatus status ) => Internal.GetSessionConnectionInfo( ref identity, ref info, ref status ); + public static bool AcceptSessionWithUser( ref NetIdentity identity ) => Internal.AcceptSessionWithUser( ref identity ); + public static bool CloseSessionWithUser( ref NetIdentity identity ) => Internal.CloseSessionWithUser( ref identity ); + public static bool CloseChannelWithUser( ref NetIdentity identity, int channel ) => Internal.CloseChannelWithUser( ref identity, channel ); + public static ConnectionState GetSessionConnectionInfo( ref NetIdentity identity, ref ConnectionInfo info, ref ConnectionStatus status ) => Internal.GetSessionConnectionInfo( ref identity, ref info, ref status ); public static unsafe Result SendMessageToUser( ref NetIdentity identity, byte[] data, SteamNetworkingOptions flags, int channel) { diff --git a/Facepunch.Steamworks/SteamNetworkingSockets.cs b/Facepunch.Steamworks/SteamNetworkingSockets.cs index 4029ed6..639122f 100644 --- a/Facepunch.Steamworks/SteamNetworkingSockets.cs +++ b/Facepunch.Steamworks/SteamNetworkingSockets.cs @@ -311,10 +311,13 @@ namespace Steamworks /// To use this derive a class from and override as much as you want. /// /// - public static T CreateRelaySocketFakeIP( int fakePortIndex = 0 ) where T : SocketManager, new() + public static T CreateRelaySocketFakeIP( int fakePortIndex = 0, int sendBufferSize = 524288 ) where T : SocketManager, new() { var t = new T(); - var options = Array.Empty(); + var options = new NetKeyValue[1]; + options[0].DataType = NetConfigType.Int32; + options[0].Value = NetConfig.SendBufferSize; + options[0].Int32Value = sendBufferSize; t.Socket = Internal.CreateListenSocketP2PFakeIP( 0, options.Length, options ); t.Initialize(); SetSocketManager( t.Socket.Id, t );