mirror of https://github.com/aria2/aria2
2010-02-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed unused PeerSessionResource::_latency. * src/BtConstants.h * src/BtPieceMessage.cc * src/Peer.cc * src/Peer.h * src/PeerSessionResource.cc * src/PeerSessionResource.h * test/PeerSessionResourceTest.ccpull/1/head
parent
978258d2a4
commit
da682bd6bd
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2010-02-08 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Removed unused PeerSessionResource::_latency.
|
||||||
|
* src/BtConstants.h
|
||||||
|
* src/BtPieceMessage.cc
|
||||||
|
* src/Peer.cc
|
||||||
|
* src/Peer.h
|
||||||
|
* src/PeerSessionResource.cc
|
||||||
|
* src/PeerSessionResource.h
|
||||||
|
* test/PeerSessionResourceTest.cc
|
||||||
|
|
||||||
2010-02-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-02-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the bug that --file-allocation=falloc doesn't work with
|
Fixed the bug that --file-allocation=falloc doesn't work with
|
||||||
|
|
|
@ -49,8 +49,6 @@ typedef std::map<std::string, uint8_t> Extensions;
|
||||||
|
|
||||||
#define INFO_HASH_LENGTH 20
|
#define INFO_HASH_LENGTH 20
|
||||||
|
|
||||||
#define DEFAULT_LATENCY 1500
|
|
||||||
|
|
||||||
#define MAX_BLOCK_LENGTH (16*1024)
|
#define MAX_BLOCK_LENGTH (16*1024)
|
||||||
|
|
||||||
#define DEFAULT_MAX_OUTSTANDING_REQUEST 6
|
#define DEFAULT_MAX_OUTSTANDING_REQUEST 6
|
||||||
|
|
|
@ -86,7 +86,6 @@ void BtPieceMessage::doReceivedAction() {
|
||||||
peer->updateDownloadLength(blockLength);
|
peer->updateDownloadLength(blockLength);
|
||||||
if(!RequestSlot::isNull(slot)) {
|
if(!RequestSlot::isNull(slot)) {
|
||||||
peer->snubbing(false);
|
peer->snubbing(false);
|
||||||
peer->updateLatency(slot.getLatencyInMillis());
|
|
||||||
PieceHandle piece = pieceStorage->getPiece(index);
|
PieceHandle piece = pieceStorage->getPiece(index);
|
||||||
off_t offset = (off_t)index*_downloadContext->getPieceLength()+begin;
|
off_t offset = (off_t)index*_downloadContext->getPieceLength()+begin;
|
||||||
logger->debug(MSG_PIECE_RECEIVED,
|
logger->debug(MSG_PIECE_RECEIVED,
|
||||||
|
|
12
src/Peer.cc
12
src/Peer.cc
|
@ -335,18 +335,6 @@ void Peer::setAllBitfield() {
|
||||||
_seeder = true;
|
_seeder = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Peer::updateLatency(unsigned int latency)
|
|
||||||
{
|
|
||||||
assert(_res);
|
|
||||||
_res->updateLatency(latency);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int Peer::getLatency() const
|
|
||||||
{
|
|
||||||
assert(_res);
|
|
||||||
return _res->latency();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Peer::startBadCondition()
|
void Peer::startBadCondition()
|
||||||
{
|
{
|
||||||
_badConditionStartTime.reset();
|
_badConditionStartTime.reset();
|
||||||
|
|
|
@ -263,10 +263,6 @@ public:
|
||||||
|
|
||||||
bool hasPiece(size_t index) const;
|
bool hasPiece(size_t index) const;
|
||||||
|
|
||||||
void updateLatency(unsigned int latency);
|
|
||||||
|
|
||||||
unsigned int getLatency() const;
|
|
||||||
|
|
||||||
uint8_t getExtensionMessageID(const std::string& name) const;
|
uint8_t getExtensionMessageID(const std::string& name) const;
|
||||||
|
|
||||||
std::string getExtensionName(uint8_t id) const;
|
std::string getExtensionName(uint8_t id) const;
|
||||||
|
|
|
@ -56,7 +56,6 @@ PeerSessionResource::PeerSessionResource(size_t pieceLength, uint64_t totalLengt
|
||||||
_fastExtensionEnabled(false),
|
_fastExtensionEnabled(false),
|
||||||
_extendedMessagingEnabled(false),
|
_extendedMessagingEnabled(false),
|
||||||
_dhtEnabled(false),
|
_dhtEnabled(false),
|
||||||
_latency(DEFAULT_LATENCY),
|
|
||||||
_lastDownloadUpdate(0),
|
_lastDownloadUpdate(0),
|
||||||
_lastAmUnchoking(0)
|
_lastAmUnchoking(0)
|
||||||
{}
|
{}
|
||||||
|
@ -235,11 +234,6 @@ void PeerSessionResource::dhtEnabled(bool b)
|
||||||
_dhtEnabled = b;
|
_dhtEnabled = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerSessionResource::updateLatency(unsigned int latency)
|
|
||||||
{
|
|
||||||
_latency = static_cast<unsigned int>(_latency*0.2+latency*0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t PeerSessionResource::uploadLength() const
|
uint64_t PeerSessionResource::uploadLength() const
|
||||||
{
|
{
|
||||||
return _peerStat.getSessionUploadLength();
|
return _peerStat.getSessionUploadLength();
|
||||||
|
|
|
@ -74,7 +74,6 @@ private:
|
||||||
Extensions _extensions;
|
Extensions _extensions;
|
||||||
bool _dhtEnabled;
|
bool _dhtEnabled;
|
||||||
PeerStat _peerStat;
|
PeerStat _peerStat;
|
||||||
unsigned int _latency;
|
|
||||||
|
|
||||||
Time _lastDownloadUpdate;
|
Time _lastDownloadUpdate;
|
||||||
|
|
||||||
|
@ -207,13 +206,6 @@ public:
|
||||||
return _peerStat;
|
return _peerStat;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int latency() const
|
|
||||||
{
|
|
||||||
return _latency;
|
|
||||||
}
|
|
||||||
|
|
||||||
void updateLatency(unsigned int latency);
|
|
||||||
|
|
||||||
uint64_t uploadLength() const;
|
uint64_t uploadLength() const;
|
||||||
|
|
||||||
void updateUploadLength(size_t bytes);
|
void updateUploadLength(size_t bytes);
|
||||||
|
|
|
@ -17,7 +17,6 @@ class PeerSessionResourceTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST(testHasPiece);
|
CPPUNIT_TEST(testHasPiece);
|
||||||
CPPUNIT_TEST(testUpdateUploadLength);
|
CPPUNIT_TEST(testUpdateUploadLength);
|
||||||
CPPUNIT_TEST(testUpdateDownloadLength);
|
CPPUNIT_TEST(testUpdateDownloadLength);
|
||||||
CPPUNIT_TEST(testUpdateLatency);
|
|
||||||
CPPUNIT_TEST(testExtendedMessageEnabled);
|
CPPUNIT_TEST(testExtendedMessageEnabled);
|
||||||
CPPUNIT_TEST(testGetExtensionMessageID);
|
CPPUNIT_TEST(testGetExtensionMessageID);
|
||||||
CPPUNIT_TEST(testFastExtensionEnabled);
|
CPPUNIT_TEST(testFastExtensionEnabled);
|
||||||
|
@ -42,7 +41,6 @@ public:
|
||||||
void testHasPiece();
|
void testHasPiece();
|
||||||
void testUpdateUploadLength();
|
void testUpdateUploadLength();
|
||||||
void testUpdateDownloadLength();
|
void testUpdateDownloadLength();
|
||||||
void testUpdateLatency();
|
|
||||||
void testExtendedMessageEnabled();
|
void testExtendedMessageEnabled();
|
||||||
void testGetExtensionMessageID();
|
void testGetExtensionMessageID();
|
||||||
void testFastExtensionEnabled();
|
void testFastExtensionEnabled();
|
||||||
|
@ -124,15 +122,6 @@ void PeerSessionResourceTest::testUpdateDownloadLength()
|
||||||
CPPUNIT_ASSERT_EQUAL((uint64_t)300ULL, res.downloadLength());
|
CPPUNIT_ASSERT_EQUAL((uint64_t)300ULL, res.downloadLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerSessionResourceTest::testUpdateLatency()
|
|
||||||
{
|
|
||||||
PeerSessionResource res(1024, 1024*1024);
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL((unsigned int)1500, res.latency());
|
|
||||||
res.updateLatency(1000);
|
|
||||||
CPPUNIT_ASSERT_EQUAL((unsigned int)1100, res.latency());
|
|
||||||
}
|
|
||||||
|
|
||||||
void PeerSessionResourceTest::testExtendedMessageEnabled()
|
void PeerSessionResourceTest::testExtendedMessageEnabled()
|
||||||
{
|
{
|
||||||
PeerSessionResource res(1024, 1024*1024);
|
PeerSessionResource res(1024, 1024*1024);
|
||||||
|
|
Loading…
Reference in New Issue