2010-02-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Return SharedHandle<LpdMessage>(new LpdMessage()) if received data
	is bad in LpdMessageReceiver.
	* src/LpdMessage.h
	* src/LpdMessageReceiver.cc
	* src/LpdMessageReceiver.h
	* src/LpdReceiveMessageCommand.cc
	* test/LpdMessageReceiverTest.cc
This commit is contained in:
Tatsuhiro Tsujikawa 2010-02-22 16:11:33 +00:00
parent 6ae5882f3c
commit 232deb47b5
6 changed files with 37 additions and 5 deletions

View file

@ -60,7 +60,10 @@ void LpdMessageReceiverTest::testReceiveMessage()
sendsock->writeData(request.c_str(), request.size(),
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
CPPUNIT_ASSERT(rcv.receiveMessage().isNull());
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(!msg.isNull());
CPPUNIT_ASSERT(msg->getPeer().isNull());
CPPUNIT_ASSERT(msg->getInfoHash().empty());
// Bad port
request =
@ -70,7 +73,14 @@ void LpdMessageReceiverTest::testReceiveMessage()
sendsock->writeData(request.c_str(), request.size(),
LPD_MULTICAST_ADDR, LPD_MULTICAST_PORT);
CPPUNIT_ASSERT(rcv.receiveMessage().isNull());
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(!msg.isNull());
CPPUNIT_ASSERT(msg->getPeer().isNull());
CPPUNIT_ASSERT(msg->getInfoHash().empty());
// No data available
msg = rcv.receiveMessage();
CPPUNIT_ASSERT(msg.isNull());
}
} // namespace aria2