diff --git a/scapy/config.py b/scapy/config.py index 3408648b7cad0f6870f0da8cee0628307962043e..871c182cfc8e4641be0ccc29fc1f056dfb781d9e 100755 --- a/scapy/config.py +++ b/scapy/config.py @@ -201,8 +201,12 @@ class CacheInstance(dict, object): self._timetable[item] = time.time() dict.__setitem__(self, item,v) def update(self, other): - dict.update(self, other) - self._timetable.update(other._timetable) + for key, value in other.iteritems(): + # We only update an element from `other` either if it does + # not exist in `self` or if the entry in `self` is older. + if key not in self or self._timetable[key] < other._timetable[key]: + dict.__setitem__(self, key, value) + self._timetable[key] = other._timetable[key] def iteritems(self): if self.timeout is None: return six.iteritems(self.__dict__)