o
    oi	                     @   s2   d Z ddlZddlmZ dgZG dd deZdS )z(
Native thread-based hostname resolver.
    N)get_hubResolverc                   @   sR   e Zd ZdZdddZdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd ZdS )r   a  
    Implementation of the resolver API using native threads and native resolution
    functions.

    Using the native resolution mechanisms ensures the highest
    compatibility with what a non-gevent program would return
    including good support for platform specific configuration
    mechanisms. The use of native (non-greenlet) threads ensures that
    a caller doesn't block other greenlets.

    This implementation also has the benefit of being very simple in comparison to
    :class:`gevent.resolver_ares.Resolver`.

    .. tip::

        Most users find this resolver to be quite reliable in a
        properly monkey-patched environment. However, there have been
        some reports of long delays, slow performance or even hangs,
        particularly in long-lived programs that make many, many DNS
        requests. If you suspect that may be happening to you, try the
        dnspython or ares resolver (and submit a bug report).
    Nc                 C   s@   |d u rt  }|j| _tj|jvr| jtjtjf7  _d S d S N)r   
threadpoolpool_socketgaierror	NOT_ERRORherror)selfhub r   U/var/www/html/pca-backend/venv/lib/python3.10/site-packages/gevent/resolver/thread.py__init__$   s   zResolver.__init__c                 C   s"   dt | jt | jt| | jf S )Nz<%s.%s at 0x%x pool=%r>)type
__module____name__idr   r   r   r   r   __repr__-   s   

zResolver.__repr__c                 C   s   d S r   r   r   r   r   r   close2   s   zResolver.closec                 G      | j tj|S r   )r   applyr   gethostbynamer   argsr   r   r   r   8      zResolver.gethostbynamec                 G   r   r   )r   r   r   gethostbyname_exr   r   r   r   r   ;   r   zResolver.gethostbyname_exc                 O      | j tj||S r   )r   r   r   getaddrinfor   r   kwargsr   r   r   r   >      zResolver.getaddrinfoc                 O   r   r   )r   r   r   gethostbyaddrr    r   r   r   r#   A   r"   zResolver.gethostbyaddrc                 O   r   r   )r   r   r   getnameinfor    r   r   r   r$   D   r"   zResolver.getnameinfor   )r   r   __qualname____doc__r   r   r   r   r   r   r#   r$   r   r   r   r   r      s    
	)r&   r   
gevent.hubr   __all__objectr   r   r   r   r   <module>   s
   