mirror of
https://github.com/Kaveinator/NetickProForUnity.git
synced 2025-10-26 01:49:05 -07:00
Fix: Resolve an exception in the server when reaching Max Players in server mode
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -100,7 +100,7 @@ namespace Netick.Transport
|
|||||||
|
|
||||||
void INetEventListener.OnConnectionRequest(ConnectionRequest request)
|
void INetEventListener.OnConnectionRequest(ConnectionRequest request)
|
||||||
{
|
{
|
||||||
if (_clients.Count >= Engine.Config.MaxPlayers)
|
if (_freeClients.Count == 0)
|
||||||
{
|
{
|
||||||
request.Reject();
|
request.Reject();
|
||||||
return;
|
return;
|
||||||
@@ -118,6 +118,11 @@ namespace Netick.Transport
|
|||||||
|
|
||||||
void INetEventListener.OnPeerConnected(NetPeer peer)
|
void INetEventListener.OnPeerConnected(NetPeer peer)
|
||||||
{
|
{
|
||||||
|
if (_freeClients.Count == 0)
|
||||||
|
{
|
||||||
|
peer.Disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
var connection = _freeClients.Dequeue();
|
var connection = _freeClients.Dequeue();
|
||||||
connection.LNLPeer = peer;
|
connection.LNLPeer = peer;
|
||||||
_clients. Add(peer, connection);
|
_clients. Add(peer, connection);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.karrar.netick",
|
"name": "com.karrar.netick",
|
||||||
"version": "0.14.60",
|
"version": "0.14.61",
|
||||||
"displayName": "Netick",
|
"displayName": "Netick",
|
||||||
"description": "A networking solution for Unity",
|
"description": "A networking solution for Unity",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user