mirror of https://github.com/aria2/aria2
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use last 8 bytes of peer ID as 'key' parameter for tracker request. * src/DefaultBtAnnounce.cc * src/DefaultBtAnnounce.h * test/DefaultBtAnnounceTest.ccpull/1/head
parent
c44cf31df7
commit
3a1a8868d5
|
@ -1,3 +1,10 @@
|
||||||
|
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Use last 8 bytes of peer ID as 'key' parameter for tracker request.
|
||||||
|
* src/DefaultBtAnnounce.cc
|
||||||
|
* src/DefaultBtAnnounce.h
|
||||||
|
* test/DefaultBtAnnounceTest.cc
|
||||||
|
|
||||||
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2009-12-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Fixed the bug that connection is always dropped if handshake
|
Fixed the bug that connection is always dropped if handshake
|
||||||
|
|
|
@ -71,17 +71,11 @@ DefaultBtAnnounce::DefaultBtAnnounce
|
||||||
_randomizer(SimpleRandomizer::getInstance())
|
_randomizer(SimpleRandomizer::getInstance())
|
||||||
{
|
{
|
||||||
prevAnnounceTime.setTimeInSec(0);
|
prevAnnounceTime.setTimeInSec(0);
|
||||||
generateKey();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultBtAnnounce::~DefaultBtAnnounce() {
|
DefaultBtAnnounce::~DefaultBtAnnounce() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultBtAnnounce::generateKey()
|
|
||||||
{
|
|
||||||
key = util::randomAlpha(8, _randomizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DefaultBtAnnounce::isDefaultAnnounceReady() {
|
bool DefaultBtAnnounce::isDefaultAnnounceReady() {
|
||||||
return (trackers == 0 &&
|
return (trackers == 0 &&
|
||||||
prevAnnounceTime.elapsed(_userDefinedInterval==0?
|
prevAnnounceTime.elapsed(_userDefinedInterval==0?
|
||||||
|
@ -159,7 +153,10 @@ std::string DefaultBtAnnounce::getAnnounceUrl() {
|
||||||
url += util::uitos(left);
|
url += util::uitos(left);
|
||||||
url += "&compact=1";
|
url += "&compact=1";
|
||||||
url += "&key=";
|
url += "&key=";
|
||||||
url += key;
|
// Use last 8 bytes of peer ID as a key
|
||||||
|
size_t keyLen = 8;
|
||||||
|
url += util::torrentUrlencode
|
||||||
|
(bittorrent::getStaticPeerId()+PEER_ID_LENGTH-keyLen, keyLen);
|
||||||
url += "&numwant=";
|
url += "&numwant=";
|
||||||
url += util::uitos(numWant);
|
url += util::uitos(numWant);
|
||||||
url += "&no_peer_id=1";
|
url += "&no_peer_id=1";
|
||||||
|
|
|
@ -61,7 +61,6 @@ private:
|
||||||
unsigned int incomplete;
|
unsigned int incomplete;
|
||||||
AnnounceList announceList;
|
AnnounceList announceList;
|
||||||
std::string trackerId;
|
std::string trackerId;
|
||||||
std::string key;
|
|
||||||
const Option* option;
|
const Option* option;
|
||||||
Logger* logger;
|
Logger* logger;
|
||||||
SharedHandle<Randomizer> _randomizer;
|
SharedHandle<Randomizer> _randomizer;
|
||||||
|
@ -124,8 +123,6 @@ public:
|
||||||
|
|
||||||
virtual void overrideMinInterval(time_t interval);
|
virtual void overrideMinInterval(time_t interval);
|
||||||
|
|
||||||
void generateKey();
|
|
||||||
|
|
||||||
void setRandomizer(const SharedHandle<Randomizer>& randomizer);
|
void setRandomizer(const SharedHandle<Randomizer>& randomizer);
|
||||||
|
|
||||||
time_t getInterval() const
|
time_t getInterval() const
|
||||||
|
|
|
@ -133,37 +133,36 @@ void DefaultBtAnnounceTest::testNoMoreAnnounce()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceFailure();
|
btAnnounce.announceFailure();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_pieceStorage->setAllDownloadFinished(true);
|
_pieceStorage->setAllDownloadFinished(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_btRuntime->setHalt(true);
|
_btRuntime->setHalt(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
|
@ -182,25 +181,24 @@ void DefaultBtAnnounceTest::testGetAnnounceUrl()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_pieceStorage->setAllDownloadFinished(true);
|
_pieceStorage->setAllDownloadFinished(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_btRuntime->setHalt(true);
|
_btRuntime->setHalt(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultBtAnnounceTest::testGetAnnounceUrl_withQuery()
|
void DefaultBtAnnounceTest::testGetAnnounceUrl_withQuery()
|
||||||
|
@ -214,14 +212,13 @@ void DefaultBtAnnounceTest::testGetAnnounceUrl_withQuery()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL
|
CPPUNIT_ASSERT_EQUAL
|
||||||
(std::string("http://localhost/announce?k=v&"
|
(std::string("http://localhost/announce?k=v&"
|
||||||
"info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&"
|
"info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&"
|
||||||
"peer_id=%2Daria2%2Dultrafastdltl&"
|
"peer_id=%2Daria2%2Dultrafastdltl&"
|
||||||
"uploaded=1572864&downloaded=1310720&left=1572864&compact=1&"
|
"uploaded=1572864&downloaded=1310720&left=1572864&compact=1&"
|
||||||
"key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&"
|
"key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&"
|
||||||
"supportcrypto=1"),
|
"supportcrypto=1"),
|
||||||
btAnnounce.getAnnounceUrl());
|
btAnnounce.getAnnounceUrl());
|
||||||
}
|
}
|
||||||
|
@ -238,14 +235,13 @@ void DefaultBtAnnounceTest::testGetAnnounceUrl_externalIP()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL
|
CPPUNIT_ASSERT_EQUAL
|
||||||
(std::string("http://localhost/announce?"
|
(std::string("http://localhost/announce?"
|
||||||
"info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&"
|
"info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&"
|
||||||
"peer_id=%2Daria2%2Dultrafastdltl&"
|
"peer_id=%2Daria2%2Dultrafastdltl&"
|
||||||
"uploaded=1572864&downloaded=1310720&left=1572864&compact=1&"
|
"uploaded=1572864&downloaded=1310720&left=1572864&compact=1&"
|
||||||
"key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&"
|
"key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&"
|
||||||
"supportcrypto=1&ip=192.168.1.1"),
|
"supportcrypto=1&ip=192.168.1.1"),
|
||||||
btAnnounce.getAnnounceUrl());
|
btAnnounce.getAnnounceUrl());
|
||||||
}
|
}
|
||||||
|
@ -262,13 +258,12 @@ void DefaultBtAnnounceTest::testIsAllAnnounceFailed()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceFailure();
|
btAnnounce.announceFailure();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://backup/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceFailure();
|
btAnnounce.announceFailure();
|
||||||
|
|
||||||
|
@ -295,19 +290,18 @@ void DefaultBtAnnounceTest::testURLOrderInStoppedEvent()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_btRuntime->setHalt(true);
|
_btRuntime->setHalt(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceFailure();
|
btAnnounce.announceFailure();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost2/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost2/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=0&no_peer_id=1&port=6989&event=stopped&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
}
|
}
|
||||||
|
@ -326,19 +320,18 @@ void DefaultBtAnnounceTest::testURLOrderInCompletedEvent()
|
||||||
btAnnounce.setPeerStorage(_peerStorage);
|
btAnnounce.setPeerStorage(_peerStorage);
|
||||||
btAnnounce.setBtRuntime(_btRuntime);
|
btAnnounce.setBtRuntime(_btRuntime);
|
||||||
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
btAnnounce.setRandomizer(SharedHandle<Randomizer>(new FixedNumberRandomizer()));
|
||||||
btAnnounce.generateKey();
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=started&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
|
|
||||||
_pieceStorage->setAllDownloadFinished(true);
|
_pieceStorage->setAllDownloadFinished(true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost1/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceFailure();
|
btAnnounce.announceFailure();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost2/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=AAAAAAAA&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
CPPUNIT_ASSERT_EQUAL(std::string("http://localhost2/announce?info_hash=%01%23Eg%89%AB%CD%EF%01%23Eg%89%AB%CD%EF%01%23Eg&peer_id=%2Daria2%2Dultrafastdltl&uploaded=1572864&downloaded=1310720&left=1572864&compact=1&key=fastdltl&numwant=50&no_peer_id=1&port=6989&event=completed&supportcrypto=1"), btAnnounce.getAnnounceUrl());
|
||||||
|
|
||||||
btAnnounce.announceSuccess();
|
btAnnounce.announceSuccess();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue