mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-27 17:25:20 -04:00
pubapi: extract StartVPNAPIServer and StartUpdateLoop as separate functions
Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
parent
77b0237dd5
commit
f2b3fc328b
4 changed files with 25 additions and 18 deletions
|
@ -142,8 +142,7 @@ func (a *API) ActivateAsNode(stream pubproto.API_ActivateAsNodeServer) (reterr e
|
|||
}
|
||||
|
||||
// regularly get (peer) updates from Coordinator
|
||||
a.wgClose.Add(1)
|
||||
go a.updateLoop()
|
||||
a.StartUpdateLoop()
|
||||
|
||||
/*
|
||||
coordinator <- VPN public key <- node
|
||||
|
@ -206,6 +205,12 @@ func (a *API) TriggerNodeUpdate(ctx context.Context, in *pubproto.TriggerNodeUpd
|
|||
return &pubproto.TriggerNodeUpdateResponse{}, nil
|
||||
}
|
||||
|
||||
// StartUpdateLoop starts a loop that will periodically request updates from the Coordinator.
|
||||
func (a *API) StartUpdateLoop() {
|
||||
a.wgClose.Add(1)
|
||||
go a.updateLoop()
|
||||
}
|
||||
|
||||
func (a *API) updateLoop() {
|
||||
defer a.wgClose.Done()
|
||||
ticker := time.NewTicker(updateInterval)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue