403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/zmq/devices/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/zmq/devices/__pycache__/basedevice.cpython-310.pyc
o

;jF%�@s�dZddlZddlmZddlmZddlmZmZm	Z	m
Z
mZddlZddlm
Z
mZmZmZmZmZmZmZGdd�d�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�Zgd�ZdS)z2Classes for running 0MQ Devices in the background.�N)�Process)�Thread)�Any�Callable�List�Optional�Tuple)�ENOTSOCK�ETERM�PUSH�QUEUE�Context�ZMQBindError�ZMQError�proxyc	@s�eZdZUdZejZegejfe	d<	e
e	d<ee	d<ee	d<ee	d<ee
e	d<ee
e	d<eeeefe	d	<ee
e	d
<ee
e	d<eeeefe	d<ee
e	d
<eeje	d<eddfdedeedeeddfdd�Zde
ddfdd�Zde
defdd�Zde
ddfdd�Zdededdfdd�Zde
ddfdd�Zde
defd d!�Zde
fd"d#�Zdedefd$d%�Zde
defd&d'�Zdeejejffd(d)�Zd5d*d+�Zd,d-�Zd5d.d/�Z d5d0d1�Z!d6d2ee"ddfd3d4�Z#dS)7�DeviceaaA 0MQ Device to be run in the background.

    You do not pass Socket instances to this, but rather Socket types::

        Device(device_type, in_socket_type, out_socket_type)

    For instance::

        dev = Device(zmq.QUEUE, zmq.DEALER, zmq.ROUTER)

    Similar to zmq.device, but socket types instead of sockets themselves are
    passed, and the sockets are created in the work thread, to avoid issues
    with thread safety. As a result, additional bind_{in|out} and
    connect_{in|out} methods and setsockopt_{in|out} allow users to specify
    connections for the sockets.

    Parameters
    ----------
    device_type : int
        The 0MQ Device type
    {in|out}_type : int
        zmq socket types, to be passed later to context.socket(). e.g.
        zmq.PUB, zmq.SUB, zmq.REQ. If out_type is < 0, then in_socket is used
        for both in_socket and out_socket.

    Methods
    -------
    bind_{in_out}(iface)
        passthrough for ``{in|out}_socket.bind(iface)``, to be called in the thread
    connect_{in_out}(iface)
        passthrough for ``{in|out}_socket.connect(iface)``, to be called in the
        thread
    setsockopt_{in_out}(opt,value)
        passthrough for ``{in|out}_socket.setsockopt(opt, value)``, to be called in
        the thread

    Attributes
    ----------
    daemon : bool
        sets whether the thread should be run as a daemon
        Default is true, because if it is false, the thread will not
        exit unless it is killed
    context_factory : callable
        This is a class attribute.
        Function for creating the Context. This will be Context.instance
        in ThreadDevices, and Context in ProcessDevices.  The only reason
        it is not instance() in ProcessDevices is that there may be a stale
        Context instance already initialized, and the forked environment
        should *never* try to use it.
    �context_factory�daemon�device_type�in_type�out_type�	_in_binds�_in_connects�_in_sockopts�
_out_binds�
_out_connects�
_out_sockopts�
_random_addrs�_socketsN�returncCsr||_|durtd��|durtd��||_||_g|_g|_g|_g|_g|_g|_	g|_
d|_d|_g|_
dS)Nzin_type must be specifiedzout_type must be specifiedTF)r�	TypeErrorrrrrrrrrrr�doner)�selfrrr�r#�J/opt/saltstack/salt/lib/python3.10/site-packages/zmq/devices/basedevice.py�__init__Vs"
zDevice.__init__�addrcC�|j�|�dS)z`Enqueue ZMQ address for binding on in_socket.

        See zmq.Socket.bind for details.
        N)r�append�r"r&r#r#r$�bind_inn�zDevice.bind_incO�0|j|g|�Ri|��}|�|�d|���|S)z�Enqueue a random port on the given interface for binding on
        in_socket.

        See zmq.Socket.bind_to_random_port for details.

        .. versionadded:: 18.0
        �:)�_reserve_random_portr*�r"r&�args�kwargs�portr#r#r$�bind_in_to_random_portu�zDevice.bind_in_to_random_portcCr')zfEnqueue ZMQ address for connecting on in_socket.

        See zmq.Socket.connect for details.
        N)rr(r)r#r#r$�
connect_in�r+zDevice.connect_in�opt�valuecC�|j�||f�dS)zeEnqueue setsockopt(opt, value) for in_socket

        See zmq.Socket.setsockopt for details.
        N)rr(�r"r6r7r#r#r$�
setsockopt_in��zDevice.setsockopt_incCr')zaEnqueue ZMQ address for binding on out_socket.

        See zmq.Socket.bind for details.
        N)rr(r)r#r#r$�bind_out�r+zDevice.bind_outcOr,)z�Enqueue a random port on the given interface for binding on
        out_socket.

        See zmq.Socket.bind_to_random_port for details.

        .. versionadded:: 18.0
        r-)r.r<r/r#r#r$�bind_out_to_random_port�r4zDevice.bind_out_to_random_portcCr')zgEnqueue ZMQ address for connecting on out_socket.

        See zmq.Socket.connect for details.
        N)rr(r)r#r#r$�connect_out�r+zDevice.connect_outcCr8)zfEnqueue setsockopt(opt, value) for out_socket

        See zmq.Socket.setsockopt for details.
        N)rr(r9r#r#r$�setsockopt_out�r;zDevice.setsockopt_outc		Os�t��Q}|�t��3}td�D]}|j|g|�Ri|��}|�d|��}||jvr)qntd��|j�|�Wd�n1s?wYWd�|SWd�|S1sWwY|S)N�r-zCould not reserve random port.)r
�socketr�rangeZbind_to_random_portrrr()	r"r&r0r1�ctxZbinder�ir2�new_addrr#r#r$r.�s$
�
��
��zDevice._reserve_random_portcCs�|��}||_|�|j�}|j�|�|jdkr|}n|�|j�}|j�|�|jD]
\}}|�||�q*|j	D]
\}}|�||�q8|j
D]}|�|�qF|jD]}|�|�qQ|j
D]}|�|�q\|jD]}|�|�qg||fS)Nr)r�_contextrArrr(rr�
setsockoptrr�bindrr�connectr)r"rC�ins�outsr6r7Zifacer#r#r$�_setup_sockets�s*




zDevice._setup_socketscCs|��\}}t||�dS)zpThe runner method.

        Do not call me directly, instead call ``self.start()``, just like a Thread.
        N)rLr)r"rJrKr#r#r$�
run_device�szDevice.run_devicecCs"|jD]}|r|js|��qdS)zCleanup sockets we createdN)r�closed�close)r"�sr#r#r$�_close_sockets�s


��zDevice._close_socketsc
Cs~z6z|��Wnty"}z|jtthvrn�WYd}~nd}~wwWd|_|��dSWd|_|��dSd|_|��w)z"wrap run_device in try/catch ETERMNT)rMr�errnor
r	r!rQ)r"�er#r#r$�run�s"������
z
Device.runcCs|��S)z>Start the device. Override me in subclass for other launchers.)rT�r"r#r#r$�startszDevice.start�timeoutcCsbt��}|}|js+|dur|||ks/t�d�t��}|js-|dur|||krdSdSdSdS)z\wait for me to finish, like Thread.join.

        Reimplemented appropriately by subclasses.Ng����MbP?)�time�	monotonicr!�sleep)r"rWZticZtocr#r#r$�joins
*�zDevice.join�rN�N)$�__name__�
__module__�__qualname__�__doc__r
�instancerr�zmq�__annotations__�bool�intr�strrrZSocketrrr%r*r3r5r:r<r=r>r?r.rLrMrQrTrV�floatr[r#r#r#r$rsV
3����
�


rc@sLeZdZUdZdZeed<dZeed<ddd�Zdde	e
ddfd	d
�ZdS)
�BackgroundDevicezEBase class for launching Devices in background processes and threads.N�launcher�
_launch_classrcCs$|j|jd�|_|j|j_|j��S)N)�target)rkrTrjrrVrUr#r#r$rVs

zBackgroundDevice.startrWcCs|jj|d�S)N)rW)rjr[)r"rWr#r#r$r[szBackgroundDevice.joinr\r])r^r_r`rarjrrdrkrVrrhr[r#r#r#r$ris

ric@seZdZdZeZdS)�ThreadDevicezSA Device that will be run in a background Thread.

    See Device for details.
    N)r^r_r`rarrkr#r#r#r$rm srmc@seZdZdZeZeZdS)�
ProcessDevicezTA Device that will be run in a background Process.

    See Device for details.
    N)r^r_r`rarrkr
rr#r#r#r$rn)s
rn)rrmrn)rarX�multiprocessingr�	threadingr�typingrrrrrrcr	r
rrr
rrrrrirmrn�__all__r#r#r#r$�<module>s(	

Youez - 2016 - github.com/yon3zu
LinuXploit