private void EnqueueSegment(Segment segment)
 {
     for(int i = 0; i < m_ServerGroups.Count; i++)
     {
         if(((ServerGroup)m_ServerGroups[i]).EnqueueSegment(segment))
             return;
     }
 }
Example #2
0
 public void FailedSegmentHandler(object sender, Segment segment, FailedStatus failedstatus)
 {
     //HANDLE FAILED SEGMENT FOR CONNECTION
     if( failedstatus != FailedStatus.Disconnected)
         segment.AddFailedServer(m_Hostname);
     OnFailedSegment(this, segment, failedstatus);
 }
        public void FailedSegmentHandler(object sender, Segment segment, FailedStatus failedstatus)
        {
            //HANDLE FAILED SEGMENT FROM SERVER GROUP
            for(int i = m_ServerGroups.IndexOf((ServerGroup)sender) + 1; i < m_ServerGroups.Count; i++)
            {
                if(m_ServerGroups[i] != null)
                {
                    ((ServerGroup)m_ServerGroups[i]).DownloadQueue.Enqueue(segment);
                    return;
                }
            }

            segment.Article.Status = ArticleStatus.Incomplete;
            frmMain.LogWriteError("Segment not found on any servers: " + segment.ArticleID);
            return;
        }
Example #4
0
        private void FailedSegmentHandler(object sender, Segment segment, FailedStatus failedstatus)
        {
            //HANDLE FAILED SEGMENT FOR SERVER
            foreach(Server server in m_Servers)
                if(!segment.FailedServers.Contains(server.Hostname) && server.Enabled)
                {
                    server.DownloadQueue.Enqueue(segment);
                    return;
                }

            OnFailedSegment(this, segment, failedstatus);
        }
Example #5
0
 public bool EnqueueSegment(Segment segment)
 {
     int enabled = 0;
     foreach(Server server in m_Servers)
     {
         if(server.Enabled)
             enabled++;
     }
     if(enabled > 0)
     {
         m_DownloadQueue.Enqueue(segment);
         return true;
     }
     return false;
 }
Example #6
0
 public void DownloadedHandler(Segment segment)
 {
     segment.OnDownloaded -= OnDownloadedHandler;
     segment.Article.IncreaseFinishedParts();
 }
Example #7
0
        public void AddSegment( int Number, int Bytes, string ArticleID)
        {
            Segment segment = new Segment( this, Number, Bytes, ArticleID);
            segment.Article = this;
            m_Size += segment.Bytes;
            m_Segments.Add( segment);

            if(segment.Downloaded)
                DownloadedHandler(segment);
            else
                segment.OnDownloaded += OnDownloadedHandler;
        }