*** empty log message ***

svn path=/trunk/boinc/; revision=3782
This commit is contained in:
David Anderson 2004-07-04 18:55:31 +00:00
parent b36a009e89
commit 6b39b0f3d1
5 changed files with 56 additions and 8 deletions

View File

@ -14598,4 +14598,17 @@ Rom 3 July 2004
db/
boinc_db.C
David 4 July 2004
- scheduler: if client is requesting work,
and client is not returning results,
and there's no work,
then send "No work available" message
and return without opening DB
- scheduler: if client has wrong major version,
and is not returning results,
return without opening DB
sched/
handle_request.C
main.C
sched_shmem.C,h

View File

@ -624,13 +624,35 @@ void process_request(
struct tm *rpc_time_tm;
int last_rpc_dayofyear;
int current_rpc_dayofyear;
bool ok_to_send = true;
bool ok_to_send_work = true;
// if different major version of BOINC, just send a message
//
if (wrong_major_version(sreq, reply)) {
ok_to_send = false;
ok_to_send_work = false;
// if no results, return without accessing DB
//
if (sreq.results.size() == 0) {
return;
}
}
// if there's no work, and client isn't returning results,
// and client is requesting work, return without accessing DB
//
if ((sreq.work_req_seconds > 0)
&& ss.no_work()
&& (sreq.results.size() == 0)
) {
strcat(reply.message, "No work available");
strcpy(reply.message_priority, "low");
reply.request_delay = 3600;
log_messages.printf(
SCHED_MSG_LOG::NORMAL, "No work - skipping DB access\n"
);
return;
}
// now open the database
@ -694,11 +716,11 @@ void process_request(
// if last RPC was within config.min_sendwork_interval, don't send work
//
if (ok_to_send && sreq.work_req_seconds > 0) {
if (ok_to_send_work && sreq.work_req_seconds > 0) {
if (config.min_sendwork_interval) {
double diff = dtime() - last_rpc_time;
if (diff < config.min_sendwork_interval) {
ok_to_send = false;
ok_to_send_work = false;
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"Not sending work - last RPC too recent: %f\n", diff
@ -710,7 +732,7 @@ void process_request(
reply.request_delay = config.min_sendwork_interval;
}
}
if (ok_to_send) {
if (ok_to_send_work) {
send_work(sreq, reply, *platform, ss);
}
}

View File

@ -80,9 +80,9 @@ void send_message(char* msg, int delay) {
);
}
static bool db_opened=false;
int open_database() {
int retval;
static bool db_opened=false;
if (db_opened) return 0;
@ -226,5 +226,7 @@ done:
continue;
}
#endif
boinc_db.close();
if (db_opened) {
boinc_db.close();
}
}

View File

@ -156,3 +156,13 @@ APP_VERSION* SCHED_SHMEM::lookup_app_version(
return best_avp;
}
bool SCHED_SHMEM::no_work() {
int i;
if (!ready) return false;
for (i=0; i<max_wu_results; i++) {
if (wu_results[i].state == WR_STATE_PRESENT) return false;
}
return true;
}

View File

@ -80,6 +80,7 @@ struct SCHED_SHMEM {
int verify();
int scan_tables();
bool have_app(int);
bool no_work();
APP* lookup_app(int);
APP_VERSION* lookup_app_version(int appid, int platform, int version);