*** empty log message ***

svn path=/trunk/boinc/; revision=4146
This commit is contained in:
David Anderson 2004-09-02 23:06:14 +00:00
parent 3b81a23326
commit 2bf3f2ef77
5 changed files with 83 additions and 63 deletions

View File

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

View File

@ -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;
}

View File

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

View File

@ -43,5 +43,5 @@ char g_szMiscItems[MAX_MISC_STR][256] = {
"Download failed",
"Upload failed",
"Suspended",
"Preempted"
"Paused"
};

View File

@ -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;
}