public override void Update() { this.TimeNow = (uint)(TimeHelper.ClientNow() - this.StartTime); this.Recv(); this.TimerOut(); foreach (long id in updateChannels) { KChannel kChannel = this.GetKChannel(id); if (kChannel == null) { continue; } if (kChannel.Id == 0) { continue; } kChannel.Update(); } this.updateChannels.Clear(); while (this.removedChannels.Count > 0) { long id = this.removedChannels.Dequeue(); KChannel channel; if (!this.localConnChannels.TryGetValue(id, out channel)) { continue; } this.localConnChannels.Remove(id); channel.Dispose(); } }
public override void Update() { this.TimeNow = (uint)(TimeHelper.ClientNow() - this.StartTime); this.Recv(); this.CheckWaitTimeout(); this.TimerOut(); foreach (long id in updateChannels) { KChannel kChannel = this.GetKChannel(id); if (kChannel == null) { continue; } if (kChannel.Id == 0) { continue; } kChannel.Update(); } this.updateChannels.Clear(); while (true) { if (this.removedChannels.Count <= 0) { break; } long id = this.removedChannels.Dequeue(); this.localConnChannels.Remove(id); } }
public override void Update() { this.TimeNow = (uint)(TimeHelper.ClientNow() - this.StartTime); this.Recv(); this.TimerOut(); while (this.removedChannels.Count > 0) { long id = this.removedChannels.Dequeue(); KChannel channel; if (!this.localConnChannels.TryGetValue(id, out channel)) { continue; } this.localConnChannels.Remove(id); channel.Dispose(); } foreach (long id in updateChannels) { KChannel kChannel = this.GetKChannel(id); if (kChannel == null) { continue; } if (kChannel.Id == 0) { continue; } kChannel.Update(); } this.updateChannels.Clear(); if (CheckHearBeat && timeHearBeat.IsPassSet()) { foreach (KChannel channel in localConnChannels.Values) { if (channel.CheckHearBeat()) { channel.OnError(ErrorCode.ERR_KcpChannelTimeout); Remove(channel.Id); } } } }