Switch back to using the UTP redesign

This commit is contained in:
Matt Joiner 2014-12-03 19:58:02 -06:00
parent 7ba25ce936
commit 7b46b41011
1 changed files with 9 additions and 4 deletions

View File

@ -441,9 +441,15 @@ func NewClient(cfg *Config) (cl *Client, err error) {
cl.listeners = append(cl.listeners, l)
go cl.acceptConnections(l, false)
}
var utpL *utp.UTPListener
var utpL *utp.Listener
if !cfg.DisableUTP {
utpL, err = utp.Listen("utp", listenAddr())
var utpAddr *utp.Addr
utpAddr, err = utp.ResolveAddr("utp", listenAddr())
if err != nil {
err = fmt.Errorf("error resolving utp listen addr: %s", err)
return
}
utpL, err = utp.Listen("utp", utpAddr)
if err != nil {
return
}
@ -896,10 +902,9 @@ func (me *Client) runConnection(sock net.Conn, torrent *torrent, discovery peerS
})
}
if conn.PeerExtensionBytes[7]&0x01 != 0 && me.dHT != nil {
addr, _ := me.dHT.LocalAddr().(*net.UDPAddr)
conn.Post(pp.Message{
Type: pp.Port,
Port: uint16(addr.Port),
Port: uint16(AddrPort(me.dHT.LocalAddr())),
})
}
if torrent.haveInfo() {