Changeset 7171 for trunk/libtransmission/peer-io.c
- Timestamp:
- Nov 28, 2008, 4:00:29 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/peer-io.c
r7159 r7171 530 530 **/ 531 531 532 static size_t 533 getDesiredOutputBufferSize( const tr_peerIo * io ) 534 { 535 /* this is all kind of arbitrary, but what seems to work well is 536 * being large enough to hold the next 15 seconds' worth of input, 537 * or two and a half blocks, whichever is bigger. 538 * It's okay to tweak this as needed */ 539 const double maxBlockSize = 16 * 1024; /* 16 KiB is from BT spec */ 540 const double currentSpeed = tr_bandwidthGetPieceSpeed( io->bandwidth, TR_UP ); 541 const double period = 20; /* arbitrary */ 542 return MAX( maxBlockSize*2.5, currentSpeed*1024*period ); 543 } 544 532 545 size_t 533 546 tr_peerIoGetWriteBufferSpace( const tr_peerIo * io ) 534 547 { 535 const size_t desiredLen = io->session->so_sndbuf * 2; /* FIXME: bigger? */548 const size_t desiredLen = getDesiredOutputBufferSize( io ); 536 549 const size_t currentLen = EVBUFFER_LENGTH( tr_iobuf_output( io->iobuf ) ); 537 550 size_t freeSpace = 0;
Note: See TracChangeset
for help on using the changeset viewer.