// Token: 0x06000025 RID: 37 RVA: 0x00002A18 File Offset: 0x00000C18 private static bool FallbackSendAckThread() { if (PhotonVoiceHandler.sendThreadShouldRun && PhotonVoiceNetwork.Client != null && PhotonVoiceNetwork.Client.loadBalancingPeer != null) { ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer loadBalancingPeer = PhotonVoiceNetwork.Client.loadBalancingPeer; ExitGames.Client.Photon.LoadBalancing.ClientState state = PhotonVoiceNetwork.Client.State; if (PhotonVoiceHandler.timerToStopConnectionInBackground != null && PhotonVoiceNetwork.BackgroundTimeout > 0.1f && (float)PhotonVoiceHandler.timerToStopConnectionInBackground.ElapsedMilliseconds > PhotonVoiceNetwork.BackgroundTimeout * 1000f) { bool flag = true; if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated || state - ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting <= 1 || state == ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer) { flag = false; } if (flag) { PhotonVoiceNetwork.Disconnect(); } PhotonVoiceHandler.timerToStopConnectionInBackground.Stop(); PhotonVoiceHandler.timerToStopConnectionInBackground.Reset(); return(PhotonVoiceHandler.sendThreadShouldRun); } if (loadBalancingPeer.ConnectionTime - loadBalancingPeer.LastSendOutgoingTime > 200) { loadBalancingPeer.SendAcksOnly(); } } return(PhotonVoiceHandler.sendThreadShouldRun); }
protected void Update() { ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer voicePeer = PhotonVoiceNetwork.Client.loadBalancingPeer; if (voicePeer == null) { UnityEngine.Debug.LogError("[PUNVoice]: LoadBalancingPeer broke!"); return; } ExitGames.Client.Photon.LoadBalancing.ClientState clientState = PhotonVoiceNetwork.Client.State; bool connected = true; switch (clientState) { case ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated: case ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnected: case ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting: case ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer: connected = false; break; } if (!connected) { return; } bool doDispatch = true; while (PhotonNetwork.isMessageQueueRunning && doDispatch) { // DispatchIncomingCommands() returns true of it found any command to dispatch (event, result or state change) Profiler.BeginSample("[PUNVoice]: DispatchIncomingCommands"); doDispatch = voicePeer.DispatchIncomingCommands(); Profiler.EndSample(); } int currentMsSinceStart = (int)(Time.realtimeSinceStartup * 1000); // avoiding Environment.TickCount, which could be negative on long-running platforms if (currentMsSinceStart > nextSendTickCount) { bool doSend = true; while (PhotonNetwork.isMessageQueueRunning && doSend) { // Send all outgoing commands Profiler.BeginSample("[PUNVoice]: SendOutgoingCommands"); doSend = voicePeer.SendOutgoingCommands(); Profiler.EndSample(); } nextSendTickCount = currentMsSinceStart + updateInterval; } }
/// <summary>A thread which runs independent from the Update() calls. Keeps connections online while loading or in background. See PhotonVoiceNetwork.BackgroundTimeout.</summary> private static bool FallbackSendAckThread() { if (sendThreadShouldRun && PhotonVoiceNetwork.Client != null && PhotonVoiceNetwork.Client.loadBalancingPeer != null) { ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer voicePeer = PhotonVoiceNetwork.Client.loadBalancingPeer; ExitGames.Client.Photon.LoadBalancing.ClientState clientState = PhotonVoiceNetwork.Client.State; // check if the client should disconnect after some seconds in background if (timerToStopConnectionInBackground != null && PhotonVoiceNetwork.BackgroundTimeout > 0.1f) { if (timerToStopConnectionInBackground.ElapsedMilliseconds > PhotonVoiceNetwork.BackgroundTimeout * 1000) { bool connected = true; switch (clientState) { case ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated: case ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnected: case ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting: case ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer: connected = false; break; } if (connected) { PhotonVoiceNetwork.Disconnect(); } timerToStopConnectionInBackground.Stop(); timerToStopConnectionInBackground.Reset(); return(sendThreadShouldRun); } } if (voicePeer.ConnectionTime - voicePeer.LastSendOutgoingTime > 200) { voicePeer.SendAcksOnly(); } } return(sendThreadShouldRun); }
// Token: 0x06000028 RID: 40 RVA: 0x00002B54 File Offset: 0x00000D54 protected void Update() { ExitGames.Client.Photon.LoadBalancing.LoadBalancingPeer loadBalancingPeer = PhotonVoiceNetwork.Client.loadBalancingPeer; if (loadBalancingPeer == null) { Debug.LogError("[PUNVoice]: LoadBalancingPeer broke!"); return; } ExitGames.Client.Photon.LoadBalancing.ClientState state = PhotonVoiceNetwork.Client.State; bool flag = true; if (state == ExitGames.Client.Photon.LoadBalancing.ClientState.PeerCreated || state - ExitGames.Client.Photon.LoadBalancing.ClientState.Disconnecting <= 1 || state == ExitGames.Client.Photon.LoadBalancing.ClientState.ConnectedToNameServer) { flag = false; } if (!flag) { return; } bool flag2 = true; while (PhotonNetwork.isMessageQueueRunning && flag2) { flag2 = loadBalancingPeer.DispatchIncomingCommands(); } int num = (int)(Time.realtimeSinceStartup * 1000f); if (num > this.nextSendTickCount) { bool flag3 = true; while (PhotonNetwork.isMessageQueueRunning && flag3) { flag3 = loadBalancingPeer.SendOutgoingCommands(); } this.nextSendTickCount = num + this.updateInterval; } }
public LoadBalancingClient(ConnectionProtocol protocol = ConnectionProtocol.Udp) { #if UNITY_WEBGL UnityEngine.Debug.Log("LoadBalancingClient using a new WebSocket LoadBalancingPeer and SocketWebTcp."); protocol = ConnectionProtocol.WebSocketSecure; #endif this.loadBalancingPeer = new LoadBalancingPeer(this, protocol); #if UNITY_WEBGL if (protocol == ConnectionProtocol.WebSocket || protocol == ConnectionProtocol.WebSocketSecure) { this.loadBalancingPeer.SocketImplementation = typeof(SocketWebTcp); } #endif }
public LoadBalancingClient(ConnectionProtocol protocol = ConnectionProtocol.Udp) { this.MasterServerAddress = "app-eu.exitgamescloud.com:5055"; this.loadBalancingPeer = new LoadBalancingPeer(this, protocol); }
public LoadBalancingClient() { this.clientId = ++clientCount; this.MasterServerAddress = "app.exitgamescloud.com:5055"; this.LocalPlayer = this.CreatePlayer(string.Empty, -1, true, null); this.loadBalancingPeer = new LoadBalancingPeer(this, ConnectionProtocol.Udp); }