Select Git revision
Forked from
einsteinathome / graphicsframework
Source project has a limited visibility.
-
Oliver Bock authored
* Logos at the top * Proper stylesheet (better heading handling) * Added LSC logo
Oliver Bock authored* Logos at the top * Proper stylesheet (better heading handling) * Added LSC logo
pers_file_xfer.cpp 14.52 KiB
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#include "cpp.h"
#ifdef _WIN32
#include "boinc_win.h"
#endif
#ifndef _WIN32
#include "config.h"
#include <cmath>
#include <cstdlib>
#endif
#include "error_numbers.h"
#include "md5_file.h"
#include "parse.h"
#include "str_util.h"
#include "filesys.h"
#include "log_flags.h"
#include "file_names.h"
#include "client_state.h"
#include "client_types.h"
#include "client_msgs.h"
using std::vector;
PERS_FILE_XFER::PERS_FILE_XFER() {
nretry = 0;
first_request_time = gstate.now;
next_request_time = first_request_time;
time_so_far = 0;
last_bytes_xferred = 0;
pers_xfer_done = false;
fip = NULL;
fxp = NULL;
}
PERS_FILE_XFER::~PERS_FILE_XFER() {
if (fip) {
fip->pers_file_xfer = NULL;
}
}
int PERS_FILE_XFER::init(FILE_INFO* f, bool is_file_upload) {
fxp = NULL;
fip = f;
is_upload = is_file_upload;
pers_xfer_done = false;
const char* p = f->get_init_url();
if (!p) {
msg_printf(NULL, MSG_INTERNAL_ERROR, "No URL for file transfer of %s", f->name);
return ERR_NULL;
}