[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[vidalia-svn] r3396: If it's time to check for available updates when Vidalia sta (vidalia/branches/auto-updates/src/vidalia)



Author: edmanm
Date: 2008-12-13 18:06:28 -0500 (Sat, 13 Dec 2008)
New Revision: 3396

Modified:
   vidalia/branches/auto-updates/src/vidalia/mainwindow.cpp
Log:
If it's time to check for available updates when Vidalia starts, 
and Vidalia is configured to launch Tor on startup, then wait until
either Tor has built a circuit or 5 minutes has passed (whichever
occurs first) before launching the check for updates.


Modified: vidalia/branches/auto-updates/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/branches/auto-updates/src/vidalia/mainwindow.cpp	2008-12-13 07:46:40 UTC (rev 3395)
+++ vidalia/branches/auto-updates/src/vidalia/mainwindow.cpp	2008-12-13 23:06:28 UTC (rev 3396)
@@ -303,8 +303,17 @@
   if (settings.isAutoUpdateEnabled()) {
     QDateTime lastCheckedAt = settings.lastCheckedForUpdates();
     if (UpdateProcess::shouldCheckForUpdates(lastCheckedAt)) {
-      /* Initiate a background check for updates */
-      checkForUpdates();
+      if (settings.runTorAtStart() && ! _torControl->circuitEstablished()) {
+        /* We started Tor but it hasn't bootstrapped yet, so give it a bit
+         * before we decide to check for updates. If Tor manages to build a
+         * circuit before this timer times out, we will stop the timer and
+         * launch a check for updates immediately. (see circuitEstablished()).
+         */
+        _updateTimer.start(5*60*1000);
+      } else {
+        /* Initiate a background check for updates now */
+        checkForUpdates();
+      }
     } else {
       /* Schedule the next time to check for updates */
       QDateTime nextCheckAt = UpdateProcess::nextCheckForUpdates(lastCheckedAt);
@@ -1342,6 +1351,18 @@
   setStartupProgress(ui.progressBar->maximum(),
                      tr("Connected to the Tor network!"));
   startSubprocesses();
+
+#if defined(USE_AUTOUPDATE)
+  VidaliaSettings settings;
+  if (settings.isAutoUpdateEnabled()) {
+    QDateTime lastCheckedAt = settings.lastCheckedForUpdates();
+    if (UpdateProcess::shouldCheckForUpdates(lastCheckedAt)) {
+      /* Initiate a background check for updates now */
+      _updateTimer.stop();
+      checkForUpdates();
+    }
+  }
+#endif
 }
 
 /** Checks the status of the current version of Tor to see if it's old,