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

refactor(core, bitswap) split bitswap init into two steps

@jbenet
parent c5333a20
...@@ -15,18 +15,18 @@ import ( ...@@ -15,18 +15,18 @@ import (
bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network" bsnet "github.com/jbenet/go-ipfs/exchange/bitswap/network"
notifications "github.com/jbenet/go-ipfs/exchange/bitswap/notifications" notifications "github.com/jbenet/go-ipfs/exchange/bitswap/notifications"
strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy" strategy "github.com/jbenet/go-ipfs/exchange/bitswap/strategy"
inet "github.com/jbenet/go-ipfs/net"
peer "github.com/jbenet/go-ipfs/peer" peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
var log = u.Logger("bitswap") var log = u.Logger("bitswap")
// NetMessageSession initializes a BitSwap session that communicates over the // New initializes a BitSwap instance that communicates over the
// provided NetMessage service. // provided BitSwapNetwork. This function registers the returned instance as
// the network delegate.
// Runs until context is cancelled // Runs until context is cancelled
func NetMessageSession(ctx context.Context, p peer.Peer, func New(ctx context.Context, p peer.Peer,
net inet.Network, srv inet.Service, routing bsnet.Routing, network bsnet.BitSwapNetwork, routing bsnet.Routing,
d ds.ThreadSafeDatastore, nice bool) exchange.Interface { d ds.ThreadSafeDatastore, nice bool) exchange.Interface {
notif := notifications.New() notif := notifications.New()
...@@ -37,8 +37,6 @@ func NetMessageSession(ctx context.Context, p peer.Peer, ...@@ -37,8 +37,6 @@ func NetMessageSession(ctx context.Context, p peer.Peer,
} }
}() }()
network := bsnet.NewFromIpfsNetwork(srv, net)
bs := &bitswap{ bs := &bitswap{
blockstore: blockstore.NewBlockstore(d), blockstore: blockstore.NewBlockstore(d),
notifications: notif, notifications: notif,
......
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