Esempio n. 1
0
        private void StartPersistTimer()
        {
            Dispatcher.Callback fun = new Dispatcher.Callback(OnPersistTimeout);
            ulong expiryTime        = (ulong)DateTime.UtcNow.Ticks + (PersistTimeout * DateTime.TicksPerSecond);

            persistTimer = Core.Instance().TheDispatcher.AddCallback(fun, null, expiryTime);
        }
Esempio n. 2
0
        internal void StartConnectTimer()
        {
            ulong timeout;

            if (passiveSession != null)
            {
                timeout = PassiveConnectTimeout;
            }
            else
            {
                timeout = ActiveConnectTimeout;
            }

            Dispatcher.Callback fun = new Dispatcher.Callback(OnConnectTimeout);
            ulong expiryTime        = (ulong)DateTime.UtcNow.Ticks + (timeout * DateTime.TicksPerSecond);

            connectTimer = Core.Instance().TheDispatcher.AddCallback(fun, null, expiryTime);
        }
Esempio n. 3
0
        private void DestroyTimer(ref RJBlack.Timer timer, string timerName)
        {
            if (timer == null)
            {
                DebugPrint("TCP: Ses{0,3} ({1}) No {2} Timer to Destroy.",
                           this.Uid, this.currentState.StateName, timerName);
            }

            if (timer != null)      // BUGBUG: Lock done on "timers" in RemoveTimeoutCallback.  Is there a nulling race?  // TODO
            {
                bool removeWorked =
                    Core.Instance().TheDispatcher.RemoveTimeoutCallback(timer);
                DebugPrint("TCP: Ses{0,3} ({1}) Destroy {2} Timer {3}.",
                           this.Uid,
                           this.currentState.StateName,
                           timerName,
                           (removeWorked) ? "Worked" : "Failed");
                timer = null;
            }
        }