mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=7417
This commit is contained in:
parent
0d4fae3a35
commit
7bf14665c2
|
@ -106,6 +106,8 @@ static volatile int interrupt_count = 0;
|
|||
static double fpops_per_cpu_sec = 0;
|
||||
static double fpops_cumulative = 0;
|
||||
static int non_cpu_intensive = 0;
|
||||
static int want_network = 0;
|
||||
static int have_network = 1;
|
||||
|
||||
#define TIMER_PERIOD 1
|
||||
// period of worker-thread timer interrupts.
|
||||
|
@ -196,6 +198,9 @@ static bool update_app_progress(
|
|||
"<non_cpu_intensive>%d</non_cpu_intensive>\n",
|
||||
cpu_t, cp_cpu_t, non_cpu_intensive
|
||||
);
|
||||
if (want_network) {
|
||||
strcat(msg_buf, "<want_network>1</want_network>\n");
|
||||
}
|
||||
if (fraction_done >= 0) {
|
||||
double range = aid.fraction_done_end - aid.fraction_done_start;
|
||||
double fdone = aid.fraction_done_start + fraction_done*range;
|
||||
|
@ -550,6 +555,9 @@ static void handle_process_control_msg() {
|
|||
if (match_tag(buf, "<reread_app_info/>")) {
|
||||
boinc_status.reread_init_data_file = true;
|
||||
}
|
||||
if (match_tag(buf, "<network_available/>")) {
|
||||
have_network = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -809,6 +817,19 @@ void boinc_using_cpu() {
|
|||
non_cpu_intensive = 0;
|
||||
}
|
||||
|
||||
void boinc_need_network() {
|
||||
want_network = 1;
|
||||
have_network = 0;
|
||||
}
|
||||
|
||||
int boinc_network_poll() {
|
||||
return have_network?0:1;
|
||||
}
|
||||
|
||||
void boinc_network_done() {
|
||||
want_network = 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
// block SIGALRM, so that the worker thread will be forced to handle it
|
||||
//
|
||||
|
|
|
@ -10800,3 +10800,33 @@ David 17 Aug 2005
|
|||
scheduler_op.C
|
||||
lib/
|
||||
app_ipc.h
|
||||
|
||||
David 17 Aug 2005
|
||||
- Add new API calls:
|
||||
boinc_need_network()
|
||||
boinc_network_poll()
|
||||
boinc_network_done()
|
||||
For apps that do network communication.
|
||||
If there is no physical connection (e.g. modem not dialed)
|
||||
this allows the app
|
||||
1) to request (via the core client and the BOINC manager)
|
||||
that the user establish a connection;
|
||||
2) to learn when a connection has been established
|
||||
3) to indicate that it is done with network comm
|
||||
(e.g. so we can hang up the modem)
|
||||
|
||||
Implementation:
|
||||
Add want_network, have_network flags in API lib.
|
||||
Send want_network in app_status messages to core.
|
||||
Core: on network_available(), send <network_available/> to
|
||||
any app that wants network.
|
||||
|
||||
(for Folding@Home)
|
||||
|
||||
api/
|
||||
boinc_api.C
|
||||
client/
|
||||
app.C,h
|
||||
app_control.C
|
||||
client_state.C
|
||||
scheduler_op.C
|
||||
|
|
20
client/app.C
20
client/app.C
|
@ -102,7 +102,8 @@ ACTIVE_TASK::ACTIVE_TASK() {
|
|||
have_trickle_down = false;
|
||||
send_upload_file_status = false;
|
||||
pending_suspend_via_quit = false;
|
||||
non_cpu_intensive = false;
|
||||
non_cpu_intensive = 0;
|
||||
want_network = 0;
|
||||
#ifdef _WIN32
|
||||
pid_handle = 0;
|
||||
thread_handle = 0;
|
||||
|
@ -554,6 +555,23 @@ void ACTIVE_TASK_SET::handle_upload_files() {
|
|||
}
|
||||
}
|
||||
|
||||
bool ACTIVE_TASK_SET::want_network() {
|
||||
for (unsigned int i=0; i<active_tasks.size(); i++) {
|
||||
ACTIVE_TASK* atp = active_tasks[i];
|
||||
if (atp->want_network) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ACTIVE_TASK_SET::network_available() {
|
||||
for (unsigned int i=0; i<active_tasks.size(); i++) {
|
||||
ACTIVE_TASK* atp = active_tasks[i];
|
||||
if (atp->want_network) {
|
||||
atp->send_network_available();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ACTIVE_TASK::upload_notify_app(const FILE_INFO* fip, const FILE_REF* frp) {
|
||||
char path[256];
|
||||
sprintf(path, "%s/%s%s", slot_dir, UPLOAD_FILE_STATUS_PREFIX, frp->open_name);
|
||||
|
|
|
@ -125,6 +125,7 @@ public:
|
|||
bool send_upload_file_status;
|
||||
bool pending_suspend_via_quit; // waiting for task to suspend via quit
|
||||
int non_cpu_intensive;
|
||||
int want_network;
|
||||
|
||||
APP_CLIENT_SHM app_client_shm; // core/app shared mem
|
||||
MSG_QUEUE graphics_request_queue;
|
||||
|
@ -167,6 +168,7 @@ public:
|
|||
bool has_task_exited(); // return true if this task has exited
|
||||
int preempt(bool quit_task); // preempt (via suspend or quit) a running task
|
||||
int resume_or_start();
|
||||
void send_network_available();
|
||||
#ifdef _WIN32
|
||||
bool handle_exited_app(unsigned long);
|
||||
#else
|
||||
|
@ -220,6 +222,8 @@ public:
|
|||
void report_overdue();
|
||||
void handle_upload_files();
|
||||
void upload_notify_app(FILE_INFO*);
|
||||
bool want_network();
|
||||
void network_available();
|
||||
|
||||
// screensaver-related functions
|
||||
ACTIVE_TASK* get_ss_app();
|
||||
|
|
|
@ -797,6 +797,15 @@ int ACTIVE_TASK::unsuspend() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void ACTIVE_TASK::send_network_available() {
|
||||
if (!app_client_shm.shm) return;
|
||||
process_control_queue.msg_queue_send(
|
||||
"<network_available/>",
|
||||
app_client_shm.shm->process_control_request
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// See if the app has placed a new message in shared mem
|
||||
// (with CPU done, frac done etc.)
|
||||
// If so parse it and return true.
|
||||
|
|
|
@ -1404,6 +1404,7 @@ bool CLIENT_STATE::want_network() {
|
|||
if (http_ops->nops()) return true;
|
||||
if (network_suspended) return false;
|
||||
if (want_network_flag) return true;
|
||||
if (active_tasks.want_network()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1418,6 +1419,7 @@ void CLIENT_STATE::network_available() {
|
|||
PROJECT* p = projects[i];
|
||||
p->min_rpc_time = 0;
|
||||
}
|
||||
active_tasks.network_available();
|
||||
}
|
||||
|
||||
const char *BOINC_RCSID_e836980ee1 = "$Id$";
|
||||
|
|
|
@ -541,7 +541,7 @@ SCHEDULER_REPLY::~SCHEDULER_REPLY() {
|
|||
//
|
||||
int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
|
||||
char buf[256], msg_buf[1024], pri_buf[256];
|
||||
int retval, x;
|
||||
int retval;
|
||||
MIOFILE mf;
|
||||
std::string delete_file_name;
|
||||
mf.init_file(in);
|
||||
|
|
Loading…
Reference in New Issue