From 148b8738de1e57310e4aca372bae14e6fbe9f5e3 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Tue, 11 Mar 2008 04:13:17 +0000 Subject: [PATCH] Client: retry each step in writing state file only if that step failed. svn path=/trunk/boinc/; revision=14886 --- client/cs_statefile.C | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/cs_statefile.C b/client/cs_statefile.C index 61530ebbf5..60642bf20e 100644 --- a/client/cs_statefile.C +++ b/client/cs_statefile.C @@ -511,6 +511,10 @@ int CLIENT_STATE::write_state_file() { if (attempt < MAX_STATE_FILE_WRITE_ATTEMPTS) continue; return ret2; } + } + + for (attempt=1; attempt<=MAX_STATE_FILE_WRITE_ATTEMPTS; attempt++) { + if (attempt > 1) boinc_sleep(1.0); // only attempt to rename the current state file if it exists. // @@ -535,7 +539,11 @@ int CLIENT_STATE::write_state_file() { } } } - + } + + for (attempt=1; attempt<=MAX_STATE_FILE_WRITE_ATTEMPTS; attempt++) { + if (attempt > 1) boinc_sleep(1.0); + retval = boinc_rename(STATE_FILE_NAME, STATE_FILE_PREV); if (retval) { if ((attempt == MAX_STATE_FILE_WRITE_ATTEMPTS) || log_flags.state_debug) { @@ -554,6 +562,11 @@ int CLIENT_STATE::write_state_file() { if (attempt < MAX_STATE_FILE_WRITE_ATTEMPTS) continue; } + } + + for (attempt=1; attempt<=MAX_STATE_FILE_WRITE_ATTEMPTS; attempt++) { + if (attempt > 1) boinc_sleep(1.0); + retval = boinc_rename(STATE_FILE_NEXT, STATE_FILE_NAME); if (log_flags.state_debug) { msg_printf(0, MSG_INFO,