move NextClient.SetTransportError calls up

This commit is contained in:
JohnCorby 2022-01-24 11:30:41 -08:00
parent 218e796f46
commit 4b53ad6538

View File

@ -48,8 +48,8 @@ namespace Mirror.FizzySteam
} }
else else
{ {
Debug.LogError("SteamWorks not initialized");
c.SetTransportError("SteamWorks not initialized"); c.SetTransportError("SteamWorks not initialized");
Debug.LogError("SteamWorks not initialized");
c.OnConnectionFailed(); c.OnConnectionFailed();
} }
@ -75,13 +75,13 @@ namespace Mirror.FizzySteam
{ {
if (cancelToken.IsCancellationRequested) if (cancelToken.IsCancellationRequested)
{ {
Debug.LogError($"The connection attempt was cancelled.");
SetTransportError("The connection attempt was cancelled."); SetTransportError("The connection attempt was cancelled.");
Debug.LogError($"The connection attempt was cancelled.");
} }
else if (timeOutTask.IsCompleted) else if (timeOutTask.IsCompleted)
{ {
Debug.LogError($"Connection to {host} timed out.");
SetTransportError($"Connection to {host} timed out."); SetTransportError($"Connection to {host} timed out.");
Debug.LogError($"Connection to {host} timed out.");
} }
OnConnected -= SetConnectedComplete; OnConnected -= SetConnectedComplete;
@ -92,16 +92,16 @@ namespace Mirror.FizzySteam
} }
catch (FormatException) catch (FormatException)
{ {
SetTransportError("Connection string was not in the right format. Did you enter a SteamId?");
Debug.LogError($"Connection string was not in the right format. Did you enter a SteamId?"); Debug.LogError($"Connection string was not in the right format. Did you enter a SteamId?");
Error = true; Error = true;
SetTransportError("Connection string was not in the right format. Did you enter a SteamId?");
OnConnectionFailed(); OnConnectionFailed();
} }
catch (Exception ex) catch (Exception ex)
{ {
SetTransportError(ex.Message);
Debug.LogError(ex.Message); Debug.LogError(ex.Message);
Error = true; Error = true;
SetTransportError(ex.Message);
OnConnectionFailed(); OnConnectionFailed();
} }
finally finally
@ -149,10 +149,10 @@ namespace Mirror.FizzySteam
} }
else if (info.State == ConnectionState.ClosedByPeer) else if (info.State == ConnectionState.ClosedByPeer)
{ {
SetTransportError("connection closed by peer");
Connected = false; Connected = false;
OnDisconnected.Invoke(); OnDisconnected.Invoke();
Debug.LogError("Disconnected."); Debug.LogError("Disconnected.");
SetTransportError("connection closed by peer");
conn.Close(false, 0, "Disconnected"); conn.Close(false, 0, "Disconnected");
} }
else else