From 891e3f2740af9c019eb675fdd0cbf93e64c19ea6 Mon Sep 17 00:00:00 2001 From: gardners Date: Tue, 10 Jan 2012 16:29:50 +1030 Subject: [PATCH] Added another debug/verbosity flag. --- mphlr.h | 1 + overlay_abbreviations.c | 7 +++++-- overlay_payload.c | 6 +++--- overlay_route.c | 5 ++++- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mphlr.h b/mphlr.h index 5bfa335b..025f3f55 100644 --- a/mphlr.h +++ b/mphlr.h @@ -892,5 +892,6 @@ int rhizome_server_poll(); #define DEBUG_OVERLAYROUTING 32768 #define DEBUG_SECURITY 65536 #define DEBUG_RHIZOME 131072 +#define DEBUG_OVERLAYROUTEMONITOR 262144 int serval_packetvisualise(FILE *f,char *message,unsigned char *packet,int plen); diff --git a/overlay_abbreviations.c b/overlay_abbreviations.c index 334696ad..bd61d64d 100644 --- a/overlay_abbreviations.c +++ b/overlay_abbreviations.c @@ -264,8 +264,11 @@ int overlay_abbreviate_address(unsigned char *in,unsigned char *out,int *ofs) for(i=0;i<2;i++) if (abbrs->byfirstbyte[in[0]][i]) { - if (0) { if (!overlay_abbreviate_try_byindex(in,out,ofs,abbrs->byfirstbyte[in[0]][i])) - return 0; } else WHY("Abbreviation by index temporarily disabled to simplify development"); + if (0) { if (!overlay_abbreviate_try_byindex(in,out,ofs,abbrs->byfirstbyte[in[0]][i])) return 0; } + else { + if (debug&DEBUG_OVERLAYABBREVIATIONS) + WHY("Abbreviation by index temporarily disabled to simplify development"); + } } else break; diff --git a/overlay_payload.c b/overlay_payload.c index 567f68fe..0c060de3 100644 --- a/overlay_payload.c +++ b/overlay_payload.c @@ -34,20 +34,20 @@ int op_append_type(overlay_buffer *headers,overlay_frame *p) { case OF_TYPE_FLAG_NORMAL: c[0]=p->type|p->modifiers; - if (debug>3) fprintf(stderr,"type resolves to %02x\n",c[0]); + if (debug&DEBUG_PACKETFORMATS) fprintf(stderr,"type resolves to %02x\n",c[0]); if (ob_append_bytes(headers,c,1)) return -1; break; case OF_TYPE_FLAG_E12: c[0]=(p->type&OF_MODIFIER_BITS)|OF_TYPE_EXTENDED12; c[1]=(p->type>>4)&0xff; - if (debug>3) fprintf(stderr,"type resolves to %02x%02x\n",c[0],c[1]); + if (debug&DEBUG_PACKETFORMATS) fprintf(stderr,"type resolves to %02x%02x\n",c[0],c[1]); if (ob_append_bytes(headers,c,2)) return -1; break; case OF_TYPE_FLAG_E20: c[0]=(p->type&OF_MODIFIER_BITS)|OF_TYPE_EXTENDED20; c[1]=(p->type>>4)&0xff; c[2]=(p->type>>12)&0xff; - if (debug>3) fprintf(stderr,"type resolves to %02x%02x%02x\n",c[0],c[1],c[2]); + if (debug&DEBUG_PACKETFORMATS) fprintf(stderr,"type resolves to %02x%02x%02x\n",c[0],c[1],c[2]); if (ob_append_bytes(headers,c,3)) return -1; break; default: diff --git a/overlay_route.c b/overlay_route.c index cd1f5390..2f343103 100644 --- a/overlay_route.c +++ b/overlay_route.c @@ -802,7 +802,10 @@ int overlay_route_recalc_node_metrics(overlay_node *n,long long now) if it goes down, we probably don't need to say anything at all. */ int diff=best_score-n->best_link_score; - if (diff>0) overlay_route_please_advertise(n); + if (diff>0) { + overlay_route_please_advertise(n); + if (debug&DEBUG_OVERLAYROUTEMONITOR) overlay_route_dump(); + } /* Remember new reachability information */ n->best_link_score=best_score;