diff --git a/client/client_state.C b/client/client_state.C index cf90b70ef6..a7172ee1ca 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -359,7 +359,10 @@ int CLIENT_STATE::parse_state_file() { // Init PERS_FILE_XFER and push it onto pers_file_xfer stack if (fip->pers_file_xfer) { fip->pers_file_xfer->init(fip, fip->upload_when_present); - pers_xfers->insert( fip->pers_file_xfer ); + retval = pers_xfers->insert( fip->pers_file_xfer ); + if (retval) { + // TODO: What should we do here? + } } } else { delete fip; diff --git a/client/cs_files.C b/client/cs_files.C index 8162d7fc3c..b2399e89f3 100644 --- a/client/cs_files.C +++ b/client/cs_files.C @@ -102,6 +102,7 @@ bool CLIENT_STATE::handle_pers_file_xfers() { FILE_INFO* fip; PERS_FILE_XFER *pfx; bool action = false; + int retval; for (i=0; iinit(fip, false); fip->pers_file_xfer = pfx; - pers_xfers->insert( fip->pers_file_xfer ); + retval = pers_xfers->insert(fip->pers_file_xfer); + //if (retval) gstate.report_project_error( *fip->result, retval, "" ); // ******* action = true; } else if (fip->upload_when_present && fip->status == FILE_PRESENT && !fip->uploaded) { @@ -125,7 +127,7 @@ bool CLIENT_STATE::handle_pers_file_xfers() { pfx = new PERS_FILE_XFER; pfx->init(fip, true); fip->pers_file_xfer = pfx; - pers_xfers->insert(fip->pers_file_xfer); + retval = pers_xfers->insert(fip->pers_file_xfer); action = true; } } diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 72b67ae379..a924c4d0ba 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -53,7 +53,10 @@ int SCHEDULER_OP::init_get_work() { else { project = gstate.next_project_master_pending(); if (project) { - init_master_fetch(project); + if (retval=init_master_fetch(project)) { + sprintf(err_msg, "init_master_fetch failed, error %d\n", retval); + backoff(project, err_msg); + } } } @@ -83,8 +86,8 @@ int SCHEDULER_OP::init_op_project(double ns) { // and just get its master file. // if (project->scheduler_urls.size() == 0) { - init_master_fetch(project); - return 0; + retval = init_master_fetch(project); + return retval; } url_index = 0; retval = gstate.make_scheduler_request(project, ns); @@ -107,8 +110,7 @@ int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) { if (n > RETRY_CAP) n = RETRY_CAP; // we've hit the limit on master_url fetches - if(project->master_fetch_failures >= MASTER_FETCH_RETRY_CAP) - { + if(project->master_fetch_failures >= MASTER_FETCH_RETRY_CAP) { if (log_flags.sched_op_debug) { printf("we've hit the limit on master_url fetches\n"); } @@ -132,28 +134,27 @@ int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) { // int SCHEDULER_OP::backoff( PROJECT* p, char *error_msg ) { - if (log_flags.sched_op_debug) { - printf(error_msg); - } - - if(project->master_fetch_failures >= MASTER_FETCH_RETRY_CAP) - { - project->master_url_fetch_pending = true; - set_min_rpc_time(p); - return 0; + if (log_flags.sched_op_debug) { + printf(error_msg); + } + + if (project->master_fetch_failures >= MASTER_FETCH_RETRY_CAP) { + project->master_url_fetch_pending = true; + set_min_rpc_time(p); + return 0; } - // if nrpc failures a multiple of master_fetch_period, then set master_url_fetch_pending and initialize again - if (project->nrpc_failures == MASTER_FETCH_PERIOD) { - project->master_url_fetch_pending = true; - project->min_rpc_time = 0; - project->nrpc_failures = 0; - project->master_fetch_failures++; - } - - p->nrpc_failures++; - set_min_rpc_time(p); - - return 0; + // if nrpc failures a multiple of master_fetch_period, then set master_url_fetch_pending and initialize again + if (project->nrpc_failures == MASTER_FETCH_PERIOD) { + project->master_url_fetch_pending = true; + project->min_rpc_time = 0; + project->nrpc_failures = 0; + project->master_fetch_failures++; + } + + p->nrpc_failures++; + set_min_rpc_time(p); + + return 0; } // low-level routine to initiate an RPC @@ -304,7 +305,8 @@ bool SCHEDULER_OP::poll() { } project = gstate.next_project_master_pending(); if (project) { - init_master_fetch(project); + if (retval = init_master_fetch(project)) + backoff(project, "Master file fetch failed\n"); } else { state = SCHEDULER_OP_STATE_IDLE; if (log_flags.sched_op_debug) { @@ -387,7 +389,12 @@ bool SCHEDULER_OP::poll() { if (scheduler_op_done) { project = gstate.next_project_master_pending(); if (project) { - init_master_fetch(project); + if (retval = init_master_fetch(project)) { + if (log_flags.sched_op_debug) { + printf("Scheduler op: init_master_fetch failed.\n" ); + } + backoff(project, "Scheduler op: init_master_fetch failed.\n" ); + } } else { state = SCHEDULER_OP_STATE_IDLE; if (log_flags.sched_op_debug) {