From e9386d10160708ac7681fa8773923c8b434eb83b Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 12 Apr 2018 23:34:31 +1000 Subject: [PATCH] Fix #246 --- client_test.go | 6 ++++++ config.go | 3 +++ 2 files changed, 9 insertions(+) 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 { -- 2.50.0