From 21d4a3d9c21bc8f7eec420f976138adc37882a1e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 13 Feb 2012 05:02:51 +0000 Subject: [PATCH] - client: zero PROJECT::last_upload_start on reset, so that we can fetch work immediately - client: in PERS_FILE_XFER::create_xfer(), check for already-existing file before seeing we're allowed to start a new xfer - client: in PERS_FILE_XFER::create_xfer(), if an async verify is in progress, mark PERS_FILE_XFER as done. svn path=/trunk/boinc/; revision=25243 --- checkin_notes | 13 +++++++++++++ client/client_state.cpp | 1 + client/log_flags.cpp | 1 + client/pers_file_xfer.cpp | 18 +++++++++++------- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/checkin_notes b/checkin_notes index 0cd9fb4d97..c6b9c7f538 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1608,3 +1608,16 @@ Charlie 11 Feb 2012 clientgui/ BOINCGUIApp.cpp + +David 12 Feb 2012 + - client: zero PROJECT::last_upload_start on reset, + so that we can fetch work immediately + - client: in PERS_FILE_XFER::create_xfer(), + check for already-existing file before seeing we're allowed to start a new xfer + - client: in PERS_FILE_XFER::create_xfer(), + if an async verify is in progress, mark PERS_FILE_XFER as done. + + client/ + client_state.cpp + log_flags.cpp + pers_file_xfer.cpp diff --git a/client/client_state.cpp b/client/client_state.cpp index 25d2d0be9b..8850714465 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -1750,6 +1750,7 @@ int CLIENT_STATE::reset_project(PROJECT* project, bool detaching) { i--; } } + project->last_upload_start = 0; // if we're in the middle of a scheduler op to the project, abort it // diff --git a/client/log_flags.cpp b/client/log_flags.cpp index 918d907399..fdb0290876 100644 --- a/client/log_flags.cpp +++ b/client/log_flags.cpp @@ -70,6 +70,7 @@ void LOG_FLAGS::show() { show_flag(buf, app_msg_receive, "app_msg_receive"); show_flag(buf, app_msg_send, "app_msg_send"); + show_flag(buf, async_file_debug, "async_file_debug"); show_flag(buf, benchmark_debug, "benchmark_debug"); show_flag(buf, checkpoint_debug, "checkpoint_debug"); show_flag(buf, coproc_debug, "coproc_debug"); diff --git a/client/pers_file_xfer.cpp b/client/pers_file_xfer.cpp index c5513c6e46..64b2edb23e 100644 --- a/client/pers_file_xfer.cpp +++ b/client/pers_file_xfer.cpp @@ -90,19 +90,14 @@ int PERS_FILE_XFER::create_xfer() { FILE_XFER *file_xfer; int retval; - // Decide whether to start a new file transfer - // - if (!gstate.start_new_file_xfer(*this)) { - return ERR_IDLE_PERIOD; - } - // if download, see if file already exists and is valid // if (!is_upload) { char pathname[256]; get_pathname(fip, pathname, sizeof(pathname)); - if (!fip->verify_file(true, false, true)) { + retval = fip->verify_file(true, false, true); + if (!retval) { retval = fip->set_permissions(); fip->status = FILE_PRESENT; pers_xfer_done = true; @@ -115,6 +110,9 @@ int PERS_FILE_XFER::create_xfer() { } return 0; + } else if (retval == ERR_IN_PROGRESS) { + pers_xfer_done = true; + return ERR_IN_PROGRESS; } else { // Mark file as not present but don't delete it. // It might be partly downloaded. @@ -123,6 +121,12 @@ int PERS_FILE_XFER::create_xfer() { } } + // Decide whether to start a new file transfer + // + if (!gstate.start_new_file_xfer(*this)) { + return ERR_IDLE_PERIOD; + } + URL_LIST& ul = fip->get_url_list(is_upload); file_xfer = new FILE_XFER; fxp = file_xfer;