Skip to content

Commit

Permalink
fix infinite loop
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Jan 13, 2025
1 parent b98a30c commit 3f85dfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hscontrol/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func (h *Headscale) createRouter(grpcMux *grpcRuntime.ServeMux) *mux.Router {

router.HandleFunc("/health", h.HealthHandler).Methods(http.MethodGet)
router.HandleFunc("/key", h.KeyHandler).Methods(http.MethodGet)
router.HandleFunc("/register/{mkey}", h.authProvider.RegisterHandler).Methods(http.MethodGet)
router.HandleFunc("/register/{registration_id}", h.authProvider.RegisterHandler).Methods(http.MethodGet)

if provider, ok := h.authProvider.(*AuthProviderOIDC); ok {
router.HandleFunc("/oidc/callback", provider.OIDCCallbackHandler).Methods(http.MethodGet)
Expand Down
4 changes: 2 additions & 2 deletions hscontrol/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ func (h *Headscale) handleRegister(
// log.Debug().Interface("regcache", h.registrationCache.Items()).Msg("followup regcache")
log.Debug().Interface("regcache", h.registrationCache.Keys()).Msg("followup regcache")

if _, ok := h.registrationCache.Get(registrationId); ok {
if _, ok := h.registrationCache.Get(followupReg); ok {
logTrace("Node is waiting for interactive login")

select {
case <-req.Context().Done():
return
case <-time.After(registrationHoldoff):
h.handleNewNode(writer, regReq, registrationId)
h.handleNewNode(writer, regReq, followupReg)

return
}
Expand Down

0 comments on commit 3f85dfa

Please sign in to comment.