- GUI RPC: improved error reporting

svn path=/trunk/boinc/; revision=21585
This commit is contained in:
David Anderson 2010-05-19 17:15:33 +00:00
parent 2858ced9f4
commit 689f6c1625
3 changed files with 28 additions and 6 deletions

View File

@ -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

View File

@ -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 "<hr><pre>
@ -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);

View File

@ -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("<get_host_info/>");
if (!retval) {
retval = h.parse(rpc.fin);
if (retval) return retval;
while (rpc.fin.fgets(buf, 256)) {
if (match_tag(buf, "<host_info>")) {
return h.parse(rpc.fin);
}
if (match_tag(buf, "<unauthorized")) {
return ERR_AUTHENTICATOR;
}
}
return retval;
return ERR_XML_PARSE;
}