Add more html debugging for rhizome sync and fetch queues

This commit is contained in:
Jeremy Lakeman 2013-09-24 12:01:00 +09:30
parent 931ca60554
commit 79bdb5f993
4 changed files with 46 additions and 4 deletions

View File

@ -130,6 +130,26 @@ struct rhizome_fetch_queue rhizome_fetch_queues[] = {
#define NQUEUES NELS(rhizome_fetch_queues)
static const char * fetch_state(int state)
{
switch (state){
case RHIZOME_FETCH_FREE:
return "FREE";
case RHIZOME_FETCH_CONNECTING:
return "HTTP_CONNECTING";
case RHIZOME_FETCH_SENDINGHTTPREQUEST:
return "HTTP_SENDING_HEADERS";
case RHIZOME_FETCH_RXHTTPHEADERS:
return "HTTP_RECEIVING_HEADERS";
case RHIZOME_FETCH_RXFILE:
return "HTTP_RECEIVING_FILE";
case RHIZOME_FETCH_RXFILEMDP:
return "MDP_RECEIVING_FILE";
default:
return "UNKNOWN";
}
}
int rhizome_active_fetch_count()
{
int i,active=0;
@ -166,11 +186,18 @@ int rhizome_fetch_status_html(struct strbuf *b)
int i,j;
for(i=0;i<NQUEUES;i++){
struct rhizome_fetch_queue *q=&rhizome_fetch_queues[i];
strbuf_sprintf(b, "<p>Slot %d, ", i);
int used=0;
for (j=0;j<q->candidate_queue_size;j++){
if (q->candidate_queue[j].manifest)
used++;
}
strbuf_sprintf(b, "<p>Slot %d, (%d of %d): ", i, used, q->candidate_queue_size);
if (q->active.state!=RHIZOME_FETCH_FREE){
strbuf_sprintf(b, "%"PRId64" of %"PRId64,
strbuf_sprintf(b, "%s %"PRId64" of %"PRId64" from %s*",
fetch_state(q->active.state),
q->active.write_state.file_offset,
q->active.manifest->fileLength);
q->active.manifest->fileLength,
alloca_tohex(q->active.peer_sid,8));
}else{
strbuf_puts(b, "inactive");
}

View File

@ -60,6 +60,19 @@ struct rhizome_sync
int bar_count;
};
void rhizome_sync_status_html(struct strbuf *b, struct subscriber *subscriber)
{
if (!subscriber->sync_state)
return;
struct rhizome_sync *state=subscriber->sync_state;
strbuf_sprintf(b, "Seen %"PRId64" BARs [%"PRId64" to %"PRId64" of %"PRId64"], %d interesting<br>",
state->bars_seen,
state->sync_start,
state->sync_end,
state->highest_seen,
state->bar_count);
}
static void rhizome_sync_request(struct subscriber *subscriber, uint64_t token, unsigned char forwards)
{
overlay_mdp_frame mdp;

View File

@ -648,7 +648,7 @@ void link_neighbour_short_status_html(struct strbuf *b, const char *link_prefix)
if (!n)
strbuf_puts(b, "No peers<br>");
while(n){
strbuf_sprintf(b, "<a href=\"%s/%s\">%s*</a>, seq=%d, mask=%08"PRIx64";<br>",
strbuf_sprintf(b, "<a href=\"%s/%s\">%s*</a>, seq=%d, mask=%08"PRIx64"<br>",
link_prefix,
alloca_tohex_sid(n->subscriber->sid),
alloca_tohex(n->subscriber->sid,8),
@ -665,6 +665,7 @@ void link_neighbour_status_html(struct strbuf *b, struct subscriber *neighbour)
if (n->subscriber == neighbour){
strbuf_sprintf(b, "Neighbour %s*;<br>", alloca_tohex(n->subscriber->sid,8));
strbuf_sprintf(b, "Seq=%d, mask=%08"PRIx64"<br>", n->mdp_ack_sequence, n->mdp_ack_mask);
rhizome_sync_status_html(b, n->subscriber);
struct link_in *link_in = n->links;
while(link_in){
strbuf_sprintf(b, "In: %s%s, seq=%d, mask=%08"PRIx64"<br>",

View File

@ -597,6 +597,7 @@ int overlay_packet_init_header(int packet_version, int encapsulation,
char unicast, char interface, int seq);
int overlay_interface_args(const char *arg);
void overlay_rhizome_advertise(struct sched_ent *alarm);
void rhizome_sync_status_html(struct strbuf *b, struct subscriber *subscriber);
int overlay_add_local_identity(unsigned char *s);
extern int overlay_interface_count;