Commit 237e594a authored by Brian Tiger Chow's avatar Brian Tiger Chow

don't link when creating network client. rely on caller

parent 075841c1
......@@ -95,7 +95,8 @@ func AddCatBytes(data []byte, conf Config) error {
// defer mn.Close() FIXME does mocknet require clean-up
mn.SetLinkDefaults(mocknet.LinkOptions{
Latency: conf.NetworkLatency,
Bandwidth: math.MaxInt32, // TODO add to conf
// TODO add to conf. This is tricky because we want 0 values to be functional.
Bandwidth: math.MaxInt32,
})
dhtNetwork := mockrouting.NewDHTNetwork(mn)
net, err := tn.StreamNet(ctx, mn, dhtNetwork)
......
......@@ -20,14 +20,10 @@ func StreamNet(ctx context.Context, net mockpeernet.Mocknet, rs mockrouting.Serv
}
func (pn *peernet) Adapter(p testutil.Peer) bsnet.BitSwapNetwork {
peers := pn.Mocknet.Peers()
client, err := pn.Mocknet.AddPeer(p.PrivateKey(), p.Address())
if err != nil {
panic(err.Error())
}
for _, other := range peers {
pn.Mocknet.LinkPeers(p.ID(), other)
}
routing := pn.routingserver.ClientWithDatastore(context.TODO(), p, ds.NewMapDatastore())
return bsnet.NewFromIpfsNetwork(client, routing)
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment