private void DeviceLifeTimeClockSink(LifeTimeMonitor sender, object obj) { DeviceInfo info; lock (this.deviceTableLock) { if (!this.deviceTable.ContainsKey(obj)) { return; } info = (DeviceInfo)this.deviceTable[obj]; this.deviceTable.Remove(obj); this.deviceUpdateClock.Remove(obj); if (this.activeDeviceList.Contains(info.Device)) { this.activeDeviceList.Remove(info.Device); } else { info.Device = null; } } if (info.Device != null) { //info.Device.Removed(); } if (info.Device != null) { //info.Device.Removed(); this.OnDeviceExpiredEvent.Fire(this, info.Device); } }
private void DeviceUpdateClockSink(LifeTimeMonitor sender, object obj) { lock (this.deviceTableLock) { if (this.deviceTable.ContainsKey(obj)) { DeviceInfo info = (DeviceInfo)this.deviceTable[obj]; if (info.PendingBaseURL != null) { info.BaseURL = info.PendingBaseURL; info.MaxAge = info.PendingMaxAge; info.SourceEP = info.PendingSourceEP; info.LocalEP = info.PendingLocalEP; info.NotifyTime = DateTime.Now; info.Device.UpdateDevice(info.BaseURL, info.LocalEP.Address); this.deviceTable[obj] = info; this.deviceLifeTimeClock.Add(info.UDN, info.MaxAge); } } } }
/// <summary> /// This method can be triggered 30 seconds after an event was received /// notifying us what ConnectionIDs are valid. There could be a 30 seconds delay, because /// if there are pending connection attempts, this event may not contain the complete ID list, /// so we need to wait for PrepareForConnection to return. Or vice versa. If PrepareForConnection /// returns with its ID, we need to make sure the event arrived, because otherwise we /// could receive an event without that connection id, and the CP may think that the ID we just added /// was deleted, which is bad... Very bad race conditions here :) /// </summary> /// <param name="sender"></param> /// <param name="obj"></param> private void ConnectionMonitorSink(LifeTimeMonitor sender, object obj) { // Lets fetch information about the connection id specicifed in obj ConnectionManager.GetCurrentConnectionInfo((int)obj, null, new CpConnectionManager.Delegate_OnResult_GetCurrentConnectionInfo(ConnectionInfoSink)); }