diff --git a/checkin_notes b/checkin_notes
index c3f216afd0..353b79c83b 100755
--- a/checkin_notes
+++ b/checkin_notes
@@ -8467,3 +8467,16 @@ David 6 Aug 2006
boinccmd.vcproj
boincmgr_curl.vcproj
libboinc.vcproj
+
+David 6 Aug 2006
+ - GUI RPC: get_activity_state() returns the reasons for suspension,
+ not just flags (so that can show "throttle" messages)
+
+ client/
+ client_state.C,h
+ gui_rpc_server_ops.C
+ clientgui/
+ MainDocument.cpp,h
+ lib/
+ gui_rpc_client.h
+ gui_rpc_client_ops.C
diff --git a/client/client_state.C b/client/client_state.C
index d8d4b6b627..7e537430e5 100644
--- a/client/client_state.C
+++ b/client/client_state.C
@@ -67,6 +67,8 @@ CLIENT_STATE::CLIENT_STATE() {
contacted_sched_server = false;
tasks_suspended = false;
network_suspended = false;
+ suspend_reason = 0;
+ network_suspend_reason = 0;
core_client_major_version = BOINC_MAJOR_VERSION;
core_client_minor_version = BOINC_MINOR_VERSION;
core_client_release = BOINC_RELEASE;
@@ -404,7 +406,7 @@ void CLIENT_STATE::do_io_or_sleep(double x) {
// (in which case should call this again immediately)
//
bool CLIENT_STATE::poll_slow_events() {
- int actions = 0, suspend_reason, network_suspend_reason, retval;
+ int actions = 0, retval;
static int last_suspend_reason=0;
static bool tasks_restarted = false;
diff --git a/client/client_state.h b/client/client_state.h
index d91a885c53..a5520abf97 100644
--- a/client/client_state.h
+++ b/client/client_state.h
@@ -155,6 +155,8 @@ public:
// Don't do CPU. See check_suspend_activities for logic
bool network_suspended;
// Don't do network. See check_suspend_network for logic
+ int suspend_reason;
+ int network_suspend_reason;
bool executing_as_daemon;
// true if --daemon is on the commandline
// this means we are running as a daemon on unix,
diff --git a/client/gui_rpc_server_ops.C b/client/gui_rpc_server_ops.C
index 937d3ada4c..409cb8bb3f 100644
--- a/client/gui_rpc_server_ops.C
+++ b/client/gui_rpc_server_ops.C
@@ -329,14 +329,14 @@ static void handle_get_proxy_settings(char* , MIOFILE& fout) {
}
static void handle_get_activity_state(char* , MIOFILE& fout) {
- fout.printf("\n");
- if ( gstate.tasks_suspended ) {
- fout.printf(" \n");
- }
- if ( gstate.network_suspended ) {
- fout.printf(" \n");
- }
- fout.printf("\n");
+ fout.printf(
+ "\n"
+ " %d\n"
+ " %d\n"
+ "\n",
+ gstate.suspend_reason,
+ gstate.network_suspend_reason
+ );
}
// params:
diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp
index 49e66c058b..0bdb40ea76 100644
--- a/clientgui/MainDocument.cpp
+++ b/clientgui/MainDocument.cpp
@@ -558,7 +558,7 @@ int CMainDocument::SetNetworkRunMode(int iMode) {
}
-int CMainDocument::GetActivityState(bool& bActivitiesSuspended, bool& bNetworkSuspended) {
+int CMainDocument::GetActivityState(ACTIVITY_STATE& as) {
int iRetVal = 0;
wxTimeSpan ts(wxDateTime::Now() - m_dtCachedActivityStateTimestamp);
@@ -566,15 +566,13 @@ int CMainDocument::GetActivityState(bool& bActivitiesSuspended, bool& bNetworkSu
m_dtCachedActivityStateTimestamp = wxDateTime::Now();
if (IsConnected()) {
- iRetVal = rpc.get_activity_state(bActivitiesSuspended, bNetworkSuspended);
+ iRetVal = rpc.get_activity_state(as);
if (0 == iRetVal) {
- m_iCachedActivitiesSuspended = bActivitiesSuspended;
- m_iCachedNetworkSuspended = bNetworkSuspended;
+ m_cached_activity_state = as;
}
}
} else {
- bActivitiesSuspended = m_iCachedActivitiesSuspended;
- bNetworkSuspended = m_iCachedNetworkSuspended;
+ as = m_cached_activity_state;
}
return iRetVal;
diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h
index de9ba23d9d..9723de22e8 100644
--- a/clientgui/MainDocument.h
+++ b/clientgui/MainDocument.h
@@ -86,8 +86,7 @@ private:
wxDateTime m_dtCachedActivityStateTimestamp;
int m_iCachedActivityRunMode;
int m_iCachedNetworkRunMode;
- bool m_iCachedActivitiesSuspended;
- bool m_iCachedNetworkSuspended;
+ ACTIVITY_STATE m_cached_activity_state;
int CachedStateUpdate();
@@ -126,7 +125,7 @@ public:
int SetActivityRunMode(int iMode);
int GetNetworkRunMode(int& iMode);
int SetNetworkRunMode(int iMode);
- int GetActivityState(bool& bActivitiesSuspended, bool& bNetworkSuspended);
+ int GetActivityState(ACTIVITY_STATE&);
int ForceCacheUpdate();
int RunBenchmarks();
diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h
index 3bc4dcb0cb..89bc4a049a 100644
--- a/lib/gui_rpc_client.h
+++ b/lib/gui_rpc_client.h
@@ -515,6 +515,11 @@ struct SIMPLE_GUI_INFO {
void print();
};
+struct ACTIVITY_STATE {
+ int task_suspend_reason;
+ int network_suspend_reason;
+};
+
class RPC_CLIENT {
public:
int sock;
@@ -562,7 +567,7 @@ public:
int get_run_mode(int& mode);
int set_network_mode(int mode);
int get_network_mode(int& mode);
- int get_activity_state(bool& activities_suspended, bool& network_suspended);
+ int get_activity_state(ACTIVITY_STATE&);
int get_screensaver_mode(int& status);
int set_screensaver_mode(
bool enabled, double blank_time, DISPLAY_INFO&
diff --git a/lib/gui_rpc_client_ops.C b/lib/gui_rpc_client_ops.C
index 54092e6e2d..905906a008 100644
--- a/lib/gui_rpc_client_ops.C
+++ b/lib/gui_rpc_client_ops.C
@@ -1537,25 +1537,21 @@ int RPC_CLIENT::get_network_mode(int& mode) {
return retval;
}
-int RPC_CLIENT::get_activity_state(bool& activities_suspended, bool& network_suspended) {
+int RPC_CLIENT::get_activity_state(ACTIVITY_STATE& as) {
int retval;
SET_LOCALE sl;
char buf[256];
RPC rpc(this);
- activities_suspended = false;
- network_suspended = false;
+ memset(&as, 0, sizeof(as));
retval = rpc.do_rpc("\n");
if (!retval) {
while (rpc.fin.fgets(buf, 256)) {
if (match_tag(buf, "")) break;
- else if (match_tag(buf, "")) {
- activities_suspended = true;
+ else if (parse_int(buf, "", as.task_suspend_reason)) {
continue;
- }
- else if (match_tag(buf, "")) {
- network_suspended = true;
+ } else if (parse_int(buf, "", as.network_suspend_reason)) {
continue;
}
}