change NewXXXDiscovery to return an error instead of panic

This commit is contained in:
chaoyuepan
2020-12-29 17:41:25 +08:00
parent 2b4fc5951d
commit f426b53fa0
2 changed files with 16 additions and 4 deletions

View File

@@ -49,7 +49,11 @@ func TestPluginHeartbeat(t *testing.T) {
opts.IdleTimeout = time.Duration(5) * time.Second
opts.ConnectTimeout = time.Duration(5) * time.Second
// PeerDiscovery
d := client.NewPeer2PeerDiscovery("tcp@127.0.0.1:9001", "")
d, err := client.NewPeer2PeerDiscovery("tcp@127.0.0.1:9001", "")
if err != nil {
t.Fatalf("failed to NewPeer2PeerDiscovery: %v", err)
}
c := client.NewXClient("Arith", client.Failtry, client.RoundRobin, d, opts)
i := 0
for {