|
737 |
m_errno = ERROR_AGAIN; |
737 |
m_errno = ERROR_AGAIN; |
738 |
return 0; |
738 |
return 0; |
739 |
} |
739 |
} |
740 |
Ptr<Packet> p = m_deliveryQueue.front (); |
740 |
DeliveryQueueElement e = m_deliveryQueue.front (); |
|
|
741 |
Ptr<Packet> p = e.packet; |
741 |
if (p->GetSize () <= maxSize) |
742 |
if (p->GetSize () <= maxSize) |
742 |
{ |
743 |
{ |
743 |
m_deliveryQueue.pop (); |
744 |
m_deliveryQueue.pop (); |
|
755 |
Address &fromAddress) |
756 |
Address &fromAddress) |
756 |
{ |
757 |
{ |
757 |
NS_LOG_FUNCTION (this << maxSize << flags); |
758 |
NS_LOG_FUNCTION (this << maxSize << flags); |
758 |
Ptr<Packet> packet = Recv (maxSize, flags); |
759 |
if (m_deliveryQueue.empty ()) |
759 |
if (packet != 0) |
|
|
760 |
{ |
760 |
{ |
761 |
SocketAddressTag tag; |
761 |
m_errno = ERROR_AGAIN; |
762 |
bool found; |
762 |
return 0; |
763 |
found = packet->PeekPacketTag (tag); |
|
|
764 |
NS_ASSERT (found); |
765 |
fromAddress = tag.GetAddress (); |
766 |
} |
763 |
} |
767 |
return packet; |
764 |
DeliveryQueueElement e = m_deliveryQueue.front (); |
|
|
765 |
Ptr<Packet> p = e.packet; |
766 |
if (p->GetSize () <= maxSize) |
767 |
{ |
768 |
m_deliveryQueue.pop (); |
769 |
m_rxAvailable -= p->GetSize (); |
770 |
fromAddress = e.socketAddress; |
771 |
} |
772 |
else |
773 |
{ |
774 |
p = 0; |
775 |
} |
776 |
return p; |
768 |
} |
777 |
} |
769 |
|
778 |
|
770 |
int |
779 |
int |
|
853 |
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) |
862 |
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) |
854 |
{ |
863 |
{ |
855 |
Address address = InetSocketAddress (header.GetSource (), port); |
864 |
Address address = InetSocketAddress (header.GetSource (), port); |
856 |
SocketAddressTag tag; |
865 |
DeliveryQueueElement e; |
857 |
tag.SetAddress (address); |
866 |
e.packet = packet; |
858 |
packet->AddPacketTag (tag); |
867 |
e.socketAddress = address; |
859 |
m_deliveryQueue.push (packet); |
868 |
m_deliveryQueue.push (e); |
860 |
m_rxAvailable += packet->GetSize (); |
869 |
m_rxAvailable += packet->GetSize (); |
861 |
NotifyDataRecv (); |
870 |
NotifyDataRecv (); |
862 |
} |
871 |
} |
|
885 |
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) |
894 |
if ((m_rxAvailable + packet->GetSize ()) <= m_rcvBufSize) |
886 |
{ |
895 |
{ |
887 |
Address address = Inet6SocketAddress (saddr, port); |
896 |
Address address = Inet6SocketAddress (saddr, port); |
888 |
SocketAddressTag tag; |
897 |
DeliveryQueueElement e; |
889 |
tag.SetAddress (address); |
898 |
e.packet = packet; |
890 |
packet->AddPacketTag (tag); |
899 |
e.socketAddress = address; |
891 |
m_deliveryQueue.push (packet); |
900 |
m_deliveryQueue.push (e); |
892 |
m_rxAvailable += packet->GetSize (); |
901 |
m_rxAvailable += packet->GetSize (); |
893 |
NotifyDataRecv (); |
902 |
NotifyDataRecv (); |
894 |
} |
903 |
} |