diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-06-06 12:06:03 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-06-06 14:33:07 +0200 |
| commit | ab3b5511bc10560279dc2db12e73b87b4a0c7c16 (patch) | |
| tree | 3cd6db720fce5a8caee00ee0cb4c593601386e9f /client/client.go | |
| parent | ef85a613777c7f25acdc4687157b9ad4d84cb1a1 (diff) | |
Discovery: Organization list cache updates
Diffstat (limited to 'client/client.go')
| -rw-r--r-- | client/client.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/client/client.go b/client/client.go index 4ba7977..79de902 100644 --- a/client/client.go +++ b/client/client.go @@ -55,6 +55,20 @@ type Client struct { mu sync.Mutex } +// MarkOrganizationsExpired marks the discovery organization list as expired +// it's a no-op if the type `t` is not secure internet +// or if discovery is nil +func (c *Client) MarkOrganizationsExpired(t srvtypes.Type) { + if t != srvtypes.TypeSecureInternet { + return + } + disco := c.cfg.Discovery() + if disco == nil { + return + } + disco.MarkOrganizationsExpired() +} + // GettingConfig is defined here to satisfy the server.Callbacks interface // It is called when internally we are getting a config // We go to the GettingConfig state @@ -196,6 +210,7 @@ func (c *Client) AuthDone(id string, t srvtypes.Type) { if err != nil { log.Logger.Debugf("unhandled auth done main transition: %v", err) } + c.MarkOrganizationsExpired(t) } // TokensUpdated is called when tokens are updated @@ -446,6 +461,7 @@ func (c *Client) RemoveServer(identifier string, _type srvtypes.Type) (err error if err != nil { return i18nerr.WrapInternalf(err, "Failed to remove server: '%s'", identifier) } + c.MarkOrganizationsExpired(_type) return nil } |
