]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add Debug flag to Config
authorMatt Joiner <anacrolix@gmail.com>
Sun, 23 Aug 2015 02:59:03 +0000 (12:59 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 23 Aug 2015 02:59:03 +0000 (12:59 +1000)
I'll use this to squash the noisy logging for people who don't care.

client.go
config.go

index f3d281f8780a3a2d404310da8fd8139e017295e3..aba0ab3379c1899b318bc89cde6c4360e4460c62 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1756,7 +1756,7 @@ func (me *Client) addConnection(t *torrent, c *connection) bool {
                if c == nil {
                        return false
                }
-               if missinggo.CryHeard() {
+               if me.config.Debug && missinggo.CryHeard() {
                        log.Printf("%s: dropping connection to make room for new one:\n    %s", t, c)
                }
                c.Close()
index 4bc12896f60299648310a991957ae91473b99de2..d6b79424407b6b43ff5e27e4d3ba9ee4f6e4ca2a 100644 (file)
--- a/config.go
+++ b/config.go
@@ -47,4 +47,6 @@ type Config struct {
 
        IPBlocklist *iplist.IPList
        DisableIPv6 bool
+       // Perform logging and any other behaviour that will help debug.
+       Debug bool
 }