Fixed: ServerDisconnected due to error: Timeout. Also improved log messages to make more sense.

This commit is contained in:
vis2k 2018-06-08 11:02:24 +02:00
parent d4eb84182d
commit e505cbd5f4

View File

@ -1017,9 +1017,16 @@ public virtual void OnServerConnect(NetworkConnection conn)
public virtual void OnServerDisconnect(NetworkConnection conn) public virtual void OnServerDisconnect(NetworkConnection conn)
{ {
NetworkServer.DestroyPlayersForConnection(conn); NetworkServer.DestroyPlayersForConnection(conn);
if (conn.lastError != NetworkError.Ok)
// note: timeouts happen all the time, no need to throw an error there.
if (conn.lastError == NetworkError.Ok || conn.lastError == NetworkError.Timeout)
{ {
if (LogFilter.logError) { Debug.LogError("ServerDisconnected due to error: " + conn.lastError); } if (LogFilter.logDebug) { Debug.Log("OnServerDisconnect: client disconnected:" + conn); }
}
else
{
// a client disconnected, let's show a message
if (LogFilter.logError) { Debug.LogError("OnServerDisconnect: Client disconnected with error: " + conn.lastError); }
} }
} }