summaryrefslogtreecommitdiff
path: root/client/discovery.go
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-08-29 14:36:00 +0200
committerJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-08-29 14:40:25 +0200
commit132782f44603dfdc3b1d875d632f786109ee09a2 (patch)
tree71cd1cefee78636167c560c80c8bc79c8982fe26 /client/discovery.go
parent4a23134e1e5d70a9c8c5857790dbf27585ca3b1f (diff)
Discovery: Remove manager and DiscoveryStartup
Diffstat (limited to 'client/discovery.go')
-rw-r--r--client/discovery.go36
1 files changed, 2 insertions, 34 deletions
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
-}