update testcase to deal with the return value of Socket::Send. Make sure udp packets are copied before going down the ip stack.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue Apr 15 10:49:09 2008 -0700 (22 months ago)
changeset 29145092e8290b9b
parent 2913 66dd24c80d75
child 2915 3573d91994cc
update testcase to deal with the return value of Socket::Send. Make sure udp packets are copied before going down the ip stack.
src/internet-node/udp-socket.cc
     1.1 --- a/src/internet-node/udp-socket.cc	Tue Apr 15 10:09:42 2008 -0700
     1.2 +++ b/src/internet-node/udp-socket.cc	Tue Apr 15 10:49:09 2008 -0700
     1.3 @@ -305,7 +305,7 @@
     1.4    else if (ipv4->GetIfIndexForDestination(dest, localIfIndex))
     1.5      {
     1.6        NS_LOG_LOGIC ("Route exists");
     1.7 -      m_udp->Send (p, ipv4->GetAddress (localIfIndex), dest,
     1.8 +      m_udp->Send (p->Copy (), ipv4->GetAddress (localIfIndex), dest,
     1.9  		   m_endPoint->GetLocalPort (), port);
    1.10        NotifyDataSent (p->GetSize ());
    1.11        return p->GetSize();;
    1.12 @@ -479,7 +479,7 @@
    1.13    m_receivedPacket = Create<Packet> ();
    1.14    m_receivedPacket2 = Create<Packet> ();
    1.15    NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("10.0.0.1"), 1234),
    1.16 -                                          Create<Packet> (123)), 0);
    1.17 +                                          Create<Packet> (123)), 123);
    1.18    Simulator::Run ();
    1.19    NS_TEST_ASSERT_EQUAL (m_receivedPacket->GetSize (), 123);
    1.20    NS_TEST_ASSERT_EQUAL (m_receivedPacket2->GetSize (), 0); // second interface should receive it
    1.21 @@ -490,7 +490,7 @@
    1.22    m_receivedPacket = Create<Packet> ();
    1.23    m_receivedPacket2 = Create<Packet> ();
    1.24    NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234),
    1.25 -                                          Create<Packet> (123)), 0);
    1.26 +                                          Create<Packet> (123)), 123);
    1.27    Simulator::Run ();
    1.28    NS_TEST_ASSERT_EQUAL (m_receivedPacket->GetSize (), 123);
    1.29    // second socket should not receive it (it is bound specifically to the second interface's address
    1.30 @@ -510,7 +510,7 @@
    1.31    m_receivedPacket = Create<Packet> ();
    1.32    m_receivedPacket2 = Create<Packet> ();
    1.33    NS_TEST_ASSERT_EQUAL (txSocket->SendTo (InetSocketAddress (Ipv4Address("255.255.255.255"), 1234),
    1.34 -                                          Create<Packet> (123)), 0);
    1.35 +                                          Create<Packet> (123)), 123);
    1.36    Simulator::Run ();
    1.37    NS_TEST_ASSERT_EQUAL (m_receivedPacket->GetSize (), 123);
    1.38    NS_TEST_ASSERT_EQUAL (m_receivedPacket2->GetSize (), 123);