diff options
author | Jakob Borg <jakob@nym.se> | 2014-04-16 15:06:54 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-04-16 15:06:54 +0200 |
commit | 116203aef86a602f4d2632569ebcddcdadc52adc (patch) | |
tree | 18c071c2781af3e40bc22f3f927bd1699e1f9515 /discover | |
parent | 1bf128612d1d4bb23a92f94bb6f437900da888c0 (diff) |
discosrv: Clean up debug logging
Diffstat (limited to 'discover')
-rw-r--r-- | discover/cmd/discosrv/main.go | 6 | ||||
-rw-r--r-- | discover/discover.go | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/discover/cmd/discosrv/main.go b/discover/cmd/discosrv/main.go index a58f18011a..c53e4a8921 100644 --- a/discover/cmd/discosrv/main.go +++ b/discover/cmd/discosrv/main.go @@ -107,16 +107,14 @@ func limit(addr *net.UDPAddr) bool { if bkt.TakeAvailable(1) != 1 { // Rate limit exceeded; ignore packet if debug { - log.Printf("Rate limit exceeded for", key) + log.Println("Rate limit exceeded for", key) } limited++ return true - } else if debug { - log.Printf("Rate limit OK for", key) } } else { if debug { - log.Printf("New limiter for", key) + log.Println("New limiter for", key) } // One packet per ten seconds average rate, burst ten packets limiter.Add(key, ratelimit.NewBucket(10*time.Second, 10)) diff --git a/discover/discover.go b/discover/discover.go index 655c7c679f..fdc8a7fafa 100644 --- a/discover/discover.go +++ b/discover/discover.go @@ -131,7 +131,7 @@ func (d *Discoverer) sendExternalAnnouncements() { for errCounter < maxErrors { if debug { - dlog.Println("send announcement -> ", remote) + dlog.Printf("send announcement -> %v\n%s", remote, hex.Dump(buf)) } _, err = conn.WriteTo(buf, remote) if err != nil { @@ -140,6 +140,11 @@ func (d *Discoverer) sendExternalAnnouncements() { } else { errCounter = 0 } + if debug { + time.Sleep(1 * time.Second) + res := d.externalLookup(d.MyID) + dlog.Println("external lookup check:", res) + } time.Sleep(d.ExtBroadcastIntv) } log.Printf("discover/write: %v: stopping due to too many errors: %v", remote, err) |