- client: on startup, detect when the system clock has been set backwards,

and clear all timeout variables.
    This should fix the situation where, say:
    1) the user sets the system clock forward by a year;
    2) all projects get their min_rpc_time set;
    3) the user sets the system clock back to the correct time.
    Previously, BOINC would not do anything for a year.

    Note: a restart of BOINC is required to fix things.
    It would be harder to do this on the fly.

svn path=/trunk/boinc/; revision=15314
This commit is contained in:
David Anderson 2008-05-28 19:15:44 +00:00
parent 4287f4a505
commit eeeb3b7951
6 changed files with 56 additions and 4 deletions

View File

@ -4478,3 +4478,20 @@ Rom May 28 2008 (HEAD)
configure.ac
version.h
David May 28 2008
- client: on startup, detect when the system clock has been set backwards,
and clear all timeout variables.
This should fix the situation where, say:
1) the user sets the system clock forward by a year;
2) all projects get their min_rpc_time set;
3) the user sets the system clock back to the correct time.
Previously, BOINC would not do anything for a year.
Note: a restart of BOINC is required to fix things.
It would be harder to do this on the fly.
client/
client_state.C,h
client_types.h
pers_file_xfer.h
time_stats.h

View File

@ -245,6 +245,8 @@ int CLIENT_STATE::init() {
set_ncpus();
show_host_info();
check_clock_reset();
coprocs.get();
#if 0
fake_cuda(coprocs);
@ -1573,4 +1575,38 @@ double calculate_exponential_backoff( int n, double MIN, double MAX) {
return rand_range(MIN, rmax);
}
// See if a timestamp in the client state file
// is later than the current time.
// If so, the user must have decremented the system clock.
// Clear all timeout variables.
//
void CLIENT_STATE::check_clock_reset() {
now = time(0);
if (!time_stats.last_update) return;
if (time_stats.last_update <= now) return;
msg_printf(NULL, MSG_INFO,
"System clock was turned backwards; clearing timeouts"
);
new_version_check_time = now;
all_projects_list_check_time = now;
unsigned int i;
for (i=0; i<projects.size(); i++) {
PROJECT* p = projects[i];
p->min_rpc_time = 0;
if (p->next_rpc_time) {
p->next_rpc_time = now;
}
p->next_file_xfer_up = 0;
p->next_file_xfer_down = 0;
}
for (i=0; i<pers_file_xfers->pers_file_xfers.size(); i++) {
PERS_FILE_XFER* pfx = pers_file_xfers->pers_file_xfers[i];
pfx->next_request_time = 0;
}
// RESULT: could change report_deadline, but not clear how
}
const char *BOINC_RCSID_e836980ee1 = "$Id$";

View File

@ -241,6 +241,7 @@ private:
bool garbage_collect_always();
bool update_results();
int nresults_for_project(PROJECT*);
void check_clock_reset();
// --------------- cpu_sched.C:
private:

View File

@ -408,13 +408,11 @@ public:
// Also, none of this is used right now (commented out)
//
#define FILE_XFER_FAILURE_LIMIT 3
private:
int file_xfer_failures_up;
int file_xfer_failures_down;
double next_file_xfer_up;
double next_file_xfer_down;
public:
double next_file_xfer_time(const bool);
void file_xfer_failed(const bool);
void file_xfer_succeeded(const bool);

View File

@ -116,8 +116,8 @@ public:
};
class PERS_FILE_XFER_SET {
FILE_XFER_SET* file_xfers;
public:
FILE_XFER_SET* file_xfers;
std::vector<PERS_FILE_XFER*>pers_file_xfers;
PERS_FILE_XFER_SET(FILE_XFER_SET*);

View File

@ -24,10 +24,10 @@
#include <vector>
class TIME_STATS {
double last_update;
bool first;
int previous_connected_state;
public:
double last_update;
// we maintain an exponentially weighted average of these quantities:
double on_frac;
// the fraction of total time this host runs the core client