mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=1440
This commit is contained in:
parent
3b2322f117
commit
1591319e1b
|
@ -40,8 +40,9 @@ CONFIG config;
|
||||||
#define ERR_TRANSIENT true
|
#define ERR_TRANSIENT true
|
||||||
#define ERR_PERMANENT false
|
#define ERR_PERMANENT false
|
||||||
|
|
||||||
|
#define DEBUG_LEVEL 1
|
||||||
|
|
||||||
#define STDERR_FILENAME "file_upload_handler.out"
|
#define STDERR_FILENAME "file_upload_handler.out"
|
||||||
#define DEBUG
|
|
||||||
|
|
||||||
#define MAX_FILES 32
|
#define MAX_FILES 32
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ int FILE_INFO::parse(FILE* in) {
|
||||||
if (match_tag(buf, "<upload_when_present/>")) continue;
|
if (match_tag(buf, "<upload_when_present/>")) continue;
|
||||||
if (match_tag(buf, "<url>")) continue;
|
if (match_tag(buf, "<url>")) continue;
|
||||||
sprintf(ebuf, "FILE_INFO::parse: unrecognized: %s \n", buf);
|
sprintf(ebuf, "FILE_INFO::parse: unrecognized: %s \n", buf);
|
||||||
write_log(ebuf);
|
write_log(ebuf, MSG_NORMAL);
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,7 @@ int return_error(bool transient, char* message) {
|
||||||
message
|
message
|
||||||
);
|
);
|
||||||
sprintf(buf, "%s\n", message);
|
sprintf(buf, "%s\n", message);
|
||||||
write_log(buf);
|
write_log(buf, MSG_DEBUG);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ int copy_socket_to_file(FILE* in, char* path, double offset, double nbytes) {
|
||||||
if (bytes_left == 0) {
|
if (bytes_left == 0) {
|
||||||
fclose(out);
|
fclose(out);
|
||||||
sprintf(buf2, "offset == nbytes: %f\n", nbytes);
|
sprintf(buf2, "offset == nbytes: %f\n", nbytes);
|
||||||
write_log(buf2);
|
write_log(buf2, MSG_DEBUG);
|
||||||
return return_success(0);
|
return return_success(0);
|
||||||
}
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -166,9 +167,7 @@ int handle_file_upload(FILE* in, R_RSA_PUBLIC_KEY& key) {
|
||||||
bool is_valid;
|
bool is_valid;
|
||||||
|
|
||||||
while (fgets(buf, 256, in)) {
|
while (fgets(buf, 256, in)) {
|
||||||
#ifdef DEBUG
|
write_log(buf, MSG_DEBUG);
|
||||||
write_log(buf);
|
|
||||||
#endif
|
|
||||||
if (match_tag(buf, "<file_info>")) {
|
if (match_tag(buf, "<file_info>")) {
|
||||||
retval = file_info.parse(in);
|
retval = file_info.parse(in);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
|
@ -237,16 +236,16 @@ int handle_get_file_size(char* file_name) {
|
||||||
retval = stat( path, &sbuf );
|
retval = stat( path, &sbuf );
|
||||||
if (retval && errno != ENOENT) {
|
if (retval && errno != ENOENT) {
|
||||||
sprintf(buf, "handle_get_file_size: %s, returning error\n", file_name);
|
sprintf(buf, "handle_get_file_size: %s, returning error\n", file_name);
|
||||||
write_log(buf);
|
write_log(buf, MSG_NORMAL);
|
||||||
return return_error(ERR_TRANSIENT, "cannot open file" );
|
return return_error(ERR_TRANSIENT, "cannot open file" );
|
||||||
} else if (retval) {
|
} else if (retval) {
|
||||||
sprintf(buf, "handle_get_file_size: %s, returning zero\n", file_name);
|
sprintf(buf, "handle_get_file_size: %s, returning zero\n", file_name);
|
||||||
write_log(buf);
|
write_log(buf, MSG_NORMAL);
|
||||||
return return_success("<file_size>0</file_size>");
|
return return_success("<file_size>0</file_size>");
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, "handle_get_file_size: %s, returning %d\n",
|
sprintf(buf, "handle_get_file_size: %s, returning %d\n",
|
||||||
file_name, (int)sbuf.st_size);
|
file_name, (int)sbuf.st_size);
|
||||||
write_log(buf);
|
write_log(buf, MSG_NORMAL);
|
||||||
sprintf(buf, "<file_size>%d</file_size>", (int)sbuf.st_size);
|
sprintf(buf, "<file_size>%d</file_size>", (int)sbuf.st_size);
|
||||||
return return_success(buf);
|
return return_success(buf);
|
||||||
}
|
}
|
||||||
|
@ -260,9 +259,7 @@ int handle_request(FILE* in, R_RSA_PUBLIC_KEY& key) {
|
||||||
bool got_version = false;
|
bool got_version = false;
|
||||||
|
|
||||||
while (fgets(buf, 256, in)) {
|
while (fgets(buf, 256, in)) {
|
||||||
#ifdef DEBUG
|
write_log(buf, MSG_DEBUG);
|
||||||
write_log(buf);
|
|
||||||
#endif
|
|
||||||
if (parse_int(buf, "<core_client_major_version>", major)) {
|
if (parse_int(buf, "<core_client_major_version>", major)) {
|
||||||
if (major != MAJOR_VERSION) {
|
if (major != MAJOR_VERSION) {
|
||||||
sprintf(buf,
|
sprintf(buf,
|
||||||
|
@ -313,6 +310,8 @@ int main() {
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_debug_level(DEBUG_LEVEL);
|
||||||
|
|
||||||
retval = config.parse_file();
|
retval = config.parse_file();
|
||||||
if (retval) {
|
if (retval) {
|
||||||
return_error(ERR_TRANSIENT, "can't read config file");
|
return_error(ERR_TRANSIENT, "can't read config file");
|
||||||
|
|
Loading…
Reference in New Issue