diff --git a/synced-pool.go b/synced-pool.go index a80024c..71da869 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -111,11 +111,15 @@ func NewSyncedPool(local *GrainLocalPool, hostname string, d Discovery) (*Synced if h == hostname { continue } + found := false for _, r := range pool.remotes { if r.Host == h { - continue + found = true } } + if found { + continue + } err := pool.AddRemote(h) if err != nil { log.Printf("Error adding undiscovered remote %s: %v\n", h, err) @@ -224,6 +228,7 @@ func (p *SyncedPool) handleConnection(conn net.Conn) { if !found { log.Printf("Remote host %s not found\n", idAndHostParts[1]) + log.Printf("Remotes %v\n", p.remotes) SendPacket(conn, AckError, func(w io.Writer) error { w.Write([]byte("remote host not found")) return nil