mirror of https://github.com/BOINC/boinc.git
network error catching
svn path=/trunk/boinc/; revision=862
This commit is contained in:
parent
4da75a9dd3
commit
10e0e29487
|
@ -3079,3 +3079,18 @@ David Jan 30 2003
|
|||
sched/
|
||||
db_dump.C
|
||||
handle_request.C
|
||||
|
||||
Eric Feb 04, 2003
|
||||
- Cleaned up formatting of client_state.xml
|
||||
- Added retry message to transfers tab of Windows client
|
||||
- Added error catching for network transfer failures
|
||||
|
||||
client/
|
||||
client_state.C
|
||||
client_types.C
|
||||
cs_files.C
|
||||
http.C
|
||||
pers_file_xfer.C,h
|
||||
win/
|
||||
wingui.h
|
||||
wingui_mainwindow.cpp,h
|
||||
|
|
|
@ -501,9 +501,6 @@ int CLIENT_STATE::parse_state_file() {
|
|||
if (fip->pers_file_xfer) {
|
||||
fip->pers_file_xfer->init(fip, fip->upload_when_present);
|
||||
retval = pers_xfers->insert( fip->pers_file_xfer );
|
||||
if (retval) {
|
||||
// TODO: What should we do here?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
delete fip;
|
||||
|
|
|
@ -363,17 +363,17 @@ int FILE_INFO::write(FILE* out, bool to_server) {
|
|||
if (file_signature) fprintf(out," <file_signature>\n%s</file_signature>\n", file_signature);
|
||||
}
|
||||
for (i=0; i<urls.size(); i++) {
|
||||
fprintf(out, "<url>%s</url>\n", urls[i].text);
|
||||
fprintf(out, " <url>%s</url>\n", urls[i].text);
|
||||
}
|
||||
if (!to_server && pers_file_xfer) {
|
||||
pers_file_xfer->write(out);
|
||||
}
|
||||
if (!to_server) {
|
||||
if (signed_xml && xml_signature) {
|
||||
fprintf(out, "<signed_xml>\n%s</signed_xml>\n", signed_xml);
|
||||
fprintf(out, " <signed_xml>\n%s </signed_xml>\n", signed_xml);
|
||||
}
|
||||
if (xml_signature) {
|
||||
fprintf(out, "<xml_signature>\n%s</xml_signature>\n", xml_signature);
|
||||
fprintf(out, " <xml_signature>\n%s </xml_signature>\n", xml_signature);
|
||||
}
|
||||
}
|
||||
fprintf(out, "</file_info>\n");
|
||||
|
|
|
@ -142,6 +142,7 @@ bool CLIENT_STATE::handle_pers_file_xfers() {
|
|||
pfx->fip->pers_file_xfer = NULL;
|
||||
pers_xfers->remove(pfx);
|
||||
delete pfx;
|
||||
i--;
|
||||
action = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,7 +545,13 @@ bool HTTP_OP_SET::poll() {
|
|||
}
|
||||
break;
|
||||
case HTTP_STATE_REPLY_BODY:
|
||||
if (htp->io_done) {
|
||||
if (htp->error) {
|
||||
action = true;
|
||||
if (log_flags.http_debug) printf("net_xfer returned error %d\n", htp->error);
|
||||
htp->http_op_state = HTTP_STATE_DONE;
|
||||
htp->http_op_retval = htp->error;
|
||||
}
|
||||
else if (htp->io_done) {
|
||||
action = true;
|
||||
switch(htp->http_op_type) {
|
||||
case HTTP_OP_POST2:
|
||||
|
|
|
@ -41,15 +41,19 @@
|
|||
// For upload, try to upload the file to the first URL;
|
||||
// if that fails try the others.
|
||||
//
|
||||
int PERS_FILE_XFER::init(FILE_INFO* f, bool is_file_upload) {
|
||||
fxp = NULL;
|
||||
fip = f;
|
||||
|
||||
PERS_FILE_XFER::PERS_FILE_XFER() {
|
||||
nretry = 0;
|
||||
first_request_time = time(0);
|
||||
next_request_time = first_request_time;
|
||||
}
|
||||
|
||||
int PERS_FILE_XFER::init(FILE_INFO* f, bool is_file_upload) {
|
||||
fxp = NULL;
|
||||
fip = f;
|
||||
is_upload = is_file_upload;
|
||||
xfer_done = false;
|
||||
time_so_far = 0;
|
||||
time_so_far = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,8 +97,16 @@ bool PERS_FILE_XFER::start_xfer() {
|
|||
);
|
||||
} else {
|
||||
retval = gstate.file_xfers->insert(file_xfer);
|
||||
if (retval) return false;
|
||||
fxp = file_xfer;
|
||||
if (retval) {
|
||||
if (log_flags.file_xfer) {
|
||||
printf( "file_xfer insert failed\n" );
|
||||
}
|
||||
fxp->file_xfer_retval = retval;
|
||||
handle_xfer_failure(aclock);
|
||||
fxp = NULL;
|
||||
return false;
|
||||
}
|
||||
if (log_flags.file_xfer) {
|
||||
printf(
|
||||
"started %s of %s to %s at time: %s\n",
|
||||
|
@ -123,18 +135,18 @@ bool PERS_FILE_XFER::poll(unsigned int now) {
|
|||
// See if it's time to try again.
|
||||
//
|
||||
if (now >= (unsigned int)next_request_time) {
|
||||
bool ok = start_xfer();
|
||||
last_time = dtime();
|
||||
return ok;
|
||||
bool ok = start_xfer();
|
||||
last_time = dtime();
|
||||
return ok;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(dtime() - last_time <= 2) {
|
||||
time_so_far += dtime() - last_time;
|
||||
}
|
||||
last_time = dtime();
|
||||
if(dtime() - last_time <= 2) {
|
||||
time_so_far += dtime() - last_time;
|
||||
}
|
||||
last_time = dtime();
|
||||
|
||||
if (fxp->file_xfer_done) {
|
||||
if (log_flags.file_xfer) {
|
||||
|
@ -197,18 +209,18 @@ void PERS_FILE_XFER::handle_xfer_failure(unsigned int cur_time) {
|
|||
if (fxp->file_xfer_retval == HTTP_STATUS_RANGE_REQUEST_ERROR) {
|
||||
fip->delete_file();
|
||||
}
|
||||
|
||||
|
||||
retry_and_backoff(cur_time);
|
||||
|
||||
// See if it's time to give up on the persistent file xfer
|
||||
//
|
||||
if ((cur_time - first_request_time) > gstate.giveup_after) {
|
||||
// Set the associated files status to a ERR_GIVEUP_DOWNLOAD and ERR_GIVEUP_UPLOAD failure
|
||||
if(is_upload)
|
||||
fip->status = ERR_GIVEUP_UPLOAD;
|
||||
else
|
||||
fip->status = ERR_GIVEUP_DOWNLOAD;
|
||||
xfer_done = true;
|
||||
if(is_upload)
|
||||
fip->status = ERR_GIVEUP_UPLOAD;
|
||||
else
|
||||
fip->status = ERR_GIVEUP_DOWNLOAD;
|
||||
xfer_done = true;
|
||||
}
|
||||
if (log_flags.file_xfer_debug) {
|
||||
printf("Error: transfer failure for %s: %d\n", fip->name, fip->status);
|
||||
|
@ -241,8 +253,8 @@ int PERS_FILE_XFER::retry_and_backoff(unsigned int cur_time) {
|
|||
}
|
||||
if (log_flags.file_xfer_debug) {
|
||||
printf(
|
||||
"exponential back off is %d, current_time is %s\n", (int) exp_backoff,asctime( newtime )
|
||||
);
|
||||
"exponential back off is %d, current_time is %s\n", (int) exp_backoff,asctime( newtime )
|
||||
);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -35,12 +35,12 @@
|
|||
|
||||
#define PERS_RETRY_DELAY_MIN 60 // 1 minute
|
||||
#define PERS_RETRY_DELAY_MAX (60*60*4) // 4 hours
|
||||
#define PERS_GIVEUP (60*60*24*7*2) // 2 weeks
|
||||
#define PERS_GIVEUP (60*60*24*7*2) // 2 weeks
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PERS_RETRY_DELAY_MIN 1
|
||||
#define PERS_RETRY_DELAY_MAX 30
|
||||
#define PERS_GIVEUP 30
|
||||
#define PERS_RETRY_DELAY_MIN 1
|
||||
#define PERS_RETRY_DELAY_MAX 30
|
||||
#define PERS_GIVEUP 30
|
||||
#endif
|
||||
|
||||
// give up on xfer if this time elapses since last byte xferred
|
||||
|
@ -48,15 +48,16 @@
|
|||
class PERS_FILE_XFER {
|
||||
int nretry; // # of retries so far
|
||||
int first_request_time; // UNIX time of first file request
|
||||
int next_request_time; // UNIX time to next retry the file request
|
||||
bool is_upload;
|
||||
|
||||
public:
|
||||
int next_request_time; // UNIX time to next retry the file request
|
||||
double last_time, time_so_far;
|
||||
bool xfer_done;
|
||||
FILE_XFER* fxp; // nonzero if file xfer in progress
|
||||
FILE_INFO* fip;
|
||||
|
||||
PERS_FILE_XFER();
|
||||
int init(FILE_INFO*, bool is_file_upload);
|
||||
bool poll(unsigned int now);
|
||||
void handle_xfer_failure(unsigned int cur_time);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "log_flags.h"
|
||||
#include "client_state.h"
|
||||
#include "account.h"
|
||||
#include "error_numbers.h"
|
||||
#include "resource.h"
|
||||
#include "util.h"
|
||||
#include "win_net.h"
|
||||
|
|
|
@ -33,7 +33,7 @@ char g_szTabItems[MAX_TABS][256] = {
|
|||
char g_szColumnTitles[MAX_LIST_ID][MAX_COLS][256] = {
|
||||
{"Project", "Account", "Total Credit", "Avg. Credit", "Resource Share", "", ""},
|
||||
{"Project", "Application", "Name", "CPU time", "Progress", "To Completion", "Status"},
|
||||
{"Project", "File", "Progress", "Size", "Time", "Direction", ""},
|
||||
{"Project", "File", "Progress", "Size", "Time", "Status", ""},
|
||||
{"Project", "Time", "Message", "", "", "", ""}
|
||||
};
|
||||
|
||||
|
@ -54,8 +54,11 @@ char g_szMiscItems[MAX_MISC_STR][256] = {
|
|||
"Acknowledged",
|
||||
"Error: invalid state",
|
||||
"Completed",
|
||||
"Upload",
|
||||
"Download"
|
||||
"Uploading",
|
||||
"Downloading",
|
||||
"Retry in",
|
||||
"Download failed",
|
||||
"Upload failed"
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -336,8 +339,23 @@ void CMainWindow::UpdateGUI(CLIENT_STATE* pcs)
|
|||
strBuf.Format("%0.2d:%0.2d:%0.2d", xhour, xmin, xsec);
|
||||
m_XferListCtrl.SetItemText(i, 4, strBuf.GetBuffer(0));
|
||||
|
||||
// direction
|
||||
m_XferListCtrl.SetItemText(i, 5, fi->fip->generated_locally?g_szMiscItems[8]:g_szMiscItems[9]);
|
||||
// status
|
||||
if (fi->next_request_time > time(0)) {
|
||||
double xtime = fi->next_request_time-time(0);
|
||||
int xhour = (int)(xtime / (60 * 60));
|
||||
int xmin = (int)(xtime / 60) % 60;
|
||||
int xsec = (int)(xtime) % 60;
|
||||
strBuf.Format("%s %0.2d:%0.2d:%0.2d", g_szMiscItems[10], xhour, xmin, xsec);
|
||||
m_XferListCtrl.SetItemText(i, 5, strBuf);
|
||||
} else if (fi->fip->status == ERR_GIVEUP_DOWNLOAD) {
|
||||
strBuf.Format(g_szMiscItems[11]);
|
||||
m_XferListCtrl.SetItemText(i, 5, strBuf);
|
||||
} else if (fi->fip->status == ERR_GIVEUP_UPLOAD) {
|
||||
strBuf.Format(g_szMiscItems[12]);
|
||||
m_XferListCtrl.SetItemText(i, 5, strBuf);
|
||||
} else {
|
||||
m_XferListCtrl.SetItemText(i, 5, fi->fip->generated_locally?g_szMiscItems[8]:g_szMiscItems[9]);
|
||||
}
|
||||
}
|
||||
m_XferListCtrl.SetRedraw(TRUE);
|
||||
|
||||
|
|
|
@ -66,7 +66,8 @@
|
|||
|
||||
#define MAX_TABS 5
|
||||
#define MAX_USAGE_STR 5
|
||||
#define MAX_MISC_STR 10
|
||||
#define MAX_MISC_STR 13
|
||||
|
||||
|
||||
//////////
|
||||
// class: CMyApp
|
||||
|
|
2
todo
2
todo
|
@ -29,9 +29,11 @@ BUGS (arranged from high to low priority)
|
|||
- client died quickly on Mandrake 9.0 linux (unconfirmed)
|
||||
- make pie chart colors/labels easier to understand
|
||||
- need a way to refresh prefs from client
|
||||
- Client should display "Upload failed" and "Download failed" when failure occurs
|
||||
- columns expand when window expands
|
||||
- Download speed is not as fast as it should be
|
||||
- Result status should say "downloading files", "uploading files", etc.
|
||||
- Change vector removal routines to use an iterator
|
||||
|
||||
-----------------------
|
||||
HIGH-PRIORITY (should do for beta test)
|
||||
|
|
Loading…
Reference in New Issue