From: Matt Joiner Date: Mon, 3 Aug 2015 14:43:46 +0000 (+1000) Subject: If a DHTConfig was provided without a blocklist, the DHT wouldn't inherit the Client... X-Git-Tag: v1.0.0~1093 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f9995244c07453828fb3e1c71797feb1e76c285e;p=btrtrc.git If a DHTConfig was provided without a blocklist, the DHT wouldn't inherit the Client's blocklist --- diff --git a/client.go b/client.go index dc5b66fd..045919a3 100644 --- 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()