Track IPv6 peers received over PEX and simplify the adding code

This commit is contained in:
Matt Joiner 2018-02-15 14:43:57 +11:00
parent d6f6359799
commit d69cfbc419
1 changed files with 2 additions and 6 deletions

View File

@ -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)