mirror of https://github.com/aria2/aria2
2010-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Don't use hash for Peer::id. Simple concatenation of ip address and port is enough. * src/Peer.cc * test/PeerTest.ccpull/1/head
parent
b55f2de8e6
commit
db4ed87f7a
|
@ -1,3 +1,10 @@
|
|||
2010-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Don't use hash for Peer::id. Simple concatenation of ip address
|
||||
and port is enough.
|
||||
* src/Peer.cc
|
||||
* test/PeerTest.cc
|
||||
|
||||
2010-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Enclosed log of DHTMessage::toString() with Logger::info().
|
||||
|
|
12
src/Peer.cc
12
src/Peer.cc
|
@ -40,9 +40,6 @@
|
|||
#include "util.h"
|
||||
#include "a2functional.h"
|
||||
#include "PeerSessionResource.h"
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
# include "MessageDigestHelper.h"
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
#include "BtMessageDispatcher.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -60,13 +57,8 @@ Peer::Peer(std::string ipaddr, uint16_t port, bool incoming):
|
|||
{
|
||||
memset(_peerId, 0, PEER_ID_LENGTH);
|
||||
resetStatus();
|
||||
std::string idSeed = ipaddr;
|
||||
strappend(idSeed, ":", util::uitos(port));
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
id = MessageDigestHelper::digestString(MessageDigestContext::SHA1, idSeed);
|
||||
#else
|
||||
id = idSeed;
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
id = ipaddr;
|
||||
strappend(id, A2STR::COLON_C, util::uitos(port));
|
||||
}
|
||||
|
||||
Peer::~Peer()
|
||||
|
|
|
@ -43,8 +43,7 @@ void PeerTest::testAmAllowedIndexSet() {
|
|||
}
|
||||
|
||||
void PeerTest::testGetId() {
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("f05897fc14a41cb3400e283e189158656d7184da"),
|
||||
peer->getID());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("localhost:6969"), peer->getID());
|
||||
}
|
||||
|
||||
void PeerTest::testOperatorEqual()
|
||||
|
|
Loading…
Reference in New Issue