Exemplo n.º 1
0
        public void DistributeWork(HtmlRecord record)
        {
            while (crawlerNodes.Count == 0)
            {
                ;
            }
            CrawlerNode node = crawlerNodes.OrderByDescending(x => x.Value.messageQueue.Count).Last().Value;

            jobSet[record.id] = node;
            node.EnqueueHtmlRecord(record);
        }
Exemplo n.º 2
0
        protected override void HandleConnection(object socket)
        {
            listenerSignal.Set();

            Socket handler = (Socket)socket;

            if (nodeIPAddresses.Contains(handler.LocalEndPoint))
            {
                CrawlerNode node = new CrawlerNode();
                node.UpdateReceived += new EventHandler <HtmlRecord>(OnUpdateReceived);
                node.Start(handler);
                crawlerNodes.Add((IPEndPoint)handler.LocalEndPoint, node);
            }
            else
            {
                throw new Exception("Invalid IP attempting to connect");
            }
        }
Exemplo n.º 3
0
 public void AddCrawlerEvent(CrawlerNode node)
 {
     node.UpdateReceived += new EventHandler <HtmlRecord>(UpdateEntry);
 }