mirror of
https://github.com/netbirdio/ice.git
synced 2026-05-22 17:10:58 -07:00
Pass UDPAddr.Zone to net.ListenUDP
listenUDPInPortRange wasn't passing the Zone and would always fail to bind. This would cause high CPU usage as every port in the range would be attempted and fail. Fixes #742
This commit is contained in:
committed by
Sean DuBois
parent
2c699d8405
commit
1c850ea1d8
@@ -137,8 +137,13 @@ func listenUDPInPortRange(n transport.Net, log logging.LeveledLogger, portMax, p
|
||||
portStart := globalMathRandomGenerator.Intn(j-i+1) + i
|
||||
portCurrent := portStart
|
||||
for {
|
||||
lAddr = &net.UDPAddr{IP: lAddr.IP, Port: portCurrent}
|
||||
c, e := n.ListenUDP(network, lAddr)
|
||||
addr := &net.UDPAddr{
|
||||
IP: lAddr.IP,
|
||||
Zone: lAddr.Zone,
|
||||
Port: portCurrent,
|
||||
}
|
||||
|
||||
c, e := n.ListenUDP(network, addr)
|
||||
if e == nil {
|
||||
return c, e //nolint:nilerr
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user