From 2bf3f2ef77042eee8d2b0f125b58da0e02dec404 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 2 Sep 2004 23:06:14 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4146 --- checkin_notes | 16 ++++++ client/app_control.C | 4 +- client/client_types.C | 1 + client/gui_titles.C | 2 +- client/pers_file_xfer.C | 123 ++++++++++++++++++++-------------------- 5 files changed, 83 insertions(+), 63 deletions(-) diff --git a/checkin_notes b/checkin_notes index dc3c73a59c..d6905f5097 100755 --- a/checkin_notes +++ b/checkin_notes @@ -16911,3 +16911,19 @@ Rom 2 Sep 2004 client/ app.C app_control.C + +David 2 Sept 2004 + - PERS_FILE_XFER::poll(): don't check file size if it's not specified in FILE_INFO + ==> This fixes download failure of user-supplied files + - PROJECT::parse_preferences_for_user_files(): fill in fip->project + ==> This fixes a crashing bug when user supplies files + - User-visible test: + change "preempt" to "pause" + change "quit" to "removed from memory" + change "suspend" to "left in memory" + + client/ + app_control.C + client_types.C + gui_titles.C + pers_file_xfer.C diff --git a/client/app_control.C b/client/app_control.C index 0b1215ffd9..0e7a8e6a18 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -170,8 +170,8 @@ int ACTIVE_TASK::preempt(bool quit_task) { scheduler_state = CPU_SCHED_PREEMPTED; msg_printf(result->project, MSG_INFO, - "Preempting result %s (%s)", - result->name, (quit_task ? "quit" : "suspend") + "Pausing result %s (%s)", + result->name, (quit_task ? "removed from memory" : "left in memory") ); return 0; } diff --git a/client/client_types.C b/client/client_types.C index f1c2bc3db6..970bdff74d 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -180,6 +180,7 @@ int PROJECT::parse_preferences_for_user_files() { fip = gstate.lookup_file_info(this, filename.c_str()); if (!fip) { fip = new FILE_INFO; + fip->project = this; fip->urls.push_back(url_str); strcpy(fip->name, filename.c_str()); fip->is_user_file = true; diff --git a/client/gui_titles.C b/client/gui_titles.C index 1fb4340690..94350b2b61 100644 --- a/client/gui_titles.C +++ b/client/gui_titles.C @@ -43,5 +43,5 @@ char g_szMiscItems[MAX_MISC_STR][256] = { "Download failed", "Upload failed", "Suspended", - "Preempted" + "Paused" }; diff --git a/client/pers_file_xfer.C b/client/pers_file_xfer.C index 91b2fc1a16..5ebc5df4eb 100644 --- a/client/pers_file_xfer.C +++ b/client/pers_file_xfer.C @@ -197,72 +197,75 @@ bool PERS_FILE_XFER::poll(time_t now) { } } - if (dtime() - last_time <= 2) { - time_so_far += dtime() - last_time; + // don't count suspended periods in total time + // + double diff = dtime() - last_time; + if (diff <= 2) { + time_so_far += diff; } last_time = dtime(); if (fxp->file_xfer_done) { - // check if the file was actually downloaded, if not check if there are more urls to try - // if there are no bytes downloaded, than the was probably a wrong url downloaded - get_pathname(fip, pathname); - file_size(pathname, existing_size); - if (existing_size != fip->nbytes) { - check_giveup("File downloaded was not the correct file or was garbage from bad URL"); - return false; - } else { - scope_messages.printf( - "PERS_FILE_XFER::poll(): file transfer status %d", - fxp->file_xfer_retval - ); - if (fxp->file_xfer_retval == 0) { - // The transfer finished with no errors. - if (log_flags.file_xfer) { - msg_printf( - fip->project, MSG_INFO, "Finished %s of %s", - is_upload?"upload":"download", fip->name - ); - if (fxp->xfer_speed < 0) { - msg_printf(fip->project, MSG_INFO, "No data transferred"); - } else { - msg_printf( - fip->project, MSG_INFO, "Throughput %d bytes/sec", - (int)fxp->xfer_speed - ); - } - } - xfer_done = true; - } else if (fxp->file_xfer_retval == ERR_UPLOAD_PERMANENT) { - if (log_flags.file_xfer) { - msg_printf( - fip->project, MSG_INFO, "Permanently failed %s of %s", - is_upload?"upload":"download", fip->name - ); - } - check_giveup("server rejected file"); - } else { - if (log_flags.file_xfer) { - msg_printf( - fip->project, MSG_INFO, "Temporarily failed %s of %s", - is_upload?"upload":"download", fip->name - ); - } - handle_xfer_failure(); + if (fip->nbytes) { + // check if the file was actually downloaded, if not check if there are more urls to try + // if there are no bytes downloaded, than the was probably a wrong url downloaded + get_pathname(fip, pathname); + file_size(pathname, existing_size); + if (existing_size != fip->nbytes) { + check_giveup("File downloaded had wrong size"); } - - // fxp could have already been deallocated via check_giveup - // so check before trying to remove - // - if (fxp) { - // remove fxp from file_xfer_set and deallocate it - // - gstate.file_xfers->remove(fxp); - delete fxp; - fxp = NULL; - } - - return true; + return false; } + scope_messages.printf( + "PERS_FILE_XFER::poll(): file transfer status %d", + fxp->file_xfer_retval + ); + if (fxp->file_xfer_retval == 0) { + // The transfer finished with no errors. + if (log_flags.file_xfer) { + msg_printf( + fip->project, MSG_INFO, "Finished %s of %s", + is_upload?"upload":"download", fip->name + ); + if (fxp->xfer_speed < 0) { + msg_printf(fip->project, MSG_INFO, "No data transferred"); + } else { + msg_printf( + fip->project, MSG_INFO, "Throughput %d bytes/sec", + (int)fxp->xfer_speed + ); + } + } + xfer_done = true; + } else if (fxp->file_xfer_retval == ERR_UPLOAD_PERMANENT) { + if (log_flags.file_xfer) { + msg_printf( + fip->project, MSG_INFO, "Permanently failed %s of %s", + is_upload?"upload":"download", fip->name + ); + } + check_giveup("server rejected file"); + } else { + if (log_flags.file_xfer) { + msg_printf( + fip->project, MSG_INFO, "Temporarily failed %s of %s", + is_upload?"upload":"download", fip->name + ); + } + handle_xfer_failure(); + } + + // fxp could have already been deallocated via check_giveup + // so check before trying to remove + // + if (fxp) { + // remove fxp from file_xfer_set and deallocate it + // + gstate.file_xfers->remove(fxp); + delete fxp; + fxp = NULL; + } + return true; } return false; }