Commit 31e71277 authored by David Anderson's avatar David Anderson

- client: make timeout values into #defines


svn path=/trunk/boinc/; revision=17396
parent dcc3bbe3
......@@ -2239,3 +2239,9 @@ David 25 Feb 2009
sched_*.cpp
handle_request.cpp
server_types.cpp
David 25 Feb 2009
- client: make timeout values into #defines
client/
(several).cpp
......@@ -372,7 +372,7 @@ bool ACTIVE_TASK_SET::poll() {
bool action;
unsigned int i;
static double last_time = 0;
if (gstate.now - last_time < 1.0) return false;
if (gstate.now - last_time < TASK_POLL_PERIOD) return false;
last_time = gstate.now;
action = check_app_exited();
......
......@@ -921,7 +921,7 @@ int CLIENT_STATE::nresults_for_project(PROJECT* p) {
bool CLIENT_STATE::garbage_collect() {
static double last_time=0;
if (gstate.now - last_time < 1.0) return false;
if (gstate.now - last_time < GARBAGE_COLLECT_PERIOD) return false;
last_time = gstate.now;
bool action = garbage_collect_always();
......@@ -1213,7 +1213,7 @@ bool CLIENT_STATE::update_results() {
static double last_time=0;
int retval;
if (gstate.now - last_time < 1.0) return false;
if (gstate.now - last_time < UPDATE_RESULTS_PERIOD) return false;
last_time = gstate.now;
result_iter = results.begin();
......
......@@ -510,4 +510,26 @@ extern void print_suspend_tasks_message(int);
// debt is adjusted at least this often,
// since adjust_debts() is called from enforce_schedule()
#define GARBAGE_COLLECT_PERIOD 10
// how often to garbage collect
#define TASK_POLL_PERIOD 1.0
#define UPDATE_RESULTS_PERIOD 1.0
#define HANDLE_FINISHED_APPS_PERIOD 1.0
#define BENCHMARK_POLL_PERIOD 1.0
#define PERS_FILE_XFER_START_PERIOD 1.0
#define PERS_FILE_XFER_POLL_PERIOD 1.0
#define SCHEDULER_RPC_POLL_PERIOD 5.0
#define FILE_XFER_POLL_PERIOD 1.0
#define GUI_HTTP_POLL_PERIOD 1.0
#define CONNECT_ERROR_PERIOD 600.0
#endif
......@@ -53,7 +53,7 @@ bool CLIENT_STATE::handle_finished_apps() {
ACTIVE_TASK* atp;
bool action = false;
static double last_time = 0;
if (now - last_time < 1.0) return false;
if (now - last_time < HANDLE_FINISHED_APPS_PERIOD) return false;
last_time = now;
vector<ACTIVE_TASK*>::iterator iter;
......
......@@ -342,7 +342,7 @@ bool CLIENT_STATE::cpu_benchmarks_poll() {
static double last_time = 0;
if (!benchmarks_running) return false;
if (now < last_time + 1) return false;
if (now < last_time + BENCHMARK_POLL_PERIOD) return false;
last_time = now;
active_tasks.send_heartbeats();
......
......@@ -246,7 +246,7 @@ bool CLIENT_STATE::handle_pers_file_xfers() {
int retval;
static double last_time;
if (now - last_time < 1.0) return false;
if (now - last_time < PERS_FILE_XFER_START_PERIOD) return false;
last_time = now;
// Look for FILE_INFOs for which we should start a transfer,
......
......@@ -335,7 +335,7 @@ bool CLIENT_STATE::scheduler_rpc_poll() {
// check only every 5 sec
//
if (now - last_time < 5.0) return false;
if (now - last_time < SCHEDULER_RPC_POLL_PERIOD) return false;
last_time = now;
switch(scheduler_op->state) {
......
......@@ -220,7 +220,7 @@ bool FILE_XFER_SET::poll() {
char pathname[256];
double size;
if (gstate.now - last_time < 1.0) return false;
if (gstate.now - last_time < FILE_XFER_POLL_PERIOD) return false;
last_time = gstate.now;
for (i=0; i<file_xfers.size(); i++) {
......
......@@ -65,7 +65,7 @@ int GUI_HTTP::do_rpc_post(GUI_HTTP_OP* op, string url, string input_file, string
bool GUI_HTTP::poll() {
if (state == GUI_HTTP_STATE_IDLE) return false;
static double last_time=0;
if (gstate.now-last_time < 1) return false;
if (gstate.now-last_time < GUI_HTTP_POLL_PERIOD) return false;
last_time = gstate.now;
if (http_op.http_op_state == HTTP_STATE_DONE) {
......
......@@ -290,7 +290,7 @@ static void show_connect_error(in_addr ia) {
last_time = gstate.now;
count = 1;
} else {
if (gstate.now - last_time < 600) {
if (gstate.now - last_time < CONNECT_ERROR_PERIOD) {
count++;
return;
}
......
......@@ -444,7 +444,7 @@ bool PERS_FILE_XFER_SET::poll() {
bool action = false;
static double last_time=0;
if (gstate.now - last_time < 1.0) return false;
if (gstate.now - last_time < PERS_FILE_XFER_POLL_PERIOD) return false;
last_time = gstate.now;
for (i=0; i<pers_file_xfers.size(); i++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment