@@ -190,9 +190,6 @@ static volatile int running_interrupt_count = 0;
190190static volatile bool finishing;
191191 // used for worker/timer synch during boinc_finish();
192192static int want_network = 0 ;
193- static int have_network = 1 ;
194- static double bytes_sent = 0 ;
195- static double bytes_received = 0 ;
196193bool boinc_disable_timer_thread = false ;
197194 // simulate unresponsive app by setting to true (debugging)
198195static FUNC_PTR timer_callback = 0 ;
@@ -205,6 +202,7 @@ int app_min_checkpoint_period = 0;
205202static volatile SPORADIC_AC_STATE ac_state;
206203static volatile int ac_fd, ca_fd;
207204static volatile bool do_sporadic_files;
205+ volatile bool got_heartbeat_message = false ;
208206
209207#define TIMER_PERIOD 0.1
210208 // Sleep interval for timer thread;
@@ -425,26 +423,17 @@ static bool update_app_progress(double cpu_t, double cp_cpu_t) {
425423
426424 snprintf (msg_buf, sizeof (msg_buf),
427425 " <current_cpu_time>%e</current_cpu_time>\n "
428- " <checkpoint_cpu_time>%e</checkpoint_cpu_time>\n " ,
429- cpu_t , cp_cpu_t
426+ " <checkpoint_cpu_time>%e</checkpoint_cpu_time>\n "
427+ " <want_network>%d</want_network>\n " ,
428+ cpu_t , cp_cpu_t ,
429+ want_network?1 :0
430430 );
431- if (want_network) {
432- strlcat (msg_buf, " <want_network>1</want_network>\n " , sizeof (msg_buf));
433- }
434431 if (fraction_done >= 0 ) {
435432 double range = aid.fraction_done_end - aid.fraction_done_start ;
436433 double fdone = aid.fraction_done_start + fraction_done*range;
437434 snprintf (buf, sizeof (buf), " <fraction_done>%e</fraction_done>\n " , fdone);
438435 strlcat (msg_buf, buf, sizeof (msg_buf));
439436 }
440- if (bytes_sent) {
441- snprintf (buf, sizeof (buf), " <bytes_sent>%f</bytes_sent>\n " , bytes_sent);
442- strlcat (msg_buf, buf, sizeof (msg_buf));
443- }
444- if (bytes_received) {
445- snprintf (buf, sizeof (buf), " <bytes_received>%f</bytes_received>\n " , bytes_received);
446- strlcat (msg_buf, buf, sizeof (msg_buf));
447- }
448437 if (ac_state) {
449438 sprintf (buf, " <sporadic_ac>%d</sporadic_ac>\n " , ac_state);
450439 strlcat (msg_buf, buf, sizeof (msg_buf));
@@ -480,12 +469,13 @@ static void handle_heartbeat_msg() {
480469 if (parse_double (buf, " <max_wss>" , dtemp)) {
481470 boinc_status.max_working_set_size = dtemp;
482471 }
483- if (parse_bool (buf, " suspend_network " , btemp)) {
472+ if (parse_bool (buf, " network_suspended " , btemp)) {
484473 boinc_status.network_suspended = btemp;
485474 }
486475 if (parse_int (buf, " <sporadic_ca>" , i)) {
487476 boinc_status.ca_state = (SPORADIC_CA_STATE )i;
488477 }
478+ got_heartbeat_message = true ;
489479}
490480
491481// called in timer thread
@@ -970,11 +960,6 @@ void boinc_exit(int status) {
970960#endif
971961}
972962
973- void boinc_network_usage (double sent, double received) {
974- bytes_sent = sent;
975- bytes_received = received;
976- }
977-
978963int boinc_is_standalone () {
979964 if (standalone) return 1 ;
980965 return 0 ;
@@ -1087,8 +1072,8 @@ int boinc_report_app_status_aux(
10871072 double checkpoint_cpu_time,
10881073 double _fraction_done,
10891074 int other_pid,
1090- double _bytes_sent,
1091- double _bytes_received,
1075+ double /* _bytes_sent*/ ,
1076+ double /* _bytes_received*/ ,
10921077 double wss
10931078) {
10941079 char msg_buf[MSG_CHANNEL_SIZE ], buf[1024 ];
@@ -1106,14 +1091,6 @@ int boinc_report_app_status_aux(
11061091 snprintf (buf, sizeof (buf), " <other_pid>%d</other_pid>\n " , other_pid);
11071092 safe_strcat (msg_buf, buf);
11081093 }
1109- if (_bytes_sent) {
1110- snprintf (buf, sizeof (buf), " <bytes_sent>%f</bytes_sent>\n " , _bytes_sent);
1111- safe_strcat (msg_buf, buf);
1112- }
1113- if (_bytes_received) {
1114- snprintf (buf, sizeof (buf), " <bytes_received>%f</bytes_received>\n " , _bytes_received);
1115- safe_strcat (msg_buf, buf);
1116- }
11171094 if (ac_state) {
11181095 sprintf (buf, " <sporadic_ac>%d</sporadic_ac>\n " , ac_state);
11191096 strlcat (msg_buf, buf, sizeof (msg_buf));
@@ -1122,6 +1099,9 @@ int boinc_report_app_status_aux(
11221099 sprintf (buf, " <wss>%f</wss>\n " , wss);
11231100 strlcat (msg_buf, buf, sizeof (msg_buf));
11241101 }
1102+ if (want_network) {
1103+ strlcat (msg_buf, " <want_network>1</want_network>\n " , sizeof (msg_buf));
1104+ }
11251105#ifdef MSGS_FROM_FILE
11261106 if (fout) {
11271107 fputs (msg_buf, fout);
@@ -1371,9 +1351,6 @@ static void handle_process_control_msg() {
13711351 if (match_tag (buf, " <reread_app_info/>" )) {
13721352 boinc_status.reread_init_data_file = true ;
13731353 }
1374- if (match_tag (buf, " <network_available/>" )) {
1375- have_network = 1 ;
1376- }
13771354#ifdef ANDROID
13781355 // Trigger call to worker_signal_handler() in the worker thread
13791356 //
@@ -1794,17 +1771,8 @@ int boinc_upload_status(std::string& name) {
17941771 return ERR_NOT_FOUND ;
17951772}
17961773
1797- void boinc_need_network () {
1798- want_network = 1 ;
1799- have_network = 0 ;
1800- }
1801-
1802- int boinc_network_poll () {
1803- return have_network?0 :1 ;
1804- }
1805-
1806- void boinc_network_done () {
1807- want_network = 0 ;
1774+ void boinc_waiting_for_network (bool x) {
1775+ want_network = x;
18081776}
18091777
18101778#ifndef _WIN32
0 commit comments