]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Wait 60 minutes before retrying failed state save; bug2346
authorNick Mathewson <nickm@torproject.org>
Mon, 10 Jan 2011 21:44:42 +0000 (16:44 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 10 Jan 2011 21:51:11 +0000 (16:51 -0500)
changes/bug2346 [new file with mode: 0644]
src/or/config.c

diff --git a/changes/bug2346 b/changes/bug2346
new file mode 100644 (file)
index 0000000..341b4f4
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor features
+    - If writing the state file to disk fails, wait an hour before
+      retrying again.  Fixes bug 2346.  Bugfix on Tor 0.1.1.3-alpha.
+
+
index 17d776e71e31195cb0bae661125a0474e7652b9b..5198eaa0552c92c47caed7dcce513cfb5fab3d3f 100644 (file)
@@ -5145,6 +5145,9 @@ or_state_load(void)
   return r;
 }
 
+/** If writing the state to disk fails, try again after this many seconds. */
+#define STATE_WRITE_RETRY_INTERVAL 3600
+
 /** Write the persistent state to disk. Return 0 for success, <0 on failure. */
 int
 or_state_save(time_t now)
@@ -5179,10 +5182,13 @@ or_state_save(time_t now)
   tor_free(state);
   fname = get_datadir_fname("state");
   if (write_str_to_file(fname, contents, 0)<0) {
-    log_warn(LD_FS, "Unable to write state to file \"%s\"", fname);
+    log_warn(LD_FS, "Unable to write state to file \"%s\"; will try later",
+             fname);
     global_state->LastWritten = -1;
     tor_free(fname);
     tor_free(contents);
+    /* Try again in after STATE_WRITE_RETRY_INTERVAL */
+    global_state->next_write = now + STATE_WRITE_RETRY_INTERVAL;
     return -1;
   }