Commit 0e4276e4 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet
Browse files

p2p/net/conn/dialer: added Dialer field

parent 2f19d9fb
...@@ -41,11 +41,10 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) ( ...@@ -41,11 +41,10 @@ func (d *Dialer) Dial(ctx context.Context, raddr ma.Multiaddr, remote peer.ID) (
} }
// TODO: try to get reusing addr/ports to work. // TODO: try to get reusing addr/ports to work.
// madialer := manet.Dialer{LocalAddr: laddr} // d.Dialer.LocalAddr = laddr
madialer := manet.Dialer{}
log.Debugf("%s dialing %s %s", d.LocalPeer, remote, raddr) log.Debugf("%s dialing %s %s", d.LocalPeer, remote, raddr)
maconn, err := madialer.Dial(raddr) maconn, err := d.Dialer.Dial(raddr)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
msgio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-msgio" msgio "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-msgio"
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr-net"
) )
// Map maps Keys (Peer.IDs) to Connections. // Map maps Keys (Peer.IDs) to Connections.
...@@ -52,6 +53,9 @@ type Conn interface { ...@@ -52,6 +53,9 @@ type Conn interface {
// no longer simple (need a peerstore, a local peer, a context, a network, etc) // no longer simple (need a peerstore, a local peer, a context, a network, etc)
type Dialer struct { type Dialer struct {
// Dialer is an optional manet.Dialer to use.
Dialer manet.Dialer
// LocalPeer is the identity of the local Peer. // LocalPeer is the identity of the local Peer.
LocalPeer peer.ID LocalPeer peer.ID
......
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