mirror of
https://github.com/transmission/transmission
synced 2025-02-21 13:46:52 +00:00
(trunk libT) define MAX_BLOCK_SIZE once instead of in a handful of places
This commit is contained in:
parent
e3148e85fc
commit
b0b9e17032
4 changed files with 11 additions and 11 deletions
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef __TRANSMISSION__
|
||||
#error only libtransmission should #include this header.
|
||||
#error only libtransmission should #include this header.
|
||||
#endif
|
||||
|
||||
#ifndef TR_PEER_H
|
||||
|
@ -33,7 +33,13 @@ enum
|
|||
/** when we're making requests from another peer,
|
||||
batch them together to send enough requests to
|
||||
meet our bandwidth goals for the next N seconds */
|
||||
REQUEST_BUF_SECS = 10
|
||||
REQUEST_BUF_SECS = 10,
|
||||
|
||||
/** this is the maximum size of a block request.
|
||||
most bittorrent clients will reject requests
|
||||
larger than this size. */
|
||||
MAX_BLOCK_SIZE = ( 1024 * 16 )
|
||||
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "crypto.h"
|
||||
#include "list.h"
|
||||
#include "net.h"
|
||||
#include "peer-common.h" /* MAX_BLOCK_SIZE */
|
||||
#include "peer-io.h"
|
||||
#include "trevent.h" /* tr_runInEventThread() */
|
||||
#include "utils.h"
|
||||
|
@ -720,11 +721,10 @@ getDesiredOutputBufferSize( const tr_peerIo * io, uint64_t now )
|
|||
* being large enough to hold the next 20 seconds' worth of input,
|
||||
* or a few blocks, whichever is bigger.
|
||||
* It's okay to tweak this as needed */
|
||||
const double maxBlockSize = 16 * 1024; /* 16 KiB is from BT spec */
|
||||
const double currentSpeed = tr_bandwidthGetPieceSpeed( &io->bandwidth, now, TR_UP );
|
||||
const double period = 15; /* arbitrary */
|
||||
const double numBlocks = 3.5; /* the 3 is arbitrary; the .5 is to leave room for messages */
|
||||
return MAX( maxBlockSize*numBlocks, currentSpeed*1024*period );
|
||||
return MAX( MAX_BLOCK_SIZE*numBlocks, currentSpeed*1024*period );
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
@ -82,8 +82,6 @@ enum
|
|||
|
||||
METADATA_REQQ = 64,
|
||||
|
||||
MAX_BLOCK_SIZE = ( 1024 * 16 ),
|
||||
|
||||
/* used in lowering the outMessages queue period */
|
||||
IMMEDIATE_PRIORITY_INTERVAL_SECS = 0,
|
||||
HIGH_PRIORITY_INTERVAL_SECS = 2,
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "fdlimit.h" /* tr_fdTorrentClose */
|
||||
#include "magnet.h"
|
||||
#include "metainfo.h"
|
||||
#include "peer-common.h" /* MAX_BLOCK_SIZE */
|
||||
#include "peer-mgr.h"
|
||||
#include "platform.h" /* TR_PATH_DELIMITER_STR */
|
||||
#include "ptrarray.h"
|
||||
|
@ -46,11 +47,6 @@
|
|||
#include "verify.h"
|
||||
#include "version.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_BLOCK_SIZE = 1024 * 16
|
||||
};
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
|
Loading…
Reference in a new issue