Fix crash with conventional trackers when tcp and utp are disabled

Fixes #396.
This commit is contained in:
Matt Joiner 2020-04-16 10:27:17 +10:00
parent 8cf3ce187d
commit d4430e89b6
1 changed files with 8 additions and 6 deletions

View File

@ -1323,13 +1323,15 @@ func (cl *Client) publicIp(peer net.IP) net.IP {
}
func (cl *Client) findListenerIp(f func(net.IP) bool) net.IP {
return addrIpOrNil(
cl.findListener(
func(l net.Listener) bool {
return f(addrIpOrNil(l.Addr()))
},
).Addr(),
l := cl.findListener(
func(l net.Listener) bool {
return f(addrIpOrNil(l.Addr()))
},
)
if l == nil {
return nil
}
return addrIpOrNil(l.Addr())
}
// Our IP as a peer should see it.