Changeset 911:62c8b641239a

Show
Ignore:
Timestamp:
09/12/08 15:41:39 (4 months ago)
Author:
Phil <phil@secdev.org>
Message:

Fixed CacheInstance? (used for ARP cache) timetable updating

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • scapy/config.py

    r901 r911  
    142142        return val 
    143143    def get(self, item, default=None): 
     144        # overloading this method is needed to force the dict to go through 
     145        # the timetable check 
    144146        try: 
    145147            return self[item] 
     
    149151        self._timetable[item] = time.time() 
    150152        dict.__setitem__(self, item,v) 
     153    def update(self, other): 
     154        dict.update(self, other) 
     155        self._timetable.update(other._timetable) 
    151156    def __repr__(self): 
    152157        if self.timeout is None: 
     
    155160            n = 0 
    156161            t0 = time.time() 
    157             for t,v in self.itervalues(): 
     162            for k,v in self.iteritems(): 
     163                t = self._timetable[k] 
    158164                if t0-t <= self.timeout: 
    159165                    n += 1