- client: replicated trickles. Seems to be working now.

- client: added <trickle_debug> config option

svn path=/trunk/boinc/; revision=24265
This commit is contained in:
David Anderson 2011-09-22 18:52:21 +00:00
parent 5cbcd9a137
commit 96feb0014c
7 changed files with 41 additions and 8 deletions

View File

@ -6386,3 +6386,14 @@ David 22 Sept 2011
client/
client_state.cpp
cs_trickle.cpp,h
David 22 Sept 2011
- client: replicated trickles. Seems to be working now.
- client: added <trickle_debug> config option
client/
cs_trickle.cpp
gui_http.cpp,h
httl_curl.cpp
lib/
cc_config.cpp,h

View File

@ -201,10 +201,18 @@ void send_replicated_trickles(PROJECT* p, const char* msg, char* result_name, in
for (unsigned int i=0; i<p->trickle_up_ops.size(); i++) {
TRICKLE_UP_OP *t = p->trickle_up_ops[i];
if (t->gui_http->is_busy()) {
msg_printf(p, MSG_INFO, "TRICKLE CHANNEL IS BUSY");
if (log_flags.trickle_debug) {
msg_printf(p, MSG_INFO,
"[trickle] Trickle channel to %s is busy", t->url.c_str()
);
}
return;
}
msg_printf(p, MSG_INFO, "SENDING REPLICATED TRICKLE TO %s", t->url.c_str());
if (log_flags.trickle_debug) {
msg_printf(p, MSG_INFO,
"[trickle] Sending replicated trickle to %s", t->url.c_str()
);
}
t->do_rpc(buf);
}
}
@ -257,11 +265,15 @@ void update_trickle_up_urls(PROJECT* p, vector<string> &urls) {
}
int TRICKLE_UP_OP::do_rpc(const char* msg) {
req_buf = strdup(msg);
int n = strlen(msg)+1;
if (n<65536) n = 65536;
req_buf = (char*)malloc(n);
strcpy(req_buf, msg);
int retval = gui_http->do_rpc_post_str(
this, const_cast<char*>(url.c_str()), req_buf
this, const_cast<char*>(url.c_str()), req_buf, n
);
if (retval) {
msg_printf(0, MSG_INTERNAL_ERROR, "Trickle-up post failed: %d", retval);
free(req_buf);
req_buf = 0;
}
@ -282,7 +294,11 @@ int parse_trickle_up_urls(XML_PARSER& xp, std::vector<std::string>& urls) {
}
void TRICKLE_UP_OP::handle_reply(int http_op_retval) {
msg_printf(0, MSG_INFO, "TRICKLE RETVAL: %d", http_op_retval);
if (log_flags.trickle_debug) {
msg_printf(0, MSG_INFO,
"[trickle] Replicated trickle done; retval %d", http_op_retval
);
}
if (req_buf) {
free(req_buf);
req_buf = 0;

View File

@ -73,11 +73,11 @@ int GUI_HTTP::do_rpc_post(
return 0;
}
int GUI_HTTP::do_rpc_post_str(GUI_HTTP_OP* op, char* url, char* req_buf) {
int GUI_HTTP::do_rpc_post_str(GUI_HTTP_OP* op, char* url, char* req_buf, int len) {
if (gui_http_state != GUI_HTTP_STATE_IDLE) {
return ERR_RETRY;
}
int retval = http_op.init_post2(url, req_buf, 0, NULL, 0);
int retval = http_op.init_post2(url, req_buf, len, NULL, 0);
if (retval) return retval;
gstate.http_ops->insert(&http_op);
gui_http_op = op;

View File

@ -70,7 +70,7 @@ struct GUI_HTTP {
const char* input_file, const char* output_file,
bool is_background
);
int do_rpc_post_str(GUI_HTTP_OP*, char* url, char* req);
int do_rpc_post_str(GUI_HTTP_OP*, char* url, char* req, int len);
bool poll();
inline bool is_busy() {
return (gui_http_state == GUI_HTTP_STATE_BUSY);

View File

@ -335,6 +335,7 @@ int HTTP_OP::init_post2(
init();
req1 = r1;
req1_len = r1_len;
content_length = 0;
if (in) {
safe_strcpy(infile, in);
file_offset = offset;

View File

@ -90,6 +90,7 @@ int LOG_FLAGS::parse(XML_PARSER& xp) {
if (xp.parse_bool("statefile_debug", statefile_debug)) continue;
if (xp.parse_bool("task_debug", task_debug)) continue;
if (xp.parse_bool("time_debug", time_debug)) continue;
if (xp.parse_bool("trickle_debug", trickle_debug)) continue;
if (xp.parse_bool("unparsed_xml", unparsed_xml)) continue;
if (xp.parse_bool("work_fetch_debug", work_fetch_debug)) continue;
if (xp.parse_bool("notice_debug", notice_debug)) continue;
@ -133,6 +134,7 @@ int LOG_FLAGS::write(MIOFILE& out) {
" <std_debug>%d</std_debug>\n"
" <task_debug>%d</task_debug>\n"
" <time_debug>%d</time_debug>\n"
" <trickle_debug>%d</trickle_debug>\n"
" <unparsed_xml>%d</unparsed_xml>\n"
" <work_fetch_debug>%d</work_fetch_debug>\n"
" <notice_debug>%d</notice_debug>\n"
@ -169,6 +171,7 @@ int LOG_FLAGS::write(MIOFILE& out) {
std_debug ? 1 : 0,
task_debug ? 1 : 0,
time_debug ? 1 : 0,
trickle_debug ? 1 : 0,
unparsed_xml ? 1 : 0,
work_fetch_debug ? 1 : 0,
notice_debug ? 1 : 0

View File

@ -101,6 +101,8 @@ struct LOG_FLAGS {
// task start and control details, and when apps checkpoint
bool time_debug;
// changes in on_frac, active_frac, connected_frac
bool trickle_debug;
// show trickle messages
bool unparsed_xml;
// show unparsed XML lines
bool work_fetch_debug;