mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=3308
This commit is contained in:
parent
e3b01ec028
commit
00191f0456
|
@ -11842,3 +11842,19 @@ Rom April 28 2004
|
|||
win_build/
|
||||
boinc_cli.vcproj
|
||||
|
||||
David April 30 2004
|
||||
- scheduler: connect to DB after checking major version#
|
||||
- scheduler: request 24-hour delay if bad major version#
|
||||
- scheduler: request 1 hr delay if project is shut down
|
||||
- scheduler: parse <cross_project_id> from client
|
||||
- print expanded error in PHP when can't connect to DB
|
||||
|
||||
html/
|
||||
inc/
|
||||
db.inc
|
||||
user/
|
||||
create_account_action.php
|
||||
sched/
|
||||
handle_request.C
|
||||
main.C,h
|
||||
server_types.C,h
|
||||
|
|
|
@ -14,8 +14,8 @@ function db_init() {
|
|||
$pass = parse_config("<db_passwd>");
|
||||
$retval = mysql_pconnect("localhost", $user, $pass);
|
||||
if (!$retval) {
|
||||
echo "Unable to connect to database - please try again later";
|
||||
echo mysql_error();
|
||||
echo "Unable to connect to database - please try again later\n";
|
||||
echo "Error: ", mysql_errno(), mysql_error();
|
||||
exit();
|
||||
}
|
||||
$db_name = parse_config("<db_name>");
|
||||
|
|
|
@ -67,7 +67,7 @@ function show_error($str) {
|
|||
$cross_project_id = random_string();
|
||||
$munged_email_addr = munge_email_addr($new_email_addr, $authenticator);
|
||||
$query = sprintf(
|
||||
"insert into user (create_time, email_addr, name, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, project_prefs, teamid, venue, url, send_email, show_hosts, cross_project_id) values(%d, '%s', '%s', '%s', '%s', '%s', 0, 0, 0, '$project_prefs', $teamid, 'home', '', 1, 1, $cross_project_id)",
|
||||
"insert into user (create_time, email_addr, name, authenticator, country, postal_code, total_credit, expavg_credit, expavg_time, project_prefs, teamid, venue, url, send_email, show_hosts, cross_project_id) values(%d, '%s', '%s', '%s', '%s', '%s', 0, 0, 0, '$project_prefs', $teamid, 'home', '', 1, 1, '$cross_project_id')",
|
||||
time(),
|
||||
$munged_email_addr,
|
||||
$new_name,
|
||||
|
|
|
@ -490,6 +490,7 @@ bool wrong_major_version(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) {
|
|||
sreq.hostid, sreq.authenticator,
|
||||
MAJOR_VERSION, sreq.core_client_major_version
|
||||
);
|
||||
reply.request_delay = 3600*24;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -567,6 +568,14 @@ void process_request(
|
|||
//
|
||||
if (wrong_major_version(sreq, reply)) return;
|
||||
|
||||
// now open the database
|
||||
//
|
||||
retval = open_database();
|
||||
if (retval) {
|
||||
send_shut_message();
|
||||
return;
|
||||
}
|
||||
|
||||
retval = authenticate_user(sreq, reply);
|
||||
if (retval) return;
|
||||
if (reply.user.id == 0) {
|
||||
|
|
39
sched/main.C
39
sched/main.C
|
@ -33,6 +33,7 @@ using namespace std;
|
|||
#include "boinc_db.h"
|
||||
#include "parse.h"
|
||||
#include "filesys.h"
|
||||
#include "error_numbers.h"
|
||||
#include "shmem.h"
|
||||
#include "util.h"
|
||||
|
||||
|
@ -64,10 +65,32 @@ void send_shut_message() {
|
|||
"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"
|
||||
);
|
||||
}
|
||||
|
||||
int open_database() {
|
||||
int retval;
|
||||
bool found;
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open database\n");
|
||||
return retval;
|
||||
} else {
|
||||
found = false;
|
||||
while (!gproject.enumerate("")) {
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find project\n");
|
||||
return ERR_DB_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main() {
|
||||
FILE* fin, *fout;
|
||||
int i, retval, pid;
|
||||
|
@ -76,7 +99,6 @@ int main() {
|
|||
void* p;
|
||||
unsigned int counter=0;
|
||||
char* code_sign_key;
|
||||
bool found;
|
||||
bool project_stopped = false;
|
||||
|
||||
get_log_path(path);
|
||||
|
@ -137,21 +159,6 @@ int main() {
|
|||
}
|
||||
}
|
||||
|
||||
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
|
||||
if (retval) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't open database\n");
|
||||
project_stopped = true;
|
||||
} else {
|
||||
found = false;
|
||||
while (!gproject.enumerate("")) {
|
||||
found = true;
|
||||
}
|
||||
if (!found) {
|
||||
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find project\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
pid = getpid();
|
||||
#ifdef _USING_FCGI_
|
||||
while(FCGI_Accept() >= 0) {
|
||||
|
|
|
@ -24,3 +24,6 @@
|
|||
extern DB_PROJECT gproject;
|
||||
extern SCHED_CONFIG config;
|
||||
extern key_t sema_key;
|
||||
|
||||
extern void send_shut_message();
|
||||
extern int open_database();
|
||||
|
|
|
@ -68,6 +68,7 @@ int SCHEDULER_REQUEST::parse(FILE* fin) {
|
|||
while (fgets(buf, 256, fin)) {
|
||||
if (match_tag(buf, "</scheduler_request>")) return 0;
|
||||
else if (parse_str(buf, "<authenticator>", authenticator, sizeof(authenticator))) continue;
|
||||
else if (parse_str(buf, "<cross_project_id>", cross_project_id, sizeof(cross_project_id))) continue;
|
||||
else if (parse_int(buf, "<hostid>", hostid)) continue;
|
||||
else if (parse_int(buf, "<rpc_seqno>", rpc_seqno)) continue;
|
||||
else if (parse_str(buf, "<platform_name>", platform_name, sizeof(platform_name))) continue;
|
||||
|
@ -184,6 +185,7 @@ int SCHEDULER_REPLY::write(FILE* fout) {
|
|||
|
||||
if (request_delay) {
|
||||
fprintf(fout, "<request_delay>%d</request_delay>\n", request_delay);
|
||||
log_messages.printf(SCHED_MSG_LOG::NORMAL, "sending delay request %d\n", request_delay);
|
||||
}
|
||||
if (strlen(message)) {
|
||||
fprintf(fout,
|
||||
|
|
|
@ -55,6 +55,7 @@ struct GLOBAL_PREFS {
|
|||
struct SCHEDULER_REQUEST {
|
||||
char authenticator[256];
|
||||
char platform_name[256];
|
||||
char cross_project_id[256];
|
||||
int hostid; // zero if first RPC
|
||||
int core_client_major_version;
|
||||
int core_client_minor_version;
|
||||
|
|
Loading…
Reference in New Issue