From 8e0f06ef2b36fc7baa668e39c6df61cdc39676e4 Mon Sep 17 00:00:00 2001 From: CharlieFenton Date: Wed, 30 Mar 2022 02:35:09 -0700 Subject: [PATCH] Merge pull request #4684 from BOINC/dpa_version_check Fix bug in new version check --- client/current_version.cpp | 20 +++++++++++++------- client/gui_rpc_server_ops.cpp | 9 ++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/client/current_version.cpp b/client/current_version.cpp index fc13e65a25..48a1338c01 100644 --- a/client/current_version.cpp +++ b/client/current_version.cpp @@ -320,13 +320,19 @@ void newer_version_startup_check() { #define NEW_VERSION_CHECK_PERIOD (14*86400) +// get client version info from the BOINC server if we haven't done so recently. +// Called periodically from the main loop. +// Also called with force=true for the get_newer_version() GUI RPC +// void CLIENT_STATE::new_version_check(bool force) { - if (force || (new_version_check_time == 0) || - (now - new_version_check_time > NEW_VERSION_CHECK_PERIOD)) { - // get_current_version_op.handle_reply() - // updates new_version_check_time - // - get_current_version_op.do_rpc(); - } + if (force + || (new_version_check_time == 0) + || (now - new_version_check_time > NEW_VERSION_CHECK_PERIOD) + ) { + // get_current_version_op.handle_reply() + // updates new_version_check_time + // + get_current_version_op.do_rpc(); + } } diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index eafcc9c1ce..1dc4cae04e 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -1089,7 +1089,14 @@ static void handle_acct_mgr_rpc_poll(GUI_RPC_CONN& grc) { static void handle_get_newer_version(GUI_RPC_CONN& grc) { gstate.new_version_check(true); - + // this initiates an RPC to get version info. + // Wait for it to finish. + // + while (gstate.get_current_version_op.gui_http->gui_http_state != HTTP_STATE_IDLE) { + if (!gstate.poll_slow_events()) { + gstate.do_io_or_sleep(1.0); + } + } grc.mfout.printf( "%s\n" "%s\n",