mirror of https://github.com/BOINC/boinc.git
parent
6606bc73d8
commit
df677a3eee
|
@ -5260,4 +5260,13 @@ Karl 2003/07/02
|
|||
scheduler_op.C
|
||||
scheduler_op.h
|
||||
|
||||
|
||||
David July 2 2003
|
||||
- changed all "fprintf(stderr," in the client to msg_printf()
|
||||
This will give better messages (timestamps, project names)
|
||||
in the cmdline version, and more complete error messages
|
||||
in the GUI version
|
||||
- moved msg_printf() from client_state.C to message.C
|
||||
|
||||
client/
|
||||
*.C
|
||||
message.C (new)
|
||||
|
|
38
client/app.C
38
client/app.C
|
@ -384,7 +384,7 @@ int ACTIVE_TASK::start(bool first_time) {
|
|||
debug_print_argv(argv);
|
||||
sprintf(buf, "..%s..%s%s", PATH_SEPARATOR, PATH_SEPARATOR, exec_path );
|
||||
retval = execv(buf, argv);
|
||||
fprintf(stderr, "execv failed: %d\n", retval);
|
||||
msg_printf(wup->project, MSG_ERROR, "execv failed: %d\n", retval);
|
||||
perror("execv");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ bool ACTIVE_TASK_SET::check_app_exited() {
|
|||
scope_messages.printf("ACTIVE_TASK_SET::check_app_exited(): process %d is done\n", pid);
|
||||
atp = lookup_pid(pid);
|
||||
if (!atp) {
|
||||
fprintf(stderr, "ACTIVE_TASK_SET::check_app_exited(): pid %d not found\n", pid);
|
||||
msg_printf(NULL, MSG_ERROR, "ACTIVE_TASK_SET::check_app_exited(): pid %d not found\n", pid);
|
||||
return true;
|
||||
}
|
||||
double x = rs.ru_utime.tv_sec + rs.ru_utime.tv_usec/1.e6;
|
||||
|
@ -633,10 +633,12 @@ bool ACTIVE_TASK::check_max_disk_exceeded() {
|
|||
if (retval) {
|
||||
msg_printf(0, MSG_ERROR, "Can't get application disk usage");
|
||||
} else {
|
||||
//fprintf(stderr, "using %f bytes; max is %f bytes\n", disk_usage, max_disk_usage);
|
||||
if (disk_usage > max_disk_usage) {
|
||||
msg_printf(result->project, MSG_INFO, "Aborting result %s: exceeded disk limit %f\n",
|
||||
result->name, max_disk_usage);
|
||||
msg_printf(
|
||||
result->project, MSG_INFO,
|
||||
"Aborting result %s: exceeded disk limit %f\n",
|
||||
result->name, max_disk_usage
|
||||
);
|
||||
abort();
|
||||
return true;
|
||||
}
|
||||
|
@ -650,8 +652,12 @@ bool ACTIVE_TASK::check_max_disk_exceeded() {
|
|||
bool ACTIVE_TASK::check_max_mem_exceeded() {
|
||||
// TODO: calculate working set size elsewhere
|
||||
if (working_set_size > max_mem_usage || working_set_size/1048576 > gstate.global_prefs.max_memory_mbytes) {
|
||||
msg_printf(result->project, MSG_INFO, "Aborting result %s: exceeded memory limit %f\n",
|
||||
result->name, min(max_mem_usage, gstate.global_prefs.max_memory_mbytes*1048576));
|
||||
msg_printf(
|
||||
result->project, MSG_INFO,
|
||||
"Aborting result %s: exceeded memory limit %f\n",
|
||||
result->name,
|
||||
min(max_mem_usage, gstate.global_prefs.max_memory_mbytes*1048576)
|
||||
);
|
||||
abort();
|
||||
return true;
|
||||
}
|
||||
|
@ -879,7 +885,7 @@ int ACTIVE_TASK_SET::remove(ACTIVE_TASK* atp) {
|
|||
}
|
||||
iter++;
|
||||
}
|
||||
fprintf(stderr, "ACTIVE_TASK_SET::remove(): not found\n");
|
||||
msg_printf(NULL, MSG_ERROR, "ACTIVE_TASK_SET::remove(): not found\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1077,7 +1083,8 @@ int ACTIVE_TASK::parse(FILE* fin, CLIENT_STATE* cs) {
|
|||
if (match_tag(buf, "</active_task>")) {
|
||||
project = cs->lookup_project(project_master_url);
|
||||
if (!project) {
|
||||
fprintf(stderr,
|
||||
msg_printf(
|
||||
NULL, MSG_ERROR,
|
||||
"ACTIVE_TASK::parse(): project not found: %s\n",
|
||||
project_master_url
|
||||
);
|
||||
|
@ -1085,7 +1092,9 @@ int ACTIVE_TASK::parse(FILE* fin, CLIENT_STATE* cs) {
|
|||
}
|
||||
result = cs->lookup_result(project, result_name);
|
||||
if (!result) {
|
||||
fprintf(stderr, "ACTIVE_TASK::parse(): result not found\n");
|
||||
msg_printf(
|
||||
NULL, MSG_ERROR, "ACTIVE_TASK::parse(): result not found\n"
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
wup = result->wup;
|
||||
|
@ -1093,7 +1102,10 @@ int ACTIVE_TASK::parse(FILE* fin, CLIENT_STATE* cs) {
|
|||
result->app, app_version_num
|
||||
);
|
||||
if (!app_version) {
|
||||
fprintf(stderr, "ACTIVE_TASK::parse(): app_version not found\n");
|
||||
msg_printf(
|
||||
NULL, MSG_ERROR,
|
||||
"ACTIVE_TASK::parse(): app_version not found\n"
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1103,7 +1115,7 @@ int ACTIVE_TASK::parse(FILE* fin, CLIENT_STATE* cs) {
|
|||
else if (parse_int(buf, "<app_version_num>", app_version_num)) continue;
|
||||
else if (parse_int(buf, "<slot>", slot)) continue;
|
||||
else if (parse_double(buf, "<checkpoint_cpu_time>", checkpoint_cpu_time)) continue;
|
||||
else fprintf(stderr, "ACTIVE_TASK::parse(): unrecognized %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "ACTIVE_TASK::parse(): unrecognized %s\n", buf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -1138,7 +1150,7 @@ int ACTIVE_TASK_SET::parse(FILE* fin, CLIENT_STATE* cs) {
|
|||
if (!retval) active_tasks.push_back(atp);
|
||||
else delete atp;
|
||||
} else {
|
||||
fprintf(stderr, "ACTIVE_TASK_SET::parse(): unrecognized %s\n", buf);
|
||||
msg_printf(NULL, MSG_ERROR, "ACTIVE_TASK_SET::parse(): unrecognized %s\n", buf);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "parse.h"
|
||||
|
@ -1675,24 +1674,3 @@ int CLIENT_STATE::detach_project(PROJECT* project) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Takes a printf style formatted string, inserts the proper values,
|
||||
// and passes it to show_message
|
||||
// TODO: add translation functionality
|
||||
//
|
||||
void msg_printf(PROJECT *p, int priority, char *fmt, ...) {
|
||||
char buf[512];
|
||||
va_list ap;
|
||||
|
||||
if (fmt == NULL) return;
|
||||
|
||||
// Since Windows doesn't support vsnprintf, we have to do a
|
||||
// workaround to prevent buffer overruns
|
||||
//
|
||||
if (strlen(fmt) > 512) fmt[511] = '\0';
|
||||
va_start(ap, fmt); // Parses string for variables
|
||||
vsprintf(buf, fmt, ap); // And convert symbols To actual numbers
|
||||
va_end(ap); // Results are stored in text
|
||||
|
||||
show_message(p, buf, priority);
|
||||
}
|
||||
|
|
|
@ -211,6 +211,4 @@ public:
|
|||
|
||||
extern CLIENT_STATE gstate;
|
||||
|
||||
extern void msg_printf(PROJECT *p, int priority, char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "error_numbers.h"
|
||||
#include "file_names.h"
|
||||
#include "filesys.h"
|
||||
#include "message.h"
|
||||
#include "parse.h"
|
||||
#include "util.h"
|
||||
#include "pers_file_xfer.h"
|
||||
|
@ -162,7 +163,7 @@ int PROJECT::parse_account(FILE* in) {
|
|||
if (retval) return ERR_XML_PARSE;
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "PROJECT::parse_account(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "PROJECT::parse_account(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -212,14 +213,13 @@ int PROJECT::parse_state(FILE* in) {
|
|||
code_sign_key,
|
||||
sizeof(code_sign_key)
|
||||
);
|
||||
//fprintf(stderr, "code_sign_key: %s\n", code_sign_key);
|
||||
}
|
||||
else if (parse_int(buf, "<nrpc_failures>", nrpc_failures)) continue;
|
||||
else if (parse_int(buf, "<master_fetch_failures>", master_fetch_failures)) continue;
|
||||
else if (parse_int(buf, "<min_rpc_time>", (int&)min_rpc_time)) continue;
|
||||
else if (match_tag(buf, "<master_url_fetch_pending/>")) master_url_fetch_pending = true;
|
||||
else if (match_tag(buf, "<sched_rpc_pending/>")) sched_rpc_pending = true;
|
||||
else fprintf(stderr, "PROJECT::parse_state(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "PROJECT::parse_state(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ int PROJECT::write_state(FILE* out) {
|
|||
exp_avg_mod_time,
|
||||
nrpc_failures,
|
||||
master_fetch_failures,
|
||||
min_rpc_time,
|
||||
(int)min_rpc_time,
|
||||
master_url_fetch_pending?" <master_url_fetch_pending/>\n":"",
|
||||
sched_rpc_pending?" <sched_rpc_pending/>\n":""
|
||||
);
|
||||
|
@ -329,7 +329,7 @@ int APP::parse(FILE* in) {
|
|||
while (fgets(buf, 256, in)) {
|
||||
if (match_tag(buf, "</app>")) return 0;
|
||||
else if (parse_str(buf, "<name>", name, sizeof(name))) continue;
|
||||
else fprintf(stderr, "APP::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "APP::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
@ -457,7 +457,7 @@ int FILE_INFO::parse(FILE* in, bool from_server) {
|
|||
);
|
||||
continue;
|
||||
} else {
|
||||
fprintf(stderr, "FILE_INFO::parse(): unrecognized: %s\n", buf);
|
||||
msg_printf(NULL, MSG_ERROR, "FILE_INFO::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
}
|
||||
if (from_server)
|
||||
|
@ -570,7 +570,7 @@ int APP_VERSION::parse(FILE* in) {
|
|||
continue;
|
||||
}
|
||||
else if (parse_int(buf, "<version_num>", version_num)) continue;
|
||||
else fprintf(stderr, "APP_VERSION::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "APP_VERSION::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -611,7 +611,7 @@ int FILE_REF::parse(FILE* in) {
|
|||
else if (parse_int(buf, "<fd>", fd)) continue;
|
||||
else if (match_tag(buf, "<main_program/>")) main_program = true;
|
||||
else if (match_tag(buf, "<copy_file/>")) copy_file = true;
|
||||
else fprintf(stderr, "FILE_REF::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "FILE_REF::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ int WORKUNIT::parse(FILE* in) {
|
|||
input_files.push_back(file_ref);
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "WORKUNIT::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "WORKUNIT::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -726,7 +726,7 @@ int RESULT::parse_ack(FILE* in) {
|
|||
while (fgets(buf, 256, in)) {
|
||||
if (match_tag(buf, "</result_ack>")) return 0;
|
||||
else if (parse_str(buf, "<name>", name, sizeof(name))) continue;
|
||||
else fprintf(stderr, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ int RESULT::parse_server(FILE* in) {
|
|||
output_files.push_back(file_ref);
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -801,7 +801,7 @@ int RESULT::parse_state(FILE* in) {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "RESULT::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
#include <vector>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "hostinfo.h"
|
||||
#include "result_state.h"
|
||||
|
||||
|
|
|
@ -57,12 +57,12 @@ int CLIENT_STATE::cleanup_and_exit() {
|
|||
|
||||
retval = active_tasks.exit_tasks();
|
||||
if (retval) {
|
||||
fprintf(stderr, "error: CLIENT_STATE.exit: exit_tasks failed\n");
|
||||
msg_printf(NULL, MSG_ERROR, "CLIENT_STATE.cleanup_and_exit: exit_tasks failed\n");
|
||||
// don't return here - we'll exit anyway
|
||||
}
|
||||
retval = write_state_file();
|
||||
if (retval) {
|
||||
fprintf(stderr, "error: CLIENT_STATE.exit: write_state_file failed\n");
|
||||
msg_printf(NULL, MSG_ERROR, "CLIENT_STATE.cleanup_and_exit: write_state_file failed\n");
|
||||
// don't return here - we'll exit anyway
|
||||
}
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ int CLIENT_STATE::make_project_dirs() {
|
|||
//
|
||||
int verify_downloaded_file(char* pathname, FILE_INFO& file_info) {
|
||||
char cksum[64];
|
||||
PROJECT* project;
|
||||
PROJECT* project = file_info.project;
|
||||
bool verified;
|
||||
int retval;
|
||||
|
||||
|
@ -90,22 +90,21 @@ int verify_downloaded_file(char* pathname, FILE_INFO& file_info) {
|
|||
fprintf(stdout, "ERROR: file %s missing signature\n", file_info.name);
|
||||
return ERR_NO_SIGNATURE;
|
||||
}
|
||||
project = file_info.project;
|
||||
retval = verify_file2(
|
||||
pathname, file_info.file_signature, project->code_sign_key, verified
|
||||
);
|
||||
if (retval) {
|
||||
fprintf(stderr, "error: verify_file2: internal error\n");
|
||||
msg_printf(project, MSG_ERROR, "verify_downloaded_file(): internal error\n");
|
||||
return ERR_RSA_FAILED;
|
||||
}
|
||||
if (!verified) {
|
||||
fprintf(stderr, "error: verify_file2: file not verified\n");
|
||||
msg_printf(project, MSG_ERROR, "verify_downloaded_file(): file not verified\n");
|
||||
return ERR_RSA_FAILED;
|
||||
}
|
||||
} else if (strlen(file_info.md5_cksum)) {
|
||||
retval = md5_file(pathname, cksum, file_info.nbytes);
|
||||
if (strcmp(cksum, file_info.md5_cksum) || retval) {
|
||||
fprintf(stderr, "error: verify_file2: MD5 check failed\n");
|
||||
msg_printf(project, MSG_ERROR, "verify_downloaded_file(): MD5 check failed\n");
|
||||
return ERR_MD5_FAILED;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ int CLIENT_STATE::handle_scheduler_reply(
|
|||
|
||||
f = fopen(SCHED_OP_RESULT_FILE, "r");
|
||||
if (!f) return ERR_FOPEN;
|
||||
retval = sr.parse(f);
|
||||
retval = sr.parse(f, project);
|
||||
fclose(f);
|
||||
if (retval) return retval;
|
||||
|
||||
|
|
|
@ -29,9 +29,11 @@
|
|||
|
||||
#include "filesys.h"
|
||||
#include "error_numbers.h"
|
||||
#include "file_names.h"
|
||||
#include "message.h"
|
||||
#include "util.h"
|
||||
|
||||
#include "file_names.h"
|
||||
|
||||
void escape_project_url(char *in, char* out) {
|
||||
escape_url_readable(in, out);
|
||||
char& last = out[strlen(out)-1];
|
||||
|
@ -91,7 +93,7 @@ int remove_project_dir(PROJECT& p) {
|
|||
int make_slot_dir(int slot) {
|
||||
char buf[256];
|
||||
if(slot<0) {
|
||||
fprintf(stderr, "error: make_slot_dir: negative slot\n");
|
||||
msg_printf(NULL, MSG_ERROR, "make_slot_dir(): negative slot\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
boinc_mkdir(SLOTS_DIR);
|
||||
|
|
|
@ -167,7 +167,7 @@ int FILE_XFER_SET::remove(FILE_XFER* fxp) {
|
|||
}
|
||||
iter++;
|
||||
}
|
||||
fprintf(stderr, "FILE_XFER_SET::remove(): not found\n");
|
||||
msg_printf(NULL, MSG_ERROR, "FILE_XFER_SET::remove(): not found\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,9 +42,11 @@
|
|||
|
||||
#include "util.h"
|
||||
#include "parse.h"
|
||||
#include "hostinfo.h"
|
||||
#include "message.h"
|
||||
#include "error_numbers.h"
|
||||
|
||||
#include "hostinfo.h"
|
||||
|
||||
// Reset the host info struct to default values
|
||||
//
|
||||
void clear_host_info(HOST_INFO& host) {
|
||||
|
@ -107,7 +109,7 @@ int HOST_INFO::parse(FILE* in) {
|
|||
else if (parse_double(buf, "<m_swap>", m_swap)) continue;
|
||||
else if (parse_double(buf, "<d_total>", d_total)) continue;
|
||||
else if (parse_double(buf, "<d_free>", d_free)) continue;
|
||||
else fprintf(stderr, "HOST_INFO::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "HOST_INFO::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -181,7 +183,7 @@ int HOST_INFO::parse_cpu_benchmarks(FILE* in) {
|
|||
else if (parse_int(buf, "<p_membw_err>", p_membw_err)) continue;
|
||||
else if (parse_double(buf, "<p_calculated>", p_calculated)) continue;
|
||||
else if (parse_double(buf, "<m_cache>", m_cache)) continue;
|
||||
else fprintf(stderr, "HOST_INFO::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "HOST_INFO::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -36,10 +36,11 @@
|
|||
|
||||
#include "error_numbers.h"
|
||||
#include "filesys.h"
|
||||
#include "http.h"
|
||||
#include "util.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "http.h"
|
||||
|
||||
#define HTTP_BLOCKSIZE 16384
|
||||
|
||||
// Breaks a HTTP url down into its server and file path components
|
||||
|
@ -131,10 +132,6 @@ int read_http_reply_header(int socket, HTTP_REPLY_HEADER& header) {
|
|||
|
||||
ScopeMessages scope_messages(log_messages, ClientMessages::DEBUG_HTTP);
|
||||
|
||||
if (socket<0) {
|
||||
fprintf(stderr, "error: read_http_reply_header: negative socket\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
memset(buf, 0, sizeof(buf));
|
||||
header.content_length = 0;
|
||||
header.status = 404; // default to failure
|
||||
|
@ -367,7 +364,7 @@ bool HTTP_OP_SET::poll() {
|
|||
htp->http_op_state = HTTP_STATE_REQUEST_BODY;
|
||||
htp->file = fopen(htp->infile, "rb");
|
||||
if (!htp->file) {
|
||||
fprintf(stderr, "HTTP_OP: no input file %s\n", htp->infile);
|
||||
msg_printf(NULL, MSG_ERROR, "HTTP_OP_SET::poll(): no input file %s\n", htp->infile);
|
||||
htp->io_done = true;
|
||||
htp->http_op_retval = ERR_FOPEN;
|
||||
htp->http_op_state = HTTP_STATE_DONE;
|
||||
|
@ -396,7 +393,7 @@ bool HTTP_OP_SET::poll() {
|
|||
if (htp->infile && strlen(htp->infile) > 0) {
|
||||
htp->file = fopen(htp->infile, "rb");
|
||||
if (!htp->file) {
|
||||
fprintf(stderr, "HTTP_OP: no input2 file %s\n", htp->infile);
|
||||
msg_printf(NULL, MSG_ERROR, "HTTP_OP_SET::poll(): no input2 file %s\n", htp->infile);
|
||||
htp->io_done = true;
|
||||
htp->http_op_retval = ERR_FOPEN;
|
||||
htp->http_op_state = HTTP_STATE_DONE;
|
||||
|
@ -477,8 +474,8 @@ bool HTTP_OP_SET::poll() {
|
|||
|
||||
htp->file = fopen(htp->outfile, "ab");
|
||||
if (!htp->file) {
|
||||
fprintf(stderr,
|
||||
"HTTP_OP: can't open output file %s\n",
|
||||
msg_printf(NULL, MSG_ERROR,
|
||||
"HTTP_OP_SET::poll(): can't open output file %s\n",
|
||||
htp->outfile
|
||||
);
|
||||
htp->io_done = true;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "windows_cpp.h"
|
||||
#include "error_numbers.h"
|
||||
#include "file_names.h"
|
||||
#include "message.h"
|
||||
#include "parse.h"
|
||||
|
||||
#include "log_flags.h"
|
||||
|
@ -95,7 +96,7 @@ int LOG_FLAGS::parse(FILE* in) {
|
|||
poll_debug = true;
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "LOG_FLAGS::parse: unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "LOG_FLAGS::parse: unrecognized: %s\n", buf);
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
extern void show_message(class PROJECT *p, char* message, int priority);
|
||||
|
||||
|
||||
class ClientMessages : public Messages {
|
||||
int debug_level;
|
||||
const char* v_format_kind(int kind) const;
|
||||
|
@ -56,4 +55,6 @@ public:
|
|||
|
||||
extern ClientMessages log_messages;
|
||||
|
||||
extern void msg_printf(PROJECT *p, int priority, char *fmt, ...);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,15 +25,17 @@
|
|||
// and maintains an exponential average of throughput.
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "windows_cpp.h"
|
||||
|
||||
#include "math.h"
|
||||
#include "parse.h"
|
||||
#include "time.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "net_stats.h"
|
||||
|
||||
#define EXP_DECAY_RATE (1./SECONDS_PER_DAY)
|
||||
|
@ -116,7 +118,7 @@ int NET_STATS::parse(FILE* in) {
|
|||
down.starting_throughput = bwdown;
|
||||
continue;
|
||||
}
|
||||
else fprintf(stderr, "NET_STATS::parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "NET_STATS::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -90,8 +90,10 @@ int PERS_FILE_XFER::start_xfer() {
|
|||
retval = file_xfer->init_download(*fip);
|
||||
}
|
||||
if (retval) {
|
||||
msg_printf(fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
|
||||
(is_upload ? "upload" : "download"), fip->get_url(), retval);
|
||||
msg_printf(
|
||||
fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
|
||||
(is_upload ? "upload" : "download"), fip->get_url(), retval
|
||||
);
|
||||
handle_xfer_failure();
|
||||
return retval;
|
||||
// TODO: do we need to do anything here?
|
||||
|
@ -99,8 +101,10 @@ int PERS_FILE_XFER::start_xfer() {
|
|||
retval = gstate.file_xfers->insert(file_xfer);
|
||||
fxp = file_xfer;
|
||||
if (retval) {
|
||||
msg_printf(fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
|
||||
(is_upload ? "upload" : "download"), fip->get_url(), retval);
|
||||
msg_printf(
|
||||
fip->project, MSG_ERROR, "Couldn't start %s for %s: error %d",
|
||||
(is_upload ? "upload" : "download"), fip->get_url(), retval
|
||||
);
|
||||
fxp->file_xfer_retval = retval;
|
||||
handle_xfer_failure();
|
||||
delete fxp;
|
||||
|
@ -108,8 +112,10 @@ int PERS_FILE_XFER::start_xfer() {
|
|||
return retval;
|
||||
}
|
||||
if (log_flags.file_xfer) {
|
||||
msg_printf(fip->project, MSG_INFO, "Started %s of %s",
|
||||
(is_upload ? "upload" : "download"), fip->name);
|
||||
msg_printf(
|
||||
fip->project, MSG_INFO, "Started %s of %s",
|
||||
(is_upload ? "upload" : "download"), fip->name
|
||||
);
|
||||
}
|
||||
scope_messages.printf("PERS_FILE_XFER::start_xfer(): URL: %s\n",fip->get_url());
|
||||
return 0;
|
||||
|
@ -134,9 +140,6 @@ bool PERS_FILE_XFER::poll(time_t now) {
|
|||
// See if it's time to try again.
|
||||
//
|
||||
if (now >= next_request_time) {
|
||||
// fprintf(stderr, "### PERS_FILE_XFER '%s'#%x::poll(): starting file transfer (now=%d, next_request_time=%d)\n",
|
||||
// fip->name, this,
|
||||
// now, next_request_time);
|
||||
last_time = dtime();
|
||||
fip->upload_offset = -1;
|
||||
retval = start_xfer();
|
||||
|
@ -153,11 +156,15 @@ bool PERS_FILE_XFER::poll(time_t now) {
|
|||
|
||||
if (fxp->file_xfer_done) {
|
||||
if (log_flags.file_xfer) {
|
||||
msg_printf(fip->project, MSG_INFO, "Finished %s of %s",
|
||||
is_upload?"upload":"download", fip->name);
|
||||
msg_printf(
|
||||
fip->project, MSG_INFO, "Finished %s of %s",
|
||||
is_upload?"upload":"download", fip->name
|
||||
);
|
||||
}
|
||||
scope_messages.printf("PERS_FILE_XFER::poll(): file transfer status %d",
|
||||
fxp->file_xfer_retval);
|
||||
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.
|
||||
//
|
||||
|
@ -212,8 +219,10 @@ void PERS_FILE_XFER::giveup() {
|
|||
fip->status = ERR_GIVEUP_DOWNLOAD;
|
||||
}
|
||||
xfer_done = true;
|
||||
msg_printf(fip->project, MSG_ERROR, "Giving up on %s of %s",
|
||||
is_upload?"upload":"download", fip->name);
|
||||
msg_printf(
|
||||
fip->project, MSG_ERROR, "Giving up on %s of %s",
|
||||
is_upload?"upload":"download", fip->name
|
||||
);
|
||||
}
|
||||
|
||||
// Handle a transfer failure
|
||||
|
@ -263,15 +272,16 @@ void PERS_FILE_XFER::retry_or_backoff() {
|
|||
// keeping within the bounds of pers_retry_delay_min and
|
||||
// pers_retry_delay_max
|
||||
//
|
||||
backoff = calculate_exponential_backoff("pers_file_xfer",
|
||||
nretry, gstate.pers_retry_delay_min, gstate.pers_retry_delay_max);
|
||||
backoff = calculate_exponential_backoff(
|
||||
"pers_file_xfer",
|
||||
nretry, gstate.pers_retry_delay_min, gstate.pers_retry_delay_max
|
||||
);
|
||||
next_request_time = now + backoff;
|
||||
// fprintf(stderr, "### PERS_FILE_XFER '%s'#%x::retry_or_backoff(): nretry=%d, backoff=%d, now=%d, next_request_time=%d\n",
|
||||
// fip->name, this, nretry,
|
||||
// backoff, now, next_request_time);
|
||||
}
|
||||
scope_messages.printf("PERS_FILE_XFER::retry_or_backoff(): Backing off %d seconds on transfer of file %s",
|
||||
backoff, fip->name);
|
||||
scope_messages.printf(
|
||||
"PERS_FILE_XFER::retry_or_backoff(): Backing off %d seconds on transfer of file %s",
|
||||
backoff, fip->name
|
||||
);
|
||||
}
|
||||
|
||||
// Parse XML information about a single persistent file transfer
|
||||
|
|
|
@ -114,7 +114,7 @@ int SCHEDULER_OP::init_op_project(double ns) {
|
|||
}
|
||||
retval = gstate.make_scheduler_request(project, ns);
|
||||
if (retval) {
|
||||
fprintf(stderr, "make_scheduler_request: %d\n", retval);
|
||||
msg_printf(project, MSG_ERROR, "make_scheduler_request: %d\n", retval);
|
||||
goto done;
|
||||
}
|
||||
retval = start_rpc();
|
||||
|
@ -504,7 +504,7 @@ SCHEDULER_REPLY::~SCHEDULER_REPLY() {
|
|||
if (code_sign_key_signature) free(code_sign_key_signature);
|
||||
}
|
||||
|
||||
int SCHEDULER_REPLY::parse(FILE* in) {
|
||||
int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
|
||||
char buf[256], *p;
|
||||
int retval;
|
||||
|
||||
|
@ -529,13 +529,13 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
|
||||
p = fgets(buf, 256, in);
|
||||
if (!p) {
|
||||
fprintf(stderr, "SCHEDULER_REPLY::parse(): empty file\n");
|
||||
msg_printf(project, MSG_ERROR, "SCHEDULER_REPLY::parse(): empty file\n");
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
// First part of content should either be tag (HTTP 1.0) or
|
||||
// hex length of response (HTTP 1.1)
|
||||
if (!match_tag(buf, "<scheduler_reply>")) {
|
||||
fprintf(stderr, "SCHEDULER_REPLY::parse(): bad first tag %s\n", buf);
|
||||
msg_printf(project, MSG_ERROR, "SCHEDULER_REPLY::parse(): bad first tag %s\n", buf);
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
while (fgets(buf, 256, in)) {
|
||||
|
@ -575,7 +575,7 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
&code_sign_key
|
||||
);
|
||||
if (retval) {
|
||||
fprintf(stderr, "error: SCHEDULER_REPLY.parse: xml parsing error\n");
|
||||
msg_printf(project, MSG_ERROR, "SCHEDULER_REPLY.parse(): xml parsing error\n");
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
} else if (match_tag(buf, "<code_sign_key_signature>")) {
|
||||
|
@ -614,9 +614,9 @@ int SCHEDULER_REPLY::parse(FILE* in) {
|
|||
parse_attr(buf, "priority", message_priority, sizeof(message_priority));
|
||||
continue;
|
||||
} else {
|
||||
fprintf(stderr, "SCHEDULER_REPLY::parse: unrecognized %s\n", buf);
|
||||
msg_printf(project, MSG_ERROR, "SCHEDULER_REPLY::parse(): unrecognized %s\n", buf);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "SCHEDULER_REPLY::parse: no close tag\n");
|
||||
msg_printf(project, MSG_ERROR, "SCHEDULER_REPLY::parse(): no close tag\n");
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ struct SCHEDULER_REPLY {
|
|||
|
||||
SCHEDULER_REPLY();
|
||||
~SCHEDULER_REPLY();
|
||||
int parse(FILE*);
|
||||
int parse(FILE*, PROJECT*);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,8 +28,10 @@
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "speed_stats.h"
|
||||
#include "error_numbers.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "speed_stats.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <afxwin.h>
|
||||
|
@ -60,7 +62,7 @@ int main(void) {
|
|||
|
||||
void run_test_suite(double num_secs_per_test) {
|
||||
if (num_secs_per_test<0) {
|
||||
fprintf(stderr, "error: run_test_suite: negative num_seconds_per_test\n");
|
||||
msg_printf(NULL, MSG_ERROR, "error: run_test_suite: negative num_seconds_per_test\n");
|
||||
}
|
||||
printf(
|
||||
"Running tests. This will take about %.1lf seconds.\n\n",
|
||||
|
@ -91,7 +93,7 @@ int check_cache_size(int mem_size) {
|
|||
double secs, nanosecs, temp2;
|
||||
int not_found;
|
||||
if (mem_size<0) {
|
||||
fprintf(stderr, "error: check_cache_size: negative mem_size\n");
|
||||
msg_printf(NULL, MSG_ERROR, "check_cache_size: negative mem_size\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
logStride = (int)(log((double)(STRIDE_MAX/STRIDE_MIN))/log(2.0))+1;
|
||||
|
@ -226,7 +228,7 @@ int run_double_prec_test(double num_secs, double &flops_per_sec) {
|
|||
int retval;
|
||||
|
||||
if (num_secs<0) {
|
||||
fprintf(stderr, "error: run_double_prec_test: negative num_secs\n");
|
||||
msg_printf(NULL, MSG_ERROR, "run_double_prec_test: negative num_secs\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
@ -246,7 +248,7 @@ int run_int_test(double num_secs, double &iops_per_sec) {
|
|||
int retval;
|
||||
|
||||
if (num_secs<0) {
|
||||
fprintf(stderr, "error: run_int_test: negative num_secs\n");
|
||||
msg_printf(NULL, MSG_ERROR, "run_int_test: negative num_secs\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
@ -266,7 +268,7 @@ int run_mem_bandwidth_test(double num_secs, double &bytes_per_sec) {
|
|||
int retval;
|
||||
|
||||
if (num_secs<0) {
|
||||
fprintf(stderr, "error: run_mem_bandwidth_test: negative num_secs\n");
|
||||
msg_printf(NULL, MSG_ERROR, "run_mem_bandwidth_test: negative num_secs\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
@ -290,7 +292,7 @@ int double_flop_test(int iterations, double &flops_per_sec, int print_debug) {
|
|||
clock_t time_start, time_total;
|
||||
|
||||
if (iterations<0) {
|
||||
fprintf(stderr, "error: double_flop_test: negative iterations\n");
|
||||
msg_printf(NULL, MSG_ERROR, "double_flop_test: negative iterations\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
@ -362,7 +364,7 @@ int int_op_test(int iterations, double &iops_per_sec, int print_debug) {
|
|||
clock_t time_start, time_total;
|
||||
int i,j,k,error = 0;
|
||||
if (iterations<0) {
|
||||
fprintf(stderr, "error: int_op_test: negative iterations\n");
|
||||
msg_printf(NULL, MSG_ERROR, "int_op_test: negative iterations\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
@ -455,7 +457,7 @@ int bandwidth_test(int iterations, double &bytes_per_sec, int print_debug) {
|
|||
clock_t time_start, time_total;
|
||||
int i,j,n,actual_iters, error = 0;
|
||||
if (iterations<0) {
|
||||
fprintf(stderr, "error: bandwidth_test: negative iterations\n");
|
||||
msg_printf(NULL, MSG_ERROR, "bandwidth_test: negative iterations\n");
|
||||
return ERR_NEG;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "parse.h"
|
||||
#include "util.h"
|
||||
#include "error_numbers.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "time_stats.h"
|
||||
|
||||
|
@ -114,7 +115,7 @@ int TIME_STATS::parse(FILE* in) {
|
|||
else if (parse_double(buf, "<on_frac>", on_frac)) continue;
|
||||
else if (parse_double(buf, "<connected_frac>", connected_frac)) continue;
|
||||
else if (parse_double(buf, "<active_frac>", active_frac)) continue;
|
||||
else fprintf(stderr, "TIME_STATS:: parse(): unrecognized: %s\n", buf);
|
||||
else msg_printf(NULL, MSG_ERROR, "TIME_STATS::parse(): unrecognized: %s\n", buf);
|
||||
}
|
||||
return ERR_XML_PARSE;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
// Generated by db_def_to_php on Mon Jun 30 14:53:08 PDT 2003
|
||||
// Generated by db_def_to_php on Wed Jul 2 17:30:40 PDT 2003
|
||||
define("MAX_BLOB_SIZE", 4096);
|
||||
define("TEAM_TYPE_CLUB", 1);
|
||||
define("TEAM_TYPE_COMPANY", 2);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by db_def_to_py on Mon Jun 30 14:52:23 PDT 2003
|
||||
# Generated by db_def_to_py on Wed Jul 2 17:30:40 PDT 2003
|
||||
MAX_BLOB_SIZE = 4096
|
||||
TEAM_TYPE_CLUB = 1
|
||||
TEAM_TYPE_COMPANY = 2
|
||||
|
|
Loading…
Reference in New Issue