mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: Stop calling ClientDisconnect on host (#597)
* Stop calling ClientDisconnect on host * Update NetworkConnection.cs * Update NetworkServer.cs
This commit is contained in:
parent
78504533f3
commit
b67b3e4304
@ -82,14 +82,15 @@ public void Disconnect()
|
||||
isReady = false;
|
||||
ClientScene.HandleClientDisconnect(this);
|
||||
|
||||
// paul: we may be connecting or connected, either way, we need to disconnect
|
||||
// transport should not do anything if it is not connecting/connected
|
||||
Transport.activeTransport.ClientDisconnect();
|
||||
|
||||
// server? then disconnect that client
|
||||
if (Transport.activeTransport.ServerActive())
|
||||
{
|
||||
Transport.activeTransport.ServerDisconnect(connectionId);
|
||||
}
|
||||
// not server and not host mode? then disconnect client
|
||||
else
|
||||
{
|
||||
Transport.activeTransport.ClientDisconnect();
|
||||
}
|
||||
|
||||
// remove observers
|
||||
|
@ -289,13 +289,7 @@ public static bool SendToReady<T>(NetworkIdentity identity,T msg, int channelId
|
||||
public static void DisconnectAll()
|
||||
{
|
||||
DisconnectAllConnections();
|
||||
|
||||
if (s_LocalConnection != null)
|
||||
{
|
||||
s_LocalConnection.Disconnect();
|
||||
s_LocalConnection.Dispose();
|
||||
s_LocalConnection = null;
|
||||
}
|
||||
s_LocalConnection = null;
|
||||
|
||||
active = false;
|
||||
localClientActive = false;
|
||||
@ -307,7 +301,9 @@ public static void DisconnectAllConnections()
|
||||
{
|
||||
NetworkConnection conn = kvp.Value;
|
||||
conn.Disconnect();
|
||||
OnDisconnected(conn);
|
||||
// call OnDisconnected unless local player in host mode
|
||||
if (conn.connectionId != 0)
|
||||
OnDisconnected(conn);
|
||||
conn.Dispose();
|
||||
}
|
||||
connections.Clear();
|
||||
@ -415,8 +411,6 @@ static void OnDisconnected(NetworkConnection conn)
|
||||
}
|
||||
|
||||
if (LogFilter.Debug) Debug.Log("Server lost client:" + conn.connectionId);
|
||||
conn.RemoveObservers();
|
||||
conn.Dispose();
|
||||
}
|
||||
|
||||
static void OnDataReceived(int connectionId, byte[] data)
|
||||
|
Loading…
Reference in New Issue
Block a user