Example #1
0
        /// <summary>
        /// </summary>
        public static void OnPoll()
        {
            BuildRegistry.Poll();
            NetServer.Poll();
            LicenseMgr.Poll();
            RemoteActionServer.Poll();

            NetServer.MaxConnectedClients = LicenseMgr.ActiveLicense.MaxSeats;
            Settings.MaxBandwidth         = NetServer.BandwidthLimit;

            BuildRegistry.PruneUnseenManifests(Settings.MaximumManifestUnseenDays);
            if (BuildRegistry.ManifestLastSeenTimesDirty && TimeUtils.Ticks - LastSaveSettingsTime > MinTimeBetweenDirtyManifestSaves)
            {
                BuildRegistry.ManifestLastSeenTimesDirty = false;

                Settings.ManifestLastSeenTimes = new Dictionary <string, DateTime>(BuildRegistry.ManifestLastSeenTimes);
                SaveSettings();
            }

            PollIpcServer();

            // Pring status every so often.
            ulong Elapsed = TimeUtils.Ticks - LastStatusPrintTime;

            if (Elapsed > StatusPrintInterval)
            {
                PrintStatus();
                LastStatusPrintTime = TimeUtils.Ticks;
            }
        }
Example #2
0
        /// <summary>
        /// </summary>
        public static void OnPoll()
        {
            NetClient.TrafficEnabled = AreDownloadsAllowed();
            ManifestDownloadManager.TrafficEnabled = AreDownloadsAllowed();

            BuildRegistry.Poll();
            ScmManager.Poll();
            NetClient.Poll();
            DownloadManager.Poll(NetClient.IsReadyForData);
            ManifestDownloadManager.Poll();
            StorageManager.Poll();
            RemoteActionClient.Poll();

            // Update save data if download states have changed recently.
            if (TimeUtils.Ticks - LastSettingsSaveTime > MinimumTimeBetweenSettingsSaves || ForceSaveSettingsPending)
            {
                if (ManifestDownloadManager.AreStatesDirty || DownloadManager.AreStatesDirty || ForceSaveSettingsPending)
                {
                    Logger.Log(LogLevel.Verbose, LogCategory.Main, "Saving settings.");

                    Settings.DownloadStates         = DownloadManager.States;
                    Settings.ManifestDownloadStates = ManifestDownloadManager.States;
                    SaveSettings(true);

                    ManifestDownloadManager.AreStatesDirty = false;
                    DownloadManager.AreStatesDirty         = false;

                    ForceSaveSettingsPending = false;
                    LastSettingsSaveTime     = TimeUtils.Ticks;
                }
            }

            PollIpcServer();
            PollAutoUpdate();
            RecordPeerStates();

            if (AutoUpdateAvailable && Settings.AutoInstallUpdates)
            {
                Logger.Log(LogLevel.Verbose, LogCategory.Main, "Running silent update.");
                Program.InstallAutoUpdate(true);
            }
        }