diff --git a/rhizome_fetch.c b/rhizome_fetch.c index 0495319b..91d81a7e 100644 --- a/rhizome_fetch.c +++ b/rhizome_fetch.c @@ -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;iSlot %d, ", i); + int used=0; + for (j=0;jcandidate_queue_size;j++){ + if (q->candidate_queue[j].manifest) + used++; + } + strbuf_sprintf(b, "

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"); } diff --git a/rhizome_sync.c b/rhizome_sync.c index f4bfaf0b..de189753 100644 --- a/rhizome_sync.c +++ b/rhizome_sync.c @@ -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
", + 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; diff --git a/route_link.c b/route_link.c index 585745b8..3331b07b 100644 --- a/route_link.c +++ b/route_link.c @@ -648,7 +648,7 @@ void link_neighbour_short_status_html(struct strbuf *b, const char *link_prefix) if (!n) strbuf_puts(b, "No peers
"); while(n){ - strbuf_sprintf(b, "%s*, seq=%d, mask=%08"PRIx64";
", + strbuf_sprintf(b, "%s*, seq=%d, mask=%08"PRIx64"
", 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*;
", alloca_tohex(n->subscriber->sid,8)); strbuf_sprintf(b, "Seq=%d, mask=%08"PRIx64"
", 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"
", diff --git a/serval.h b/serval.h index d7cf27b1..bc791298 100644 --- a/serval.h +++ b/serval.h @@ -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;