diff --git a/client/log_flags.cpp b/client/log_flags.cpp
index 22e312af53..735cd38e19 100644
--- a/client/log_flags.cpp
+++ b/client/log_flags.cpp
@@ -81,7 +81,6 @@ void LOG_FLAGS::show() {
show_flag(buf, cpu_sched_debug, "cpu_sched_debug");
show_flag(buf, cpu_sched_status, "cpu_sched_status");
show_flag(buf, dcf_debug, "dcf_debug");
- show_flag(buf, priority_debug, "priority_debug");
show_flag(buf, file_xfer_debug, "file_xfer_debug");
show_flag(buf, gui_rpc_debug, "gui_rpc_debug");
show_flag(buf, heartbeat_debug, "heartbeat_debug");
@@ -89,7 +88,9 @@ void LOG_FLAGS::show() {
show_flag(buf, http_xfer_debug, "http_xfer_debug");
show_flag(buf, mem_usage_debug, "mem_usage_debug");
show_flag(buf, network_status_debug, "network_status_debug");
+ show_flag(buf, notice_debug, "notice_debug");
show_flag(buf, poll_debug, "poll_debug");
+ show_flag(buf, priority_debug, "priority_debug");
show_flag(buf, proxy_debug, "proxy_debug");
show_flag(buf, rr_simulation, "rr_simulation");
show_flag(buf, sched_op_debug, "sched_op_debug");
@@ -101,7 +102,6 @@ void LOG_FLAGS::show() {
show_flag(buf, time_debug, "time_debug");
show_flag(buf, unparsed_xml, "unparsed_xml");
show_flag(buf, work_fetch_debug, "work_fetch_debug");
- show_flag(buf, notice_debug, "notice_debug");
if (strlen(buf)) {
msg_printf(NULL, MSG_INFO, "log flags: %s", buf);
diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp
index 148b9c2866..1a1940283d 100644
--- a/clientgui/DlgEventLog.cpp
+++ b/clientgui/DlgEventLog.cpp
@@ -133,11 +133,15 @@ CDlgEventLog::~CDlgEventLog() {
bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin CDlgEventLog member initialisation
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+ wxASSERT(pDoc);
+ wxASSERT(wxDynamicCast(pDoc, CMainDocument));
+
m_iPreviousRowCount = 0;
m_iTotalDocCount = 0;
- m_iPreviousTotalDocCount = 0;
- m_iPreviousFirstMsgSeqNum = 0;
- m_iPreviousLastMsgSeqNum = 0;
+ m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
+ m_iPreviousLastMsgSeqNum = m_iPreviousFirstMsgSeqNum;
+
m_iNumDeletedFilteredRows = 0;
m_iTotalDeletedFilterRows = 0;
@@ -146,6 +150,7 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt
}
m_iFilteredIndexes.Clear();
m_bProcessingRefreshEvent = false;
+ m_bWasConnected = false;
m_bEventLogIsOpen = true;
////@end CDlgEventLog member initialisation
@@ -227,6 +232,7 @@ bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& capt
SetTextColor();
RestoreState();
+ OnRefresh();
return true;
}
@@ -460,15 +466,11 @@ wxInt32 CDlgEventLog::GetDocCount() {
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
m_iTotalDocCount = pDoc->GetMessageCount();
- if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
- // Usually due to a disconnect from client
- ResetMessageFiltering();
- m_iPreviousFirstMsgSeqNum = 0;
- m_iPreviousLastMsgSeqNum = 0;
- }
numDeletedRows = pDoc->GetFirstMsgSeqNum() - m_iPreviousFirstMsgSeqNum;
- if (numDeletedRows < 0) numDeletedRows = 0;
+ if ((numDeletedRows < 0) || (m_iPreviousFirstMsgSeqNum < 0)) {
+ numDeletedRows = 0;
+ }
m_iNumDeletedFilteredRows = 0;
if (s_bIsFiltered) {
@@ -522,8 +524,6 @@ wxInt32 CDlgEventLog::GetDocCount() {
}
}
}
-
- m_iPreviousTotalDocCount = m_iTotalDocCount;
return s_bIsFiltered ? m_iFilteredDocCount : m_iTotalDocCount;
}
@@ -534,7 +534,6 @@ wxInt32 CDlgEventLog::GetDocCount() {
*/
void CDlgEventLog::OnRefresh() {
bool isConnected;
- static bool was_connected = false;
static wxString strLastMachineName = wxEmptyString;
wxString strNewMachineName = wxEmptyString;
CMainDocument* pDoc = wxGetApp().GetDocument();
@@ -562,16 +561,16 @@ void CDlgEventLog::OnRefresh() {
pDoc->GetConnectedComputerName(strNewMachineName);
if (strLastMachineName != strNewMachineName) {
strLastMachineName = strNewMachineName;
- was_connected = false;
+ m_bWasConnected = false;
ResetMessageFiltering();
- m_iPreviousFirstMsgSeqNum = 0;
- m_iPreviousLastMsgSeqNum = 0;
+ m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
+ m_iPreviousLastMsgSeqNum = m_iPreviousFirstMsgSeqNum;
}
}
// If connection status changed, adjust color of messages display
- if (was_connected != isConnected) {
- was_connected = isConnected;
+ if (m_bWasConnected != isConnected) {
+ m_bWasConnected = isConnected;
SetTextColor();
// Force a complete update
@@ -602,9 +601,11 @@ void CDlgEventLog::OnRefresh() {
}
m_iPreviousRowCount = iRowCount;
- m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
- m_iPreviousLastMsgSeqNum = pDoc->GetLastMsgSeqNum();
-
+ if (m_iTotalDocCount > 0) {
+ m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
+ m_iPreviousLastMsgSeqNum = pDoc->GetLastMsgSeqNum();
+ }
+
UpdateButtons();
m_bProcessingRefreshEvent = false;
diff --git a/clientgui/DlgEventLog.h b/clientgui/DlgEventLog.h
index ac6b9cc569..8eecc48a59 100644
--- a/clientgui/DlgEventLog.h
+++ b/clientgui/DlgEventLog.h
@@ -147,7 +147,6 @@ private:
wxArrayInt m_iFilteredIndexes;
wxInt32 m_iTotalDocCount;
wxInt32 m_iFilteredDocCount;
- wxInt32 m_iPreviousTotalDocCount;
wxInt32 m_iPreviousFirstMsgSeqNum;
wxInt32 m_iPreviousLastMsgSeqNum;
wxInt32 m_iNumDeletedFilteredRows;
@@ -163,7 +162,7 @@ private:
wxListItemAttr* m_pMessageErrorGrayAttr;
bool m_bProcessingRefreshEvent;
-
+ bool m_bWasConnected;
bool m_bEventLogIsOpen;
bool SaveState();
diff --git a/html/inc/boinc_db.inc b/html/inc/boinc_db.inc
index acbab10b82..cba49d4b81 100644
--- a/html/inc/boinc_db.inc
+++ b/html/inc/boinc_db.inc
@@ -69,21 +69,30 @@ class BoincDb extends DbConn {
// 2) check whether the "stop_web" trigger file is present
//
static function get($readonly = false) {
+ global $generating_xml;
if (!isset(self::$instance)) {
if (web_stopped()) {
- show_page("Project down for maintenance",
- "Please check back in a few hours."
- );
- exit;
+ if ($generating_xml) {
+ xml_error(-183, "project down for maintenance");
+ } else {
+ show_page("Project down for maintenance",
+ "Please check back in a few hours."
+ );
+ exit;
+ }
}
self::get_aux($readonly);
if (!self::$instance) {
- show_page(
- "Project is down",
- "The project's database server is down.
- Please check back in a few hours."
- );
- exit;
+ if ($generating_xml) {
+ xml_error(-138, "the project's database server is down");
+ } else {
+ show_page(
+ "Project is down",
+ "The project's database server is down.
+ Please check back in a few hours."
+ );
+ exit;
+ }
}
}
return self::$instance;
diff --git a/html/inc/util.inc b/html/inc/util.inc
index 27bb1189b8..43861e3c47 100644
--- a/html/inc/util.inc
+++ b/html/inc/util.inc
@@ -44,7 +44,6 @@ if (defined('TIMEZONE')) {
date_default_timezone_set('UTC');
}
-$generating_xml = false;
$caching = false;
// if set, we're writing to a file rather than to client
$did_page_head = false;
diff --git a/html/inc/util_basic.inc b/html/inc/util_basic.inc
index 098f1512aa..f182021c6c 100644
--- a/html/inc/util_basic.inc
+++ b/html/inc/util_basic.inc
@@ -19,6 +19,8 @@
// minimal set of util functions;
// doesn't pull in translation.inc etc.
+$generating_xml = false;
+
function web_stopped() {
$d = dirname(__FILE__);
return file_exists("$d/../../stop_web");
diff --git a/html/user/submit_rpc_handler.php b/html/user/submit_rpc_handler.php
index 7b8ff06668..2f71869440 100644
--- a/html/user/submit_rpc_handler.php
+++ b/html/user/submit_rpc_handler.php
@@ -323,26 +323,41 @@ function query_batch($r) {
//
function query_batch2($r) {
list($user, $user_submit) = authenticate_user($r, null);
- $batch = get_batch($r);
- if ($batch->user_id != $user->id) xml_error(-1, "not owner");
- $wus = BoincWorkunit::enum("batch = $batch->id");
- echo "\n";
- foreach ($wus as $wu) {
- if ($wu->canonical_resultid) {
- $status = "DONE";
- } else if ($wu->error_mask) {
- $status = "ERROR";
- } else {
- $status = "IN_PROGRESS";
+ $batch_names = $r->batch_name;
+ $batches = array();
+ foreach ($batch_names as $b) {
+ $batch_name = (string)$b;
+ $batch_name = BoincDb::escape_string($batch_name);
+ $batch = BoincBatch::lookup_name($batch_name);
+ if (!$batch) {
+ xml_error(-1, "no batch named $batch_name");
}
- echo
+ if ($batch->user_id != $user->id) {
+ xml_error(-1, "not owner of $batch_name");
+ }
+ $batches[] = $batch;
+ }
+
+ echo "\n";
+ foreach ($batches as $batch) {
+ $wus = BoincWorkunit::enum("batch = $batch->id");
+ foreach ($wus as $wu) {
+ if ($wu->canonical_resultid) {
+ $status = "DONE";
+ } else if ($wu->error_mask) {
+ $status = "ERROR";
+ } else {
+ $status = "IN_PROGRESS";
+ }
+ echo
"
$wu->name
$status
";
+ }
}
- echo "\n";
+ echo "\n";
}
function query_job($r) {
@@ -477,6 +492,11 @@ function get_templates($r) {
echo "\n$in\n$out\n\n";
}
+function ping($r) {
+ BoincDb::get(); // errors out if DB down or web disabled
+ echo "1";
+}
+
if (0) {
$r = simplexml_load_string("
@@ -530,7 +550,10 @@ if (!$r) {
switch ($r->getName()) {
case 'abort_batch': handle_abort_batch($r); break;
case 'abort_jobs': handle_abort_jobs($r); break;
+ case 'create_batch': create_batch($r); break;
case 'estimate_batch': estimate_batch($r); break;
+ case 'get_templates': get_templates($r); break;
+ case 'ping': ping($r); break;
case 'query_batch': query_batch($r); break;
case 'query_batch2': query_batch2($r); break;
case 'query_batches': query_batches($r); break;
@@ -538,8 +561,6 @@ switch ($r->getName()) {
case 'query_completed_job': query_completed_job($r); break;
case 'retire_batch': handle_retire_batch($r); break;
case 'submit_batch': submit_batch($r); break;
- case 'create_batch': create_batch($r); break;
- case 'get_templates': get_templates($r); break;
default: xml_error(-1, "bad command: ".$r->getName());
}
diff --git a/lib/cc_config.cpp b/lib/cc_config.cpp
index 4b5a3a3ba1..e8f22f84fb 100644
--- a/lib/cc_config.cpp
+++ b/lib/cc_config.cpp
@@ -74,7 +74,6 @@ int LOG_FLAGS::parse(XML_PARSER& xp) {
if (xp.parse_bool("cpu_sched_status", cpu_sched_status)) continue;
if (xp.parse_bool("dcf_debug", dcf_debug)) continue;
if (xp.parse_bool("disk_usage_debug", disk_usage_debug)) continue;
- if (xp.parse_bool("priority_debug", priority_debug)) continue;
if (xp.parse_bool("file_xfer_debug", file_xfer_debug)) continue;
if (xp.parse_bool("gui_rpc_debug", gui_rpc_debug)) continue;
if (xp.parse_bool("heartbeat_debug", heartbeat_debug)) continue;
@@ -84,6 +83,7 @@ int LOG_FLAGS::parse(XML_PARSER& xp) {
if (xp.parse_bool("network_status_debug", network_status_debug)) continue;
if (xp.parse_bool("notice_debug", notice_debug)) continue;
if (xp.parse_bool("poll_debug", poll_debug)) continue;
+ if (xp.parse_bool("priority_debug", priority_debug)) continue;
if (xp.parse_bool("proxy_debug", proxy_debug)) continue;
if (xp.parse_bool("rr_simulation", rr_simulation)) continue;
if (xp.parse_bool("rrsim_detail", rrsim_detail)) continue;
@@ -120,7 +120,6 @@ int LOG_FLAGS::write(MIOFILE& out) {
" %d\n"
" %d\n"
" %d\n"
- " %d\n"
" %d\n"
" %d\n"
" %d\n"
@@ -130,6 +129,7 @@ int LOG_FLAGS::write(MIOFILE& out) {
" %d\n"
" %d\n"
" %d\n"
+ " %d\n"
" %d\n"
" %d\n"
" %d\n"
@@ -159,7 +159,6 @@ int LOG_FLAGS::write(MIOFILE& out) {
cpu_sched_status ? 1 : 0,
dcf_debug ? 1 : 0,
disk_usage_debug ? 1 : 0,
- priority_debug ? 1 : 0,
file_xfer_debug ? 1 : 0,
gui_rpc_debug ? 1 : 0,
heartbeat_debug ? 1 : 0,
@@ -169,6 +168,7 @@ int LOG_FLAGS::write(MIOFILE& out) {
network_status_debug ? 1 : 0,
notice_debug ? 1 : 0,
poll_debug ? 1 : 0,
+ priority_debug ? 1 : 0,
proxy_debug ? 1 : 0,
rr_simulation ? 1 : 0,
rrsim_detail ? 1 : 0,
diff --git a/lib/remote_submit.cpp b/lib/remote_submit.cpp
index 0ddcefa9fe..05011b8a09 100644
--- a/lib/remote_submit.cpp
+++ b/lib/remote_submit.cpp
@@ -327,20 +327,22 @@ int submit_jobs(
return retval;
}
-int query_batch(
+int query_batches(
const char* project_url,
const char* authenticator,
- string batch_name,
+ vector &batch_names,
QUERY_BATCH_REPLY& qb_reply,
string& error_msg
) {
string request;
char url[1024], buf[256];
request = "\n";
- sprintf(buf, "%s\n", batch_name.c_str());
- request += string(buf);
sprintf(buf, "%s\n", authenticator);
request += string(buf);
+ for (unsigned int i=0; i%s\n", batch_names[i].c_str());
+ request += string(buf);
+ }
request += "\n";
sprintf(url, "%ssubmit_rpc_handler.php", project_url);
FILE* reply = tmpfile();
@@ -354,8 +356,7 @@ int query_batch(
retval = -1;
error_msg = "";
while (fgets(buf, 256, reply)) {
- printf("query_batch reply: %s", buf);
- if (strstr(buf, "batch")) {
+ if (strstr(buf, "jobs")) {
retval = 0;
continue;
}
@@ -455,6 +456,7 @@ int get_templates(
retval = td.parse(xp);
}
}
+ fclose(reply);
return retval;
}
@@ -564,5 +566,37 @@ int query_completed_job(
retval = jd.parse(xp);
}
}
+ fclose(reply);
+ return retval;
+}
+
+int ping_server(
+ const char* project_url,
+ string &error_msg
+) {
+ string request;
+ char url[1024], buf[256];
+ request = " \n"; // the space is needed
+ sprintf(url, "%ssubmit_rpc_handler.php", project_url);
+ FILE* reply = tmpfile();
+ vector x;
+ int retval = do_http_post(url, request.c_str(), reply, x);
+ if (retval) {
+ fclose(reply);
+ return retval;
+ }
+ retval = -1;
+ error_msg = "";
+ fseek(reply, 0, SEEK_SET);
+ while (fgets(buf, 256, reply)) {
+ //printf("reply: %s\n", buf);
+ if (parse_int(buf, "", retval)) continue;
+ if (parse_str(buf, "", error_msg)) continue;
+ if (strstr(buf, "success")) {
+ retval = 0;
+ continue;
+ }
+ }
+ fclose(reply);
return retval;
}
diff --git a/lib/remote_submit.h b/lib/remote_submit.h
index e160cfe30f..5727bb97bf 100644
--- a/lib/remote_submit.h
+++ b/lib/remote_submit.h
@@ -133,10 +133,10 @@ extern int submit_jobs(
string& error_msg
);
-extern int query_batch(
+extern int query_batches(
const char* project_url,
const char* authenticator,
- string batch_name,
+ vector &batch_names,
QUERY_BATCH_REPLY& reply,
string& error_msg
);
@@ -173,3 +173,8 @@ extern int get_templates(
TEMPLATE_DESC&,
string& error_msg
);
+
+extern int ping_server(
+ const char* project_url,
+ string& error_msg
+);
diff --git a/samples/condor/boinc_gahp.cpp b/samples/condor/boinc_gahp.cpp
index 78c3bebf41..23fe48666f 100644
--- a/samples/condor/boinc_gahp.cpp
+++ b/samples/condor/boinc_gahp.cpp
@@ -54,11 +54,13 @@ struct COMMAND {
char* in;
// the input, in a malloc'd buffer
char* out;
- // if NULL the command is in progress; otherwise it's the output
+ // if NULL the command is in progress;
+ // otherwise the output in a malloc'd buffer
SUBMIT_REQ submit_req;
FETCH_OUTPUT_REQ fetch_output_req;
vector abort_job_names;
+ vector batch_names;
char batch_name[256];
COMMAND(char* _in) {
@@ -71,7 +73,7 @@ struct COMMAND {
}
int parse_command();
int parse_submit(char*);
- int parse_query_batch(char*);
+ int parse_query_batches(char*);
int parse_fetch_output(char*);
int parse_abort_jobs(char*);
};
@@ -243,16 +245,22 @@ void handle_submit(COMMAND& c) {
c.out = strdup(s.c_str());
}
-int COMMAND::parse_query_batch(char* p) {
- strcpy(batch_name, strtok_r(NULL, " ", &p));
+int COMMAND::parse_query_batches(char* p) {
+ int n = atoi(strtok_r(NULL, " ", &p));
+ for (int i=0; i