2008-02-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Added DHT functionality, compatible with mainline.
	DHT is disabled by default. To enable it, give --enable-dht to 
aria2c.
	You may need to specify entry point to DHT network using
	--dht-entry-point. DHT uses UDP port to listen incoming message.
	Use --dht-listen-port to specify port number. Make sure that 
your
	firewall configuration can pass through UDP traffic to the port.
	The routing table is saved in $HOME/.aria2/dht.dat.
	* src/DHT*
	* src/BNode.{h, cc}
	* src/PeerInteractionCommand.cc: enable DHT functionality for a
	particular torrent.
	* src/Data.cc: Rewritten ctor.
	* src/OptionHandlerFactory.cc: Added --enable-dht, 
--dht-listen-port,
	--dht-entry-point.
	* src/DefaultBtInteractive.cc: Send port message if dht is 
enabled.
	* src/RequestGroup.cc: Initialize DHT functionality. When 
download
	ends, remove BtContext from DHTPeerAnnounceStorage.
	* src/BtPortMessage.{h, cc}: Rewritten.
	* src/message.h
	* src/OptionHandlerImpl.cc
	* src/option_processing.cc: Added --enable-dht, 
--dht-listen-port,
	--dht-entry-point.
	* src/Dictionary.{h, cc} (remove): New function.
	* src/prefs.h
	* src/DefaultBtMessageFactory.h
	* src/BtHandshakeMessage.cc
	* src/ActivePeerConnectionCommand.cc
	* src/SocketCore.{h, cc}: Added datagram socket support.
	* src/DefaultBtMessageFactory.cc
	* src/BtSetup.cc: Add BtContext to DHTPeerAnnounceStorage here.
	Create DHT commands.
	* src/BtMessageFactory.h
	* src/PeerMessageUtil.{h, cc}
This commit is contained in:
Tatsuhiro Tsujikawa 2008-02-01 17:36:33 +00:00
parent 0bce06348e
commit 0f13363229
209 changed files with 14405 additions and 117 deletions

View file

@ -11,6 +11,7 @@ class BtHandshakeMessageTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testCreate);
CPPUNIT_TEST(testGetMessage);
CPPUNIT_TEST(testToString);
CPPUNIT_TEST(testSetDHTEnabled);
CPPUNIT_TEST_SUITE_END();
private:
@ -21,6 +22,7 @@ public:
void testCreate();
void testGetMessage();
void testToString();
void testSetDHTEnabled();
static string BTPSTR;
};
@ -100,3 +102,13 @@ void BtHandshakeMessageTest::testToString() {
CPPUNIT_ASSERT_EQUAL(string("handshake peerId=%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0%f0, reserved=0000000000100004"), msg.toString());
}
void BtHandshakeMessageTest::testSetDHTEnabled()
{
BtHandshakeMessage msg;
CPPUNIT_ASSERT(!msg.isDHTEnabled());
msg.setDHTEnabled(false);
CPPUNIT_ASSERT(!msg.isDHTEnabled());
msg.setDHTEnabled(true);
CPPUNIT_ASSERT(msg.isDHTEnabled());
}