mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-07 20:38:51 +08:00
add node to zombie list after expiration
This commit is contained in:
parent
6e50011ceb
commit
d8fe0b5194
1 changed files with 2 additions and 1 deletions
|
@ -25,6 +25,7 @@ var (
|
||||||
|
|
||||||
// CheckZombies - checks if new node has same macaddress as existing node
|
// CheckZombies - checks if new node has same macaddress as existing node
|
||||||
// if so, existing node is added to zombie node quarantine list
|
// if so, existing node is added to zombie node quarantine list
|
||||||
|
// also cleans up nodes past their expiration date
|
||||||
func CheckZombies(newnode *models.Node, mac net.HardwareAddr) {
|
func CheckZombies(newnode *models.Node, mac net.HardwareAddr) {
|
||||||
nodes, err := GetNetworkNodes(newnode.Network)
|
nodes, err := GetNetworkNodes(newnode.Network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -37,7 +38,7 @@ func CheckZombies(newnode *models.Node, mac net.HardwareAddr) {
|
||||||
// should we delete the node if host not found ??
|
// should we delete the node if host not found ??
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if host.MacAddress.String() == mac.String() {
|
if host.MacAddress.String() == mac.String() || time.Now().After(node.ExpirationDateTime) {
|
||||||
logger.Log(0, "adding ", node.ID.String(), " to zombie list")
|
logger.Log(0, "adding ", node.ID.String(), " to zombie list")
|
||||||
newZombie <- node.ID
|
newZombie <- node.ID
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue