wgengine/magicsock: remember fixed port number preference

So LinkChange events rebind to the same port when possible.
pull/91/head
Brad Fitzpatrick 5 years ago
parent c763901b1a
commit 525bf1f3d2

@ -140,6 +140,7 @@ func Listen(opts Options) (*Conn, error) {
epUpdateCtx, epUpdateCancel := context.WithCancel(context.Background()) epUpdateCtx, epUpdateCancel := context.WithCancel(context.Background())
c := &Conn{ c := &Conn{
pconn: new(RebindingUDPConn), pconn: new(RebindingUDPConn),
pconnPort: opts.Port,
donec: make(chan struct{}), donec: make(chan struct{}),
stunServers: append([]string{}, opts.STUN...), stunServers: append([]string{}, opts.STUN...),
startEpUpdate: make(chan struct{}, 1), startEpUpdate: make(chan struct{}, 1),

Loading…
Cancel
Save