Changeset 9445 for trunk/libtransmission/torrent.c
- Timestamp:
- Oct 30, 2009, 4:24:58 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r9443 r9445 1046 1046 uint64_t total = 0; 1047 1047 const tr_file * f = &tor->info.files[index]; 1048 fprintf( stderr, "in fileBytesCompleted for file #%d\n", (int)index ); 1048 1049 1049 1050 if( f->length ) … … 1055 1056 if( firstBlock == lastBlock ) 1056 1057 { 1058 fprintf( stderr, "file fits in a single block\n" ); 1057 1059 if( tr_cpBlockIsCompleteFast( &tor->completion, firstBlock ) ) 1058 1060 total = f->length; … … 1069 1071 if( f->firstPiece == f->lastPiece ) 1070 1072 { 1073 fprintf( stderr, "f->firstPiece == f->lastPiece\n" ); 1071 1074 for( i=firstBlock+1; i<lastBlock; ++i ) 1072 1075 if( tr_cpBlockIsCompleteFast( &tor->completion, i ) ) … … 1083 1086 1084 1087 /* the rest of the first piece */ 1088 fprintf( stderr, "looping on the rest of the first piece\n" ); 1085 1089 for( i=firstBlock+1; i<lastBlock && i<=lastBlockOfFirstPiece; ++i ) 1086 1090 if( tr_cpBlockIsCompleteFast( &tor->completion, i ) ) … … 1088 1092 1089 1093 /* the middle pieces */ 1094 fprintf( stderr, "looking at the middle pieces\n" ); 1090 1095 if( f->firstPiece + 1 < f->lastPiece ) 1091 1096 for( i=f->firstPiece+1; i<f->lastPiece; ++i ) … … 1093 1098 1094 1099 /* the rest of the last piece */ 1100 fprintf( stderr, "looping on the rest of the last piece\n" ); 1095 1101 for( i=firstBlockOfLastPiece; i<lastBlock; ++i ) 1096 1102 if( tr_cpBlockIsCompleteFast( &tor->completion, i ) ) … … 1106 1112 } 1107 1113 } 1114 fprintf( stderr, "finished fileBytesCompleted for file #%d\n", (int)index ); 1108 1115 1109 1116 return total; … … 1119 1126 tr_file_stat * walk = files; 1120 1127 const tr_bool isSeed = tor->completeness == TR_SEED; 1121 1122 assert( tr_isTorrent( tor ) ); 1123 1124 for( i = 0; i < n; ++i, ++walk ) 1125 { 1128 static int numCalls = 0; 1129 1130 fprintf( stderr, "entering tr_torrentFiles for the %d time\n", ++numCalls ); 1131 1132 assert( tr_isTorrent( tor ) ); 1133 1134 for( i=0; i<n; ++i, ++walk ) 1135 { 1136 fprintf( stderr, "looking at file #%d of %d\n", (int)i, (int)n ); 1126 1137 const uint64_t b = isSeed ? tor->info.files[i].length : fileBytesCompleted( tor, i ); 1138 fprintf( stderr, "file has %"PRIu64" out of %"PRIu64" bytes\n", b, tor->info.files[i].length ); 1127 1139 walk->bytesCompleted = b; 1128 1140 walk->progress = tr_getRatio( b, tor->info.files[i].length ); 1141 fprintf( stderr, "walk->progress is %f\n", walk->progress ); 1129 1142 } 1130 1143 1131 1144 if( fileCount ) 1132 1145 *fileCount = n; 1146 1147 fprintf( stderr, "tr_torrentFiles finished\n" ); 1133 1148 1134 1149 return files;
Note: See TracChangeset
for help on using the changeset viewer.