Remove s_ prefix because the entire class is static, the prefix doesnt actually specify anything. (#668)

This commit is contained in:
rodolphito 2019-03-27 04:04:07 -07:00 committed by vis2k
parent 86c1942310
commit 9be7426efa

View File

@ -6,8 +6,8 @@ namespace Mirror
{ {
public static class NetworkServer public static class NetworkServer
{ {
static bool s_Initialized; static bool initialized;
static int s_MaxConnections; static int maxConnections;
// original HLAPI has .localConnections list with only m_LocalConnection in it // original HLAPI has .localConnections list with only m_LocalConnection in it
// (for downwards compatibility because they removed the real localConnections list a while ago) // (for downwards compatibility because they removed the real localConnections list a while ago)
@ -30,7 +30,7 @@ public static void Reset()
public static void Shutdown() public static void Shutdown()
{ {
if (s_Initialized) if (initialized)
{ {
DisconnectAll(); DisconnectAll();
@ -48,7 +48,7 @@ public static void Shutdown()
Transport.activeTransport.OnServerDataReceived.RemoveListener(OnDataReceived); Transport.activeTransport.OnServerDataReceived.RemoveListener(OnDataReceived);
Transport.activeTransport.OnServerError.RemoveListener(OnError); Transport.activeTransport.OnServerError.RemoveListener(OnError);
s_Initialized = false; initialized = false;
} }
dontListen = false; dontListen = false;
active = false; active = false;
@ -58,10 +58,10 @@ public static void Shutdown()
static void Initialize() static void Initialize()
{ {
if (s_Initialized) if (initialized)
return; return;
s_Initialized = true; initialized = true;
if (LogFilter.Debug) Debug.Log("NetworkServer Created version " + Version.Current); if (LogFilter.Debug) Debug.Log("NetworkServer Created version " + Version.Current);
//Make sure connections are cleared in case any old connections references exist from previous sessions //Make sure connections are cleared in case any old connections references exist from previous sessions
@ -80,10 +80,10 @@ internal static void RegisterMessageHandlers()
RegisterHandler<NetworkPingMessage>(NetworkTime.OnServerPing); RegisterHandler<NetworkPingMessage>(NetworkTime.OnServerPing);
} }
public static bool Listen(int maxConnections) public static bool Listen(int maxConns)
{ {
Initialize(); Initialize();
s_MaxConnections = maxConnections; maxConnections = maxConns;
// only start server if we want to listen // only start server if we want to listen
if (!dontListen) if (!dontListen)
@ -356,7 +356,7 @@ static void OnConnected(int connectionId)
// less code and third party transport might not do that anyway) // less code and third party transport might not do that anyway)
// (this way we could also send a custom 'tooFull' message later, // (this way we could also send a custom 'tooFull' message later,
// Transport can't do that) // Transport can't do that)
if (connections.Count < s_MaxConnections) if (connections.Count < maxConnections)
{ {
// get ip address from connection // get ip address from connection
string address = Transport.activeTransport.ServerGetClientAddress(connectionId); string address = Transport.activeTransport.ServerGetClientAddress(connectionId);