Do not overwrite transport protocol downtarget callback in NotifyNewAggregate()
This commit is contained in:
@@ -57,7 +57,7 @@ Icmpv4L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -112,7 +112,7 @@ void Icmpv6L4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv6L3Protocol> ipv6 = this->GetObject<Ipv6L3Protocol> ();
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
SetNode (node);
|
||||
ipv6->Insert (this);
|
||||
|
||||
@@ -196,7 +196,7 @@ NscTcpL4Protocol::NotifyNewAggregate ()
|
||||
if (node != 0)
|
||||
{
|
||||
Ptr<Ipv4L3Protocol> ipv4 = this->GetObject<Ipv4L3Protocol> ();
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
this->SetNode (node);
|
||||
ipv4->Insert (this);
|
||||
|
||||
@@ -132,12 +132,12 @@ TcpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull ())
|
||||
{
|
||||
ipv4->Insert(this);
|
||||
this->SetDownTarget(MakeCallback(&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull ())
|
||||
{
|
||||
ipv6->Insert(this);
|
||||
this->SetDownTarget6(MakeCallback(&Ipv6L3Protocol::Send, ipv6));
|
||||
|
||||
@@ -88,6 +88,7 @@ UdpL4Protocol::SetNode (Ptr<Node> node)
|
||||
void
|
||||
UdpL4Protocol::NotifyNewAggregate ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<Node> node = this->GetObject<Node> ();
|
||||
Ptr<Ipv4> ipv4 = this->GetObject<Ipv4> ();
|
||||
Ptr<Ipv6L3Protocol> ipv6 = node->GetObject<Ipv6L3Protocol> ();
|
||||
@@ -108,12 +109,12 @@ UdpL4Protocol::NotifyNewAggregate ()
|
||||
// need to keep track of whether we are connected to an IPv4 or
|
||||
// IPv6 lower layer and call the appropriate one.
|
||||
|
||||
if (ipv4 != 0)
|
||||
if (ipv4 != 0 && m_downTarget.IsNull())
|
||||
{
|
||||
ipv4->Insert (this);
|
||||
this->SetDownTarget (MakeCallback (&Ipv4::Send, ipv4));
|
||||
}
|
||||
if (ipv6 != 0)
|
||||
if (ipv6 != 0 && m_downTarget6.IsNull())
|
||||
{
|
||||
ipv6->Insert (this);
|
||||
this->SetDownTarget6 (MakeCallback (&Ipv6L3Protocol::Send, ipv6));
|
||||
@@ -499,6 +500,7 @@ UdpL4Protocol::Send (Ptr<Packet> packet,
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget (IpL4Protocol::DownTargetCallback callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget = callback;
|
||||
}
|
||||
|
||||
@@ -511,6 +513,7 @@ UdpL4Protocol::GetDownTarget (void) const
|
||||
void
|
||||
UdpL4Protocol::SetDownTarget6 (IpL4Protocol::DownTargetCallback6 callback)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downTarget6 = callback;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user