Ignore:
Timestamp:
Sep 27, 2007, 3:03:38 AM (15 years ago)
Author:
charles
Message:

some experimental code. (1) try to improve throughput to peers. (2) add first draft of new tr_stat fields requested by BentMyWookie? (3) raise the per-torrent peer limit to 100 to match LibTorrent?'s defaults

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-mgr.c

    r3184 r3197  
    6969    /* this is arbitrary and, hopefully, temporary until we come up
    7070     * with a better idea for managing the connection limits */
    71     MAX_CONNECTED_PEERS_PER_TORRENT = 60,
     71    MAX_CONNECTED_PEERS_PER_TORRENT = 100,
    7272
    7373    /* if we hang up on a peer for being worthless, don't try to
     
    651651
    652652        case TR_PEERMSG_PEER_PROGRESS: { /* if we're both seeds, then disconnect. */
     653#if 0
    653654            const int clientIsSeed = tr_cpGetStatus( t->tor->completion ) != TR_CP_INCOMPLETE;
    654655            const int peerIsSeed = e->progress >= 1.0;
    655656            if( clientIsSeed && peerIsSeed )
    656657                peer->doPurge = 1;
     658#endif
    657659            break;
    658660        }
     
    967969}
    968970
     971/* Returns the pieces that we and/or a connected peer has */
     972tr_bitfield*
     973tr_peerMgrGetAvailable( const tr_peerMgr * manager,
     974                        const uint8_t    * torrentHash )
     975{
     976    int i, size;
     977    const Torrent * t;
     978    const tr_peer ** peers;
     979    tr_bitfield * pieces;
     980
     981    t = getExistingTorrent( (tr_peerMgr*)manager, torrentHash );
     982    peers = (const tr_peer **) tr_ptrArrayPeek( t->peers, &size );
     983    pieces = tr_bitfieldDup( tr_cpPieceBitfield( t->tor->completion ) );
     984    for( i=0; i<size; ++i )
     985        if( peers[i]->io != NULL )
     986            tr_bitfieldAnd( pieces, peers[i]->have );
     987
     988    return pieces;
     989}
    969990
    970991void
Note: See TracChangeset for help on using the changeset viewer.