don't link when creating network client. rely on caller
Brian Tiger Chow committed
Dec 24, 2014 at 09:26 UTC
237e594a8f3c48580fa5f194f3afe02694f60d28
2 files changed
+2
-5
epictest/addcat_test.go
+2
-1
@@ -95,7 +95,8 @@ func AddCatBytes(data []byte, conf Config) error {
95
// defer mn.Close() FIXME does mocknet require clean-up
96
mn.SetLinkDefaults(mocknet.LinkOptions{
97
Latency: conf.NetworkLatency,
98
- Bandwidth: math.MaxInt32, // TODO add to conf
98
+ // TODO add to conf. This is tricky because we want 0 values to be functional.
99
+ Bandwidth: math.MaxInt32,
100
})
101
dhtNetwork := mockrouting.NewDHTNetwork(mn)
102
net, err := tn.StreamNet(ctx, mn, dhtNetwork)
exchange/bitswap/testnet/peernet.go
-4
@@ -20,14 +20,10 @@ func StreamNet(ctx context.Context, net mockpeernet.Mocknet, rs mockrouting.Serv
20
}
21
22
func (pn *peernet) Adapter(p testutil.Peer) bsnet.BitSwapNetwork {
23
- peers := pn.Mocknet.Peers()
23
client, err := pn.Mocknet.AddPeer(p.PrivateKey(), p.Address())
24
if err != nil {
25
panic(err.Error())
26
}
28
- for _, other := range peers {
29
- pn.Mocknet.LinkPeers(p.ID(), other)
30
- }
27
routing := pn.routingserver.ClientWithDatastore(context.TODO(), p, ds.NewMapDatastore())
28
return bsnet.NewFromIpfsNetwork(client, routing)
29
}