diff --git a/synced-pool.go b/synced-pool.go index 14cb433..b45bc4e 100644 --- a/synced-pool.go +++ b/synced-pool.go @@ -240,7 +240,9 @@ func NewPacketQueue(connection net.Conn) *PacketQueue { queue.mu.Lock() for i, packet := range queue.Packets { if time.Since(packet.Added) < time.Second*5 { - queue.Packets = queue.Packets[i:] + stillInQueue := queue.Packets[i:] + log.Printf("DEBUG: Requeueing %v packets\n", stillInQueue) + queue.Packets = stillInQueue packetQueue.Set(float64(len(queue.Packets))) break } @@ -498,7 +500,9 @@ func (p *SyncedPool) addRemoteHost(address string, remote *RemoteHost) error { } func (p *SyncedPool) AddRemote(address string) error { - + if address == "" || p.IsKnown(address) { + return nil + } connection, err := net.Dial("tcp", fmt.Sprintf("%s:1338", address)) if err != nil { log.Printf("Error connecting to remote %s: %v\n", address, err)