예제 #1
0
        public MetamineBlock[] Next(MetamineStrategy strategy, PeerHash peer)
        {
            MetamineStrategyContext context = new MetamineStrategyContext
            {
                Peer          = peer,
                Blocks        = blocks,
                Configuration = configuration,
                Reservations  = reservations
            };

            return(strategy.Next(context).ToArray());
        }
예제 #2
0
        public void Execute(MetagetContext context)
        {
            if (context.Metamine != null && context.Dependencies.Metafile.IsCompleted() == false)
            {
                foreach (PeerHash peer in context.Dependencies.Glue.Peers)
                {
                    MetamineStrategy strategy = MetamineStrategy.Sequential;
                    MetamineBlock[]  blocks   = context.Metamine.Next(strategy, peer);

                    foreach (MetamineBlock block in blocks)
                    {
                        context.Metamine.Reserve(peer, block);
                        context.Dependencies.Glue.SendMetadataRequest(peer, block.Index);
                    }
                }
            }
        }