*** empty log message ***

svn path=/trunk/boinc/; revision=4052
This commit is contained in:
David Anderson 2004-08-12 12:44:55 +00:00
parent b6f5e39bed
commit 3ff86344da
4 changed files with 106 additions and 41 deletions

View File

@ -16267,15 +16267,23 @@ David 12 Aug 2004
util.C
David 12 Aug 2004
- Added more error checking and reporting in parse state file
- check error returns of all parse functions
- Improved error checking and reporting in parse state file
- check error returns of parse functions
- temp_project is local to block (so get a new one)
- delete objects in all error cases
- Check and report errors in init/insert of PERS_FILE_XFER
while parsing state file
- ignore app/app_version from state file if project is anonymous platform
- If get error parsing host info, time/net stats etc.,
continue parsing rather than error out
- Check and report errors in init/insert of PERS_FILE_XFER
while parsing state file
- ignore app/app_version from state file if project is anonymous platform
- If get error parsing host info, time/net stats etc.,
continue parsing rather than error out
- Improved error checking and reporting in parsing
and processing of scheduler reply
- check error returns of parse functions
- use msg_printf() instead of show_message() or fprintf(stderr)!!
- fix memory leaks
client/
client_msgs.C
cs_scheduler.C
cs_statefile.C
scheduler_op.C

View File

@ -75,7 +75,7 @@ list<MESSAGE_DESC*> message_descs;
// TODO: add translation functionality
//
void msg_printf(PROJECT *p, int priority, char *fmt, ...) {
char buf[512];
char buf[8192]; // output can be much longer than format
va_list ap;
if (fmt == NULL) return;

View File

@ -578,7 +578,7 @@ int CLIENT_STATE::handle_scheduler_reply(
GLOBAL_PREFS_FILE_NAME, host_venue, found_venue
);
if (retval) {
msg_printf(NULL, MSG_ERROR, "Can't parse general preferences");
msg_printf(project, MSG_ERROR, "Can't parse general preferences");
} else {
show_global_prefs_source(found_venue);
install_global_prefs();
@ -593,7 +593,10 @@ int CLIENT_STATE::handle_scheduler_reply(
if (strcmp(project->project_prefs.c_str(), sr.project_prefs_xml)) {
project->project_prefs = string(sr.project_prefs_xml);
retval = project->write_account_file();
if (retval) return retval;
if (retval) {
msg_printf(project, MSG_ERROR, "Can't write account file: %d", retval);
return retval;
}
project->parse_account_file();
project->parse_preferences_for_user_files();
active_tasks.request_reread_prefs(project);
@ -617,13 +620,10 @@ int CLIENT_STATE::handle_scheduler_reply(
if (!retval && signature_valid) {
safe_strcpy(project->code_sign_key, sr.code_sign_key);
} else {
fprintf(stdout,
"New code signing key from %s doesn't validate\n",
project->project_name
);
msg_printf(project, MSG_ERROR, "New code signing key doesn't validate");
}
} else {
fprintf(stdout, "Missing code sign key signature\n");
msg_printf(project, MSG_ERROR, "Missing code sign key signature");
}
}
}
@ -636,7 +636,14 @@ int CLIENT_STATE::handle_scheduler_reply(
app = new APP;
*app = sr.apps[i];
retval = link_app(project, app);
if (!retval) apps.push_back(app);
if (retval) {
msg_printf(project, MSG_ERROR,
"Can't link app %s in sched reply", app->name
);
delete app;
} else {
apps.push_back(app);
}
}
}
FILE_INFO* fip;
@ -648,14 +655,20 @@ int CLIENT_STATE::handle_scheduler_reply(
fip = new FILE_INFO;
*fip = sr.file_infos[i];
retval = link_file_info(project, fip, true);
if (!retval) file_infos.push_back(fip);
if (retval) {
msg_printf(project, MSG_ERROR,
"Can't link file_info %s in sched reply", fip->name
);
delete fip;
} else {
file_infos.push_back(fip);
}
}
fip->update_time();
}
for (i=0; i<sr.file_deletes.size(); i++) {
fip = lookup_file_info(project, sr.file_deletes[i].text);
if (fip) {
msg_printf(project, MSG_INFO, "Deleting file: %s\n", fip->name);
msg_printf(project, MSG_INFO, "Got request to delete file: %s\n", fip->name);
fip->sticky = false;
}
}
@ -666,7 +679,15 @@ int CLIENT_STATE::handle_scheduler_reply(
avp = new APP_VERSION;
*avp = sr.app_versions[i];
retval = link_app_version(project, avp);
if (!retval) app_versions.push_back(avp);
if (retval) {
msg_printf(project, MSG_ERROR,
"Can't link app version %s %d in sched reply",
avp->app_name, avp->version_num
);
delete avp;
} else {
app_versions.push_back(avp);
}
}
}
for (i=0; i<sr.workunits.size(); i++) {
@ -675,7 +696,12 @@ int CLIENT_STATE::handle_scheduler_reply(
*wup = sr.workunits[i];
wup->version_num = choose_version_num(wup->app_name, sr);
retval = link_workunit(project, wup);
if (!retval) {
if (retval) {
msg_printf(project, MSG_ERROR,
"Can't link workunit %s in sched reply", wup->name
);
delete wup;
} else {
workunits.push_back(wup);
}
}
@ -685,12 +711,20 @@ int CLIENT_STATE::handle_scheduler_reply(
RESULT* rp = new RESULT;
*rp = sr.results[i];
retval = link_result(project, rp);
if (!retval) results.push_back(rp);
rp->state = RESULT_NEW;
nresults++;
if (retval) {
msg_printf(project, MSG_ERROR,
"Can't link result %s in sched reply", rp->name
);
delete rp;
} else {
results.push_back(rp);
rp->state = RESULT_NEW;
nresults++;
}
} else {
sprintf(buf, "Already have result %s\n", sr.results[i].name);
show_message(project, buf, MSG_ERROR);
msg_printf(project, MSG_ERROR,
"Already have result %s\n", sr.results[i].name
);
}
}
@ -702,10 +736,9 @@ int CLIENT_STATE::handle_scheduler_reply(
if (rp) {
rp->got_server_ack = true;
} else {
sprintf(buf, "Got ack for result %s, can't find\n",
sr.result_acks[i].name
msg_printf(project, MSG_ERROR,
"Got ack for result %s, can't find", rp->name
);
show_message(project, buf, MSG_ERROR);
}
}

View File

@ -659,29 +659,53 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
if (retval) return ERR_XML_PARSE;
} else if (match_tag(buf, "<app>")) {
APP app;
app.parse(mf);
apps.push_back(app);
retval = app.parse(mf);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse app in scheduler reply");
} else {
apps.push_back(app);
}
} else if (match_tag(buf, "<file_info>")) {
FILE_INFO file_info;
file_info.parse(mf, true);
file_infos.push_back(file_info);
retval = file_info.parse(mf, true);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse file info in scheduler reply");
} else {
file_infos.push_back(file_info);
}
} else if (match_tag(buf, "<app_version>")) {
APP_VERSION av;
av.parse(mf);
app_versions.push_back(av);
retval = av.parse(mf);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse app version in scheduler reply");
} else {
app_versions.push_back(av);
}
} else if (match_tag(buf, "<workunit>")) {
WORKUNIT wu;
wu.parse(mf);
workunits.push_back(wu);
retval = wu.parse(mf);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse work unit in scheduler reply");
} else {
workunits.push_back(wu);
}
} else if (match_tag(buf, "<result>")) {
RESULT result; // make sure this is here so constructor
// gets called each time
result.parse_server(mf);
results.push_back(result);
retval = result.parse_server(mf);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse result in scheduler reply");
} else {
results.push_back(result);
}
} else if (match_tag(buf, "<result_ack>")) {
RESULT result;
result.parse_ack(in);
result_acks.push_back(result);
retval = result.parse_ack(in);
if (retval) {
msg_printf(project, MSG_ERROR, "Can't parse result ack in scheduler reply");
} else {
result_acks.push_back(result);
}
} else if (parse_str(buf, "<delete_file_info>", delete_file_name, sizeof(delete_file_name))) {
STRING256 delete_file;
strcpy(delete_file.text, delete_file_name);