]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Do not add nodes if dht is disabled
authormlmhl <409107750@qq.com>
Thu, 29 Jun 2017 01:49:55 +0000 (09:49 +0800)
committermlmhl <409107750@qq.com>
Thu, 29 Jun 2017 06:28:07 +0000 (14:28 +0800)
client.go

index 635f96de67366e2fc40692bbaa2407e9c08ab7bf..d1cf5069887bb5ba46d7f38d7a0bf871bbea4ab9 100644 (file)
--- a/client.go
+++ b/client.go
@@ -1331,6 +1331,9 @@ func (cl *Client) DHT() *dht.Server {
 }
 
 func (cl *Client) AddDHTNodes(nodes []string) {
+       if cl.DHT() == nil {
+               return
+       }
        for _, n := range nodes {
                hmp := missinggo.SplitHostMaybePort(n)
                ip := net.ParseIP(hmp.Host)