*** empty log message ***

svn path=/trunk/boinc/; revision=3616
This commit is contained in:
David Anderson 2004-06-16 23:06:47 +00:00
parent 09eea50af6
commit a5565d4b82
5 changed files with 28 additions and 15 deletions

View File

@ -13733,3 +13733,10 @@ David 16 June 2004
boinc_gui.vcproj
boinc_guirpc_test.vcproj
David 16 June 2004
- scheduler returns message to client in case of internal errors
sched/
main.C,h
handle_request.C

View File

@ -5,8 +5,9 @@ $sort_by = $_GET["sort_by"];
if (!$sort_by) $sort_by = "expavg_credit";
$offset = $_GET["offset"];
if (!$offset) $offset=0;
$teamid = $_GET["teamid"];
$cache_args = "sort_by=$sort_by&offset=$offset";
$cache_args = "teamid=$teamid&sort_by=$sort_by&offset=$offset";
start_cache(3600, $cache_args);
require_once("../inc/db.inc");
@ -16,7 +17,6 @@ require_once("../inc/team.inc");
db_init();
$user = get_logged_in_user(false);
$teamid = $_GET["teamid"];
$result = mysql_query("select * from team where id=$teamid");
if ($result) {
$team = mysql_fetch_object($result);

View File

@ -630,7 +630,7 @@ void process_request(
//
retval = open_database();
if (retval) {
send_shut_message();
send_message("Server can't open database", 3600);
return;
}

View File

@ -68,13 +68,14 @@ bool use_files = false; // use disk files for req/reply msgs (for debugging)
SCHED_CONFIG config;
key_t sema_key;
void send_shut_message() {
void send_message(char* msg, int delay) {
printf(
"Content-type: text/plain\n\n"
"<scheduler_reply>\n"
" <message priority=\"low\">Project is temporarily shut down for maintenance</message>\n"
" <request_delay>3600</request_delay>\n"
"</scheduler_reply>\n"
" <message priority=\"low\">%s</message>\n"
" <request_delay>%d</request_delay>\n"
"</scheduler_reply>\n",
msg, delay
);
}
@ -106,20 +107,22 @@ int main() {
get_log_path(path);
if (!freopen(path, "a", stderr)) {
fprintf(stderr, "Can't redirect stderr\n");
exit(1);
send_message("Server can't open log file", 3600);
exit(0);
}
log_messages.set_debug_level(DEBUG_LEVEL);
if (check_stop_sched()) {
send_shut_message();
send_message("Project is temporarily shut down for maintenance", 3600);
goto done;
}
retval = config.parse_file("..");
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "Can't parse config file\n");
exit(1);
send_message("Server can't parse configuration file", 3600);
exit(0);
}
sprintf(path, "%s/code_sign_public", config.key_dir);
@ -128,7 +131,8 @@ int main() {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"Can't read code sign key file (%s)\n", path
);
exit(1);
send_message("Server can't find key file", 3600);
exit(0);
}
get_project_dir(path, sizeof(path));
@ -147,7 +151,8 @@ int main() {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"shmem has wrong struct sizes - recompile\n"
);
exit(1);
send_message("Server has software problem", 3600);
exit(0);
}
for (i=0; i<10; i++) {
@ -157,7 +162,8 @@ int main() {
}
if (!ssp->ready) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "feeder doesn't seem to be running\n");
exit(1);
send_message("Server has software problem", 3600);
exit(0);
}
}
@ -167,7 +173,7 @@ int main() {
counter++;
#endif
if (project_stopped) {
send_shut_message();
send_message("Project is temporarily shut down for maintenance", 3600);
goto done;
}
printf("Content-type: text/plain\n\n");

View File

@ -24,5 +24,5 @@
extern SCHED_CONFIG config;
extern key_t sema_key;
extern void send_shut_message();
extern void send_message(char*, int);
extern int open_database();