src/devices/wifi/yans-wifi-channel.cc
changeset 5523 86e84169c725
parent 5421 612dd4189fa7
child 5944 b1a245ae00d4
--- a/src/devices/wifi/yans-wifi-channel.cc	Sat Nov 14 17:47:05 2009 +0100
+++ b/src/devices/wifi/yans-wifi-channel.cc	Sat Nov 14 17:47:05 2009 +0100
@@ -92,8 +92,19 @@
           NS_LOG_DEBUG ("propagation: txPower="<<txPowerDbm<<"dbm, rxPower="<<rxPowerDbm<<"dbm, "<<
                         "distance="<<senderMobility->GetDistanceFrom (receiverMobility)<<"m, delay="<<delay);
           Ptr<Packet> copy = packet->Copy ();
-          Simulator::Schedule (delay, &YansWifiChannel::Receive, this, 
-                               j, copy, rxPowerDbm, wifiMode, preamble);
+          Ptr<Object> dstNetDevice = m_phyList[j]->GetDevice ();
+          uint32_t dstNode;
+          if (dstNetDevice == 0)
+            {
+              dstNode = 0xffffffff;
+            }
+          else
+            {
+              dstNode = dstNetDevice->GetObject<NetDevice> ()->GetNode ()->GetId ();
+            }
+          Simulator::ScheduleWithContext (dstNode,
+                                          delay, &YansWifiChannel::Receive, this, 
+                                          j, copy, rxPowerDbm, wifiMode, preamble);
         }
     }
 }