AlkantarClanX12
Current Path : /opt/alt/python310/lib64/python3.10/asyncio/__pycache__/ |
Current File : //opt/alt/python310/lib64/python3.10/asyncio/__pycache__/streams.cpython-310.opt-1.pyc |
o 6��f�d � @ s& d Z ddlZddlZddlZddlZddlZeed�re d7 Z ddlmZ ddlm Z ddlm Z dd lmZ dd lmZ ddl mZ ddlmZ d Zded�dd�Zded�dd�Zeed�rpd ed�dd�Zd ed�dd�ZG dd� dej�ZG dd� deej�ZG dd� d�ZG dd� d�ZdS )!)�StreamReader�StreamWriter�StreamReaderProtocol�open_connection�start_server� NZAF_UNIX)�open_unix_connection�start_unix_server� )� coroutines)�events)� exceptions)�format_helpers)� protocols)�logger)�sleepi )�limitc � s` �t �� }t||d�}t||d�� |j� fdd�| |fi |��I dH \}}t|� ||�}||fS )a� A wrapper for create_connection() returning a (reader, writer) pair. The reader returned is a StreamReader instance; the writer is a StreamWriter instance. The arguments are all the usual arguments to create_connection() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). (If you want to customize the StreamReader and/or StreamReaderProtocol classes, just copy the code -- there's really nothing special here except some convenience.) �r �loop�r c � � S �N� r ��protocolr �6/opt/alt/python310/lib64/python3.10/asyncio/streams.py�<lambda>1 � z!open_connection.<locals>.<lambda>N)r �get_running_loopr r Zcreate_connectionr ) �host�portr �kwdsr �reader� transport�_�writerr r r r s ���r c � s6 �t �� �� ��fdd�}�j|||fi |��I dH S )a� Start a socket server, call back for each client connected. The first parameter, `client_connected_cb`, takes two parameters: client_reader, client_writer. client_reader is a StreamReader object, while client_writer is a StreamWriter object. This parameter can either be a plain callback function or a coroutine; if it is a coroutine, it will be automatically converted into a Task. The rest of the arguments are all the usual arguments to loop.create_server() except protocol_factory; most common are positional host and port, with various optional keyword arguments following. The return value is the same as loop.create_server(). Additional optional keyword arguments are loop (to set the event loop instance to use) and limit (to set the buffer limit passed to the StreamReader). The return value is the same as loop.create_server(), i.e. a Server object which can be used to stop the service. c � t ��d�} t| � �d�}|S �Nr r �r r �r! r ��client_connected_cbr r r r �factoryO � �zstart_server.<locals>.factoryN)r r Z create_server)r* r r r r r+ r r) r r 6 s �r c � s^ �t �� }t||d�}t||d�� |j� fdd�| fi |��I dH \}}t|� ||�}||fS )z@Similar to `open_connection` but works with UNIX Domain Sockets.r r c r r r r r r r r c r z&open_unix_connection.<locals>.<lambda>N)r r r r Zcreate_unix_connectionr )�pathr r r r! r"