def __call__(self, sendto, request, address): try: src_ip, src_port = address dst_ip, dst_port = get_original_destination(None, src_ip, src_port) if 53 == get_original_destination(None, src_ip, src_port)[1]: self.dns_handler(sendto, request, address) else: sock = fqdns.create_udp_socket() try: sock.sendto(request, (dst_ip, dst_port)) response = sock.recv(8192) sendto(response, address) finally: sock.close() except: LOGGER.exception('failed to handle udp')