feature/portlist: address case where poller misses CollectServices updates

This is a minimal hacky fix for a case where the portlist poller extension
could miss updates to NetMap's CollectServices bool.

Updates tailscale/corp#36813

Change-Id: I9b50de8ba8b09e4a44f9fbfe90c9df4d8ab4d586
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
main
Brad Fitzpatrick 1 month ago committed by Brad Fitzpatrick
parent 2c9ffdd188
commit 30adf4527b
  1. 13
      feature/portlist/portlist.go

@ -122,6 +122,19 @@ func (e *Extension) runPollLoop() {
return
}
// Before we do potentially expensive work below (polling what might be
// a ton of ports), double check that we actually need to do it.
// TODO(bradfitz): the onSelfChange, and onChangeProfile hooks above are
// not enough, because CollectServices is a NetMap-level thing and not a
// change to the local self node. We should add an eventbus topic for
// when CollectServices changes probably, or move the CollectServices
// thing into a local node self cap (at least logically, if not on the
// wire) so then the onSelfChange hook would cover it. In the meantime,
// we'll just end up doing some extra checks every PollInterval, which
// is not the end of the world, and fixes the problem of picking up
// changes to CollectServices that come down in the netmap.
e.updateShouldUploadServices()
if !e.shouldUploadServicesAtomic.Load() {
continue
}

Loading…
Cancel
Save