Changeset 1607

Show
Ignore:
Timestamp:
06/17/09 14:30:20 (9 months ago)
Author:
alpt
Message:

the route_add() code implemented erroneously the algorithm described in Chapter 5 of topology.pdf

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • netsukuku/trunk/pyntk/ntk/core/route.py

    r1599 r1607  
    262262        It returns (0,None) if the route hasn't been added, and thus it isn't 
    263263        interesting, otherwise it returns (1,None) if it is a new route, 
    264         (2, oldrem) if it substituted an old route.""" 
     264        (2, oldrem) if it substituted an old route. 
     265         
     266        The following code implements the algorithm described in  
     267        Chapter 5 of topology.pdf. 
     268        """ 
    265269 
    266270        ret = 0 
     
    268272        oldr = self.route_getby_gw(gw) 
    269273 
    270         if self.is_empty() or (oldr is None and rem > self.routes[-1].rem): 
    271             # If there aren't routes, or if it is better than the worst 
    272             # route, add it 
     274        if self.is_empty() or oldr is None: 
     275            # If it is a new route, add it 
    273276            self.routes.append(RouteGw(gw, rem)) 
    274277            ret = 1