From f9995244c07453828fb3e1c71797feb1e76c285e Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 4 Aug 2015 00:43:46 +1000 Subject: [PATCH] If a DHTConfig was provided without a blocklist, the DHT wouldn't inherit the Client's blocklist --- client.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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() -- 2.48.1