wgengine/magicsock: remember fixed port number preference

So LinkChange events rebind to the same port when possible.
This commit is contained in:
Brad Fitzpatrick 2020-02-21 13:51:18 -08:00
parent c763901b1a
commit 525bf1f3d2
1 changed files with 1 additions and 0 deletions

View File

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