try file URLs in order

svn path=/trunk/boinc/; revision=6805
This commit is contained in:
David Anderson 2005-07-26 11:55:28 +00:00
parent fbf8121d9a
commit 8af3a9466e
6 changed files with 62 additions and 28 deletions

View File

@ -9576,3 +9576,18 @@ Rom 25 July 2005
wizfailure.gif (Added)
wizquestion.bmp (Added)
wizsuccess.gif (Added)
David 26 July 2005
- Core client: try DL/UL of replicated files
in URL order listed by project, not random order.
Einstein@home orders URLs by proximity to client.
Left in randomization code but commented it out.
- Shorten host info messages, and move to separate function
(don't lengthen functions that are too large already)
- fix small memory leak when using anon platform
client/
client_state.C,h
client_types.C
cs_scheduler.C
cs_statefile.C

View File

@ -185,11 +185,32 @@ void CLIENT_STATE::free_mem() {
}
#endif
void CLIENT_STATE::show_host_info() {
char buf[256], buf2[256];
msg_printf(NULL, MSG_INFO,
"Processor: %d %s %s",
host_info.p_ncpus, host_info.p_vendor, host_info.p_model
);
nbytes_to_string(host_info.m_nbytes, 0, buf, sizeof(buf));
nbytes_to_string(host_info.m_swap, 0, buf2, sizeof(buf2));
msg_printf(NULL, MSG_INFO,
"Memory: %s physical, %s virtual",
buf, buf2
);
nbytes_to_string(host_info.d_total, 0, buf, sizeof(buf));
nbytes_to_string(host_info.d_free, 0, buf2, sizeof(buf2));
msg_printf(NULL, MSG_INFO,
"Disk: %s total, %s free",
buf, buf2
);
}
int CLIENT_STATE::init() {
int retval;
unsigned int i;
char buf[256];
char buf2[256];
srand((unsigned int)time(0));
now = dtime();
@ -243,26 +264,7 @@ int CLIENT_STATE::init() {
set_ncpus();
// Display useful diagnostic information in case the user is confused
// about their own system.
msg_printf(NULL, MSG_INFO,
"Processor Inventory: %d %s %s Processor(s)",
host_info.p_ncpus, host_info.p_vendor, host_info.p_model
);
nbytes_to_string(host_info.m_nbytes, 0, buf, sizeof(buf));
nbytes_to_string(host_info.m_swap, 0, buf2, sizeof(buf2));
msg_printf(NULL, MSG_INFO,
"Memory Inventory: Memory total - %s, Swap total - %s",
buf, buf2
);
nbytes_to_string(host_info.d_total, 0, buf, sizeof(buf));
nbytes_to_string(host_info.d_free, 0, buf2, sizeof(buf2));
msg_printf(NULL, MSG_INFO,
"Disk Inventory: Disk total - %s, Disk available - %s",
buf, buf2
);
show_host_info();
// Parse various files
parse_account_files();

View File

@ -171,6 +171,7 @@ public:
// --------------- client_state.C:
public:
CLIENT_STATE();
void show_host_info();
int init();
bool do_something();
// Initiates and completes actions (file transfers, process executions)

View File

@ -747,21 +747,28 @@ int FILE_INFO::delete_file() {
return retval;
}
// If a file has multiple replicas, we want to choose
// a random one to try first, and then cycle through others
// if transfers fail.
// Call this to get the initial url,
//
// Files may have URLs for both upload and download.
// Call this to get the initial url,
// The is_upload arg says which kind you want.
// NULL return means there is no URL of the requested type
//
const char* FILE_INFO::get_init_url(bool is_upload) {
// if a project supplies multiple URLs, try them in order
// (e.g. in Einstein@home they're ordered by proximity to client).
// The commented-out code tries them starting from random place.
// This is appropriate if replication is for load-balancing.
// TODO: add a flag saying which mode to use.
//
#if 1
current_url = 0;
#else
double temp;
temp = rand();
temp *= urls.size();
temp /= RAND_MAX;
current_url = (int)temp;
#endif
start_url = current_url;
while(1) {
if (!is_correct_url_type(is_upload, urls[current_url])) {

View File

@ -786,6 +786,9 @@ int CLIENT_STATE::handle_scheduler_reply(
}
}
// the account file has GUI URLs and project prefs.
// rewrite if either of these has changed
//
if (project->gui_urls != old_gui_urls || update_project_prefs) {
retval = project->write_account_file();
if (retval) {

View File

@ -102,7 +102,10 @@ int CLIENT_STATE::parse_state_file() {
} else if (match_tag(buf, "<app>")) {
APP* app = new APP;
retval = app->parse(mf);
if (project && project->anonymous_platform) continue;
if (project && project->anonymous_platform) {
delete app;
continue;
}
if (retval) {
msg_printf(NULL, MSG_ERROR, "Can't parse app in state file");
delete app;
@ -176,7 +179,10 @@ int CLIENT_STATE::parse_state_file() {
} else if (match_tag(buf, "<app_version>")) {
APP_VERSION* avp = new APP_VERSION;
retval = avp->parse(mf);
if (project && project->anonymous_platform) continue;
if (project && project->anonymous_platform) {
delete avp;
continue;
}
if (retval) {
msg_printf(NULL, MSG_ERROR, "Can't parse app version in state file");
delete avp;