// if any input files had download error from previous WU,
// reset them to try download again
//
void WORKUNIT::clear_errors() {
    int x;
    unsigned int i;
    for (i=0; i<input_files.size();i++) {
        FILE_INFO* fip = input_files[i].file_info;
        if (fip->had_failure(x)) {
            fip->reset();
        }
    }
}
void APP_VERSION::clear_errors() {
    int x;
    unsigned int i;
    for (i=0; i<app_files.size();i++) {
        FILE_INFO* fip = app_files[i].file_info;
        if (fip->had_failure(x)) {
            fip->reset();
        }
    }
}
Exemple #3
0
// for each FILE_INFO (i.e. each project file the client knows about)
// check that the file exists and is of the right size.
// Called at startup.
//
void CLIENT_STATE::check_file_existence() {
    unsigned int i;
    char path[MAXPATHLEN];

    for (i=0; i<file_infos.size(); i++) {
        FILE_INFO* fip = file_infos[i];
        if (fip->status < 0 && fip->downloadable()) {
            // file had an error; reset it so that we download again
            get_pathname(fip, path, sizeof(path));
            msg_printf(fip->project, MSG_INFO,
                "Resetting file %s: %s", path, boincerror(fip->status)
            );
            fip->reset();
            continue;
        }
        if (cc_config.dont_check_file_sizes) continue;
        if (fip->status == FILE_PRESENT) {
            get_pathname(fip, path, sizeof(path));
            double size;
            int retval = file_size(path, size);
            if (retval) {
                delete_project_owned_file(path, true);
                fip->status = FILE_NOT_PRESENT;
                msg_printf(fip->project, MSG_INFO, "File %s not found", path);
            } else if (fip->nbytes && (size != fip->nbytes)) {
                if (gstate.global_prefs.dont_verify_images && is_image_file(path)) continue;
                delete_project_owned_file(path, true);
                fip->status = FILE_NOT_PRESENT;
                msg_printf(fip->project, MSG_INFO,
                    "File %s has wrong size: expected %.0f, got %.0f",
                    path, fip->nbytes, size
                );
            }
        }
    }
}