From 132782f44603dfdc3b1d875d632f786109ee09a2 Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Fri, 29 Aug 2025 14:36:00 +0200 Subject: Discovery: Remove manager and DiscoveryStartup --- client/discovery.go | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'client/discovery.go') diff --git a/client/discovery.go b/client/discovery.go index 802fe48..562315b 100644 --- a/client/discovery.go +++ b/client/discovery.go @@ -1,7 +1,6 @@ package client import ( - "context" "sort" "strings" @@ -26,10 +25,7 @@ func (c *Client) DiscoOrganizations(ck *cookie.Cookie, cache bool, search string return nil, i18nerr.NewInternal("Organization discovery with this client ID is not supported") } - disco, release := c.discoMan.Discovery(true) - defer release() - - orgs, fresh, err := disco.Organizations(ck.Context(), cache) + orgs, fresh, err := c.disco.Organizations(ck.Context(), cache) if fresh { defer c.TrySave() } @@ -76,9 +72,7 @@ func (c *Client) DiscoServers(ck *cookie.Cookie, cache bool, search string) (*di return nil, i18nerr.NewInternal("Server discovery with this client ID is not supported") } - disco, release := c.discoMan.Discovery(true) - defer release() - servs, fresh, err := disco.Servers(ck.Context(), cache) + servs, fresh, err := c.disco.Servers(ck.Context(), cache) if fresh { defer c.TrySave() } @@ -113,29 +107,3 @@ func (c *Client) DiscoServers(ck *cookie.Cookie, cache bool, search string) (*di List: retServs, }, err } - -// DiscoveryStartup gets the discovery when the client is just starting up -// cb is called when discovery has finished in the background -func (c *Client) DiscoveryStartup(cb func()) error { - // Not supported with Let's Connect! & govVPN - if !c.hasDiscovery() { - return i18nerr.NewInternal("Server/organization discovery startup with this client ID is not supported") - } - - fcb := func() { - if cb == nil { - return - } - - c.mu.Lock() - defer c.mu.Unlock() - - if c.FSM.Current != StateMain { - return - } - - cb() - } - c.discoMan.Startup(context.Background(), fcb) - return nil -} -- cgit v1.2.3