diff --git a/api/graphics2_unix.C b/api/graphics2_unix.C index 75dcb923f7..439d489f56 100644 --- a/api/graphics2_unix.C +++ b/api/graphics2_unix.C @@ -25,20 +25,6 @@ static APP_INIT_DATA aid; bool fullscreen; -static void get_window_title(APP_INIT_DATA& aid, char* buf, int len) { - if (aid.app_version) { - snprintf(buf, len, - "%s version %.2f [workunit: %s]", - aid.app_name, aid.app_version/100.0, aid.wu_name - ); - } else { - snprintf(buf, len, - "%s [workunit: %s]", - aid.app_name, aid.wu_name - ); - } -} - static void close_window() { exit(0); } diff --git a/checkin_notes b/checkin_notes index 1baaf4194a..7d5613f68d 100755 --- a/checkin_notes +++ b/checkin_notes @@ -5203,3 +5203,19 @@ Charlie 22 May 2007 setupForBOINC.sh boinc.xcodeproj/ project.pbxproj + +David 22 May 2007 + - lib/filesys: do timed retry of delete/rename on Unix as well as Win + - client: sleep 1 sec (not 60) before retry statefile write + - client: parse in workunit XML + - scheduler: better error messages if insert_wu_tags() fails + + api/ + graphics2_unix.C + client/ + client_state.C + client_types.C + lib/ + filesys.C + sched/ + sched_send.C diff --git a/client/client_state.C b/client/client_state.C index abf657bd06..e53c70bfb9 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -528,7 +528,7 @@ bool CLIENT_STATE::poll_slow_events() { msg_printf(NULL, MSG_INTERNAL_ERROR, "Couldn't write state file: %s", boincerror(retval) ); - boinc_sleep(60.0); + boinc_sleep(1.0); // if we can't write the state file twice in a row, something's hosed; // better to not keep trying diff --git a/client/client_types.C b/client/client_types.C index aa94a9d9d6..d76906361d 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -1206,6 +1206,7 @@ int FILE_REF::write(MIOFILE& out) { int WORKUNIT::parse(MIOFILE& in) { char buf[4096]; FILE_REF file_ref; + double dtemp; strcpy(name, ""); strcpy(app_name, ""); @@ -1258,6 +1259,8 @@ int WORKUNIT::parse(MIOFILE& in) { input_files.push_back(file_ref); continue; } + // unused stuff + else if (parse_double(buf, "", dtemp)) continue; else { if (log_flags.unparsed_xml) { msg_printf(0, MSG_INFO, diff --git a/lib/filesys.C b/lib/filesys.C index 2ebd5a9cea..f875caf776 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -247,6 +247,19 @@ DirScanner::~DirScanner() { #endif } +static int boinc_delete_file_aux(const char* path) { +#ifdef _WIN32 + if (DeleteFile(path)) return 0; + return GetLastError(); +#else + int retval = unlink(path); + if (retval && g_use_sandbox && (errno == EACCES)) { + // We may not have permission to read subdirectories created by projects + return remove_project_owned_file_or_dir(path); + } + return retval; +#endif +} // Delete the file located at path // @@ -256,21 +269,15 @@ int boinc_delete_file(const char* path) { if (!boinc_file_exists(path)) { return 0; } -#ifdef _WIN32 - double start = dtime(); - do { - if (DeleteFile(path)) break; - retval = GetLastError(); - boinc_sleep(drand()); // avoid lockstep - } while (dtime() < start + RETRY_INTERVAL); -#else - retval = unlink(path); - if (retval && g_use_sandbox && (errno == EACCES)) { - // We may not have permission to read subdirectories created by projects - return remove_project_owned_file_or_dir(path); + retval = boinc_delete_file_aux(path); + if (retval) { + double start = dtime(); + do { + boinc_sleep(drand()*2); // avoid lockstep + retval = boinc_delete_file_aux(path); + if (!retval) break; + } while (dtime() < start + RETRY_INTERVAL); } - return retval; -#endif if (retval) { safe_strcpy(boinc_failed_file, path); return ERR_UNLINK; @@ -408,6 +415,7 @@ FILE* boinc_fopen(const char* path, const char* mode) { // if (!f) { for (int i=0; i<5; i++) { + boinc_sleep(drand()); if (errno != EINTR) break; f = fopen(path, mode); if (f) break; @@ -463,22 +471,31 @@ int boinc_copy(const char* orig, const char* newf) { #endif } -int boinc_rename(const char* old, const char* newf) { +static int boinc_rename_aux(const char* old, const char* newf) { #ifdef _WIN32 - int retval=0; boinc_delete_file(newf); - double start = dtime(); - do { - if (MoveFile(old, newf)) break; - retval = GetLastError(); - boinc_sleep(drand()*2); // avoid lockstep - } while (dtime() < start + RETRY_INTERVAL); - return retval; + if (MoveFile(old, newf)) return 0; + return GetLastError(); #else return rename(old, newf); #endif } +int boinc_rename(const char* old, const char* newf) { + int retval=0; + + retval = boinc_rename_aux(old, newf); + if (retval) { + double start = dtime(); + do { + boinc_sleep(drand()*2); // avoid lockstep + retval = boinc_rename_aux(old, newf); + if (!retval) break; + } while (dtime() < start + RETRY_INTERVAL); + } + return retval; +} + int boinc_mkdir(const char* path) { if (is_dir(path)) return 0; #ifdef _WIN32 diff --git a/sched/sched_send.C b/sched/sched_send.C index f44f37a55b..38270bdf9e 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -444,8 +444,9 @@ int insert_after(char* buffer, const char* after, const char* text) { char temp[LARGE_BLOB_SIZE]; if (strlen(buffer) + strlen(text) > LARGE_BLOB_SIZE-1) { - log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, - "insert_after: overflow\n" + log_messages.printf(SCHED_MSG_LOG::MSG_CRITICAL, + "insert_after: overflow: %d %d\n", + strlen(buffer), strlen(text) ); return ERR_BUFFER_OVERFLOW; } @@ -567,7 +568,9 @@ int add_wu_to_reply( wu2 = wu; // make copy since we're going to modify its XML field retval = insert_wu_tags(wu2, *app); if (retval) { - log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, "insert_wu_tags failed\n"); + log_messages.printf(SCHED_MSG_LOG::MSG_NORMAL, + "insert_wu_tags failed %d\n", retval + ); return retval; } wu3=wu2;