]> Sergey Matveev's repositories - btrtrc.git/commitdiff
If a DHTConfig was provided without a blocklist, the DHT wouldn't inherit the Client...
authorMatt Joiner <anacrolix@gmail.com>
Mon, 3 Aug 2015 14:43:46 +0000 (00:43 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 3 Aug 2015 14:43:46 +0000 (00:43 +1000)
client.go

index dc5b66fd921b1ad7340a08e8a0fe7c995b9312f0..045919a30956d7fbf5fabadd2f83be264e28724a 100644 (file)
--- a/client.go
+++ b/client.go
@@ -22,6 +22,7 @@ import (
        "strings"
        "time"
 
+       . "github.com/anacrolix/missinggo"
        "github.com/anacrolix/missinggo/perf"
        "github.com/anacrolix/sync"
        "github.com/anacrolix/utp"
@@ -514,9 +515,10 @@ func NewClient(cfg *Config) (cl *Client, err error) {
        if !cfg.NoDHT {
                dhtCfg := cfg.DHTConfig
                if dhtCfg == nil {
-                       dhtCfg = &dht.ServerConfig{
-                               IPBlocklist: cl.ipBlockList,
-                       }
+                       dhtCfg = &dht.ServerConfig{}
+               }
+               if dhtCfg.IPBlocklist == nil {
+                       dhtCfg.IPBlocklist = cl.ipBlockList
                }
                if dhtCfg.Addr == "" {
                        dhtCfg.Addr = listenAddr()