Guest User

Untitled

a guest
Oct 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. Index: libtransmission/torrent.c
  2. ===================================================================
  3. --- libtransmission/torrent.c (revision 13343)
  4. +++ libtransmission/torrent.c (working copy)
  5. @@ -621,6 +621,20 @@
  6. return priority;
  7. }
  8.  
  9. +static tr_priority_t
  10. +calculateRightPiecePriority( tr_piece_index_t p, const tr_info *inf,
  11. + const tr_torrent * tor, int fileHint )
  12. +{
  13. + if(p>=(inf->pieceCount/3)*2){
  14. + return TR_PRI_LOW;
  15. + }else if(p>=inf->pieceCount/3&&p<=(inf->pieceCount/3)*2){
  16. + return TR_PRI_NORMAL;
  17. + }else if(p<=inf->pieceCount/3||p==inf->pieceCount){
  18. + return TR_PRI_HIGH;
  19. + }else
  20. + return calculatePiecePriority(tor, p, fileHint);
  21. +}
  22. +
  23. static void
  24. tr_torrentInitFilePieces( tr_torrent * tor )
  25. {
  26. @@ -661,7 +675,8 @@
  27. #endif
  28.  
  29. for( p=0; p<inf->pieceCount; ++p )
  30. - inf->pieces[p].priority = calculatePiecePriority( tor, p, firstFiles[p] );
  31. + //inf->pieces[p].priority = calculatePiecePriority( tor, p, firstFiles[p] );
  32. + inf->pieces[p].priority = calculateRightPiecePriority(p, inf, tor, firstFiles[p]);
  33.  
  34. tr_free( firstFiles );
  35. }
  36. @@ -2756,7 +2771,7 @@
  37.  
  38. base = tr_strdup_printf( "%s__XXXXXX", tr_torrentName( tor ) );
  39. tmpdir = tr_buildPath( top, base, NULL );
  40. - tr_mkdtemp( tmpdir );
  41. + mkdtemp( tmpdir );
  42. tr_free( base );
  43.  
  44. for( f=0; f<tor->info.fileCount; ++f )
Add Comment
Please, Sign In to add comment