Changeset 10694


Ignore:
Timestamp:
May 26, 2010, 3:23:21 PM (12 years ago)
Author:
charles
Message:

(trunk libT) define MAX_BLOCK_SIZE once instead of in a handful of places

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-common.h

    r10500 r10694  
    1212
    1313#ifndef __TRANSMISSION__
    14 #error only libtransmission should #include this header.
     14 #error only libtransmission should #include this header.
    1515#endif
    1616
     
    3434        batch them together to send enough requests to
    3535        meet our bandwidth goals for the next N seconds */
    36     REQUEST_BUF_SECS = 10
     36    REQUEST_BUF_SECS = 10,
     37
     38    /** this is the maximum size of a block request.
     39        most bittorrent clients will reject requests
     40        larger than this size. */
     41    MAX_BLOCK_SIZE = ( 1024 * 16 )
     42   
    3743};
    3844
  • trunk/libtransmission/peer-io.c

    r10671 r10694  
    3232#include "list.h"
    3333#include "net.h"
     34#include "peer-common.h" /* MAX_BLOCK_SIZE */
    3435#include "peer-io.h"
    3536#include "trevent.h" /* tr_runInEventThread() */
     
    721722     * or a few blocks, whichever is bigger.
    722723     * It's okay to tweak this as needed */
    723     const double maxBlockSize = 16 * 1024; /* 16 KiB is from BT spec */
    724724    const double currentSpeed = tr_bandwidthGetPieceSpeed( &io->bandwidth, now, TR_UP );
    725725    const double period = 15; /* arbitrary */
    726726    const double numBlocks = 3.5; /* the 3 is arbitrary; the .5 is to leave room for messages */
    727     return MAX( maxBlockSize*numBlocks, currentSpeed*1024*period );
     727    return MAX( MAX_BLOCK_SIZE*numBlocks, currentSpeed*1024*period );
    728728}
    729729
  • trunk/libtransmission/peer-msgs.c

    r10553 r10694  
    8282
    8383    METADATA_REQQ           = 64,
    84 
    85     MAX_BLOCK_SIZE          = ( 1024 * 16 ),
    8684
    8785    /* used in lowering the outMessages queue period */
  • trunk/libtransmission/torrent.c

    r10692 r10694  
    3636#include "magnet.h"
    3737#include "metainfo.h"
     38#include "peer-common.h" /* MAX_BLOCK_SIZE */
    3839#include "peer-mgr.h"
    3940#include "platform.h" /* TR_PATH_DELIMITER_STR */
     
    4647#include "verify.h"
    4748#include "version.h"
    48 
    49 enum
    50 {
    51     MAX_BLOCK_SIZE = 1024 * 16
    52 };
    5349
    5450/***
Note: See TracChangeset for help on using the changeset viewer.