관리-도구
편집 파일: query.cpython-36.opt-1.pyc
3 �Of�L � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Z ddlZ ddlZ ddl Z ddlZ ddlZ ddlmZmZ ejd/kr�eZnejZejZG dd� de jj�ZG d d � d e jj�Zdd� Zd d� Zdd� Zdd� Z dd� Z!e"ed�r�ea#nea#dd� Z$dd� Z%dd� Z&dd� Z'dd� Z(d0d"d#�Z)d$d%� Z*d&d'� Z+d(d)� Z,d1d*d+�Z-e j.j/e j0j1dd ddd,dddddd!e j2j3fd-d.�Z4dS )2zTalk to a DNS server.� )� generatorsN� )�long�string_types� c @ s e Zd ZdZdS )�UnexpectedSourcez=A DNS query response came from an unexpected address or port.N)�__name__� __module__�__qualname__�__doc__� r r �/usr/lib/python3.6/query.pyr , s r c @ s e Zd ZdZdS )�BadResponsez<A DNS query response does not respond to the question asked.N)r r r r r r r r r 1 s r c C s | d krd S t j � | S d S )N)�time)�timeoutr r r �_compute_expiration6 s r c C sj d}|r|t jO }|r |t jO }|r.|t jO }t j� }|j| |� |rZ|jt|d ��}n|j� }t|�S )aq Poll polling backend. @param fd: File descriptor @type fd: int @param readable: Whether to wait for readability @type readable: bool @param writable: Whether to wait for writability @type writable: bool @param timeout: Deadline timeout (expiration time, in seconds) @type timeout: float @return True on success, False on timeout r i� )�selectZPOLLINZPOLLOUTZPOLLERR�poll�registerr �bool)�fd�readable�writable�errorr Z event_maskZpollableZ event_listr r r � _poll_for= s r c C sr g g g }}}|r| g}|r$| g}|r.| g}|dkrLt j |||�\}} } nt j ||||�\}} } t|pn| pn| �S )as Select polling backend. @param fd: File descriptor @type fd: int @param readable: Whether to wait for readability @type readable: bool @param writable: Whether to wait for writability @type writable: bool @param timeout: Deadline timeout (expiration time, in seconds) @type timeout: float @return True on success, False on timeout N)r r )r r r r r ZrsetZwsetZxsetZrcountZwcountZxcountr r r �_select_for\ s r c C s� d}x�|s�|d krd }n|t j � }|dkr4tjj�yt| ||||�sNtjj�W n6 tk r� } z|jd tjkrv|�W Y d d }~X nX d}qW d S )NFg r T) r �dns� exceptionZTimeout�_polling_backend�select_error�args�errnoZEINTR)r r r r � expiration�doner �er r r � _wait_fory s r% c C s | a dS )z# Internal API. Do not use. N)r )�fnr r r �_set_polling_backend� s r'