adding some sleep on re-registration after machine expired (#1256)

This commit is contained in:
Kurnia D Win 2023-03-20 17:14:34 +07:00 committed by GitHub
parent e38efd3cfa
commit 2560c32378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -131,11 +131,10 @@ func (h *Headscale) handleRegisterCommon(
Bool("noise", isNoise).
Msg("Machine is waiting for interactive login")
ticker := time.NewTicker(registrationHoldoff)
select {
case <-req.Context().Done():
return
case <-ticker.C:
case <-time.After(registrationHoldoff):
h.handleNewMachineCommon(writer, registerRequest, machineKey, isNoise)
return
@ -265,6 +264,14 @@ func (h *Headscale) handleRegisterCommon(
return
}
if registerRequest.Followup != "" {
select {
case <-req.Context().Done():
return
case <-time.After(registrationHoldoff):
}
}
// The machine has expired or it is logged out
h.handleMachineExpiredOrLoggedOutCommon(writer, registerRequest, *machine, machineKey, isNoise)