mirror of https://github.com/BOINC/boinc.git
reset all if platform changes
svn path=/trunk/boinc/; revision=9508
This commit is contained in:
parent
e2e5be5164
commit
44052b53e6
|
@ -2087,3 +2087,17 @@ Charlie 17 Feb 2006
|
|||
setupForBOINC.sh
|
||||
wxMac-BOINC.xcodeproj/ (added)
|
||||
project.pbxproj (added)
|
||||
|
||||
David 17 Feb 2005
|
||||
- If statefile doesn't have right platform name, reset all projects.
|
||||
This is intended to deal with the case where someone
|
||||
copies all their files from a Mac/PPC to a Mac/Intel
|
||||
and expects everything to work.
|
||||
(suggested by Charlie Fenton).
|
||||
- minor code cleanup
|
||||
|
||||
client/
|
||||
check_state.C
|
||||
client_state.C,h
|
||||
cs_statefile.C
|
||||
http_curl.C
|
||||
|
|
|
@ -179,4 +179,68 @@ void CLIENT_STATE::check_all() {
|
|||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Deallocate memory. Can be used to check for memory leaks.
|
||||
// Turned off for now.
|
||||
//
|
||||
void CLIENT_STATE::free_mem() {
|
||||
vector<PROJECT*>::iterator proj_iter;
|
||||
vector<APP*>::iterator app_iter;
|
||||
vector<FILE_INFO*>::iterator fi_iter;
|
||||
vector<APP_VERSION*>::iterator av_iter;
|
||||
vector<WORKUNIT*>::iterator wu_iter;
|
||||
vector<RESULT*>::iterator res_iter;
|
||||
PROJECT *proj;
|
||||
APP *app;
|
||||
FILE_INFO *fi;
|
||||
APP_VERSION *av;
|
||||
WORKUNIT *wu;
|
||||
RESULT *res;
|
||||
|
||||
proj_iter = projects.begin();
|
||||
while (proj_iter != projects.end()) {
|
||||
proj = projects[0];
|
||||
proj_iter = projects.erase(proj_iter);
|
||||
delete proj;
|
||||
}
|
||||
|
||||
app_iter = apps.begin();
|
||||
while (app_iter != apps.end()) {
|
||||
app = apps[0];
|
||||
app_iter = apps.erase(app_iter);
|
||||
delete app;
|
||||
}
|
||||
|
||||
fi_iter = file_infos.begin();
|
||||
while (fi_iter != file_infos.end()) {
|
||||
fi = file_infos[0];
|
||||
fi_iter = file_infos.erase(fi_iter);
|
||||
delete fi;
|
||||
}
|
||||
|
||||
av_iter = app_versions.begin();
|
||||
while (av_iter != app_versions.end()) {
|
||||
av = app_versions[0];
|
||||
av_iter = app_versions.erase(av_iter);
|
||||
delete av;
|
||||
}
|
||||
|
||||
wu_iter = workunits.begin();
|
||||
while (wu_iter != workunits.end()) {
|
||||
wu = workunits[0];
|
||||
wu_iter = workunits.erase(wu_iter);
|
||||
delete wu;
|
||||
}
|
||||
|
||||
res_iter = results.begin();
|
||||
while (res_iter != results.end()) {
|
||||
res = results[0];
|
||||
res_iter = results.erase(res_iter);
|
||||
delete res;
|
||||
}
|
||||
|
||||
active_tasks.free_mem();
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *BOINC_RCSID_d91498c9e4 = "$Id$";
|
||||
|
|
|
@ -21,26 +21,9 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include "boinc_win.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#else
|
||||
#include "config.h"
|
||||
#if HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SIGNAL_H
|
||||
#include <sys/signal.h>
|
||||
#endif
|
||||
#if HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <csignal>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
|
@ -63,8 +46,6 @@
|
|||
#include "client_state.h"
|
||||
|
||||
using std::max;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
CLIENT_STATE gstate;
|
||||
|
||||
|
@ -127,70 +108,6 @@ CLIENT_STATE::CLIENT_STATE() {
|
|||
detach_console = false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Deallocate memory. Can be used to check for memory leaks.
|
||||
// Turned off for now.
|
||||
//
|
||||
void CLIENT_STATE::free_mem() {
|
||||
vector<PROJECT*>::iterator proj_iter;
|
||||
vector<APP*>::iterator app_iter;
|
||||
vector<FILE_INFO*>::iterator fi_iter;
|
||||
vector<APP_VERSION*>::iterator av_iter;
|
||||
vector<WORKUNIT*>::iterator wu_iter;
|
||||
vector<RESULT*>::iterator res_iter;
|
||||
PROJECT *proj;
|
||||
APP *app;
|
||||
FILE_INFO *fi;
|
||||
APP_VERSION *av;
|
||||
WORKUNIT *wu;
|
||||
RESULT *res;
|
||||
|
||||
proj_iter = projects.begin();
|
||||
while (proj_iter != projects.end()) {
|
||||
proj = projects[0];
|
||||
proj_iter = projects.erase(proj_iter);
|
||||
delete proj;
|
||||
}
|
||||
|
||||
app_iter = apps.begin();
|
||||
while (app_iter != apps.end()) {
|
||||
app = apps[0];
|
||||
app_iter = apps.erase(app_iter);
|
||||
delete app;
|
||||
}
|
||||
|
||||
fi_iter = file_infos.begin();
|
||||
while (fi_iter != file_infos.end()) {
|
||||
fi = file_infos[0];
|
||||
fi_iter = file_infos.erase(fi_iter);
|
||||
delete fi;
|
||||
}
|
||||
|
||||
av_iter = app_versions.begin();
|
||||
while (av_iter != app_versions.end()) {
|
||||
av = app_versions[0];
|
||||
av_iter = app_versions.erase(av_iter);
|
||||
delete av;
|
||||
}
|
||||
|
||||
wu_iter = workunits.begin();
|
||||
while (wu_iter != workunits.end()) {
|
||||
wu = workunits[0];
|
||||
wu_iter = workunits.erase(wu_iter);
|
||||
delete wu;
|
||||
}
|
||||
|
||||
res_iter = results.begin();
|
||||
while (res_iter != results.end()) {
|
||||
res = results[0];
|
||||
res_iter = results.erase(res_iter);
|
||||
delete res;
|
||||
}
|
||||
|
||||
active_tasks.free_mem();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CLIENT_STATE::show_host_info() {
|
||||
char buf[256], buf2[256];
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
|
@ -207,10 +124,7 @@ void CLIENT_STATE::show_host_info() {
|
|||
|
||||
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
|
||||
);
|
||||
msg_printf(NULL, MSG_INFO, "Disk: %s total, %s free", buf, buf2);
|
||||
}
|
||||
|
||||
// Get global preferences.
|
||||
|
@ -287,7 +201,7 @@ int CLIENT_STATE::init() {
|
|||
|
||||
// if we are running as anybody other than localsystem
|
||||
// and executing as a daemon then app graphics won't work.
|
||||
// display a note at startup reminding user of that.
|
||||
// display a note at startup reminding user of that.
|
||||
//
|
||||
#ifdef _WIN32
|
||||
DWORD buf_size = sizeof(buf);
|
||||
|
@ -304,7 +218,6 @@ int CLIENT_STATE::init() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Parse various files
|
||||
parse_account_files();
|
||||
parse_statistics_files();
|
||||
|
||||
|
@ -410,6 +323,20 @@ int CLIENT_STATE::init() {
|
|||
if (retval) return retval;
|
||||
}
|
||||
|
||||
// Has platform name changed? If so reset all.
|
||||
// This could happen e.g. if user copies files from PPC to Intel Mac
|
||||
//
|
||||
if (strcmp(platform_name, statefile_platform_name.c_str())) {
|
||||
msg_printf(NULL, MSG_INFO,
|
||||
"Platform changed from %s to %s - resetting projects",
|
||||
statefile_platform_name.c_str(), platform_name
|
||||
);
|
||||
for (i=0; i<projects.size(); i++) {
|
||||
p = projects[i];
|
||||
reset_project(p);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include <ctime>
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
#include "acct_mgr.h"
|
||||
#include "acct_setup.h"
|
||||
#include "app.h"
|
||||
|
@ -75,12 +78,12 @@ enum SUSPEND_REASON {
|
|||
//
|
||||
class CLIENT_STATE {
|
||||
public:
|
||||
std::vector<PROJECT*> projects;
|
||||
std::vector<APP*> apps;
|
||||
std::vector<FILE_INFO*> file_infos;
|
||||
std::vector<APP_VERSION*> app_versions;
|
||||
std::vector<WORKUNIT*> workunits;
|
||||
std::vector<RESULT*> results;
|
||||
vector<PROJECT*> projects;
|
||||
vector<APP*> apps;
|
||||
vector<FILE_INFO*> file_infos;
|
||||
vector<APP_VERSION*> app_versions;
|
||||
vector<WORKUNIT*> workunits;
|
||||
vector<RESULT*> results;
|
||||
|
||||
NET_XFER_SET* net_xfers;
|
||||
PERS_FILE_XFER_SET* pers_file_xfers;
|
||||
|
@ -100,6 +103,7 @@ public:
|
|||
int core_client_major_version;
|
||||
int core_client_minor_version;
|
||||
int core_client_release;
|
||||
string statefile_platform_name;
|
||||
int file_xfer_giveup_period;
|
||||
int user_run_request;
|
||||
// values above (USER_RUN_REQUEST_*)
|
||||
|
@ -203,7 +207,7 @@ public:
|
|||
GET_CURRENT_VERSION_OP get_current_version_op;
|
||||
void new_version_check();
|
||||
double new_version_check_time;
|
||||
std::string newer_version;
|
||||
string newer_version;
|
||||
|
||||
// --------------- client_state.C:
|
||||
public:
|
||||
|
@ -256,7 +260,6 @@ private:
|
|||
bool garbage_collect();
|
||||
bool garbage_collect_always();
|
||||
bool update_results();
|
||||
void free_mem();
|
||||
|
||||
// --------------- cpu_sched.C:
|
||||
private:
|
||||
|
@ -427,6 +430,7 @@ public:
|
|||
void check_file_xfer(FILE_XFER&);
|
||||
|
||||
void check_all();
|
||||
void free_mem();
|
||||
|
||||
#if 0
|
||||
// ------------------ cs_data.C:
|
||||
|
|
|
@ -308,8 +308,8 @@ int CLIENT_STATE::parse_state_file() {
|
|||
"Can't parse active tasks in state file"
|
||||
);
|
||||
}
|
||||
} else if (match_tag(buf, "<platform_name>")) {
|
||||
// should match our current platform name
|
||||
} else if (parse_str(buf, "<platform_name>", statefile_platform_name)) {
|
||||
continue;
|
||||
} else if (parse_int(buf, "<user_run_request>", user_run_request)) {
|
||||
continue;
|
||||
} else if (parse_int(buf, "<user_network_request>", user_network_request)) {
|
||||
|
|
|
@ -46,10 +46,7 @@
|
|||
|
||||
#define HTTP_BLOCKSIZE 16384
|
||||
|
||||
using std::string;
|
||||
using std::istringstream;
|
||||
using std::vector;
|
||||
using std::getline;
|
||||
|
||||
extern CURLM* g_curlMulti; // global curl multi handle for http/s
|
||||
static char g_user_agent_string[256] = {""};
|
||||
|
|
|
@ -16,6 +16,15 @@ Director and architect. Contact him at davea at ssl.berkeley.edu.
|
|||
<dd>
|
||||
Developer.
|
||||
Contact him at rwalton at ssl.berkeley.edu.
|
||||
|
||||
<dt><b>Charlie Fenton</b>
|
||||
<dd>
|
||||
Developer.
|
||||
|
||||
<dt><b>Walt Gribben</b>
|
||||
<dd>
|
||||
Developer.
|
||||
|
||||
</dl>
|
||||
|
||||
<h2>Development organization</h2>
|
||||
|
|
Loading…
Reference in New Issue