mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix: Edgegap Lobby Error continues to Connecting (#3898)
Missing return, oops. Also some minor readability cleanup
This commit is contained in:
parent
1cc18e67c5
commit
2d9ee5646c
@ -206,63 +206,66 @@ private IEnumerator WaitForLobbyRelay(string lobbyId, bool forServer)
|
|||||||
Api.GetLobby(lobbyId, lobby =>
|
Api.GetLobby(lobbyId, lobby =>
|
||||||
{
|
{
|
||||||
waitingForResponse = false;
|
waitingForResponse = false;
|
||||||
if (!string.IsNullOrEmpty(lobby.assignment.ip))
|
if (string.IsNullOrEmpty(lobby.assignment.ip))
|
||||||
{
|
{
|
||||||
relayAddress = lobby.assignment.ip;
|
// no lobby deployed yet, have the outer loop retry
|
||||||
foreach (Lobby.Port aport in lobby.assignment.ports)
|
return;
|
||||||
|
}
|
||||||
|
relayAddress = lobby.assignment.ip;
|
||||||
|
foreach (Lobby.Port aport in lobby.assignment.ports)
|
||||||
|
{
|
||||||
|
if (aport.protocol == "UDP")
|
||||||
{
|
{
|
||||||
if (aport.protocol == "UDP")
|
if (aport.name == "server")
|
||||||
{
|
{
|
||||||
if (aport.name == "server")
|
relayGameServerPort = (ushort)aport.port;
|
||||||
{
|
|
||||||
relayGameServerPort = (ushort)aport.port;
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (aport.name == "client")
|
|
||||||
{
|
|
||||||
relayGameClientPort = (ushort)aport.port;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
else if (aport.name == "client")
|
||||||
bool found = false;
|
|
||||||
foreach (Lobby.Player player in lobby.players)
|
|
||||||
{
|
|
||||||
if (player.id == _playerId)
|
|
||||||
{
|
{
|
||||||
userId = player.authorization_token;
|
relayGameClientPort = (ushort)aport.port;
|
||||||
sessionId = lobby.assignment.authorization_token;
|
|
||||||
found = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
running = false;
|
}
|
||||||
if (!found)
|
bool found = false;
|
||||||
|
foreach (Lobby.Player player in lobby.players)
|
||||||
|
{
|
||||||
|
if (player.id == _playerId)
|
||||||
{
|
{
|
||||||
string errorMsg = $"Couldn't find my player ({_playerId})";
|
userId = player.authorization_token;
|
||||||
Debug.LogError(errorMsg);
|
sessionId = lobby.assignment.authorization_token;
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
running = false;
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
string errorMsg = $"Couldn't find my player ({_playerId})";
|
||||||
|
Debug.LogError(errorMsg);
|
||||||
|
|
||||||
if (forServer)
|
|
||||||
{
|
|
||||||
_status = TransportStatus.Error;
|
|
||||||
OnServerError?.Invoke(0, TransportError.Unexpected, errorMsg);
|
|
||||||
ServerStop();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_status = TransportStatus.Error;
|
|
||||||
OnClientError?.Invoke(TransportError.Unexpected, errorMsg);
|
|
||||||
ClientDisconnect();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_status = TransportStatus.Connecting;
|
|
||||||
if (forServer)
|
if (forServer)
|
||||||
{
|
{
|
||||||
base.ServerStart();
|
_status = TransportStatus.Error;
|
||||||
|
OnServerError?.Invoke(0, TransportError.Unexpected, errorMsg);
|
||||||
|
ServerStop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.ClientConnect("");
|
_status = TransportStatus.Error;
|
||||||
|
OnClientError?.Invoke(TransportError.Unexpected, errorMsg);
|
||||||
|
ClientDisconnect();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_status = TransportStatus.Connecting;
|
||||||
|
if (forServer)
|
||||||
|
{
|
||||||
|
base.ServerStart();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.ClientConnect("");
|
||||||
}
|
}
|
||||||
}, error =>
|
}, error =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user