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