From 88f41d14b37d42bfe7631cc0ff6ffbbf4c42db59 Mon Sep 17 00:00:00 2001 From: Jake Taylor <jake@elixxir.io> Date: Tue, 30 Mar 2021 13:39:24 -0500 Subject: [PATCH] fix bug --- network/gateway/hostPool.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go index e0d89bbdd..3e520daba 100644 --- a/network/gateway/hostPool.go +++ b/network/gateway/hostPool.go @@ -270,7 +270,7 @@ func (h *HostPool) ForceAdd(gwIds []*id.ID) error { h.hostMux.Lock() defer h.hostMux.Unlock() - checked := make(map[int]interface{}) // Keep track of Hosts already replaced + checked := make(map[uint32]interface{}) // Keep track of Hosts already replaced for i := 0; i < len(gwIds); { // Verify the GwId is not already in the hostMap if _, ok := h.hostMap[*gwIds[i]]; ok { @@ -279,12 +279,12 @@ func (h *HostPool) ForceAdd(gwIds []*id.ID) error { // Randomly select another Gateway in the HostPool for replacement poolIdx := readRangeUint32(0, h.poolParams.poolSize, h.rng) - if _, ok := checked[i]; !ok { + if _, ok := checked[poolIdx]; !ok { err := h.replaceHost(gwIds[i], poolIdx) if err != nil { return err } - checked[i] = nil + checked[poolIdx] = nil i++ } } -- GitLab