func (cm *ConnectionManager) Connect(pi peer.AddrInfo) error {
	cm.lastConnectLock.Lock()
	defer cm.lastConnectLock.Unlock()
	lastConnect, found := cm.lastConnect[pi.ID]
	if !found || time.Since(lastConnect) > connectionCooldown {
		cm.lastConnect[pi.ID] = time.Now()
		ctx, _ := context.WithTimeout(context.Background(), connectionTimeout)
		return cm.host.Connect(ctx, pi)
	}
	return nil
}
// Connect connects to a peer.
Connect connects to a peer.
// Connect connects to a peer .
func (cm *ConnectionManager) Connect(pi peer.AddrInfo) error {
	cm.lastConnectLock.Lock()
	defer cm.lastConnectLock.Unlock()
	lastConnect, found := cm.lastConnect[pi.ID]
	if !found || time.Since(lastConnect) > connectionCooldown {
		cm.lastConnect[pi.ID] = time.Now()
		ctx, _ := context.WithTimeout(context.Background(), connectionTimeout)
		return cm.host.Connect(ctx, pi)
	}
	return nil
}
func ( cm * ConnectionManager ) Connect ( pi peer . AddrInfo ) error { cm . lastConnectLock . Lock ( ) defer cm . lastConnectLock . Unlock ( ) lastConnect , found := cm . lastConnect [ pi . ID ] if ! found || time . Since ( lastConnect ) > connectionCooldown { cm . lastConnect [ pi . ID ] = time . Now ( ) ctx , _ := context . WithTimeout ( context . Background ( ) , connectionTimeout ) return cm . host . Connect ( ctx , pi ) } return nil }
Connect connects to a peer.
Connect connects to a peer .