Browse Source

merge pr from mengskysama

dev
BreakWa11 9 years ago
parent
commit
6ee8035735
  1. 2
      shadowsocks/lru_cache.py
  2. 1
      shadowsocks/udprelay.py

2
shadowsocks/lru_cache.py

@ -88,12 +88,12 @@ class LRUCache(collections.MutableMapping):
self.close_callback(value)
self._closed_values.add(value)
for key in self._time_to_keys[least]:
self._last_visits.popleft()
if key in self._store:
if now - self._keys_to_last_time[key] > self.timeout:
del self._store[key]
del self._keys_to_last_time[key]
c += 1
self._last_visits.popleft()
del self._time_to_keys[least]
if c:
self._closed_values.clear()

1
shadowsocks/udprelay.py

@ -1293,6 +1293,7 @@ class UDPRelay(object):
logging.info('closed UDP port %d', self._listen_port)
before_sweep_size = len(self._sockets)
self._cache.sweep()
self._dns_cache.sweep()
if before_sweep_size != len(self._sockets):
logging.debug('UDP port %5d sockets %d' % (self._listen_port, len(self._sockets)))
self._client_fd_to_server_addr.sweep()

Loading…
Cancel
Save