Created
June 10, 2012 23:07
-
-
Save SpeCT/2907634 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: libtransmission/torrent.c | |
=================================================================== | |
--- libtransmission/torrent.c (revision 13343) | |
+++ libtransmission/torrent.c (working copy) | |
@@ -621,6 +621,20 @@ | |
return priority; | |
} | |
+static tr_priority_t | |
+calculateRightPiecePriority( tr_piece_index_t p, const tr_info *inf, | |
+ const tr_torrent * tor, int fileHint ) | |
+{ | |
+ if(p>=(inf->pieceCount/3)*2){ | |
+ return TR_PRI_LOW; | |
+ }else if(p>=inf->pieceCount/3&&p<=(inf->pieceCount/3)*2){ | |
+ return TR_PRI_NORMAL; | |
+ }else if(p<=inf->pieceCount/3||p==inf->pieceCount){ | |
+ return TR_PRI_HIGH; | |
+ }else | |
+ return calculatePiecePriority(tor, p, fileHint); | |
+} | |
+ | |
static void | |
tr_torrentInitFilePieces( tr_torrent * tor ) | |
{ | |
@@ -661,7 +675,8 @@ | |
#endif | |
for( p=0; p<inf->pieceCount; ++p ) | |
- inf->pieces[p].priority = calculatePiecePriority( tor, p, firstFiles[p] ); | |
+ //inf->pieces[p].priority = calculatePiecePriority( tor, p, firstFiles[p] ); | |
+ inf->pieces[p].priority = calculateRightPiecePriority(p, inf, tor, firstFiles[p]); | |
tr_free( firstFiles ); | |
} | |
@@ -2756,7 +2771,7 @@ | |
base = tr_strdup_printf( "%s__XXXXXX", tr_torrentName( tor ) ); | |
tmpdir = tr_buildPath( top, base, NULL ); | |
- tr_mkdtemp( tmpdir ); | |
+ mkdtemp( tmpdir ); | |
tr_free( base ); | |
for( f=0; f<tor->info.fileCount; ++f ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment