Ignore:
Timestamp:
Apr 21, 2009, 4:18:51 PM (13 years ago)
Author:
charles
Message:

(trunk libT) make sure that outbound protocol messages don't get blocked by bandwidth limits

File:
1 edited

Legend:

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

    r8217 r8265  
    4040
    4141static size_t
    42 getPacketOverhead( size_t d )
     42guessPacketOverhead( size_t d )
    4343{
    4444    /**
     
    9191        struct tr_datatype * next = __tr_list_entry( io->outbuf_datatypes.next, struct tr_datatype, head );
    9292        const size_t payload = MIN( next->length, bytes_transferred );
    93         const size_t overhead = getPacketOverhead( payload );
     93        const size_t overhead = guessPacketOverhead( payload );
    9494
    9595        tr_bandwidthUsed( &io->bandwidth, TR_UP, payload, next->isPieceData );
     
    848848}
    849849
     850int
     851tr_peerIoFlushOutgoingProtocolMsgs( tr_peerIo * io )
     852{
     853    size_t byteCount = 0;
     854    struct __tr_list * walk;
     855    struct __tr_list * fencepost = &io->outbuf_datatypes;
     856
     857    /* count up how many bytes are used by non-piece-data messages
     858       at the front of our outbound queue */
     859    for( walk=fencepost->next; walk!=fencepost; walk=walk->next ) {
     860        struct tr_datatype * d = __tr_list_entry( walk, struct tr_datatype, head );
     861        if( d->isPieceData )
     862            break;
     863        byteCount += d->length;
     864    }
     865
     866    return tr_peerIoFlush( io, TR_UP, byteCount );
     867}
     868
     869
    850870/***
    851871****
Note: See TracChangeset for help on using the changeset viewer.