Changeset 1603
- Timestamp:
- Mar 29, 2007, 12:19:09 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/configure
r1466 r1603 220 220 221 221 case "x$1" in 222 x--disable-openssl )222 x--disable-openssl|x--without-openssl) 223 223 OPENSSL=no 224 224 ;; 225 x--disable-gtk )225 x--disable-gtk|x--without-gtk) 226 226 GTK=no 227 227 ;; -
trunk/libtransmission/fastresume.h
r1594 r1603 380 380 if( !( TR_FLAG_PRIVATE & tor->info.flags ) ) 381 381 { 382 int used; 382 383 uint8_t * buf = malloc( len ); 383 384 if( 1 != fread( buf, len, 1, file ) ) … … 387 388 return 1; 388 389 } 389 tr_torrentAddCompact( tor, TR_PEER_FROM_CACHE, 390 buf, len / 6 ); 390 used = tr_torrentAddCompact( tor, TR_PEER_FROM_CACHE, 391 buf, len / 6 ); 392 tr_dbg( "found %i peers in resume file, used %i", 393 len / 6, used ); 391 394 free( buf ); 392 395 } -
trunk/libtransmission/internal.h
r1600 r1603 147 147 #include "xml.h" 148 148 149 voidtr_torrentAddCompact( tr_torrent_t * tor, int from,149 int tr_torrentAddCompact( tr_torrent_t * tor, int from, 150 150 uint8_t * buf, int count ); 151 voidtr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer );151 int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer ); 152 152 153 153 struct tr_torrent_s -
trunk/libtransmission/peeraz.h
r1600 r1603 445 445 tr_info_t * info = &tor->info; 446 446 benc_val_t val, * list, * pair; 447 int ii ;447 int ii, used; 448 448 449 449 if( peer->private || PEX_PEER_CUTOFF <= tor->peerCount ) … … 484 484 } 485 485 486 peer_dbg( "GET azureus-pex, %i peers", list->val.l.count ); 487 486 used = 0; 488 487 for( ii = 0; ii < list->val.l.count; ii++ ) 489 488 { … … 491 490 if( TYPE_STR == pair->type && 6 == pair->val.s.i ) 492 491 { 493 tr_torrentAddCompact( tor, TR_PEER_FROM_PEX, 494 ( uint8_t * )pair->val.s.s, 1 ); 495 } 496 } 492 used += tr_torrentAddCompact( tor, TR_PEER_FROM_PEX, 493 ( uint8_t * )pair->val.s.s, 1 ); 494 } 495 } 496 497 peer_dbg( "GET azureus-pex, found %i peers, using %i", 498 list->val.l.count, used ); 497 499 498 500 tr_bencFree( &val ); -
trunk/libtransmission/peerext.h
r1600 r1603 268 268 { 269 269 benc_val_t val, * sub; 270 int used; 270 271 271 272 if( peer->private || PEX_PEER_CUTOFF <= tor->peerCount ) … … 291 292 if( NULL != sub && TYPE_STR == sub->type && 0 == sub->val.s.i % 6 ) 292 293 { 293 peer_dbg( "GET extended-pex, %i peers", sub->val.s.i / 6 ); 294 tr_torrentAddCompact( tor, TR_PEER_FROM_PEX, 295 ( uint8_t * )sub->val.s.s, sub->val.s.i / 6 ); 294 used = tr_torrentAddCompact( tor, TR_PEER_FROM_PEX, 295 ( uint8_t * )sub->val.s.s, 296 sub->val.s.i / 6 ); 297 peer_dbg( "GET extended-pex, got %i peers, used %i", 298 sub->val.s.i / 6, used ); 296 299 } 297 300 else -
trunk/libtransmission/torrent.c
r1595 r1603 283 283 void tr_manualUpdate( tr_torrent_t * tor ) 284 284 { 285 int peerCount ;285 int peerCount, new; 286 286 uint8_t * peerCompact; 287 287 … … 291 291 tr_lockLock( &tor->lock ); 292 292 tr_trackerAnnouncePulse( tor->tracker, &peerCount, &peerCompact, 1 ); 293 new = 0; 293 294 if( peerCount > 0 ) 294 295 { 295 tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,296 new = tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER, 296 297 peerCompact, peerCount ); 297 298 free( peerCompact ); 298 299 } 300 tr_dbg( "got %i peers from manual announce, used %i", peerCount, new ); 299 301 tr_lockUnlock( &tor->lock ); 300 302 } … … 614 616 } 615 617 616 voidtr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer )618 int tr_torrentAttachPeer( tr_torrent_t * tor, tr_peer_t * peer ) 617 619 { 618 620 int i; … … 622 624 { 623 625 tr_peerDestroy( peer ); 624 return ;626 return 0; 625 627 } 626 628 … … 632 634 { 633 635 tr_peerDestroy( peer ); 634 return ;636 return 0; 635 637 } 636 638 } … … 639 641 tr_peerSetTorrent( peer, tor ); 640 642 tor->peers[tor->peerCount++] = peer; 641 } 642 643 void tr_torrentAddCompact( tr_torrent_t * tor, int from, 643 644 return 1; 645 } 646 647 int tr_torrentAddCompact( tr_torrent_t * tor, int from, 644 648 uint8_t * buf, int count ) 645 649 { 646 650 struct in_addr addr; 647 651 in_port_t port; 648 int i ;652 int i, added; 649 653 tr_peer_t * peer; 650 654 655 added = 0; 651 656 for( i = 0; i < count; i++ ) 652 657 { … … 655 660 656 661 peer = tr_peerInit( addr, port, -1, from ); 657 tr_torrentAttachPeer( tor, peer ); 658 } 662 added += tr_torrentAttachPeer( tor, peer ); 663 } 664 665 return added; 659 666 } 660 667 … … 666 673 tr_torrent_t * tor = _tor; 667 674 int i, ret; 668 int peerCount ;675 int peerCount, used; 669 676 uint8_t * peerCompact; 670 677 tr_peer_t * peer; … … 696 703 /* Try to get new peers or to send a message to the tracker */ 697 704 tr_trackerPulse( tor->tracker, &peerCount, &peerCompact ); 705 used = 0; 698 706 if( peerCount > 0 ) 699 707 { 700 tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER,701 peerCompact, peerCount );708 used = tr_torrentAddCompact( tor, TR_PEER_FROM_TRACKER, 709 peerCompact, peerCount ); 702 710 free( peerCompact ); 703 711 } 712 tr_dbg( "got %i peers from announce, used %i", peerCount, used ); 704 713 if( tor->status & TR_STATUS_STOPPED ) 705 714 {
Note: See TracChangeset
for help on using the changeset viewer.