mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-27 08:29:26 -05:00
Merge pull request #1494 from csoler/v0.6-FT
set default FT rate to some non zero value. Should start transfers faster. Needs testing!
This commit is contained in:
commit
af0ce1013f
@ -44,34 +44,40 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const double FT_TM_MAX_PEER_RATE = 100 * 1024 * 1024; /* 100MB/s */
|
||||
const double FT_TM_MAX_PEER_RATE = 100 * 1024 * 1024; /* 100MB/s */
|
||||
const uint32_t FT_TM_MAX_RESETS = 5;
|
||||
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
|
||||
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
|
||||
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
|
||||
//const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
|
||||
|
||||
// const double FT_TM_MAX_INCREASE = 1.00;
|
||||
// const double FT_TM_MIN_INCREASE = -0.10;
|
||||
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
|
||||
const uint32_t FT_TM_DEFAULT_TRANSFER_RATE = 20*1024; /* ie 20 Kb/sec */
|
||||
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
|
||||
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
|
||||
|
||||
const double FT_TM_RATE_INCREASE_SLOWER = 0.05 ;
|
||||
const double FT_TM_RATE_INCREASE_AVERAGE = 0.3 ;
|
||||
const double FT_TM_RATE_INCREASE_FASTER = 1.0 ;
|
||||
|
||||
//const int32_t FT_TM_FAST_RTT = 1.0;
|
||||
//const int32_t FT_TM_STD_RTT = 5.0;
|
||||
//const int32_t FT_TM_SLOW_RTT = 20.0;
|
||||
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
|
||||
//const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
|
||||
|
||||
#define FT_TM_FLAG_DOWNLOADING 0
|
||||
#define FT_TM_FLAG_CANCELED 1
|
||||
#define FT_TM_FLAG_COMPLETE 2
|
||||
#define FT_TM_FLAG_CHECKING 3
|
||||
#define FT_TM_FLAG_CHUNK_CRC 4
|
||||
|
||||
peerInfo::peerInfo(const RsPeerId& peerId_in)
|
||||
:peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(FT_TM_DEFAULT_TRANSFER_RATE),actualRate(FT_TM_DEFAULT_TRANSFER_RATE),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
}
|
||||
// peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
// peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
// lastTS(0),
|
||||
// recvTS(0), lastTransfers(0), nResets(0),
|
||||
// rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
// mRateIncrease(1)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
ftTransferModule::ftTransferModule(ftFileCreator *fc, ftDataMultiplex *dm, ftController *c)
|
||||
:mFileCreator(fc), mMultiplexor(dm), mFtController(c), tfMtx("ftTransferModule"), mFlag(FT_TM_FLAG_DOWNLOADING),mPriority(SPEED_NORMAL)
|
||||
{
|
||||
|
@ -54,39 +54,32 @@ class HashThread ;
|
||||
class peerInfo
|
||||
{
|
||||
public:
|
||||
explicit peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
lastTS(0),
|
||||
recvTS(0), lastTransfers(0), nResets(0),
|
||||
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
mRateIncrease(1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
explicit peerInfo(const RsPeerId& peerId_in);
|
||||
|
||||
// peerInfo(const RsPeerId& peerId_in,uint32_t state_in,uint32_t maxRate_in):
|
||||
// peerId(peerId_in),state(state_in),desiredRate(maxRate_in),actualRate(0),
|
||||
// lastTS(0),
|
||||
// recvTS(0), lastTransfers(0), nResets(0),
|
||||
// rtt(0), rttActive(false), rttStart(0), rttOffset(0),
|
||||
// mRateIncrease(1)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
RsPeerId peerId;
|
||||
uint32_t state;
|
||||
double desiredRate;
|
||||
double actualRate;
|
||||
double desiredRate; /* speed at which the data should be requested */
|
||||
double actualRate; /* actual speed at which the data is received */
|
||||
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
rstime_t lastTS; /* last Request */
|
||||
rstime_t recvTS; /* last Recv */
|
||||
uint32_t lastTransfers; /* data recvd in last second */
|
||||
uint32_t nResets; /* count to disable non-existant files */
|
||||
|
||||
/* rrt rate control */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate */
|
||||
uint32_t rtt; /* last rtt */
|
||||
bool rttActive; /* have we initialised an rtt measurement */
|
||||
rstime_t rttStart; /* ts of request */
|
||||
uint64_t rttOffset; /* end of request */
|
||||
float mRateIncrease; /* current rate increase factor */
|
||||
};
|
||||
|
||||
class ftFileStatus
|
||||
|
Loading…
Reference in New Issue
Block a user