Skip to content

Commit

Permalink
if dialing a utp address, dont use a local address
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Oct 4, 2015
1 parent d481033 commit d3e9792
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions p2p/net/conn/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,16 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee
}
}

useLocalAddr := true
for _, p := range raddr.Protocols() {
if p.Name == "utp" {
useLocalAddr = false
}
}
defer log.EventBegin(ctx, "connDialManet", logdial).Done()
if !useLocalAddr {
madialer.LocalAddr = nil
}
return madialer.Dial(raddr)
}

Expand Down

0 comments on commit d3e9792

Please sign in to comment.