Skip to content

Commit c2a1ac8

Browse files
committed
removing k_TimeoutDuration
1 parent 7ebad5f commit c2a1ac8

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

Assets/BossRoom/Scripts/Shared/Net/ConnectionManagement/ClientGameNetPortal.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ public class ClientGameNetPortal : MonoBehaviour
2727
/// </summary>
2828
public DisconnectReason DisconnectReason { get; } = new DisconnectReason();
2929

30-
/// <summary>
31-
/// Time in seconds before the client considers a lack of server response a timeout
32-
/// </summary>
33-
private const int k_TimeoutDuration = 10;
34-
3530
const int k_NbReconnectAttempts = 2;
3631

3732
Coroutine m_TryToReconnectCoroutine;
@@ -222,7 +217,7 @@ private IEnumerator TryToReconnect(string lobbyCode)
222217
{
223218
ConnectClient();
224219
}
225-
yield return new WaitForSeconds(1.1f * k_TimeoutDuration); // wait a bit longer than the timeout duration to make sure we have enough time to stop this coroutine if successful
220+
yield return new WaitForSeconds(1.1f * NetworkManager.Singleton.NetworkConfig.ClientConnectionBufferTimeout); // wait a bit longer than the timeout duration to make sure we have enough time to stop this coroutine if successful
226221
nbTries++;
227222
}
228223

@@ -301,7 +296,6 @@ async Task JoinRelayAsync(Action<string> onFailure = null)
301296

302297
void ConnectClient()
303298
{
304-
305299
var payload = JsonUtility.ToJson(new ConnectionPayload()
306300
{
307301
playerId = m_Portal.GetPlayerId(),
@@ -313,7 +307,7 @@ void ConnectClient()
313307
var payloadBytes = System.Text.Encoding.UTF8.GetBytes(payload);
314308

315309
m_Portal.NetManager.NetworkConfig.ConnectionData = payloadBytes;
316-
m_Portal.NetManager.NetworkConfig.ClientConnectionBufferTimeout = k_TimeoutDuration;
310+
m_Portal.NetManager.NetworkConfig.ClientConnectionBufferTimeout = ((UnityTransport)NetworkManager.Singleton.NetworkConfig.NetworkTransport).DisconnectTimeoutMS;
317311

318312
//and...we're off! Netcode will establish a socket connection to the host.
319313
// If the socket connection fails, we'll hear back by getting an ReceiveServerToClientSetDisconnectReason_CustomMessage callback for ourselves and get a message telling us the reason

0 commit comments

Comments
 (0)