adding some sleep on re-registration after machine expired (#1256)
This commit is contained in:
parent
e38efd3cfa
commit
2560c32378
1 changed files with 9 additions and 2 deletions
|
@ -131,11 +131,10 @@ func (h *Headscale) handleRegisterCommon(
|
||||||
Bool("noise", isNoise).
|
Bool("noise", isNoise).
|
||||||
Msg("Machine is waiting for interactive login")
|
Msg("Machine is waiting for interactive login")
|
||||||
|
|
||||||
ticker := time.NewTicker(registrationHoldoff)
|
|
||||||
select {
|
select {
|
||||||
case <-req.Context().Done():
|
case <-req.Context().Done():
|
||||||
return
|
return
|
||||||
case <-ticker.C:
|
case <-time.After(registrationHoldoff):
|
||||||
h.handleNewMachineCommon(writer, registerRequest, machineKey, isNoise)
|
h.handleNewMachineCommon(writer, registerRequest, machineKey, isNoise)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -265,6 +264,14 @@ func (h *Headscale) handleRegisterCommon(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if registerRequest.Followup != "" {
|
||||||
|
select {
|
||||||
|
case <-req.Context().Done():
|
||||||
|
return
|
||||||
|
case <-time.After(registrationHoldoff):
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The machine has expired or it is logged out
|
// The machine has expired or it is logged out
|
||||||
h.handleMachineExpiredOrLoggedOutCommon(writer, registerRequest, *machine, machineKey, isNoise)
|
h.handleMachineExpiredOrLoggedOutCommon(writer, registerRequest, *machine, machineKey, isNoise)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue