public static void Process() { if (!Connected) { if (TimeConnected == 0 && Main.Time >= 10000) { MirScenes.SceneFunctions.ConnectionClosed(); } return; } while (ReceiveList.Count > 0) { InBound.ProcessPacket(ReceiveList.Dequeue()); } if (Main.Time > TimeOutTime) { OutBound.KeepAlive(); } while (SendList.Count > 0) { TimeOutTime = Main.Time + Settings.TimeOut; BeginSend(SendList.Dequeue()); } }
public static void Disconnect() { while (Connected && SendList.Count > 0) { BeginSend(SendList.Dequeue()); } Connected = false; if (Client != null) { Client.Client.Dispose(); } Client = null; SendList.Clear(); ReceiveList.Clear(); }
public void Process() { while (ReceiveList.Count > 0) { ProcessPacket(ReceiveList.Dequeue()); TimeOutTime = Main.Time + Settings.TimeOut; } if (Main.Time > TimeOutTime) { Connected = false; SendList.Clear(); Disconnect(); return; } while (SendList.Count > 0) { BeginSend(SendList.Dequeue()); } }
public void Disconnect() { while (Connected && SendList.Count > 0) { BeginSend(SendList.Dequeue()); } Connected = false; if (Stage == GameStage.Disconnected) { return; } if (Stage == GameStage.Game) { Player.DeSpawn(); } Stage = GameStage.Disconnected; TimeDisconnected = Main.Time; if (TClient != null) { TClient.Client.Dispose(); } TClient = null; Account = null; SendList.Clear(); ReceiveList.Clear(); Network.ActiveConnections.Remove(this); if (!Network.ExpiredConnections.Contains(this)) { Network.ExpiredConnections.Add(this); } }