diff --git a/client/gui_rpc_server.C b/client/gui_rpc_server.C index f608eeabc7..0de52f3860 100644 --- a/client/gui_rpc_server.C +++ b/client/gui_rpc_server.C @@ -411,6 +411,8 @@ int GUI_RPC_CONN::handle_rpc() { handle_get_run_mode(request_msg, mf); } else if (match_tag(request_msg, "")) { handle_set_network_mode(request_msg, mf); + } else if (match_tag(request_msg, "")) { + handle_get_network_mode(request_msg, mf); } else if (match_tag(request_msg, "")) { diff --git a/lib/gui_rpc_client.C b/lib/gui_rpc_client.C index 9bc8dc884b..2cdc9d4a57 100644 --- a/lib/gui_rpc_client.C +++ b/lib/gui_rpc_client.C @@ -407,11 +407,13 @@ int RPC_CLIENT::get_run_mode(int& mode) { MIOFILE fin; fin.init_buf(mbuf); + mode = -1; while (fin.fgets(buf, 256)) { - if (match_tag(buf, mode_name(RUN_MODE_ALWAYS))) return RUN_MODE_ALWAYS; - if (match_tag(buf, mode_name(RUN_MODE_NEVER))) return RUN_MODE_NEVER; - if (match_tag(buf, mode_name(RUN_MODE_AUTO))) return RUN_MODE_AUTO; + if (match_tag(buf, mode_name(RUN_MODE_ALWAYS))) mode = RUN_MODE_ALWAYS; + if (match_tag(buf, mode_name(RUN_MODE_NEVER))) mode = RUN_MODE_NEVER; + if (match_tag(buf, mode_name(RUN_MODE_AUTO))) mode = RUN_MODE_AUTO; } + return 0; } int RPC_CLIENT::set_network_mode(int mode) { @@ -433,6 +435,27 @@ int RPC_CLIENT::set_network_mode(int mode) { return 0; } +int RPC_CLIENT::get_network_mode(int& mode) { + char buf[256]; + char* mbuf=0; + int retval; + + retval = send_request("\n"); + if (retval) return retval; + retval = get_reply(mbuf); + if (retval) return retval; + MIOFILE fin; + fin.init_buf(mbuf); + + mode = -1; + while (fin.fgets(buf, 256)) { + if (match_tag(buf, mode_name(RUN_MODE_ALWAYS))) mode = RUN_MODE_ALWAYS; + if (match_tag(buf, mode_name(RUN_MODE_NEVER))) mode = RUN_MODE_NEVER; + if (match_tag(buf, mode_name(RUN_MODE_AUTO))) mode = RUN_MODE_AUTO; + } + return 0; +} + int RPC_CLIENT::run_benchmarks() { char buf[256]; char* mbuf=0; diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index fccf851f31..a6e9d138af 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -201,6 +201,7 @@ public: int set_run_mode(int mode); int get_run_mode(int& mode); int set_network_mode(int mode); + int get_network_mode(int& mode); int run_benchmarks(); int set_proxy_settings(PROXY_INFO&); int get_messages(int nmessages, int seqno, std::vector&);