Skip to content

Commit 0461c0b

Browse files
committed
small bug fixes
* shutting down host now changes state to offline * fixed return value of JoinRelayServerAsync (cherry picked from commit 593da8a)
1 parent 5a808c0 commit 0461c0b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Assets/Scripts/Gameplay/ConnectionManagement/ConnectionState/HostingConnectionState.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ IEnumerator WaitToShutdown()
147147
yield return null;
148148
m_ConnectionManager.NetworkManager.Shutdown();
149149
SessionManager<SessionPlayerData>.Instance.OnServerEnded();
150+
m_ConnectionManager.ChangeState(ConnectionStateType.Offline);
150151
}
151152
}
152153
}

Assets/Scripts/Gameplay/ConnectionManagement/ConnectionState/OfflineConnectionState.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ public override void StartClientIP(string playerName, string ipaddress, int port
4545

4646
public override async Task StartClientLobbyAsync(string playerName, Action<string> onFailure)
4747
{
48-
if (await JoinRelayServerAsync(onFailure)) return;//not re-throwing, but still not allowing to connect
49-
50-
ConnectClient(GetPlayerId(), playerName);
51-
m_ConnectionManager.ChangeState(ConnectionStateType.Connecting);
48+
if (await JoinRelayServerAsync(onFailure))
49+
{
50+
ConnectClient(GetPlayerId(), playerName);
51+
m_ConnectionManager.ChangeState(ConnectionStateType.Connecting);
52+
}
5253
}
5354

5455
protected async Task<bool> JoinRelayServerAsync(Action<string> onFailure)
@@ -67,10 +68,10 @@ protected async Task<bool> JoinRelayServerAsync(Action<string> onFailure)
6768
catch (Exception e)
6869
{
6970
onFailure?.Invoke(e.Message);
70-
return true;
71+
return false;
7172
}
7273

73-
return false;
74+
return true;
7475
}
7576

7677
public override bool StartHostIP(string playerName, string ipaddress, int port)

0 commit comments

Comments
 (0)