Only update port if expiration is not in the future
authorRichard Whitehouse <github@richardwhiuk.com>
Sun, 20 Feb 2011 02:29:52 +0000 (02:29 +0000)
committerRichard Whitehouse <github@richardwhiuk.com>
Sun, 20 Feb 2011 02:29:52 +0000 (02:29 +0000)
code/src/devices/bridge/model/moose-bridge-net-device.cc

index b765525ab9f5faf0096f3717c049721b2e23f2c7..05d2ef13a27cebba9914a9def9486305615becc8 100644 (file)
@@ -196,16 +196,16 @@ void MooseBridgeNetDevice::Learn(MooseAddress const& addr, Ptr<BridgePortNetDevi
   if(addr.GetMoosePrefix() != m_mooseAddress.GetMoosePrefix()){
      
      PrefixState &state = m_prefixState[addr.GetMoosePrefix()];
-     state.associatedPort = port;
      if(now + m_expirationTime > state.expirationTime){
+            state.associatedPort = port;                               // Only update if the expiration is not in the future
             state.expirationTime = now + m_expirationTime;
      }
 
   } else {
 
      PortState &state = m_portState[addr.GetMooseSuffix()];
-     state.associatedPort = port;
      if(now + m_expirationTime > state.expirationTime){
+            state.associatedPort = port;
             state.expirationTime = now + m_expirationTime;
      }