wgengine/magicsock: fix relayManager alloc work cleanup (#16387)

Premature cancellation was preventing the work from ever being cleaned
up in runLoop().

Updates tailscale/corp#27502

Signed-off-by: Jordan Whited <jordan@tailscale.com>
pull/16396/head
Jordan Whited 5 months ago committed by GitHub
parent 37eca1785c
commit 51d00e135b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -743,8 +743,11 @@ func (r *relayManager) allocateAllServersRunLoop(ep *endpoint) {
r.allocWorkByEndpoint[ep] = started
go func() {
started.wg.Wait()
started.cancel()
relayManagerInputEvent(r, ctx, &r.allocateWorkDoneCh, relayEndpointAllocWorkDoneEvent{work: started})
// cleanup context cancellation must come after the
// relayManagerInputEvent call, otherwise it returns early without
// writing the event to runLoop().
started.cancel()
}()
}

Loading…
Cancel
Save