
    DQcI                     "   d Z 	 ddlZddlZddlZddlZddlZddlT ddlT ddlT ej	        ej
        dfgZ eed          r"e                    ej        ej        df            eed          r"e                    ej	        ej        df            eed          r"e                    ej	        ej        d	f            eed
          r"e                    ej	        ej        df           dag dZ G d de          Zd Zd Zd Zd Zd ZdS )z

    N   )*SO_KEEPALIVETCP_KEEPIDLE   TCP_KEEPINTVL
   TCP_KEEPCNT   )DEFAULT_SOCKET_OPTIONsock_optsetdefaulttimeoutgetdefaulttimeoutrecv	recv_linesendc                       e Zd Zd ZdS )r   c                 @    |g }|i }|| _         || _        d | _        d S )N)sockoptsslopttimeout)selfr   r   s      1lib/python3.11/site-packages/websocket/_socket.py__init__zsock_opt.__init__6   s5     	G 	F    N)__name__
__module____qualname__r    r   r   r   r   4   s#            r   r   c                 
    | a dS )z
    Set the global timeout setting to connect.

    Parameters
    ----------
    timeout: int or float
        default socket timeout time (in seconds)
    N_default_timeout)r   s    r   r   r   @   s     r   c                      t           S )z
    Get default timeout

    Returns
    ----------
    _default_timeout: int or float
        Return the global timeout setting (in seconds) to connect.
    r!   r   r   r   r   r   M   s
     r   c                      st          d           fd}	                                  dk    r                               }n
 |            }nz# t          j        $ r#}t          |          }t          |          d }~wt          $ r=}t          |          }t          |t                    rd|v rt          |           d }~ww xY w|st          d          |S )Nsocket is already closed.c                  r   	                                S # t          $ r Y nNt          j        $ r=} t	          |           }| |t
          j        k    s|t
          j        k    r Y d } ~ nd } ~ ww xY wt          j        fdd	                                          \  }}}|r                               S d S Nr   )
r   SSLWantReadErrorsocketerrorextract_error_codeerrnoEAGAINEWOULDBLOCKselect
gettimeout)exc
error_coderwebufsizesocks        r   _recvzrecv.<locals>._recv]   s    		99W%%% 	 	 	D| 	 	 	+C00J U\) Z5;L-L     		 -"b$//2C2CDD1a 	&99W%%%	& 	&    
A/A/3A**A/r   	timed outzConnection is already closed.)
"WebSocketConnectionClosedExceptionr0   r   r)   r   extract_err_messageWebSocketTimeoutExceptionSSLError
isinstancestr)r7   r6   r8   bytes_r5   messages   ``    r   r   r   Y   s)    N01LMMM& & & & & & ??! 	YYw''FFUWWF> 1 1 1%a(('000   %a((gs## 	w(> 	+G444  -0+- - 	- Ms#   8A C#BC8CCc                     g }	 t          | d          }|                    |           |t          j        d          k    rn?t          j        d                              |          S )NTr   
 )r   appendsixbjoin)r7   linecs      r   r   r      sa    DqMMAd 		
 599>>$r   c                     t          t          j                  r                    d           st	          d           fd}	                                  dk    r                               S  |            S # t          j        $ r#}t          |          }t          |          d }~wt          $ r=}t          |          }t          |t                    rd|v rt          |           d }~ww xY w)Nzutf-8r%   c                  r   	                                S # t          $ r Y nNt          j        $ r=} t	          |           }| |t
          j        k    s|t
          j        k    r Y d } ~ nd } ~ ww xY wt          j        dfd	                                          \  }}}|r                               S d S r'   )
r   SSLWantWriteErrorr)   r*   r+   r,   r-   r.   r/   r0   )r1   r2   r3   r4   r5   datar7   s        r   _sendzsend.<locals>._send   s    		99T??"  	 	 	D| 	 	 	+C00J U\) Z5;L-L     		 -THb$//2C2CDD1a 	#99T??"	# 	#r9   r   r:   )r?   rG   	text_typeencoder;   r0   r   r)   r   r<   r=   	Exceptionr@   )r7   rO   rP   r5   rB   s   ``   r   r   r      s$   $&& ${{7## N01LMMM# # # # # # ??! 	99T??"577N> 1 1 1%a(('000   %a((gs## 	w(> 	+G444s*   
,B 7	B C8B..C8;8C33C8)__doc__r,   r/   r)   rG   sys_exceptions_ssl_compat_utilsSOL_TCPTCP_NODELAYr   hasattrrF   
SOL_SOCKETr   r   r   r
   r"   __all__objectr   r   r   r   r   r   r   r   r   <module>r_      s   (    



 



             .&*<a@A 
76>"" N  &"3V5H!!LMMM
76>"" L  &.&2Er!JKKK
76?## M  &.&2F!KLLL
76=!! J  &.&2Da!HIII ( ( (	 	 	 	 	v 	 	 	
 
 
	 	 	' ' 'T     $ $ $ $ $r   