Bug 137840 - Torrent at 100% but individually selected files not finished
Summary: Torrent at 100% but individually selected files not finished
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-24 22:48 UTC by Eric P
Modified: 2006-11-25 12:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric P 2006-11-24 22:48:53 UTC
Version:           ktorrent_2.1~0dev+svn20061116-1~6.06prevu1_i386.deb (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
Compiler:          Precomplied binary: ktorrent_2.1~0dev+svn20061116-1~6.06prevu1_i386.deb 
OS:                Linux

I often start a torrent (ex. a bunch of audio files) and I'll just select a song or two to check the quality of some of the individual files.

In the main torrent window, the torrent will eventually reach 100%, but some of the individual, (selected for download) files are not 100%. They are stuck in the high 90s%. But they won't complete for some reason. So I'll uncheck the stuck files and recheck them, and then they usually finish up. I noticed too that when I uncheck a file that's stuck, the torrent in the main window will come back down to the high 90s%, the file(s) will finish and it will eventually show 100% in the upper window and in the file tab (as it should).

Keep up the great work and let me know if I can provide any more info.
Comment 1 Joris Guisson 2006-11-25 12:56:48 UTC
SVN commit 607622 by guisson:

Fixed bug which resulted in the setting of the wrong chunk priority when not all files of a torrent were selected. This resulted in the torrent being at 100 %, while not all files where at 100 %.

BUG: 137840



 M  +15 -18    chunkmanager.cpp  
 M  +3 -4      torrentfile.cpp  
 M  +2 -5      torrentfile.h  


--- trunk/extragear/network/ktorrent/libktorrent/torrent/chunkmanager.cpp #607621:607622
@@ -76,14 +76,9 @@
 		for (Uint32 i = 0;i < tor.getNumFiles();i++)
 		{
 			TorrentFile & tf = tor.getFile(i);
-			connect(&tf,SIGNAL(downloadStatusChanged(TorrentFile*, bool )),
-					 this,SLOT(downloadStatusChanged(TorrentFile*, bool )));
 			connect(&tf,SIGNAL(downloadPriorityChanged(TorrentFile*, Priority )),
 					 this,SLOT(downloadPriorityChanged(TorrentFile*, Priority )));
-			if (tf.doNotDownload())
-			{
-				downloadStatusChanged(&tf,false);
-			}
+			
 			if (tf.getPriority() != NORMAL_PRIORITY)
 			{
 				downloadPriorityChanged(&tf,tf.getPriority());
@@ -823,17 +818,18 @@
 				if (*i == tf->getIndex())
 					continue;
 				
-				if (tf->getPriority() > maxp)
-					maxp = tf->getPriority();
-				
-				if (!tor.getFile(*i).doNotDownload() && !modified)
+				const TorrentFile & other = tor.getFile(*i);
+				if (!other.doNotDownload())
 				{
-					if (first != last)
+					if (first != last && !modified)
 					{
 						first++;
 						reprioritise_border_chunk = true;
 						modified = true;
 					}
+					
+					if (other.getPriority() > maxp)
+						maxp = other.getPriority();
 				}
 			}
 			
@@ -851,17 +847,18 @@
 				if (*i == tf->getIndex())
 					continue;
 				
-				if (tf->getPriority() > maxp)
-					maxp = tf->getPriority();
-				
-				if (!tor.getFile(*i).doNotDownload() && !modified)
+				const TorrentFile & other = tor.getFile(*i);
+				if (!other.doNotDownload())
 				{
-					if (last != first && last > 0)
+					if (first != last && last > 0 && !modified)
 					{
-						modified = true;
-						reprioritise_border_chunk = true;
 						last--;
+						reprioritise_border_chunk = true;
+						modified = true;
 					}
+					
+					if (other.getPriority() > maxp)
+						maxp = other.getPriority();
 				}
 			}
 			
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentfile.cpp #607621:607622
@@ -70,20 +70,19 @@
 		{
 			priority = EXCLUDED;
 			if(m_emitDlStatusChanged)
-				emit downloadStatusChanged(this,!dnd);
+				emit downloadPriorityChanged(this,priority);
 		}
 		if (priority == EXCLUDED && (!dnd))
 		{
 			priority = NORMAL_PRIORITY;
 			if(m_emitDlStatusChanged)
-				emit downloadStatusChanged(this,!dnd);
+				emit downloadPriorityChanged(this,priority);
 		}
 	}
 	
 	void TorrentFile::emitDownloadStatusChanged()
 	{
-		if(priority == EXCLUDED)
-			emit downloadStatusChanged(this, false);
+		emit downloadPriorityChanged(this,priority);
 	}
 
 
--- trunk/extragear/network/ktorrent/libktorrent/torrent/torrentfile.h #607621:607622
@@ -140,13 +140,10 @@
 		
 	signals:
 		/**
-		 * Signal emitted when the Priority variable changes from or to EXCLUDED.
+		 * Signal emitted when the Priority variable changes.
 		 * @param tf The TorrentFile which emitted the signal
-		 * @param download Download the file or not
+		 * @param newpriority THe new priority of the file
 		 */
-		void downloadStatusChanged(TorrentFile* tf,bool download);
-			
-		/// signal emitted when the Priority variable changes
 		void downloadPriorityChanged(TorrentFile* tf,Priority newpriority);
 	};