2008-10-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Added length equality test to operator== to drop a piece message
	whose length does not match to the requested one.
	* src/RequestSlot.cc
	* test/DefaultBtMessageDispatcherTest.cc
pull/1/head
Tatsuhiro Tsujikawa 2008-10-19 14:57:58 +00:00
parent 2040d64fe5
commit c0c80adaa2
3 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2008-10-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added length equality test to operator== to drop a piece message
whose length does not match to the requested one.
* src/RequestSlot.cc
* test/DefaultBtMessageDispatcherTest.cc
2008-10-19 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that aria2 aborts when a request larger than 16KiB is

View File

@ -68,7 +68,8 @@ RequestSlot& RequestSlot::operator=(const RequestSlot& requestSlot)
bool RequestSlot::operator==(const RequestSlot& requestSlot) const
{
return index == requestSlot.index && begin == requestSlot.begin;
return index == requestSlot.index && begin == requestSlot.begin
&& length == requestSlot.length;
}
bool RequestSlot::operator!=(const RequestSlot& requestSlot) const

View File

@ -399,7 +399,7 @@ void DefaultBtMessageDispatcherTest::testGetOutstandingRequest() {
CPPUNIT_ASSERT(!RequestSlot::isNull(s2));
RequestSlot s3 = btMessageDispatcher->getOutstandingRequest(1, 1024, 17*1024);
CPPUNIT_ASSERT(!RequestSlot::isNull(s3));
CPPUNIT_ASSERT(RequestSlot::isNull(s3));
RequestSlot s4 = btMessageDispatcher->getOutstandingRequest(1, 2*1024, 16*1024);
CPPUNIT_ASSERT(RequestSlot::isNull(s4));