client: don't piggyback work request in several situations

namely:
- some download stalled
- some task suspended
- too many uploading tasks
This commit is contained in:
David Anderson 2013-05-21 22:01:30 -07:00
parent e033347ba9
commit 3488b286cf
1 changed files with 13 additions and 6 deletions

View File

@ -459,15 +459,14 @@ bool WORK_FETCH::requested_work() {
return false;
}
// we're going to contact this project for reasons other than work fetch;
// decide if we should "piggyback" a work fetch request.
// We're going to contact this project for reasons other than work fetch
// (e.g., to report completed results, or at user request).
// Decide if we should "piggyback" a work fetch request.
//
void WORK_FETCH::piggyback_work_request(PROJECT* p) {
DEBUG(msg_printf(p, MSG_INFO, "piggyback_work_request()");)
clear_request();
if (config.fetch_minimal_work && gstate.had_or_requested_work) return;
if (p->dont_request_more_work) return;
if (p->suspended_via_gui) return;
if (p->non_cpu_intensive) {
if (!has_a_job(p)) {
rsc_work_fetch[0].req_secs = 1;
@ -475,6 +474,16 @@ void WORK_FETCH::piggyback_work_request(PROJECT* p) {
return;
}
setup();
switch (p->pwf.cant_fetch_work_reason) {
case 0:
case CANT_FETCH_WORK_MIN_RPC_TIME:
break;
default:
return;
}
// if project was updated from manager and config says so,
// fetch work for a resource even if there are higher-prio projects
// able to fetch it
@ -484,8 +493,6 @@ void WORK_FETCH::piggyback_work_request(PROJECT* p) {
check_higher_priority_projects = false;
}
setup();
// For each resource, scan projects in decreasing priority,
// seeing if there's one that's higher-priority than this
// able to fetch work for the resource.