*** empty log message ***

svn path=/trunk/boinc/; revision=3273
This commit is contained in:
David Anderson 2004-04-20 02:47:51 +00:00
parent f2d73d3a96
commit 60c82d0045
10 changed files with 55 additions and 23 deletions

View File

@ -11674,3 +11674,26 @@ David April 18 2004
sched/
db_dump.C
server_types.C
David April 19 2004
- Client: change the way network transfer speed is computed.
Instead of computing it every 3 seconds (which doesn't work
for short transfers) just computed it from start of transfer.
- when detach from a project, and global prefs are from that project,
delete the global prefs file and init() prefs in mem.
Otherwise you have prefs from unknown project.
- write <app_version_num> element in <result> only if writing to server
(avoid error parsing state file)
- some message end with multiple \n's. delete them all.
- change return type of boinc_file_exists() to bool
client/
client_state.C
client_types.C
net_xfer.C,h
prefs.C
win/
wingui.cpp
wingui_proxydlg.cpp
lib/
filesys.C,h

View File

@ -1129,6 +1129,14 @@ int CLIENT_STATE::detach_project(PROJECT* project) {
}
}
// if global prefs came from this project, delete file and reinit
//
p = lookup_project(global_prefs.source_project.c_str());
if (p == project) {
boinc_delete_file(GLOBAL_PREFS_FILE_NAME);
global_prefs.init();
}
// find project and remove it from the vector
//
for (project_iter = projects.begin(); project_iter != projects.end(); project_iter++) {

View File

@ -979,14 +979,18 @@ int RESULT::write(FILE* out, bool to_server) {
" <name>%s</name>\n"
" <final_cpu_time>%f</final_cpu_time>\n"
" <exit_status>%d</exit_status>\n"
" <app_version_num>%d</app_version_num>\n"
" <state>%d</state>\n",
name,
final_cpu_time,
exit_status,
wup->version_num,
state
);
if (to_server) {
fprintf(out,
" <app_version_num>%d</app_version_num>\n",
wup->version_num
);
}
n = stderr_out.length();
if (n) {
fprintf(out, "<stderr_out>\n");

View File

@ -265,9 +265,7 @@ void NET_XFER::init(char* host, int p, int b) {
safe_strcpy(hostname, host);
port = p;
blocksize = (b > MAX_BLOCKSIZE ? MAX_BLOCKSIZE : b);
xfer_speed = 0;
last_speed_update = dtime();
recent_bytes_xferred = 0;
start_time = dtime();
file_read_buf_offset = 0;
file_read_buf_len = 0;
bytes_xferred = 0;
@ -589,17 +587,15 @@ int NET_XFER::do_xfer(int& nbytes_transferred) {
}
// Update the transfer speed for this NET_XFER
// called on every I/O
//
void NET_XFER::update_speed(int nbytes) {
double now, delta_t;
recent_bytes_xferred += nbytes;
now = dtime();
delta_t = now - last_speed_update;
if (delta_t < 3.0) return;
xfer_speed = recent_bytes_xferred/delta_t;
last_speed_update = now;
recent_bytes_xferred = 0;
double delta_t = dtime() - start_time;
if (delta_t > 0) {
xfer_speed = bytes_xferred / delta_t;
} else if (xfer_speed == 0) {
xfer_speed = 999999999;
}
}
void NET_XFER::got_error() {

View File

@ -56,9 +56,8 @@ public:
int error;
int port;
int blocksize;
double xfer_speed; // computed every 3 seconds
double last_speed_update; // when xfer_speed was last computed
double recent_bytes_xferred; // bytes xferred since last_speed_update
double start_time;
double xfer_speed;
double bytes_xferred; // bytes transferred in this session
char file_read_buf[MAX_BLOCKSIZE];
int file_read_buf_offset, file_read_buf_len;

View File

@ -65,6 +65,8 @@ void GLOBAL_PREFS::init() {
max_memory_mbytes = 128;
proc_priority = 1;
cpu_affinity = -1;
source_project = "";
source_scheduler = "";
};
GLOBAL_PREFS::GLOBAL_PREFS() {

View File

@ -28,7 +28,7 @@ void show_message(PROJECT* p, char* msg, int priority) {
char message[1024];
strcpy(message, msg);
if (message[strlen(message)-1] == '\n') {
while (strlen(message)&&message[strlen(message)-1] == '\n') {
message[strlen(message)-1] = 0;
}
if (p) {

View File

@ -167,11 +167,11 @@ void CProxyServerDlg::OnOK()
{
UpdateData(TRUE);
gstate.pi.use_http_proxy = m_UseHTTPProxyServerCtrl.GetCheck();
gstate.pi.use_http_proxy = (m_UseHTTPProxyServerCtrl.GetCheck() != 0);
safe_strncpy(gstate.pi.http_server_name, m_strHTTPProxyServerAddress.GetBuffer(), sizeof(gstate.pi.http_server_name));
gstate.pi.http_server_port = m_uiHTTPProxyServerPort;
gstate.pi.use_socks_proxy = m_UseSOCKSProxyServerCtrl.GetCheck();
gstate.pi.use_socks_proxy = (m_UseSOCKSProxyServerCtrl.GetCheck() != 0);
safe_strncpy(gstate.pi.socks_server_name, m_strSOCKSProxyServerAddress.GetBuffer(), sizeof(gstate.pi.socks_server_name));
gstate.pi.socks_server_port = m_uiSOCKSProxyServerPort;
safe_strncpy(gstate.pi.socks5_user_name, m_strSOCKSProxyServerUsername.GetBuffer(), sizeof(gstate.pi.socks5_user_name));

View File

@ -354,11 +354,11 @@ FILE* boinc_fopen(const char* path, const char* mode) {
}
int boinc_file_exists(const char* path) {
bool boinc_file_exists(const char* path) {
struct stat buf;
if (stat(path, &buf)) {
return false;
return false; // stat() returns zero on success
}
return true;
}

View File

@ -65,7 +65,7 @@ extern int file_size(const char*, double&);
extern int clean_out_dir(const char*);
extern int dir_size(const char* dirpath, double&);
extern FILE* boinc_fopen(const char* path, const char* mode);
extern int boinc_file_exists(const char* path);
extern bool boinc_file_exists(const char* path);
extern int boinc_copy(const char* orig, const char* newf);
extern int boinc_rename(const char* old, const char* newf);
extern int boinc_mkdir(const char*);