mirror of https://github.com/BOINC/boinc.git
- client: debug async file copy. Seems to be working.
svn path=/trunk/boinc/; revision=25195
This commit is contained in:
parent
8d7a9577c2
commit
3dc7dc9ad3
|
@ -1315,3 +1315,13 @@ Rom 3 Feb 2012
|
|||
async_file.cpp
|
||||
win_build/
|
||||
boinc_cli.vcproj
|
||||
|
||||
David 3 Feb 2012
|
||||
- client: debug async file copy. Seems to be working.
|
||||
|
||||
client/
|
||||
app.cpp
|
||||
app_start.cpp
|
||||
async_file.cpp
|
||||
lib/
|
||||
common_defs.h
|
||||
|
|
|
@ -985,6 +985,7 @@ static const char* task_state_name(int val) {
|
|||
case PROCESS_ABORTED: return "ABORTED";
|
||||
case PROCESS_COULDNT_START: return "COULDNT_START";
|
||||
case PROCESS_QUIT_PENDING: return "QUIT_PENDING";
|
||||
case PROCESS_COPY_PENDING: return "COPY_PENDING";
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
|
|
@ -570,7 +570,10 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
//
|
||||
if (first_time || wup->project->anonymous_platform) {
|
||||
retval = setup_file(fip, fref, file_path, true, false);
|
||||
if (retval) {
|
||||
if (retval == ERR_IN_PROGRESS) {
|
||||
set_task_state(PROCESS_COPY_PENDING, "start");
|
||||
return 0;
|
||||
} else if (retval) {
|
||||
strcpy(buf, "Can't link app version file");
|
||||
goto error;
|
||||
}
|
||||
|
@ -591,6 +594,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
get_pathname(fref.file_info, file_path, sizeof(file_path));
|
||||
retval = setup_file(fip, fref, file_path, true, true);
|
||||
if (retval == ERR_IN_PROGRESS) {
|
||||
set_task_state(PROCESS_COPY_PENDING, "start");
|
||||
return 0;
|
||||
} else if (retval) {
|
||||
strcpy(buf, "Can't link input file");
|
||||
|
@ -1110,12 +1114,13 @@ int ACTIVE_TASK::resume_or_start(bool first_time) {
|
|||
sprintf(buf, " (%s)", app_version->plan_class);
|
||||
}
|
||||
msg_printf(result->project, MSG_INFO,
|
||||
"%s task %s using %s version %d%s",
|
||||
"%s task %s using %s version %d%s in slot %d",
|
||||
str,
|
||||
result->name,
|
||||
app_version->app->name,
|
||||
app_version->version_num,
|
||||
buf
|
||||
buf,
|
||||
slot
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -35,7 +35,8 @@ vector<ASYNC_VERIFY*> async_verifies;
|
|||
vector<ASYNC_COPY*> async_copies;
|
||||
|
||||
int ASYNC_COPY::init(
|
||||
ACTIVE_TASK* _atp, const char* from_path, const char* _to_path) {
|
||||
ACTIVE_TASK* _atp, const char* from_path, const char* _to_path
|
||||
) {
|
||||
atp = _atp;
|
||||
strcpy(to_path, _to_path);
|
||||
in = fopen(from_path, "rb");
|
||||
|
@ -75,6 +76,9 @@ int ASYNC_COPY::copy_chunk() {
|
|||
if (n <= 0) {
|
||||
// copy done. rename temp file
|
||||
//
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
in = out = NULL;
|
||||
retval = boinc_rename(temp_path, to_path);
|
||||
if (retval) {
|
||||
error(retval);
|
||||
|
@ -88,10 +92,10 @@ int ASYNC_COPY::copy_chunk() {
|
|||
error(retval);
|
||||
}
|
||||
}
|
||||
remove_async_copy(this);
|
||||
return 1; // tell caller we're done
|
||||
} else {
|
||||
int m = fwrite(buf, 1, n, out);
|
||||
m = 0;
|
||||
if (m != n) {
|
||||
error(ERR_FWRITE);
|
||||
return 1;
|
||||
|
@ -103,11 +107,11 @@ int ASYNC_COPY::copy_chunk() {
|
|||
// handle the failure of a copy; error out the result
|
||||
//
|
||||
void ASYNC_COPY::error(int retval) {
|
||||
atp->set_task_state(PROCESS_COULDNT_START, "ASYNC_COPY::error");
|
||||
gstate.report_result_error(
|
||||
*(atp->result), "Couldn't copy file: %s", boincerror(retval)
|
||||
);
|
||||
gstate.request_schedule_cpus("start failed");
|
||||
remove_async_copy(this);
|
||||
}
|
||||
|
||||
void remove_async_copy(ASYNC_COPY* acp) {
|
||||
|
@ -117,6 +121,7 @@ void remove_async_copy(ASYNC_COPY* acp) {
|
|||
async_copies.erase(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
delete acp;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,8 @@ enum SUSPEND_REASON {
|
|||
// process exceeded limits; send "abort" message, waiting to exit
|
||||
#define PROCESS_QUIT_PENDING 8
|
||||
// we've sent it a "quit" message, waiting to exit
|
||||
#define PROCESS_COPY_PENDING 10
|
||||
// waiting for async file copies to finish
|
||||
|
||||
// states in which the process has exited
|
||||
#define PROCESS_EXITED 2
|
||||
|
|
Loading…
Reference in New Issue