File: //lib/python3.10/__pycache__/asyncore.cpython-310.pyc
o
    E�h,O  �                   @   sx  d Z ddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZ ejdedd� eee
eeeeh�Zze W n eyY   i ZY nw dd� ZG d	d
� d
e�ZeeefZ dd� Z!d
d� Z"dd� Z#dd� Z$d)dd�Z%d)dd�Z&e&Z'd*dd�Z(G dd� d�Z)G dd� de)�Z*d d!� Z+d+d"d#�Z,ej-d$kr�G d%d&� d&�Z.G d'd(� d(e)�Z/dS dS ),a�  Basic infrastructure for asynchronous socket service clients and servers.
There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.
If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
�    N)
�EALREADY�EINPROGRESS�EWOULDBLOCK�
ECONNRESET�EINVAL�ENOTCONN�	ESHUTDOWN�EISCONN�EBADF�ECONNABORTED�EPIPE�EAGAIN�	errorcodezlThe asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio�   )�
stacklevelc              
   C   sB   zt �| �W S  tttfy    | tv rt|   Y S d|   Y S w )NzUnknown error %s)�os�strerror�
ValueError�
OverflowError�	NameErrorr   )�err� r   �/usr/lib/python3.10/asyncore.py�	_strerrorK   s   �r   c                   @   s   e Zd ZdS )�ExitNowN)�__name__�
__module__�__qualname__r   r   r   r   r   S   s    r   c                 C   �2   z| � �  W d S  ty   �    | ��  Y d S �N)�handle_read_event�_reraised_exceptions�handle_error��objr   r   r   �readX   �   r%   c                 C   r   r   )�handle_write_eventr!   r"