o
    ¨ÝjÇ  ã                   @   sd   d dl mZ d dlmZmZmZ d dlmZ G dd„ dƒZ	G dd„ deƒZe	ej
ejeeedœZd	S )
é    )ÚEvent)ÚqueueÚsleepÚspawn)ÚWebSocketWSGIc                   @   s*   e Zd ZdZd	dd„Zdd„ Zdd„ ZdS )
ÚEventletThreadzÍThread class that uses eventlet green threads.

    Eventlet's own Thread class has a strange bug that causes _DummyThread
    objects to be created and leaked, since they are never garbage collected.
    Nc                 C   s$   || _ |pd| _|pi | _d | _d S )N© )ÚtargetÚargsÚkwargsÚg)Úselfr	   r
   r   r   r   úZ/var/www/html/chatgpt/venv/lib/python3.10/site-packages/engineio/async_drivers/eventlet.pyÚ__init__   s   


zEventletThread.__init__c                 C   s"   t | jg| j¢R i | j¤Ž| _d S ©N)r   r	   r
   r   r   ©r   r   r   r   Ústart   s   "zEventletThread.startc                 C   s   | j r| j  ¡ S d S r   )r   Úwaitr   r   r   r   Újoin   s   
ÿzEventletThread.join)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r      s
    
r   c                       s(   e Zd Z‡ fdd„Z‡ fdd„Z‡  ZS )r   c                    sD   zt ƒ j|t|jƒd� W n ty   t ƒ  |¡ Y nw d | _d S )N)Zmax_frame_length)Úsuperr   ÚintZmax_http_buffer_sizeÚ	TypeErrorÚ_sock)r   ÚhandlerÚserver©Ú	__class__r   r   r      s   

ÿþ
zWebSocketWSGI.__init__c                    s,   d|vrt dƒ‚|d  ¡ | _tƒ  ||¡S )Nzeventlet.inputzjYou need to use the eventlet server. See the Deployment section of the documentation for more information.)ÚRuntimeErrorZ
get_socketr   r   Ú__call__)r   ÚenvironZstart_responser   r   r   r"   $   s   zWebSocketWSGI.__call__)r   r   r   r   r"   Ú__classcell__r   r   r   r   r      s    	r   )Úthreadr   Zqueue_emptyÚeventZ	websocketr   N)Zeventlet.green.threadingr   Zeventletr   r   r   Zeventlet.websocketr   Z_WebSocketWSGIr   ÚQueueÚEmptyZ_asyncr   r   r   r   Ú<module>   s    
ú