From 689f6c16256df474ccf4b3e022edca93662b49e2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 19 May 2010 17:15:33 +0000 Subject: [PATCH] - GUI RPC: improved error reporting svn path=/trunk/boinc/; revision=21585 --- checkin_notes | 8 ++++++++ html/ops/credit.php | 13 ++++++++++--- lib/gui_rpc_client_ops.cpp | 13 ++++++++++--- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1e0114d379..792f94a4f0 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3780,3 +3780,11 @@ David 19 May 2010 client/ boinc_cmd.cpp + +David 19 May 2010 + - GUI RPC: improved error reporting + + lib/ + gui_rpc_client_ops.cpp + html/ops/ + credit.php diff --git a/html/ops/credit.php b/html/ops/credit.php index 99a919a811..d7c8c43cb4 100644 --- a/html/ops/credit.php +++ b/html/ops/credit.php @@ -8,9 +8,16 @@ require_once("../inc/boinc_db.inc"); define('COBB_SCALE', 200/86400e9); +function gavid($avid, $appid) { + if ($avid < 0) { + return $appid*1000000 - $avid; + } + return $avid; +} -function show_result($r) { - $hav = BoincHostAppVersion::lookup($r->hostid, $r->app_version_id); +function show_result($r, $w) { + $gavid = gavid($r->app_version_id, $w->appid); + $hav = BoincHostAppVersion::lookup($r->hostid, $gavid); $av = BoincAppVersion::lookup_id($r->app_version_id); $raw_credit = $r->elapsed_time*$r->flops_estimate*COBB_SCALE; echo "
@@ -62,7 +69,7 @@ function handle_result($resultid) {
     $rs = BoincResult::enum("workunitid=$r->workunitid and validate_state=1");
     $app_version_ids = array();
     foreach ($rs as $r) {
-        show_result($r);
+        show_result($r, $w);
         $app_version_ids[] = $r->app_version_id;
     }
     $app_version_ids = array_unique($app_version_ids);
diff --git a/lib/gui_rpc_client_ops.cpp b/lib/gui_rpc_client_ops.cpp
index 80be19c49d..13f6942b80 100644
--- a/lib/gui_rpc_client_ops.cpp
+++ b/lib/gui_rpc_client_ops.cpp
@@ -1927,14 +1927,21 @@ int RPC_CLIENT::result_op(RESULT& result, const char* op) {
 
 int RPC_CLIENT::get_host_info(HOST_INFO& h) {
     int retval;
+    char buf[256];
     SET_LOCALE sl;
     RPC rpc(this);
 
     retval = rpc.do_rpc("");
-    if (!retval) {
-        retval = h.parse(rpc.fin);
+    if (retval) return retval;
+    while (rpc.fin.fgets(buf, 256)) {
+        if (match_tag(buf, "")) {
+            return h.parse(rpc.fin);
+        }
+        if (match_tag(buf, "