mirror of https://github.com/BOINC/boinc.git
API: remove handle_trickle_down and handle_trickle_up from BOINC_OPTIONS.
Sending or receiving trickle messages required setting flags in BOINC_OPTIONS. There were two problems with this: 1) it wasn't documented 2) it's not necessary; the act of calling boinc_send_trickle_up() tells the runtime system to do the trickle-up-related stuff. Furthermore, because intermediate file upload shares message channels with trickles, these functions also required the option flags (also undocumented). With this change, you don't need to set options to use trickle messages are intermediate file upload.
This commit is contained in:
parent
02325341c8
commit
65c82b067f
|
@ -135,7 +135,13 @@ static volatile bool standalone = false;
|
||||||
static volatile double initial_wu_cpu_time;
|
static volatile double initial_wu_cpu_time;
|
||||||
static volatile bool have_new_trickle_up = false;
|
static volatile bool have_new_trickle_up = false;
|
||||||
static volatile bool have_trickle_down = true;
|
static volatile bool have_trickle_down = true;
|
||||||
// on first call, scan slot dir for msgs
|
// set if the client notified us of a trickle-down.
|
||||||
|
// init to true so the first call to boinc_receive_trickle_down()
|
||||||
|
// will scan the slot dir for old trickle-down files
|
||||||
|
static volatile bool handle_trickle_downs = false;
|
||||||
|
// whether we should check for notifications of trickle_downs
|
||||||
|
// and file upload status.
|
||||||
|
// set by boinc_receive_trickle_down() and boinc_upload_file().
|
||||||
static volatile int heartbeat_giveup_count;
|
static volatile int heartbeat_giveup_count;
|
||||||
// interrupt count value at which to give up on client
|
// interrupt count value at which to give up on client
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -661,7 +667,6 @@ int boinc_get_status(BOINC_STATUS *s) {
|
||||||
//
|
//
|
||||||
static void send_trickle_up_msg() {
|
static void send_trickle_up_msg() {
|
||||||
char buf[MSG_CHANNEL_SIZE];
|
char buf[MSG_CHANNEL_SIZE];
|
||||||
BOINCINFO("Sending Trickle Up Message");
|
|
||||||
if (standalone) return;
|
if (standalone) return;
|
||||||
strcpy(buf, "");
|
strcpy(buf, "");
|
||||||
if (have_new_trickle_up) {
|
if (have_new_trickle_up) {
|
||||||
|
@ -671,6 +676,7 @@ static void send_trickle_up_msg() {
|
||||||
strcat(buf, "<have_new_upload_file/>\n");
|
strcat(buf, "<have_new_upload_file/>\n");
|
||||||
}
|
}
|
||||||
if (strlen(buf)) {
|
if (strlen(buf)) {
|
||||||
|
BOINCINFO("Sending Trickle Up Message");
|
||||||
if (app_client_shm->shm->trickle_up.send_msg(buf)) {
|
if (app_client_shm->shm->trickle_up.send_msg(buf)) {
|
||||||
have_new_trickle_up = false;
|
have_new_trickle_up = false;
|
||||||
have_new_upload_file = false;
|
have_new_upload_file = false;
|
||||||
|
@ -1011,7 +1017,7 @@ static void handle_upload_file_status() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle trickle and file upload messages
|
// handle trickle and file upload status messages
|
||||||
//
|
//
|
||||||
static void handle_trickle_down_msg() {
|
static void handle_trickle_down_msg() {
|
||||||
char buf[MSG_CHANNEL_SIZE];
|
char buf[MSG_CHANNEL_SIZE];
|
||||||
|
@ -1137,7 +1143,7 @@ static void timer_handler() {
|
||||||
if (options.check_heartbeat) {
|
if (options.check_heartbeat) {
|
||||||
handle_heartbeat_msg();
|
handle_heartbeat_msg();
|
||||||
}
|
}
|
||||||
if (options.handle_trickle_downs) {
|
if (handle_trickle_downs) {
|
||||||
handle_trickle_down_msg();
|
handle_trickle_down_msg();
|
||||||
}
|
}
|
||||||
if (options.handle_process_control) {
|
if (options.handle_process_control) {
|
||||||
|
@ -1183,7 +1189,7 @@ static void timer_handler() {
|
||||||
update_app_progress(last_wu_cpu_time, last_checkpoint_cpu_time);
|
update_app_progress(last_wu_cpu_time, last_checkpoint_cpu_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.handle_trickle_ups) {
|
if (have_new_trickle_up || have_new_upload_file) {
|
||||||
send_trickle_up_msg();
|
send_trickle_up_msg();
|
||||||
}
|
}
|
||||||
if (timer_callback) {
|
if (timer_callback) {
|
||||||
|
@ -1349,7 +1355,6 @@ static int start_worker_signals() {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int boinc_send_trickle_up(char* variety, char* p) {
|
int boinc_send_trickle_up(char* variety, char* p) {
|
||||||
if (!options.handle_trickle_ups) return ERR_NO_OPTION;
|
|
||||||
FILE* f = boinc_fopen(TRICKLE_UP_FILENAME, "wb");
|
FILE* f = boinc_fopen(TRICKLE_UP_FILENAME, "wb");
|
||||||
if (!f) return ERR_FOPEN;
|
if (!f) return ERR_FOPEN;
|
||||||
fprintf(f, "<variety>%s</variety>\n", variety);
|
fprintf(f, "<variety>%s</variety>\n", variety);
|
||||||
|
@ -1438,7 +1443,7 @@ int boinc_receive_trickle_down(char* buf, int len) {
|
||||||
std::string filename;
|
std::string filename;
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
|
|
||||||
if (!options.handle_trickle_downs) return false;
|
handle_trickle_downs = true;
|
||||||
|
|
||||||
if (have_trickle_down) {
|
if (have_trickle_down) {
|
||||||
relative_to_absolute("", path);
|
relative_to_absolute("", path);
|
||||||
|
@ -1466,10 +1471,15 @@ int boinc_upload_file(std::string& name) {
|
||||||
if (!f) return ERR_FOPEN;
|
if (!f) return ERR_FOPEN;
|
||||||
have_new_upload_file = true;
|
have_new_upload_file = true;
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
// file upload status messages are on same channel as
|
||||||
|
// trickle down messages, so listen to that channel
|
||||||
|
//
|
||||||
|
handle_trickle_downs = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int boinc_upload_status(std::string& name) {
|
int boinc_upload_status(std::string& name) {
|
||||||
for (unsigned int i=0; i<upload_file_status.size(); i++) {
|
for (unsigned int i=0; i<upload_file_status.size(); i++) {
|
||||||
UPLOAD_FILE_STATUS& ufs = upload_file_status[i];
|
UPLOAD_FILE_STATUS& ufs = upload_file_status[i];
|
||||||
|
|
|
@ -46,11 +46,6 @@ typedef struct BOINC_OPTIONS {
|
||||||
int check_heartbeat;
|
int check_heartbeat;
|
||||||
// check for timeout of heartbeats from the client;
|
// check for timeout of heartbeats from the client;
|
||||||
// action is determined by direct_process_action (see below)
|
// action is determined by direct_process_action (see below)
|
||||||
int handle_trickle_ups;
|
|
||||||
// periodically check for trickle-up msgs from the app
|
|
||||||
// must set this to use boinc_send_trickle_up()
|
|
||||||
int handle_trickle_downs;
|
|
||||||
// this process is allowed to call boinc_receive_trickle_down()
|
|
||||||
int handle_process_control;
|
int handle_process_control;
|
||||||
// whether runtime system should read suspend/resume/quit/abort
|
// whether runtime system should read suspend/resume/quit/abort
|
||||||
// msgs from client.
|
// msgs from client.
|
||||||
|
@ -162,8 +157,6 @@ extern bool boinc_disable_timer_thread;
|
||||||
inline void boinc_options_defaults(BOINC_OPTIONS& b) {
|
inline void boinc_options_defaults(BOINC_OPTIONS& b) {
|
||||||
b.main_program = 1;
|
b.main_program = 1;
|
||||||
b.check_heartbeat = 1;
|
b.check_heartbeat = 1;
|
||||||
b.handle_trickle_ups = 1;
|
|
||||||
b.handle_trickle_downs = 1;
|
|
||||||
b.handle_process_control = 1;
|
b.handle_process_control = 1;
|
||||||
b.send_status_msgs = 1;
|
b.send_status_msgs = 1;
|
||||||
b.direct_process_action = 1;
|
b.direct_process_action = 1;
|
||||||
|
|
Loading…
Reference in New Issue