Changeset 2738
- Timestamp:
- Aug 13, 2007, 4:43:33 PM (16 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/fastresume.c
r2596 r2738 93 93 * uint32_t: ul's tr_speedlimit_t 94 94 */ 95 FR_ID_SPEED = 8 95 FR_ID_SPEED = 8, 96 97 /* active 98 * char: 't' if running, 'f' if paused 99 */ 100 FR_ID_RUN = 9 96 101 }; 97 102 … … 149 154 } 150 155 151 static void fastResumeWriteData( uint8_t id, void * data, uint32_t size, 152 uint32_t count, FILE * file ) 156 static void 157 fastResumeWriteData( uint8_t id, 158 const void * data, 159 uint32_t size, 160 uint32_t count, 161 FILE * file ) 153 162 { 154 163 uint32_t datalen = size * count; … … 262 271 } 263 272 273 if( TRUE ) /* FR_ID_RUN */ 274 { 275 const char is_running = (tor->runStatus == TR_RUN_RUNNING) ? 't' : 'f'; 276 fastResumeWriteData( FR_ID_RUN, &is_running, 1, 1, file ); 277 } 264 278 265 279 /* Write download and upload totals */ … … 556 570 } 557 571 break; 572 573 case FR_ID_RUN: 574 { 575 char ch; 576 if( fread( &ch, 1, 1, file ) != 1 ) 577 { 578 fclose( file ); 579 return ret; 580 } 581 tor->runStatus = ch=='f' ? TR_RUN_STOPPED : TR_RUN_RUNNING; 582 ret |= TR_FR_RUN; 583 continue; 584 } 558 585 559 586 case FR_ID_DOWNLOADED: -
trunk/libtransmission/torrent.c
r2672 r2738 289 289 290 290 tor->error = TR_OK; 291 tor->runStatus = flags & TR_FLAG_PAUSED ? TR_RUN_STOPPED : TR_RUN_RUNNING;292 291 293 292 uncheckedPieces = tr_bitfieldNew( tor->info.pieceCount ); 294 293 loaded = tr_fastResumeLoad( tor, uncheckedPieces ); 294 295 /* the `paused' flag has highest precedence... 296 after that, the fastresume setting is used... 297 if that's not found, default to RUNNING */ 298 if( flags & TR_FLAG_PAUSED ) 299 tor->runStatus = TR_RUN_STOPPED; 300 else if( !(loaded & TR_FR_RUN ) ) 301 tor->runStatus = TR_RUN_RUNNING; 302 295 303 if( tr_bitfieldIsEmpty( uncheckedPieces ) ) 296 304 tr_bitfieldFree( uncheckedPieces );
Note: See TracChangeset
for help on using the changeset viewer.