Ignore:
Timestamp:
Jul 28, 2007, 3:43:34 PM (15 years ago)
Author:
charles
Message:

a nice patch that makes the three most CPU-hogging functions (as reported by Shark) essentially free and reduces memory overhead by 8 bytes per piece per torrent. Lots of asserts for extra testing fun.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peerparse.h

    r2496 r2531  
    224224        return TR_ERROR_ASSERT;
    225225    }
    226     if( tr_pieceSize( index ) < begin + length )
     226    if( tr_torPieceCountBytes( tor, index ) < begin + length )
    227227    {
    228228        peer_dbg( "GET  request, invalid begin/length" );
     
    302302        return TR_ERROR_ASSERT;
    303303    }
    304     if( tr_pieceSize( index ) < begin + len - 8 )
     304    if( tr_torPieceCountBytes( tor, index ) < begin + len - 8 )
    305305    {
    306306        peer_dbg( "GET  piece, invalid begin/length" );
     
    316316
    317317    /* Sanity checks */
    318     if( len - 8 != tr_blockSize( block ) )
    319     {
    320         peer_dbg( "wrong size (expecting %d)", tr_blockSize( block ) );
     318    if( len - 8 != tr_torBlockCountBytes( tor, block ) )
     319    {
     320        peer_dbg( "wrong size (expecting %d)", tr_torBlockCountBytes( tor, block ) );
    321321        return TR_ERROR_ASSERT;
    322322    }
     
    406406        return TR_ERROR_ASSERT;
    407407    }
    408     if( tr_pieceSize( index ) < begin + length )
     408    if( tr_torPieceCountBytes( tor, index ) < begin + length )
    409409    {
    410410        peer_dbg( "GET  cancel, invalid begin/length" );
Note: See TracChangeset for help on using the changeset viewer.