Commit 39138d13 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

chore(bitswap) remove Peerstore() methods from bitswap.Network interface

parent aabe0a29
...@@ -26,8 +26,6 @@ type BitSwapNetwork interface { ...@@ -26,8 +26,6 @@ type BitSwapNetwork interface {
peer.ID, peer.ID,
bsmsg.BitSwapMessage) (incoming bsmsg.BitSwapMessage, err error) bsmsg.BitSwapMessage) (incoming bsmsg.BitSwapMessage, err error)
Peerstore() peer.Peerstore
// SetDelegate registers the Reciver to handle messages received from the // SetDelegate registers the Reciver to handle messages received from the
// network. // network.
SetDelegate(Receiver) SetDelegate(Receiver)
......
...@@ -72,10 +72,6 @@ func (bsnet *impl) SetDelegate(r Receiver) { ...@@ -72,10 +72,6 @@ func (bsnet *impl) SetDelegate(r Receiver) {
bsnet.receiver = r bsnet.receiver = r
} }
func (bsnet *impl) Peerstore() peer.Peerstore {
return bsnet.Peerstore()
}
// FindProvidersAsync returns a channel of providers for the given key // FindProvidersAsync returns a channel of providers for the given key
func (bsnet *impl) FindProvidersAsync(ctx context.Context, k util.Key, max int) <-chan peer.ID { func (bsnet *impl) FindProvidersAsync(ctx context.Context, k util.Key, max int) <-chan peer.ID {
out := make(chan peer.ID) out := make(chan peer.ID)
......
...@@ -54,7 +54,6 @@ func (n *network) Adapter(p peer.ID) bsnet.BitSwapNetwork { ...@@ -54,7 +54,6 @@ func (n *network) Adapter(p peer.ID) bsnet.BitSwapNetwork {
client := &networkClient{ client := &networkClient{
local: p, local: p,
network: n, network: n,
peerstore: peer.NewPeerstore(),
routing: n.routingserver.Client(peer.PeerInfo{ID: p}), routing: n.routingserver.Client(peer.PeerInfo{ID: p}),
} }
n.clients[p] = client n.clients[p] = client
...@@ -156,7 +155,6 @@ type networkClient struct { ...@@ -156,7 +155,6 @@ type networkClient struct {
local peer.ID local peer.ID
bsnet.Receiver bsnet.Receiver
network Network network Network
peerstore peer.Peerstore
routing routing.IpfsRouting routing routing.IpfsRouting
} }
...@@ -187,7 +185,6 @@ func (nc *networkClient) FindProvidersAsync(ctx context.Context, k util.Key, max ...@@ -187,7 +185,6 @@ func (nc *networkClient) FindProvidersAsync(ctx context.Context, k util.Key, max
defer close(out) defer close(out)
providers := nc.routing.FindProvidersAsync(ctx, k, max) providers := nc.routing.FindProvidersAsync(ctx, k, max)
for info := range providers { for info := range providers {
nc.peerstore.AddAddresses(info.ID, info.Addrs)
select { select {
case <-ctx.Done(): case <-ctx.Done():
case out <- info.ID: case out <- info.ID:
...@@ -213,7 +210,3 @@ func (nc *networkClient) DialPeer(ctx context.Context, p peer.ID) error { ...@@ -213,7 +210,3 @@ func (nc *networkClient) DialPeer(ctx context.Context, p peer.ID) error {
func (nc *networkClient) SetDelegate(r bsnet.Receiver) { func (nc *networkClient) SetDelegate(r bsnet.Receiver) {
nc.Receiver = r nc.Receiver = r
} }
func (nc *networkClient) Peerstore() peer.Peerstore {
return nc.peerstore
}
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