From: ArronM <tux...@us...> - 2006-06-24 01:02:50
|
Update of /cvsroot/azureus/azureus2/org/gudy/azureus2/core3/download/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26498/azureus2/org/gudy/azureus2/core3/download/impl Modified Files: DownloadManagerController.java Log Message: Fixup isDownloadComplete() If this dosn't work, at least it'll be nicely commented and not working :) Index: DownloadManagerController.java =================================================================== RCS file: /cvsroot/azureus/azureus2/org/gudy/azureus2/core3/download/impl/DownloadManagerController.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -d -r1.69 -r1.70 --- DownloadManagerController.java 23 Jun 2006 01:12:19 -0000 1.69 +++ DownloadManagerController.java 24 Jun 2006 01:02:47 -0000 1.70 @@ -1125,6 +1125,15 @@ * @return completion state */ protected boolean isDownloadComplete(boolean bIncludeDND) { + // The calculate from stats doesn't take into consideration DND + // So, if we have no DND files, use calculation from stats, which + // remembers things like whether the file was once complete + if (!cached_has_dnd_files) { + return stats.getDownloadCompleted(false) == 1000; + } + + // We have DND files. If we have an existing diskmanager, then it + // will have better information than the stats object. DiskManager dm = getDiskManager(); if (dm != null) { @@ -1138,13 +1147,15 @@ } } + // No DiskManager or it's in a bad state for us. + // Assumed: We have DND files if (bIncludeDND) { - if (cached_has_dnd_files) { - return false; - } - return stats.getDownloadCompleted(false) == 1000; + // Want to include DND files in calculation, which there some, which + // means completion MUST be false + return false; } - + + // Have DND files, bad DiskManager, and we don't want to include DND files return cached_complete_excluding_dnd; } |