2008-08-25 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Bump up version number of dht.dat file to 3. In version 3 
format, time
	is stored in 64bit, network byte order.
	New build can load old format(version 2) but it saves the file 
in new
	format. It means once you used new build, your dht.dat becomes
	incompatible with older build.
	* src/DHTRoutingTableDeserializer.cc
	* src/DHTRoutingTableSerializer.cc
	* test/DHTRoutingTableSerializerTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2008-08-25 11:55:30 +00:00
parent d9668e2c23
commit 15101a89a0
4 changed files with 51 additions and 17 deletions

View file

@ -66,15 +66,12 @@ void DHTRoutingTableSerializerTest::testSerialize()
CPPUNIT_ASSERT((char)0x00 == buf[5]);
// version
CPPUNIT_ASSERT((char)0x00 == buf[6]);
CPPUNIT_ASSERT((char)0x02 == buf[7]);
CPPUNIT_ASSERT((char)0x03 == buf[7]);
// time
ss.read(buf, 4);
time_t time = ntohl(*reinterpret_cast<uint32_t*>(buf));
ss.read(buf, 8);
time_t time = ntoh64(*reinterpret_cast<uint64_t*>(buf));
std::cerr << time << std::endl;
// 4bytes reserved
ss.read(buf, 4);
CPPUNIT_ASSERT(memcmp(zero, buf, 4) == 0);
// localnode
// 8bytes reserved