Changeset 5796
- Timestamp:
- May 10, 2008, 12:19:00 AM (14 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/port-forwarding.c
r5754 r5796 206 206 tr_sharedSetPort( tr_shared * s, int port ) 207 207 { 208 tr_torrent * tor ;208 tr_torrent * tor = NULL; 209 209 210 210 s->publicPort = port; 211 211 212 for( tor = s->h->torrentList; tor; tor = tor->next)212 while(( tor = tr_torrentNext( s->h, tor ))) 213 213 tr_torrentChangeMyPort( tor ); 214 214 } -
trunk/libtransmission/session.c
r5726 r5796 389 389 { 390 390 tr_handle * h = vh; 391 tr_torrent * t ;391 tr_torrent * tor; 392 392 393 393 tr_sharedShuttingDown( h->shared ); 394 394 tr_trackerShuttingDown( h ); 395 395 396 for( t=h->torrentList; t!=NULL; ) { 397 tr_torrent * tmp = t; 398 t = t->next; 399 tr_torrentClose( tmp ); 400 } 396 while(( tor = tr_torrentNext( h, NULL ))) 397 tr_torrentClose( tor ); 401 398 402 399 tr_peerMgrFree( h->peerMgr ); … … 683 680 } 684 681 } 682 683 tr_torrent* 684 tr_torrentNext( tr_handle * session, tr_torrent * tor ) 685 { 686 return tor ? tor->next : session->torrentList; 687 } -
trunk/libtransmission/torrent.c
r5781 r5796 55 55 56 56 int 57 tr_torrentExists( tr_handle* handle,57 tr_torrentExists( const tr_handle * handle, 58 58 const uint8_t * torrentHash ) 59 59 { 60 return tr_torrentFindFromHash( handle, torrentHash ) != NULL;60 return tr_torrentFindFromHash( (tr_handle*)handle, torrentHash ) != NULL; 61 61 } 62 62 … … 65 65 const uint8_t * torrentHash ) 66 66 { 67 tr_torrent * tor ;68 69 for( tor = handle->torrentList; tor; tor = tor->next)67 tr_torrent * tor = NULL; 68 69 while(( tor = tr_torrentNext( handle, tor ))) 70 70 if( !memcmp( tor->info.hash, torrentHash, SHA_DIGEST_LENGTH ) ) 71 71 return tor; … … 78 78 const uint8_t * obfuscatedTorrentHash ) 79 79 { 80 tr_torrent * tor ;81 82 for( tor = handle->torrentList; tor; tor = tor->next)80 tr_torrent * tor = NULL; 81 82 while(( tor = tr_torrentNext( handle, tor ))) 83 83 if( !memcmp( tor->obfuscatedHash, obfuscatedTorrentHash, SHA_DIGEST_LENGTH ) ) 84 84 return tor; … … 483 483 } 484 484 485 static int486 hashExists( const tr_handle * h,487 const uint8_t * hash )488 {489 const tr_torrent * tor;490 491 for( tor=h->torrentList; tor; tor=tor->next )492 if( !memcmp( hash, tor->info.hash, SHA_DIGEST_LENGTH ) )493 return TRUE;494 495 return FALSE;496 }497 498 485 int 499 486 tr_torrentParse( const tr_handle * handle, … … 516 503 doFree = !err && ( setmeInfo == &tmp ); 517 504 518 if( !err && hashExists( handle, setmeInfo->hash ) )505 if( !err && tr_torrentExists( handle, setmeInfo->hash ) ) 519 506 err = TR_EDUPLICATE; 520 507 -
trunk/libtransmission/torrent.h
r5748 r5796 49 49 void tr_torrentChangeMyPort ( tr_torrent * ); 50 50 51 int tr_torrentExists( tr_handle *, const uint8_t * );51 int tr_torrentExists( const tr_handle *, const uint8_t * ); 52 52 tr_torrent* tr_torrentFindFromHash( tr_handle *, const uint8_t * ); 53 53 tr_torrent* tr_torrentFindFromObfuscatedHash( tr_handle *, const uint8_t* ); -
trunk/libtransmission/transmission.h
r5673 r5796 249 249 int tr_torrentCount( const tr_handle * h ); 250 250 251 /** 252 * Iterate through the torrents. 253 * Pass in in a NULL pointer to get the first torrent. 254 */ 255 tr_torrent* tr_torrentNext( tr_handle *, tr_torrent * ); 256 251 257 /*********************************************************************** 252 258 *** Speed Limits
Note: See TracChangeset
for help on using the changeset viewer.