Skip to content

Commit

Permalink
refctor(bitswap/network) replace Network interface with Dialer interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Tiger Chow authored and jbenet committed Nov 15, 2014
1 parent 0b42d77 commit 3663eef
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions exchange/bitswap/network/ipfs_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
var log = util.Logger("bitswap_network")

// NewFromIpfsNetwork returns a BitSwapNetwork supported by underlying IPFS
// Network & Service
func NewFromIpfsNetwork(s inet.Service, n inet.Network) BitSwapNetwork {
// Dialer & Service
func NewFromIpfsNetwork(s inet.Service, dialer inet.Dialer) BitSwapNetwork {
bitswapNetwork := impl{
service: s,
net: n,
dialer: dialer,
}
s.SetHandler(&bitswapNetwork)
return &bitswapNetwork
Expand All @@ -29,7 +29,7 @@ func NewFromIpfsNetwork(s inet.Service, n inet.Network) BitSwapNetwork {
// NetMessage objects, into the bitswap network interface.
type impl struct {
service inet.Service
net inet.Network
dialer inet.Dialer

// inbound messages from the network are forwarded to the receiver
receiver Receiver
Expand Down Expand Up @@ -68,8 +68,8 @@ func (bsnet *impl) HandleMessage(
return outgoing
}

func (adapter *impl) DialPeer(ctx context.Context, p peer.Peer) error {
return adapter.net.DialPeer(ctx, p)
func (bsnet *impl) DialPeer(ctx context.Context, p peer.Peer) error {
return bsnet.dialer.DialPeer(ctx, p)
}

func (bsnet *impl) SendMessage(
Expand Down

0 comments on commit 3663eef

Please sign in to comment.