Track IPv6 peers received over PEX and simplify the adding code
This commit is contained in:
parent
d6f6359799
commit
d69cfbc419
|
@ -1155,12 +1155,8 @@ func (c *connection) onReadExtendedMsg(id byte, payload []byte) (err error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error unmarshalling PEX message: %s", err)
|
return fmt.Errorf("error unmarshalling PEX message: %s", err)
|
||||||
}
|
}
|
||||||
go func() {
|
torrent.Add("pex added6 peers received", int64(len(pexMsg.Added6)))
|
||||||
ps := pexMsg.AddedPeers()
|
t.addPeers(pexMsg.AddedPeers())
|
||||||
cl.mu.Lock()
|
|
||||||
t.addPeers(ps)
|
|
||||||
cl.mu.Unlock()
|
|
||||||
}()
|
|
||||||
return nil
|
return nil
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unexpected extended message ID: %v", id)
|
return fmt.Errorf("unexpected extended message ID: %v", id)
|
||||||
|
|
Loading…
Reference in New Issue