From d0e70b60d175275debb3d86aaef42de26f29944b Mon Sep 17 00:00:00 2001 From: FirstGearGames Date: Tue, 25 Jun 2024 10:03:45 -0400 Subject: [PATCH] 4.1.1 - Connection changes are no longer added to a pending queue but are now processed like other socket messages. --- FishNet/Plugins/Bayou/Bayou.cs | 11 +++++---- FishNet/Plugins/Bayou/CHANGELOG.txt | 3 +++ FishNet/Plugins/Bayou/Core/ServerSocket.cs | 27 ++++++++-------------- FishNet/Plugins/Bayou/VERSION.txt | 1 - FishNet/Plugins/Bayou/VERSION.txt.meta | 7 ------ 5 files changed, 19 insertions(+), 30 deletions(-) delete mode 100644 FishNet/Plugins/Bayou/VERSION.txt delete mode 100644 FishNet/Plugins/Bayou/VERSION.txt.meta diff --git a/FishNet/Plugins/Bayou/Bayou.cs b/FishNet/Plugins/Bayou/Bayou.cs index 1b9ad6e..695a505 100644 --- a/FishNet/Plugins/Bayou/Bayou.cs +++ b/FishNet/Plugins/Bayou/Bayou.cs @@ -13,13 +13,16 @@ public class Bayou : Transport { #region Serialized. - [Header("Security")] + //Security. /// /// True to connect using WSS. /// [Tooltip("True to connect using WSS.")] [SerializeField] private bool _useWss = false; + + //[SerializeField] + // private bool _configureFor #if UNITY_SERVER || UNITY_EDITOR /// /// Configuration to use for SSL. @@ -29,7 +32,7 @@ public class Bayou : Transport private SslConfiguration _sslConfiguration; #endif - [Header("Channels")] + //Channels. /// /// Maximum transmission unit for this transport. /// @@ -38,7 +41,7 @@ public class Bayou : Transport [SerializeField] private int _mtu = 1023; - [Header("Server")] + //Server. /// /// Port to use. /// @@ -53,7 +56,7 @@ public class Bayou : Transport [SerializeField] private int _maximumClients = 2000; - [Header("Client")] + //Client. /// /// Address to connect. /// diff --git a/FishNet/Plugins/Bayou/CHANGELOG.txt b/FishNet/Plugins/Bayou/CHANGELOG.txt index c30dcf3..e606971 100644 --- a/FishNet/Plugins/Bayou/CHANGELOG.txt +++ b/FishNet/Plugins/Bayou/CHANGELOG.txt @@ -1,3 +1,6 @@ +4.1.1 + - Connection changes are no longer added to a pending queue but are now processed like other socket messages. + 4.1.0 - Fish-Networking 4.1.0 support. Not compatible with V3. diff --git a/FishNet/Plugins/Bayou/Core/ServerSocket.cs b/FishNet/Plugins/Bayou/Core/ServerSocket.cs index 4b770c1..b6f61e4 100644 --- a/FishNet/Plugins/Bayou/Core/ServerSocket.cs +++ b/FishNet/Plugins/Bayou/Core/ServerSocket.cs @@ -48,10 +48,6 @@ internal RemoteConnectionState GetConnectionState(int connectionId) /// Ids to disconnect immediately. /// private List _disconnectingNow = new List(); - /// - /// ConnectionEvents which need to be handled. - /// - private Queue _remoteConnectionEvents = new Queue(); #endregion /// /// Currently connected clients. @@ -140,9 +136,14 @@ private void _server_onConnect(int clientId) return; if (_clients.Count >= _maximumClients) + { _server.KickClient(clientId); - else - _remoteConnectionEvents.Enqueue(new RemoteConnectionEvent(true, clientId)); + return; + } + + _clients.Add(clientId); + RemoteConnectionState state = RemoteConnectionState.Started; + base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(state, clientId, base.Transport.Index)); } /// @@ -234,7 +235,6 @@ private void ResetQueues() base.ClearPacketQueue(ref _outgoing); _disconnectingNext.Clear(); _disconnectingNow.Clear(); - _remoteConnectionEvents.Clear(); } /// @@ -320,17 +320,8 @@ internal void IterateIncoming() if (_server == null) return; - //Handle connection and disconnection events. - while (_remoteConnectionEvents.Count > 0) - { - RemoteConnectionEvent connectionEvent = _remoteConnectionEvents.Dequeue(); - if (connectionEvent.Connected) - _clients.Add(connectionEvent.ConnectionId); - RemoteConnectionState state = (connectionEvent.Connected) ? RemoteConnectionState.Started : RemoteConnectionState.Stopped; - base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(state, connectionEvent.ConnectionId, base.Transport.Index)); - } - - //Read data from clients. + /* Read socket messages. Can contain + * connect, data, disconnect, error messages. */ _server.ProcessMessageQueue(); } diff --git a/FishNet/Plugins/Bayou/VERSION.txt b/FishNet/Plugins/Bayou/VERSION.txt deleted file mode 100644 index 99eba4d..0000000 --- a/FishNet/Plugins/Bayou/VERSION.txt +++ /dev/null @@ -1 +0,0 @@ -4.1.0 \ No newline at end of file diff --git a/FishNet/Plugins/Bayou/VERSION.txt.meta b/FishNet/Plugins/Bayou/VERSION.txt.meta deleted file mode 100644 index 0e591db..0000000 --- a/FishNet/Plugins/Bayou/VERSION.txt.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 1896dffa49f580d4ca3b7d169e596cc4 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: