diff --git a/checkin_notes b/checkin_notes index 7bd1734eda..ce02ba2d5f 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7958,6 +7958,7 @@ Charlie 24 July 2006 macsnoozebadge.xpm (Added) macdisconnectbadge.xpm (Added) + Rom 25 July 2006 - Bug Fix: Mac compiler handles std::string a little differently than Windows. @@ -7987,3 +7988,25 @@ Charlie 25 July 2006 sandbox.php mac_installer/ Postinstall.cpp + +David 25 July 2006 + core client fixes: + - fix bug where interrupted downloads failed with checksum error. + This was because we were comparing the HTTP status with 200. + But partial transfer success is 206. + (bug was introduced in June 28 checkin) + - on startup, make sure that all files that are + supposed to be present actually are. + Otherwise set status to NOT_PRESENT, + so that they'll be downloaded again. + - on reset, clear project_files and user_files vectors + - project files: parse and save md5 checksum. + Note: this is a placeholder; + I'll change it to full FILE_INFO later. + + client/ + client_state.C,h + client_types.C + cs_files.C + file_xfer.C + http_curl.C diff --git a/client/client_state.C b/client/client_state.C index da4d450aae..c199c14a5e 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -321,6 +321,8 @@ int CLIENT_STATE::init() { #endif #endif + check_file_existence(); + return 0; } @@ -1232,6 +1234,9 @@ int CLIENT_STATE::reset_project(PROJECT* project) { } } + project->user_files.clear(); + project->project_files.clear(); + garbage_collect_always(); // forcibly remove apps and app_versions diff --git a/client/client_state.h b/client/client_state.h index 29d07e1aca..7608a0d720 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -337,6 +337,7 @@ public: // --------------- cs_files.C: public: + void check_file_existence(); bool start_new_file_xfer(PERS_FILE_XFER&); private: int make_project_dirs(); diff --git a/client/client_types.C b/client/client_types.C index cffe2f909d..748b5a3404 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -499,12 +499,13 @@ int PROJECT::parse_project_file(FILE* in) { if (parse_str(buf, "", url, sizeof(url))) { finfo.urls.push_back(url); } + if (parse_str(buf, "", finfo.md5_cksum, sizeof(finfo.md5_cksum))) continue; } return ERR_XML_PARSE; } void PROJECT::write_project_files(MIOFILE& f) { - unsigned int i; + unsigned int i, j; if (!project_files.size()) return; f.printf("\n"); @@ -514,11 +515,25 @@ void PROJECT::write_project_files(MIOFILE& f) { f.printf( " \n" " %s\n" - " %s\n" - " \n", + " %s\n", fip->name, fref.open_name ); + if (strlen(fip->md5_cksum)) { + f.printf( + " %s\n", + fip->md5_cksum + ); + } + for (j=0; jurls.size(); j++) { + f.printf( + " %s\n", + fip->urls[j].c_str() + ); + } + f.printf( + " \n" + ); } f.printf("\n"); } @@ -976,6 +991,8 @@ int FILE_INFO::merge_info(FILE_INFO& new_info) { // strcpy(file_signature, new_info.file_signature); + strcpy(md5_cksum, new_info.md5_cksum); + return 0; } diff --git a/client/cs_files.C b/client/cs_files.C index f8f17d8a30..cb3af5e572 100644 --- a/client/cs_files.C +++ b/client/cs_files.C @@ -294,5 +294,25 @@ bool CLIENT_STATE::handle_pers_file_xfers() { return action; } +// called at startup to ensure that if the core client +// thinks a file is there, it's actually there +// +void CLIENT_STATE::check_file_existence() { + unsigned int i; + char path[1024]; + + for (i=0; istatus == FILE_PRESENT) { + get_pathname(fip, path); + if (!boinc_file_exists(path)) { + fip->status = FILE_NOT_PRESENT; + msg_printf(NULL, MSG_INFO, + "file %s not found", path + ); + } + } + } +} const char *BOINC_RCSID_66410b3cab = "$Id$"; diff --git a/client/file_xfer.C b/client/file_xfer.C index 9edd6d64d1..85a8229e94 100644 --- a/client/file_xfer.C +++ b/client/file_xfer.C @@ -272,7 +272,7 @@ bool FILE_XFER_SET::poll() { // deal with various error cases for downloads // if (!fxp->is_upload) { - if (fxp->response == HTTP_STATUS_OK) { + if (fxp->http_op_retval == 0) { // If no HTTP error, // see if we read less than 5 KB and file is incomplete. // If so truncate the amount read, diff --git a/client/http_curl.C b/client/http_curl.C index 47ebba4f28..371c2a214a 100644 --- a/client/http_curl.C +++ b/client/http_curl.C @@ -571,10 +571,12 @@ size_t libcurl_write(void *ptr, size_t size, size_t nmemb, HTTP_OP* phop) { // take the stream param as a FILE* and write to disk //CMC TODO: maybe assert stRead == size*nmemb, add exception handling on phop members size_t stWrite = fwrite(ptr, size, nmemb, (FILE*) phop->fileOut); +#if 0 + if (log_flags.http_debug) { + msg_printf(NULL, MSG_INFO, "HTTP: wrote %d bytes", stWrite); + } +#endif phop->bytes_xferred += (double)(stWrite); - //if (phop->bytes_xferred == (int) phop->content_length) - //{ // that's all we need! - //} phop->update_speed(); // this should update the transfer speed return stWrite; }