diff --git a/client/internal/lazyconn/listener/allocator.go b/client/internal/lazyconn/listener/allocator.go index 5f9778bd1..832749824 100644 --- a/client/internal/lazyconn/listener/allocator.go +++ b/client/internal/lazyconn/listener/allocator.go @@ -48,7 +48,7 @@ func (p *portAllocator) newConn() (*net.UDPConn, *net.UDPAddr, error) { func (p *portAllocator) nextPort() int { port := p.nextFreePort p.nextFreePort-- - if p.nextFreePort == 0 { + if p.nextFreePort == 1024 { p.nextFreePort = 65535 } return int(port) diff --git a/client/internal/lazyconn/listener/allocator_test.go b/client/internal/lazyconn/listener/allocator_test.go index 5a8162486..82fee065a 100644 --- a/client/internal/lazyconn/listener/allocator_test.go +++ b/client/internal/lazyconn/listener/allocator_test.go @@ -18,12 +18,12 @@ func Test_portAllocator_newConn(t *testing.T) { } } -func Test_portAllocator_port_zero(t *testing.T) { +func Test_portAllocator_port_bottom(t *testing.T) { pa := newPortAllocator() - pa.nextFreePort = 1 + pa.nextFreePort = 1025 port := pa.nextPort() - if port != 1 { + if port != 1025 { t.Errorf("nextPort() = %v, want %d", port, 1) }