Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.

Commit

Permalink
Fix IP assignment issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ehhthing committed Feb 4, 2021
1 parent e81387a commit c2811ff
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ func AddServer(serverType string, metadata map[string]string) (Server, error) {
return Server{}, errors.New("server type not found")
}

takenIPs := make([]net.IPAddr, len(servers))
for i, server := range servers {
takenIPs[i] = net.IPAddr{IP: server.IP.IP}
takenIPs := make([]net.IPAddr, 0)
for _, server := range servers {
if server.Type == serverType {
takenIPs = append(takenIPs, net.IPAddr{IP: server.IP.IP})
}
}

ip := AllocateIP(ipRange, takenIPs)
Expand Down

0 comments on commit c2811ff

Please sign in to comment.