Browse Source

:bug: Do not try to find a leader with no nodes

Fixes: #38
Ettore Di Giacinto 2 years ago
parent
commit
362afe6538
1 changed files with 5 additions and 0 deletions
  1. 5 0
      pkg/vpn/dhcp.go

+ 5 - 0
pkg/vpn/dhcp.go

@@ -96,6 +96,11 @@ func DHCPNetworkService(ip chan string, l log.StandardLogger, maxTime time.Durat
 				continue
 				continue
 			}
 			}
 
 
+			if len(nodesWithNoIP) == 0 {
+				l.Debug("not enough nodes waiting for IP being announced, sleeping")
+				continue
+			}
+
 			shouldBeLeader := utils.Leader(nodesWithNoIP)
 			shouldBeLeader := utils.Leader(nodesWithNoIP)
 
 
 			var lead string
 			var lead string