private void EnqueueSegment(Segment segment) { for(int i = 0; i < m_ServerGroups.Count; i++) { if(((ServerGroup)m_ServerGroups[i]).EnqueueSegment(segment)) return; } }
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; }
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); }
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; }
public void DownloadedHandler(Segment segment) { segment.OnDownloaded -= OnDownloadedHandler; segment.Article.IncreaseFinishedParts(); }
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; }