public FakeSocket(IPEndPoint ip_end_point, Command command, Console.IViewer viewer) { _IpEndPoint = ip_end_point; _Command = command; _Viewer = viewer; _Id = ++_InstanceId; _MissCount = ushort.MaxValue + 1; _Time = new Time(); _Time.Sample(); _Random = new System.Random(0); _SendRecords = new List <Record>(); _ReceiveMessages = new List <SocketMessage>(); _SendTime = 0; _SendTimeJitter = 0f; }
private void Run() { AutoPowerRegulator wait = new AutoPowerRegulator(new PowerRegulator(30)); Updater <Timestamp> updater = new Updater <Timestamp>(); updater.Add(m_Agent); while (m_Enable) { m_Time.Sample(); updater.Working(new Timestamp(m_Time.Now, m_Time.Delta)); wait.Operate(); } updater.Shutdown(); }
private void Run(object State) { var updater = new Updater <Timestamp>(); updater.Add(m_Host); var wait = new AutoPowerRegulator(new PowerRegulator()); while (m_Enable) { m_Time.Sample(); updater.Working(new Timestamp(m_Time.Now, m_Time.Delta)); wait.Operate(); } updater.Shutdown(); }
bool IUpdatable.Update() { _Time.Sample(); lock (_SendRecords) { foreach (var sendRecord in _SendRecords.ToArray()) { if ((sendRecord.TimeUp -= _Time.Delta) <= 0) { _SendRecords.RemoveAll((r) => r.Message == sendRecord.Message); SendEvent(sendRecord.Message); } } } return(true); }