mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkManager.StartHost/StartServer use m_MaxConnections instead of extra parameter, because that's what it's for. NetworkServer.Listen has maxConnections parameter now.
This commit is contained in:
parent
b904220aa2
commit
f104699784
@ -216,11 +216,6 @@ internal void RegisterServerMessages()
|
||||
}
|
||||
|
||||
public bool StartServer()
|
||||
{
|
||||
return StartServer(-1);
|
||||
}
|
||||
|
||||
bool StartServer(int maxConnections)
|
||||
{
|
||||
InitializeSingleton();
|
||||
|
||||
@ -233,7 +228,7 @@ bool StartServer(int maxConnections)
|
||||
|
||||
if (m_ServerBindToIP && !string.IsNullOrEmpty(m_ServerBindAddress))
|
||||
{
|
||||
if (!NetworkServer.Listen(m_ServerBindAddress, m_NetworkPort))
|
||||
if (!NetworkServer.Listen(m_ServerBindAddress, m_NetworkPort, m_MaxConnections))
|
||||
{
|
||||
if (LogFilter.logError) { Debug.LogError("StartServer listen on " + m_ServerBindAddress + " failed."); }
|
||||
return false;
|
||||
@ -241,7 +236,7 @@ bool StartServer(int maxConnections)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!NetworkServer.Listen(m_NetworkPort))
|
||||
if (!NetworkServer.Listen(m_NetworkPort, m_MaxConnections))
|
||||
{
|
||||
if (LogFilter.logError) { Debug.LogError("StartServer listen failed."); }
|
||||
return false;
|
||||
@ -345,19 +340,6 @@ public NetworkClient StartClient(int hostPort=0)
|
||||
return client;
|
||||
}
|
||||
|
||||
public virtual NetworkClient StartHost(int maxConnections)
|
||||
{
|
||||
OnStartHost();
|
||||
if (StartServer(maxConnections))
|
||||
{
|
||||
var client = ConnectLocalClient();
|
||||
OnServerConnect(client.connection);
|
||||
OnStartClient(client);
|
||||
return client;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual NetworkClient StartHost()
|
||||
{
|
||||
OnStartHost();
|
||||
|
@ -101,17 +101,17 @@ static internal void RegisterMessageHandlers()
|
||||
RegisterHandler((short)MsgType.AnimationTrigger, NetworkAnimator.OnAnimationTriggerServerMessage);
|
||||
}
|
||||
|
||||
static public bool Listen(int serverPort)
|
||||
static public bool Listen(int serverPort, int maxConnections)
|
||||
{
|
||||
return InternalListen(null, serverPort);
|
||||
return InternalListen(null, serverPort, maxConnections);
|
||||
}
|
||||
|
||||
static public bool Listen(string ipAddress, int serverPort)
|
||||
static public bool Listen(string ipAddress, int serverPort, int maxConnections)
|
||||
{
|
||||
return InternalListen(ipAddress, serverPort);
|
||||
return InternalListen(ipAddress, serverPort, maxConnections);
|
||||
}
|
||||
|
||||
static internal bool InternalListen(string ipAddress, int serverPort)
|
||||
static internal bool InternalListen(string ipAddress, int serverPort, int maxConnections)
|
||||
{
|
||||
Initialize();
|
||||
|
||||
@ -130,7 +130,7 @@ static internal bool InternalListen(string ipAddress, int serverPort)
|
||||
else
|
||||
{
|
||||
Debug.Log("NetworkServer.InternalListen calls NetworkTransport.AddHost port=" + serverPort);
|
||||
Transport.server.Start(serverPort);
|
||||
Transport.server.Start(serverPort, maxConnections);
|
||||
s_ServerHostId = 0; // so it doesn't return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user