def handle_read(self):
reply, whence = self.socket.recvfrom(512)
# for security reasons we may want to double-check
# that <whence> is the server we sent the request to.
id = (ord(reply[0]) << 8) + ord(reply[1])
if id in self.request_map:
host, unpack, callback, when = self.request_map[id]
del self.request_map[id]
ttl, answer = unpack(reply)
try:
callback(host, ttl, answer)
except Exception:
(file, fun, line), t, v, tbinfo = asyncore.compact_traceback()
self.log_info('%s %s %s' % (t, v, tbinfo), 'error')
评论列表
文章目录