Fix crash adding peers when Torrent is closed

This commit is contained in:
Matt Joiner 2018-06-12 20:17:15 +10:00
parent b024e1cff6
commit a287d069a4
1 changed files with 3 additions and 0 deletions

View File

@ -249,6 +249,9 @@ func (t *Torrent) unclosedConnsAsSlice() (ret []*connection) {
func (t *Torrent) addPeer(p Peer) {
cl := t.cl
peersAddedBySource.Add(string(p.Source), 1)
if t.closed.IsSet() {
return
}
if cl.badPeerIPPort(p.IP, p.Port) {
torrent.Add("peers not added because of bad addr", 1)
return