From: Matt Joiner Date: Thu, 12 Apr 2018 13:34:31 +0000 (+1000) Subject: Fix #246 X-Git-Tag: v1.0.0~148 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e9386d10160708ac7681fa8773923c8b434eb83b;p=btrtrc.git Fix #246 --- diff --git a/client_test.go b/client_test.go index 1b07f9c5..7a760d17 100644 --- a/client_test.go +++ b/client_test.go @@ -46,6 +46,12 @@ func TestClientDefault(t *testing.T) { cl.Close() } +func TestClientNilConfig(t *testing.T) { + cl, err := NewClient(nil) + require.NoError(t, err) + cl.Close() +} + func TestBoltPieceCompletionClosedWhenClientClosed(t *testing.T) { cfg := TestingConfig() pc, err := storage.NewBoltPieceCompletion(cfg.DataDir) diff --git a/config.go b/config.go index 8b679c15..615e7a24 100644 --- a/config.go +++ b/config.go @@ -161,6 +161,9 @@ func (cfg *Config) setDefaults() { if cfg.DhtStartingNodes == nil { cfg.DhtStartingNodes = dht.GlobalBootstrapAddrs } + if cfg.ListenHost == nil { + cfg.ListenHost = func(string) string { return "" } + } } type EncryptionPolicy struct {