From 3d55a019c0357a4321ec3404abaf7b6f5b486eab Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Thu, 8 Nov 2012 10:23:57 +1030 Subject: [PATCH] Quieten some unconditional DEBUG messages --- overlay_address.c | 45 +++++++++++++++++++++++---------------------- rhizome_database.c | 4 ++-- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/overlay_address.c b/overlay_address.c index 348f347b..ffe8d7fb 100644 --- a/overlay_address.c +++ b/overlay_address.c @@ -208,29 +208,30 @@ int set_reachable(struct subscriber *subscriber, int reachable){ int old_value=subscriber->reachable; subscriber->reachable=reachable; - - // these log messages may be used in tests - switch(reachable){ - case REACHABLE_NONE: - DEBUGF("%s is not reachable", alloca_tohex_sid(subscriber->sid)); - break; - case REACHABLE_SELF: - break; - - case REACHABLE_DIRECT: - DEBUGF("%s is now reachable directly", alloca_tohex_sid(subscriber->sid)); - break; - case REACHABLE_INDIRECT: - DEBUGF("%s is now reachable indirectly", alloca_tohex_sid(subscriber->sid)); - break; - case REACHABLE_UNICAST: - DEBUGF("%s is now reachable via unicast", alloca_tohex_sid(subscriber->sid)); - break; - case REACHABLE_BROADCAST: - DEBUGF("%s is now reachable via broadcast", alloca_tohex_sid(subscriber->sid)); - break; + + // These log messages are for use in tests. Changing them may break test scripts. + if (debug&DEBUG_OVERLAYROUTING) { + switch (reachable) { + case REACHABLE_NONE: + DEBUGF("NOT REACHABLE sid=%s", alloca_tohex_sid(subscriber->sid)); + break; + case REACHABLE_SELF: + break; + case REACHABLE_DIRECT: + DEBUGF("REACHABLE DIRECTLY sid=%s", alloca_tohex_sid(subscriber->sid)); + break; + case REACHABLE_INDIRECT: + DEBUGF("REACHABLE INDIRECTLY sid=%s", alloca_tohex_sid(subscriber->sid)); + break; + case REACHABLE_UNICAST: + DEBUGF("REACHABLE VIA UNICAST sid=%s", alloca_tohex_sid(subscriber->sid)); + break; + case REACHABLE_BROADCAST: + DEBUGF("REACHABLE VIA BROADCAST sid=%s", alloca_tohex_sid(subscriber->sid)); + break; + } } - + /* Pre-emptively send a sas request */ if (!subscriber->sas_valid && reachable!=REACHABLE_SELF && reachable!=REACHABLE_NONE && reachable!=REACHABLE_BROADCAST) keyring_send_sas_request(subscriber); diff --git a/rhizome_database.c b/rhizome_database.c index c5afc410..c13d8b12 100644 --- a/rhizome_database.c +++ b/rhizome_database.c @@ -909,14 +909,14 @@ int rhizome_list_manifests(const char *service, const char *sender_sid, const ch long long blob_filesize = rhizome_manifest_get_ll(m, "filesize"); int from_here = 0; if (q_author) { - DEBUGF("q_author=%s", alloca_str_toprint(q_author)); + if (debug & DEBUG_RHIZOME) DEBUGF("q_author=%s", alloca_str_toprint(q_author)); unsigned char authorSid[SID_SIZE]; stowSid(authorSid, 0, q_author); int cn = 0, in = 0, kp = 0; from_here = keyring_find_sid(keyring, &cn, &in, &kp, authorSid); } if (!from_here && blob_sender) { - DEBUGF("blob_sender=%s", alloca_str_toprint(blob_sender)); + if (debug & DEBUG_RHIZOME) DEBUGF("blob_sender=%s", alloca_str_toprint(blob_sender)); unsigned char senderSid[SID_SIZE]; stowSid(senderSid, 0, blob_sender); int cn = 0, in = 0, kp = 0;