Client: retry each step in writing state file only if that step failed.

svn path=/trunk/boinc/; revision=14886
This commit is contained in:
Charlie Fenton 2008-03-11 04:13:17 +00:00
parent 12a2986ace
commit 148b8738de
1 changed files with 14 additions and 1 deletions

View File

@ -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,