diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-01-12 12:38:54 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-01-12 12:38:54 -0500 |
commit | cbcae4aef1c0cf42244d5eea4f77d62ea74cf3c4 (patch) | |
tree | eb1055da29144ad6e20c710ba24331b4a7ade612 | |
parent | c9f8a5eebcfbda9d88148e031b43c064f31f20a3 (diff) | |
parent | 597433bcec3cc8270dec810fe82d8accc85931ef (diff) | |
download | tor-cbcae4aef1c0cf42244d5eea4f77d62ea74cf3c4.tar.gz tor-cbcae4aef1c0cf42244d5eea4f77d62ea74cf3c4.zip |
Merge remote branch 'origin/maint-0.2.2'
-rw-r--r-- | changes/bug2346 | 6 | ||||
-rw-r--r-- | src/or/config.c | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/changes/bug2346 b/changes/bug2346 new file mode 100644 index 0000000000..0f78b84614 --- /dev/null +++ b/changes/bug2346 @@ -0,0 +1,6 @@ + o Minor features + - If writing the state file to disk fails, wait up to an hour + before retrying again. (Our old code would retry the write + immediately.) Fixes bug 2346. Bugfix on Tor 0.1.1.3-alpha. + + diff --git a/src/or/config.c b/src/or/config.c index 9ea94838cb..00a01f5fb8 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -5292,6 +5292,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) @@ -5326,10 +5329,14 @@ 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 after STATE_WRITE_RETRY_INTERVAL (or sooner, if the state + * changes sooner). */ + global_state->next_write = now + STATE_WRITE_RETRY_INTERVAL; return -1; } |