Changeset 9339
- Timestamp:
- Oct 20, 2009, 8:19:41 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/fdlimit.c
r9328 r9339 388 388 tr_bool doWrite ) 389 389 { 390 int i; 391 struct tr_openfile * o; 390 struct tr_openfile * match = NULL; 392 391 393 392 assert( torrentId > 0 ); … … 395 394 396 395 /* is it already open? */ 397 for( i=0; i<gFd->openFileLimit; ++i ) 398 { 399 o = &gFd->openFiles[i]; 400 401 if( !fileIsOpen( o ) ) 402 continue; 403 if( torrentId != o->torrentId ) 404 continue; 405 if( fileNum != o->fileNum ) 406 continue; 407 408 break; 409 } 410 411 if( ( o != NULL ) && ( !doWrite || o->isWritable ) ) 412 { 413 o->date = tr_date( ); 414 return o->fd; 396 { 397 int i; 398 struct tr_openfile * o; 399 for( i=0; i<gFd->openFileLimit; ++i ) 400 { 401 o = &gFd->openFiles[i]; 402 403 if( torrentId != o->torrentId ) 404 continue; 405 if( fileNum != o->fileNum ) 406 continue; 407 if( !fileIsOpen( o ) ) 408 continue; 409 410 match = o; 411 break; 412 } 413 } 414 415 if( ( match != NULL ) && ( !doWrite || match->isWritable ) ) 416 { 417 match->date = tr_date( ); 418 return match->fd; 415 419 } 416 420 … … 445 449 o = &gFd->openFiles[i]; 446 450 447 if( !fileIsOpen( o ) )448 continue;449 451 if( torrentId != o->torrentId ) 450 452 continue; 451 453 if( fileNum != o->fileNum ) 454 continue; 455 if( !fileIsOpen( o ) ) 452 456 continue; 453 457 … … 529 533 for( o=gFd->openFiles, end=o+gFd->openFileLimit; o!=end; ++o ) 530 534 { 531 if( !fileIsOpen( o ) )532 continue;533 535 if( torrentId != o->torrentId ) 534 536 continue; 535 537 if( fileNum != o->fileNum ) 536 538 continue; 539 if( !fileIsOpen( o ) ) 540 continue; 537 541 538 542 dbgmsg( "tr_fdFileClose closing \"%s\"", o->filename ); … … 548 552 549 553 for( o=gFd->openFiles, end=o+gFd->openFileLimit; o!=end; ++o ) 550 if( fileIsOpen( o ) && o->torrentId == torrentId)554 if( fileIsOpen( o ) && ( o->torrentId == torrentId ) ) 551 555 TrCloseFile( o ); 552 556 }
Note: See TracChangeset
for help on using the changeset viewer.