Ignore:
Timestamp:
Dec 22, 2008, 12:52:44 AM (12 years ago)
Author:
charles
Message:

(trunk libT) minor cleanups found while diffing for backport to 1.4x in r7455

File:
1 edited

Legend:

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

    r7448 r7456  
    402402
    403403static void
    404 protocolSendRequest( tr_peermsgs *              msgs,
     404protocolSendRequest( tr_peermsgs               * msgs,
    405405                     const struct peer_request * req )
    406406{
     
    420420
    421421static void
    422 protocolSendCancel( tr_peermsgs *              msgs,
     422protocolSendCancel( tr_peermsgs               * msgs,
    423423                    const struct peer_request * req )
    424424{
     
    448448    tr_peerIoWriteUint32( io, out, index );
    449449
    450     dbgmsg( msgs, "sending Have %u...", index );
     450    dbgmsg( msgs, "sending Have %u", index );
    451451    dbgOutMessageLen( msgs );
    452452    pokeBatchPeriod( msgs, LOW_PRIORITY_INTERVAL_SECS );
     
    773773    tr_peerIoWriteUint32( msgs->peer->io, out, sizeof( uint8_t ) );
    774774    tr_peerIoWriteUint8 ( msgs->peer->io, out, weAreInterested ? BT_INTERESTED : BT_NOT_INTERESTED );
     775
    775776    pokeBatchPeriod( msgs, HIGH_PRIORITY_INTERVAL_SECS );
    776777    dbgOutMessageLen( msgs );
     
    876877    oldestAllowed = now - QUEUED_REQUEST_TTL_SECS;
    877878    reqListCopy( &tmp, &msgs->clientWillAskFor );
    878     for( i = 0; i < tmp.count; ++i ) {
     879    for( i=0; i<tmp.count; ++i ) {
    879880        const struct peer_request * req = &tmp.requests[i];
    880881        if( req->time_requested < oldestAllowed )
     
    934935    if( sent )
    935936        dbgmsg( msgs, "pump sent %d requests, now have %d active and %d queued",
    936                 sent,
    937                 msgs->clientAskedFor.count,
    938                 msgs->clientWillAskFor.count );
     937                sent, msgs->clientAskedFor.count, msgs->clientWillAskFor.count );
    939938
    940939    if( count < max )
     
    953952                       uint32_t         index,
    954953                       uint32_t         offset,
    955                        uint32_t         length,
    956                        int              doForce )
     954                       uint32_t         length )
    957955{
    958956    struct peer_request req;
     
    967965
    968966    /* don't send requests to choked clients */
    969     if( !doForce && msgs->peer->clientIsChoked ) {
     967    if( msgs->peer->clientIsChoked ) {
    970968        dbgmsg( msgs, "declining request because they're choking us" );
    971969        return TR_ADDREQ_CLIENT_CHOKED;
     
    973971
    974972    /* peer doesn't have this piece */
    975     if( !doForce && !tr_bitfieldHas( msgs->peer->have, index ) )
     973    if( !tr_bitfieldHas( msgs->peer->have, index ) )
    976974        return TR_ADDREQ_MISSING;
    977975
    978976    /* peer's queue is full */
    979     if( !doForce && requestQueueIsFull( msgs ) ) {
     977    if( requestQueueIsFull( msgs ) ) {
    980978        dbgmsg( msgs, "declining request because we're full" );
    981979        return TR_ADDREQ_FULL;
     
    986984    req.offset = offset;
    987985    req.length = length;
    988     if( !doForce ) {
    989         if( reqListFind( &msgs->clientAskedFor, &req ) != -1 ) {
    990             dbgmsg( msgs, "declining because it's a duplicate" );
    991             return TR_ADDREQ_DUPLICATE;
    992         }
    993         if( reqListFind( &msgs->clientWillAskFor, &req ) != -1 ) {
    994             dbgmsg( msgs, "declining because it's a duplicate" );
    995             return TR_ADDREQ_DUPLICATE;
    996         }
     986    if( reqListFind( &msgs->clientAskedFor, &req ) != -1 ) {
     987        dbgmsg( msgs, "declining because it's a duplicate" );
     988        return TR_ADDREQ_DUPLICATE;
     989    }
     990    if( reqListFind( &msgs->clientWillAskFor, &req ) != -1 ) {
     991        dbgmsg( msgs, "declining because it's a duplicate" );
     992        return TR_ADDREQ_DUPLICATE;
    997993    }
    998994
     
    15821578            break;
    15831579
    1584 
    15851580        case BT_FEXT_HAVE_NONE:
    15861581            dbgmsg( msgs, "Got a BT_FEXT_HAVE_NONE" );
     
    17811776    size_t bytesWritten = 0;
    17821777    struct peer_request req;
    1783     const int haveMessages = EVBUFFER_LENGTH( msgs->outMessages ) != 0;
     1778    const tr_bool haveMessages = EVBUFFER_LENGTH( msgs->outMessages ) != 0;
    17841779    const tr_bool fext = tr_peerIoSupportsFEXT( msgs->peer->io );
    17851780
     
    18811876tr_peerMsgsPulse( tr_peermsgs * msgs )
    18821877{
    1883     if( msgs )
     1878    if( msgs != NULL )
    18841879        peerPulse( msgs );
    18851880}
     
    22032198tr_peermsgs*
    22042199tr_peerMsgsNew( struct tr_torrent * torrent,
    2205                 struct tr_peer *    peer,
     2200                struct tr_peer    * peer,
    22062201                tr_delivery_func    func,
    2207                 void *              userData,
    2208                 tr_publisher_tag * setme )
     2202                void              * userData,
     2203                tr_publisher_tag  * setme )
    22092204{
    22102205    tr_peermsgs * m;
Note: See TracChangeset for help on using the changeset viewer.