Skip to content

Commit

Permalink
4.1.1
Browse files Browse the repository at this point in the history
- Connection changes are no longer added to a pending queue but are now processed like other socket messages.
  • Loading branch information
FirstGearGames committed Jun 25, 2024
1 parent de11a19 commit d0e70b6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 30 deletions.
11 changes: 7 additions & 4 deletions FishNet/Plugins/Bayou/Bayou.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ public class Bayou : Transport
{

#region Serialized.
[Header("Security")]
//Security.
/// <summary>
/// True to connect using WSS.
/// </summary>
[Tooltip("True to connect using WSS.")]
[SerializeField]
private bool _useWss = false;

//[SerializeField]
// private bool _configureFor
#if UNITY_SERVER || UNITY_EDITOR
/// <summary>
/// Configuration to use for SSL.
Expand All @@ -29,7 +32,7 @@ public class Bayou : Transport
private SslConfiguration _sslConfiguration;
#endif

[Header("Channels")]
//Channels.
/// <summary>
/// Maximum transmission unit for this transport.
/// </summary>
Expand All @@ -38,7 +41,7 @@ public class Bayou : Transport
[SerializeField]
private int _mtu = 1023;

[Header("Server")]
//Server.
/// <summary>
/// Port to use.
/// </summary>
Expand All @@ -53,7 +56,7 @@ public class Bayou : Transport
[SerializeField]
private int _maximumClients = 2000;

[Header("Client")]
//Client.
/// <summary>
/// Address to connect.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions FishNet/Plugins/Bayou/CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
27 changes: 9 additions & 18 deletions FishNet/Plugins/Bayou/Core/ServerSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ internal RemoteConnectionState GetConnectionState(int connectionId)
/// Ids to disconnect immediately.
/// </summary>
private List<int> _disconnectingNow = new List<int>();
/// <summary>
/// ConnectionEvents which need to be handled.
/// </summary>
private Queue<RemoteConnectionEvent> _remoteConnectionEvents = new Queue<RemoteConnectionEvent>();
#endregion
/// <summary>
/// Currently connected clients.
Expand Down Expand Up @@ -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));
}

/// <summary>
Expand Down Expand Up @@ -234,7 +235,6 @@ private void ResetQueues()
base.ClearPacketQueue(ref _outgoing);
_disconnectingNext.Clear();
_disconnectingNow.Clear();
_remoteConnectionEvents.Clear();
}

/// <summary>
Expand Down Expand Up @@ -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();
}

Expand Down
1 change: 0 additions & 1 deletion FishNet/Plugins/Bayou/VERSION.txt

This file was deleted.

7 changes: 0 additions & 7 deletions FishNet/Plugins/Bayou/VERSION.txt.meta

This file was deleted.

0 comments on commit d0e70b6

Please sign in to comment.