XylotrechusZ
�
���g�J � � � d Z ddlmZ ddlZddlZddlZddlZ ddlZddlm Z m
Z
ddlmZm
Z
mZ d� Zd� Z G d � d
e� Z G d� de� Z G d
� de� Zy# Y �>xY w)zGModule implementing low-level socket communication with MySQL servers.
� )�dequeN� )� constants�errors)�PY2�init_bytearray�
struct_unpackc �~ � | j st | � S dj | j | j �� S )z_Reformat the IOError error message
This function reformats the IOError error message.
z{errno} {strerr})�errno�strerr)r �str�format�strerror)�errs �n/opt/hc_python/lib64/python3.12/site-packages/../../../lib/python3.12/site-packages/mysql/connector/network.py�_strioerrorr + s2 � �
�9�9��3�x���$�$�3�9�9�S�\�\�$�J�J� c �` � g }t | � }t j }||kD rI|j dt j
d|� z | d| z � | |d } t | � }|dz }||kD r�I|j t j
d|� dd t j
d|� z | z � |S )z0Prepare a packet for sending to the MySQL server� ����<BNr �<Ir � )�lenr �MAX_PACKET_LENGTH�append�struct�pack)�buf�pktnr�pkts�pllen� maxpktlens r �_prepare_packetsr# 5 s� � �
�D���H�E��+�+�I�
�)�
����O�f�k�k�$��&>�>��*�9�o�&� '��)�*�o���C����� �� �)�
� �K�K����D�%�(��1�-��+�+�d�E�*�+�-0�1� 2��Kr c �� � e Zd ZdZd� Zed� � Zed� � Zd� Zd� Z d� Z
d� Z dd
�ZeZ
dd�Zd� Zd
� Zej$ dd dk( reZeZneZd� Zd� Zd� Zdd�Zy )�BaseMySQLSocketa Base class for MySQL socket communication
This class should not be used directly but overloaded, changing the
at least the open_connection()-method. Examples of subclasses are
mysql.connector.network.MySQLTCPSocket
mysql.connector.network.MySQLUnixSocket
c �h � d | _ d | _ d| _ d| _ t � | _ d| _ y )N���i )�sock�_connection_timeout�_packet_number�_compressed_packet_numberr �
_packet_queue�recvsize��selfs r �__init__zBaseMySQLSocket.__init__N s2 � ��� �#'�� � ���)+��&�"�W�����
r c �n � | j dz | _ | j dkD rd| _ | j S )zIncrements the packet numberr � r )r* r. s r �next_packet_numberz"BaseMySQLSocket.next_packet_numberV s9 � � #�1�1�A�5�������$�"#�D���"�"�"r c �n � | j dz | _ | j dkD rd| _ | j S )z'Increments the compressed packet numberr r2 r )r+ r. s r �next_compressed_packet_numberz-BaseMySQLSocket.next_compressed_packet_number^ s9 � � *.�)G�)G�!�)K��&��)�)�C�/�-.�D�*��-�-�-r c � � t �)zOpen the socket��NotImplementedErrorr. s r �open_connectionzBaseMySQLSocket.open_connectionf � � �!�!r c � � t �)zGet the location of the socketr7 r. s r �get_addresszBaseMySQLSocket.get_addressj r: r c �� � | j j t j � | j j � | `y# t j t f$ r Y yw xY w)z&Shut down the socket before closing itN)r( �shutdown�socket� SHUT_RDWR�closer, �error�AttributeErrorr. s r r>