def reap(self):
# find DNS requests that have timed out
now = int(time.time())
if now - self.last_reap_time > 180:
# reap every 3 minutes
self.last_reap_time = now # update before we forget
for k, (host, unpack, callback, when) in self.request_map.items():
if now - when > 180:
# over 3 minutes old
del self.request_map[k]
try:
# same code as in handle_read
callback(host, 0, None) # timeout val is (0,None)
except Exception:
(file, fun, line), t, v, tbinfo = \
asyncore.compact_traceback()
self.log_info('%s %s %s' % (t, v, tbinfo), 'error')
评论列表
文章目录