Current File : //proc/self/root/lib/python3/dist-packages/twisted/internet/__pycache__/protocol.cpython-312.pyc
�

Ϫ�f�k��8�dZddlZddlmZmZmZddlmZddlm	Z	m
Z
mZddlm
Z
mZddlmZddlmZmZmZeej*ej,�Gd	�d
��ZGd�de�ZGd
�de�ZGd�d�ZGd�de�ZGd�de�ZGd�d�Zej<e
j>��Z e jC�eejDej,�Gd�de��Z#eejH�Gd�dejJ��Z&ejNe&ejDejH�eejD�Gd�dejJ��Z(ejNe(ejHejD�eejR�Gd�de��Z*Gd�d �Z+eej,�Gd!�d"e+��Z,Gd#�d$e,�Z-eej�Gd%�d&��Z.gd'�Z/y)(z�
Standard implementations of Twisted protocol-related interfaces.

Start here if you are looking to write a new protocol implementation for
Twisted.  The Protocol class contains some introductory material.
�N)�Any�Callable�Optional)�implementer)�defer�error�
interfaces)�IAddress�
ITransport)�
_loggerFor)�
components�failure�logc�f�eZdZUdZdZded<dZdZed��Z	d�Z
d	�Zd
�Zd�Z
d�Zd
eddfd�Zy)�Factoryz�
    This is a factory which produces protocols.

    By default, buildProtocol will create a protocol of the class given in
    self.protocol.
    Nz Optional[Callable[[], Protocol]]�protocolrTc�$�||i|��}||_|S)a�
        Create a factory for the given protocol.

        It sets the C{protocol} attribute and returns the constructed factory
        instance.

        @param protocol: A L{Protocol} subclass

        @param args: Positional arguments for the factory.

        @param kwargs: Keyword arguments for the factory.

        @return: A L{Factory} instance wired up to C{protocol}.
        )r)�clsr�args�kwargs�factorys     �;/usr/lib/python3/dist-packages/twisted/internet/protocol.py�forProtocolzFactory.forProtocol&s �� �t�&�v�&��#�����c�.�|jjS)z9
        Describe this factory for log messages.
        ��	__class__�__name__��selfs r�	logPrefixzFactory.logPrefix:s���~�~�&�&�&rc��|js8|jrt|�jd|��|j	�|jdz|_y)zl
        Make sure startFactory is called.

        Users should not call this function themselves!
        zStarting factory {factory!r}�r�N)�numPorts�noisyr�info�startFactoryrs r�doStartzFactory.doStart@sG���}�}��z�z��4� �%�%�&D�d�%�S������
�
��)��
rc���|jdk(ry|jdz
|_|js9|jrt|�jd|��|j	�yy)zk
        Make sure stopFactory is called.

        Users should not call this function themselves!
        rNr$zStopping factory {factory!r}r#)r%r&rr'�stopFactoryrs r�doStopzFactory.doStopLs]���=�=�A��
��
�
��)��
��}�}��z�z��4� �%�%�&D�d�%�S�����rc��y)ay
        This will be called before I begin listening on a Port or Connector.

        It will only be called once, even if the factory is connected
        to multiple ports.

        This can be used to perform 'unserialization' tasks that
        are best put off until things are actually running, such
        as connecting to a database, opening files, etcetera.
        N�rs rr(zFactory.startFactory\��rc��y)a�
        This will be called before I stop listening on all Ports/Connectors.

        This can be overridden to perform 'shutdown' tasks such as disconnecting
        database connections, closing files, etc.

        It will be called, for example, before an application shuts down,
        if it was connected to a port. User code should not call this function
        directly.
        Nr.rs rr+zFactory.stopFactoryhr/r�addr�returnzOptional[Protocol]c�P�|j�J�|j�}||_|S)a�
        Create an instance of a subclass of Protocol.

        The returned instance will handle input on an incoming server
        connection, and an attribute "factory" pointing to the creating
        factory.

        Alternatively, L{None} may be returned to immediately close the
        new connection.

        Override this method to alter how Protocol instances get created.

        @param addr: an object implementing L{IAddress}
        )rr)r r1�ps   r�
buildProtocolzFactory.buildProtocolts+���}�}�(�(�(��M�M�O����	��r)r�
__module__�__qualname__�__doc__r�__annotations__r%r&�classmethodrr!r)r,r(r+r
r5r.rrrrs]���48�H�0�7��H��E�����&'�
*�� 
�
��(��/C�rrc�"�eZdZdZd�Zd�Zd�Zy)�
ClientFactoryz}
    A Protocol factory for clients.

    This can be used together with the various connectXXX methods in
    reactors.
    c��y)z�
        Called when a connection has been started.

        You can call connector.stopConnecting() to stop the connection attempt.

        @param connector: a Connector object.
        Nr.)r �	connectors  r�startedConnectingzClientFactory.startedConnecting�r/rc��y)z�
        Called when a connection has failed to connect.

        It may be useful to call connector.connect() - this will reconnect.

        @type reason: L{twisted.python.failure.Failure}
        Nr.�r r>�reasons   r�clientConnectionFailedz$ClientFactory.clientConnectionFailed�r/rc��y)z�
        Called when an established connection is lost.

        It may be useful to call connector.connect() - this will reconnect.

        @type reason: L{twisted.python.failure.Failure}
        Nr.rAs   r�clientConnectionLostz"ClientFactory.clientConnectionLost�r/rN)rr6r7r8r?rCrEr.rrr<r<�s�����rr<c�<�eZdZdZdZdZd�Zdefd�Zd�Z	d�Z
d	�Zy)
�_InstanceFactoryaP
    Factory used by ClientCreator.

    @ivar deferred: The L{Deferred} which represents this connection attempt and
        which will be fired when it succeeds or fails.

    @ivar pending: After a connection attempt succeeds or fails, a delayed call
        which will fire the L{Deferred} representing this connection attempt.
    FNc�.�||_||_||_y�N)�reactor�instance�deferred)r rJrKrLs    r�__init__z_InstanceFactory.__init__�s����� ��
� ��
rr2c�"�d|j�d�S)Nz<ClientCreator factory: �>)rKrs r�__repr__z_InstanceFactory.__repr__�s��)�$�-�-�):�!�<�<rc��|jjd|j|jj|j
�|_d|_|j
S)z�
        Return the pre-constructed protocol instance and arrange to fire the
        waiting L{Deferred} to indicate success establishing the connection.
        rN)rJ�	callLater�firerL�callbackrK�pending)r r1s  rr5z_InstanceFactory.buildProtocol�sH��
�|�|�-�-�
�t�y�y�$�-�-�0�0�$�-�-�
�����
��}�}�rc��|jjd|j|jj|�|_d|_y)z�
        Arrange to fire the waiting L{Deferred} with the given failure to
        indicate the connection could not be established.
        rN)rJrRrSrL�errbackrUrAs   rrCz'_InstanceFactory.clientConnectionFailed�s:��
�|�|�-�-�
�t�y�y�$�-�-�/�/��
�����
rc�"�d|_||�y)zo
        Clear C{self.pending} to avoid a reference cycle and then invoke func
        with the value.
        N)rU)r �func�values   rrSz_InstanceFactory.fire�s��
����U�r)rr6r7r8r&rUrM�strrPr5rCrSr.rrrGrG�s3���
�E��G�!�
=�#�=�	��rrGc�4�eZdZdZd�Zd�Zdd�Zd	d�Zdd�Zy)
�
ClientCreatora�
    Client connections that do not require a factory.

    The various connect* methods create a protocol instance using the given
    protocol class and arguments, and connect it, returning a Deferred of the
    resulting protocol instance.

    Useful for cases when we don't really need a factory.  Mainly this
    is when there is no shared state between protocol instances, and no need
    to reconnect.

    The C{connectTCP}, C{connectUNIX}, and C{connectSSL} methods each return a
    L{Deferred} which will fire with an instance of the protocol class passed to
    L{ClientCreator.__init__}.  These Deferred can be cancelled to abort the
    connection attempt (in a very unlikely case, cancelling the Deferred may not
    prevent the protocol from being instantiated and connected to a transport;
    if this happens, it will be disconnected immediately afterwards and the
    Deferred will still errback with L{CancelledError}).
    c�<�||_||_||_||_yrI)rJ�
protocolClassrr)r rJr_rrs     rrMzClientCreator.__init__�s�����*�����	���rc�������fd�}tj|�}t|j|j|j
i|j��|��||d�i|���|S)a0
        Initiate a connection attempt.

        @param method: A callable which will actually start the connection
            attempt.  For example, C{reactor.connectTCP}.

        @param args: Positional arguments to pass to C{method}, excluding the
            factory.

        @param kwargs: Keyword arguments to pass to C{method}.

        @return: A L{Deferred} which fires with an instance of the protocol
            class passed to this L{ClientCreator}'s initializer or fails if the
            connection cannot be set up for some reason.
        c�t���j��j��jj�yyrI)�
disconnectrU�cancel)rLr>�fs ��r�
cancelConnectz-ClientCreator._connect.<locals>.cancelConnect
s.���� � �"��y�y�$��	�	� � �"�%rr)r�DeferredrGrJr_rr)r �methodrrre�dr>rds      @@r�_connectzClientCreator._connect�sc���"	#�

�N�N�=�)����L�L�,�$�,�,�d�i�i�G�4�;�;�G��
���t�6�1�6�v�6�	��rNc�V�|j|jj||||��S)a
        Connect to a TCP server.

        The parameters are all the same as to L{IReactorTCP.connectTCP} except
        that the factory parameter is omitted.

        @return: A L{Deferred} which fires with an instance of the protocol
            class passed to this L{ClientCreator}'s initializer or fails if the
            connection cannot be set up for some reason.
        )�timeout�bindAddress)rirJ�
connectTCP)r �host�portrkrls     rrmzClientCreator.connectTCPs3���}�}��L�L�#�#����#��
�	
rc�T�|j|jj|||��S)a�
        Connect to a Unix socket.

        The parameters are all the same as to L{IReactorUNIX.connectUNIX} except
        that the factory parameter is omitted.

        @return: A L{Deferred} which fires with an instance of the protocol
            class passed to this L{ClientCreator}'s initializer or fails if the
            connection cannot be set up for some reason.
        )rk�checkPID)rirJ�connectUNIX)r �addressrkrqs    rrrzClientCreator.connectUNIX,s-���}�}��L�L�$�$�g�w���
�	
rc�X�|j|jj|||||��S)a�
        Connect to an SSL server.

        The parameters are all the same as to L{IReactorSSL.connectSSL} except
        that the factory parameter is omitted.

        @return: A L{Deferred} which fires with an instance of the protocol
            class passed to this L{ClientCreator}'s initializer or fails if the
            connection cannot be set up for some reason.
        )�contextFactoryrkrl)rirJ�
connectSSL)r rnrorurkrls      rrvzClientCreator.connectSSL;s6���}�}��L�L�#�#���)��#�
�
�	
r)�N)rwF)	rr6r7r8rMrirmrrrvr.rrr]r]�s ���(��:
�&

�
rr]c�b�eZdZdZdZdZdZdZeZdZ	dZ
dZdZdZ
dZd	�Zd
�Zdd�Zd�Zd
�Zd�Zy)�ReconnectingClientFactorya�
    Factory which auto-reconnects clients with an exponential back-off.

    Note that clients should call my resetDelay method after they have
    connected successfully.

    @ivar maxDelay: Maximum number of seconds between connection attempts.
    @ivar initialDelay: Delay for the first reconnection attempt.
    @ivar factor: A multiplicitive factor by which the delay grows
    @ivar jitter: Percentage of randomness to introduce into the delay length
        to prevent stampeding.
    @ivar clock: The clock used to schedule reconnection. It's mainly useful to
        be parametrized in tests. If the factory is serialized, this attribute
        will not be serialized, and the default value (the reactor) will be
        restored when deserialized.
    @type clock: L{IReactorTime}
    @ivar maxRetries: Maximum number of consecutive unsuccessful connection
        attempts, after which no further connection attempts will be made. If
        this is not explicitly set, no maximum is applied.
    ig�?giW�
�@g6Q�؟�?rNr$c�L�|jr||_|j�yyrI��continueTryingr>�retryrAs   rrCz0ReconnectingClientFactory.clientConnectionFailed~� �����&�D�N��J�J�L�rc�L�|jr||_|j�yyrIr{)r r>�
unused_reasons   rrEz.ReconnectingClientFactory.clientConnectionLost�r~rc�t����js&�jrtjd��d��y��#�j�td���j��xjdz
c_�j�J�j�jkDr1�jr$tjd��jfz�yt�j�jz�j��_	�jr<tj�j�j�jz��_	�jr$tjd��jfz���fd�}�j�
d	d
lm}|�_�jj%�j|��_y)zL
        Have this connector connect again, after a suitable delay.
        zAbandoning z on explicit requestNzno connector to retryr$zAbandoning %s after %d retries.z%s will retry in %d secondsc�4��d�_�j�yrI)�_callID�connect)r>r s��r�reconnectorz4ReconnectingClientFactory.retry.<locals>.reconnector�s����D�L����rr)rJ)r|r&r�msgr>�
ValueError�retries�
maxRetries�min�delay�factor�maxDelay�jitter�random�
normalvariate�clock�twisted.internetrJrRr�)r r>r�rJs``  rr}zReconnectingClientFactory.retry�sK����"�"��z�z����+�i�[�0D�E�F�����~�~�%� �!8�9�9� �N�N�	��������?�?�&�D�L�L�4�?�?�,J��z�z����9�Y����<U�U�V������d�k�k�1�4�=�=�A��
��;�;��-�-�d�j�j�$�*�*�t�{�{�:R�S�D�J��:�:��G�G�-���J�J���
�	 ��:�:��0� �D�J��z�z�+�+�D�J�J��D��rc���|jr!|jj�d|_d|_|jr	|jj	�yy#t
j$rYywxYw)zE
        Put a stop to any attempt to reconnect in progress.
        Nr)r�rcr|r>�stopConnectingr�NotConnectingErrorrs r�
stopTryingz$ReconnectingClientFactory.stopTrying�se��
�<�<��L�L���!��D�L�����>�>�
����-�-�/����+�+�
��
�s�A�A4�3A4c�P�|j|_d|_d|_d|_y)zt
        Call this method after a successful connection: it resets the delay and
        the retry counter.
        rNr$)�initialDelayr�r�r�r|rs r�
resetDelayz$ReconnectingClientFactory.resetDelay�s'��
�&�&��
���������rc�X�|jj�}dD]
}||vs�||=�|S)a-
        Remove all of the state which is mutated by connection attempts and
        failures, returning just the state which describes how reconnections
        should be attempted.  This will make the unserialized instance
        behave just as this one did when it was first instantiated.
        )r>r�r�r|r�r���__dict__�copy)r �state�keys   r�__getstate__z&ReconnectingClientFactory.__getstate__�s>���
�
�"�"�$��
�		�C��e�|��#�J�		��rrI)rr6r7r8r�r�r�r�r�r�r�r�r>r�r|rCrEr}r�r�r�r.rrryryPsd���*�H��L�
 �F��F��E��G��J��G��I��E��N��
�
*E�X
� �rryc��eZdZdZy)�
ServerFactoryzZ
    Subclass this to indicate that your protocol.Factory is only usable for servers.
    N)rr6r7r8r.rrr�r��s��rr�c�6�eZdZUdZdZdZeeed<d�Z	d�Z
y)�BaseProtocola
    This is the abstract superclass of all protocols.

    Some methods have helpful default implementations here so that they can
    easily be shared, but otherwise the direct subclasses of this class are more
    interesting, L{Protocol} and L{ProcessProtocol}.
    rN�	transportc�@�d|_||_|j�y)z�
        Make a connection to a transport and a server.

        This sets the 'transport' attribute of this Protocol, and calls the
        connectionMade() callback.
        r$N)�	connectedr��connectionMade�r r�s  r�makeConnectionzBaseProtocol.makeConnection�s�����"������rc��y)a�
        Called when a connection is made.

        This may be considered the initializer of the protocol, because
        it is called when the connection is completed.  For clients,
        this is called once the connection to the server has been
        established; for servers, this is called after an accept() call
        stops blocking and a socket has been received.  If you need to
        send any greeting or initial message, do it here.
        Nr.rs rr�zBaseProtocol.connectionMade�r/r)rr6r7r8r�r�rrr9r�r�r.rrr�r��s'����I�&*�I�x�
�#�*�	�
rr�c�d�eZdZUdZdZeeed<d�Zde	ddfd�Z
efdejddfd	�Zy)
�Protocola�
    This is the base class for streaming connection-oriented protocols.

    If you are going to write a new connection-oriented protocol for Twisted,
    start here.  Any protocol implementation, either client or server, should
    be a subclass of this class.

    The API is quite simple.  Implement L{dataReceived} to handle both
    event-based and synchronous input; output can be sent through the
    'transport' attribute, which is to be an instance that implements
    L{twisted.internet.interfaces.ITransport}.  Override C{connectionLost} to be
    notified when the connection ends.

    Some subclasses exist already to help you write common types of protocols:
    see the L{twisted.protocols.basic} module for a few of them.
    Nrc�.�|jjS�z~
        Return a prefix matching the class name, to identify log messages
        related to this protocol instance.
        rrs rr!zProtocol.logPrefix%���
�~�~�&�&�&r�datar2c��y)aF
        Called whenever data is received.

        Use this method to translate to a higher-level message.  Usually, some
        callback will be made upon the receipt of each complete protocol
        message.

        @param data: a string of indeterminate length.  Please keep in mind
            that you will probably need to buffer some data, as partial
            (or multiple) protocol messages may be received!  I recommend
            that unit tests for protocols call through to this method with
            differing chunk sizes, down to one byte at a time.
        Nr.�r r�s  r�dataReceivedzProtocol.dataReceived,r/rrBc��y)z�
        Called when the connection is shut down.

        Clear any circular references here, and any external references
        to this Protocol.  The connection has been closed.

        @type reason: L{twisted.python.failure.Failure}
        Nr.�r rBs  r�connectionLostzProtocol.connectionLost;r/r)rr6r7r8rrrr9r!�bytesr��connectionDoner�Failurer�r.rrr�r�sM���""&�G�X�g�
�%�'�
��
�4�
�8F��W�_�_��$�rr�c�(�eZdZdeddfd�Zd�Zd�Zy)�ProtocolToConsumerAdapterr�r2Nc�:�|jj|�yrI)�originalr�r�s  r�writezProtocolToConsumerAdapter.writeHs���
�
�"�"�4�(rc��yrIr.�r �producer�	streamings   r�registerProducerz*ProtocolToConsumerAdapter.registerProducerK���rc��yrIr.rs r�unregisterProducerz,ProtocolToConsumerAdapter.unregisterProducerNr�r)rr6r7r�r�r�r�r.rrr�r�Fs��)�%�)�D�)�
�
rr�c�L�eZdZdeddfd�Zdejddfd�Zd�Zd�Z	y)	�ConsumerToProtocolAdapterr�r2Nc�:�|jj|�yrI)r�r�r�s  rr�z&ConsumerToProtocolAdapter.dataReceivedYs���
�
���D�!rrBc��yrIr.r�s  rr�z(ConsumerToProtocolAdapter.connectionLost\r�rc��yrIr.r�s  rr�z(ConsumerToProtocolAdapter.makeConnection_r�rc��yrIr.rs rr�z(ConsumerToProtocolAdapter.connectionMadebr�r)
rr6r7r�r�rr�r�r�r�r.rrr�r�Ws6��"��"�4�"�
�W�_�_�
��
�
�
rr�c���eZdZUdZdZeejed<de	de
ddfd�Zde
ddfd�Zde
ddfd	�Z
de	ddfd
�Zd�Zd�Zd
�Zdej&ddfd�Zdej&ddfd�Zy)�ProcessProtocolz�
    Base process protocol implementation which does simple dispatching for
    stdin, stdout, and stderr file descriptors.
    Nr��childFDr�r2c�`�|dk(r|j|�y|dk(r|j|�yy)Nr$�)�outReceived�errReceived)r r�r�s   r�childDataReceivedz!ProcessProtocol.childDataReceivedts1���a�<����T�"�
��\����T�"�rc��y)z5
        Some data was received from stdout.
        Nr.r�s  rr�zProcessProtocol.outReceivedzr/rc��y)z5
        Some data was received from stderr.
        Nr.r�s  rr�zProcessProtocol.errReceivedr/rc��|dk(r|j�y|dk(r|j�y|dk(r|j�yy)Nrr$r�)�inConnectionLost�outConnectionLost�errConnectionLost)r r�s  r�childConnectionLostz#ProcessProtocol.childConnectionLost�s@���a�<��!�!�#�
��\��"�"�$�
��\��"�"�$�rc��y)z;
        This will be called when stdin is closed.
        Nr.rs rr�z ProcessProtocol.inConnectionLost�r/rc��y)z<
        This will be called when stdout is closed.
        Nr.rs rr�z!ProcessProtocol.outConnectionLost�r/rc��y)z<
        This will be called when stderr is closed.
        Nr.rs rr�z!ProcessProtocol.errConnectionLost�r/rrBc��y)zy
        This will be called when the subprocess exits.

        @type reason: L{twisted.python.failure.Failure}
        Nr.r�s  r�
processExitedzProcessProtocol.processExited�r/rc��y)z�
        Called when the child process exits and all file descriptors
        associated with it have been closed.

        @type reason: L{twisted.python.failure.Failure}
        Nr.r�s  r�processEndedzProcessProtocol.processEnded�r/r)rr6r7r8r�rr	�IProcessTransportr9�intr�r�r�r�r�r�r�r�rr�r�r�r.rrr�r�ks����
9=�I�x�
�4�4�5�<�#��#�E�#�d�#����$��
���$��
%�3�%�4�%��
�
�
�G�O�O�����7�?�?��t�rr�c�T�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
d	�Zd
�Zde
ded
dfd�Zy)�AbstractDatagramProtocolzZ
    Abstract protocol for datagram-oriented transports, e.g. IP, ICMP, ARP,
    UDP.
    NrTc�D�|jj�}d|d<|S)Nr�r�)r rhs  rr�z%AbstractDatagramProtocol.__getstate__�s"���M�M��� ����+���rc��|js4|jrtjd|z�|j	�|jdz|_y)z�
        Make sure startProtocol is called.

        This will be called by makeConnection(), users should not call it.
        zStarting protocol %sr$N)r%r&rr��
startProtocolrs rr)z AbstractDatagramProtocol.doStart�s@���}�}��z�z����.��5�6���� ��
�
��)��
rc���|jdkDsJ�|jdz
|_d|_|js5|jrtjd|z�|j�yy)zw
        Make sure stopProtocol is called.

        This will be called by the port, users should not call it.
        rr$NzStopping protocol %s)r%r�r&rr��stopProtocolrs rr,zAbstractDatagramProtocol.doStop�s^���}�}�q� � � ��
�
��)��
�����}�}��z�z����.��5�6�����rc��y)z�
        Called when a transport is connected to this protocol.

        Will only be called once, even if multiple ports are connected.
        Nr.rs rr�z&AbstractDatagramProtocol.startProtocol�r/rc��y)z�
        Called when the transport is disconnected.

        Will only be called once, after all ports are disconnected.
        Nr.rs rr�z%AbstractDatagramProtocol.stopProtocol�r/rc�T�|jdk(sJ�||_|j�y)z�
        Make a connection to a transport and a server.

        This sets the 'transport' attribute of this DatagramProtocol, and calls the
        doStart() callback.
        N)r�r)r�s  rr�z'AbstractDatagramProtocol.makeConnection�s&���~�~��%�%�%�"������r�datagramr1r2c��y)z�
        Called when a datagram is received.

        @param datagram: the bytes received from the transport.
        @param addr: tuple of source of datagram.
        Nr.)r r�r1s   r�datagramReceivedz)AbstractDatagramProtocol.datagramReceived�r/r)rr6r7r8r�r%r&r�r)r,r�r�r�r�rr�r.rrr�r��sP���
�I��H��E��

*� ���	����c��d�rr�c��eZdZdZd�Zd�Zy)�DatagramProtocola
    Protocol for datagram-oriented transport, e.g. UDP.

    @type transport: L{None} or
        L{IUDPTransport<twisted.internet.interfaces.IUDPTransport>} provider
    @ivar transport: The transport with which this protocol is associated,
        if it is associated with one.
    c�.�|jjSr�rrs rr!zDatagramProtocol.logPrefixr�rc��y)z�
        Called due to error from write in connected mode.

        Note this is a result of ICMP message generated by *previous*
        write.
        Nr.rs r�connectionRefusedz"DatagramProtocol.connectionRefusedr/rN)rr6r7r8r!r�r.rrr�r��s���'�rr�c�:�eZdZdZd�Zdejddfd�Zy)�ConnectedDatagramProtocolz_
    Protocol for connected datagram-oriented transport.

    No longer necessary for UDP.
    c��y)zw
        Called when a datagram is received.

        @param datagram: the string received from the transport.
        Nr.)r r�s  rr�z*ConnectedDatagramProtocol.datagramReceivedr/rrr2Nc��y)zi
        Called if connecting failed.

        Usually this will be due to a DNS lookup failure.
        Nr.)r rs  r�connectionFailedz*ConnectedDatagramProtocol.connectionFailedr/r)rr6r7r8r�rr�r�r.rrr�r�s#���������D�rr�c�~�eZdZdZdZdZdZdZd�Zde	ddfd�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�FileWrapperz�
    A wrapper around a file-like object to make it behave as a Transport.

    This doesn't actually stream the file to the attached protocol,
    and is thus useful mainly as a utility for debugging protocols.
    rNc��||_yrI)�file)r rs  rrMzFileWrapper.__init__5s	����	rr�r2c�z�	|jj|�y#t$r|j�YywxYwrI)rr��
BaseException�handleExceptionr�s  rr�zFileWrapper.write8s2��	#��I�I�O�O�D�!���	#�� � �"�	#�s��:�:c�R�|jr|jj�yyrI)r��resumeProducingrs r�_checkProducerzFileWrapper._checkProducer>s ���=�=��M�M�)�)�+�rc�F�||_||_|s|j�yy)z.
        From abstract.FileDescriptor
        N)r��streamingProducerrr�s   rr�zFileWrapper.registerProducerDs'��!��
�!*�����$�$�&�rc��d|_yrI)r�rs rr�zFileWrapper.unregisterProducerMs	����
rc�D�|j�|j�yrI)r��loseConnectionrs r�
stopConsumingzFileWrapper.stopConsumingPs�����!����rc�D�|jdj|��y)Nr)r��join)r �iovecs  r�
writeSequencezFileWrapper.writeSequenceTs���
�
�3�8�8�E�?�#rc��d|_	|jj�y#t$r|j	�YywxYw)Nr$)�closedr�close�OSErrorrrs rrzFileWrapper.loseConnectionWs7�����	#��I�I�O�O����	#�� � �"�	#�s�$�A�Ac��y)N)rrr.rs r�getPeerzFileWrapper.getPeer^s��rc��y)Nrr.rs r�getHostzFileWrapper.getHostcs��rc��yrIr.rs rrzFileWrapper.handleExceptionhr�rc��yrIr.rs rrzFileWrapper.resumeProducingk���rc��yrIr.rs r�pauseProducingzFileWrapper.pauseProducingorrc�$�|j�yrI)rrs r�
stopProducingzFileWrapper.stopProducingss�����r)rr6r7r8r�
disconnectingr�rrMr�r�rr�r�rrrrrrrrrr.rrr�r�'sr����F��M��H����#�%�#�D�#�,�'���$�#��
�

�
�
�rr�)rr<ryr�r�r�r�r�r�r�r�r])0r8r��typingrrr�zope.interfacerr�rrr	�twisted.internet.interfacesr
r�twisted.loggerr�twisted.pythonr
rr�IProtocolFactory�ILoggingContextrr<rGr]ryr�r�r��ConnectionDoner��cleanFailure�	IProtocolr��	IConsumer�Adapterr��registerAdapterr��IProcessProtocolr�r�r�r�r��__all__r.rr�<module>r0s:��
��*�*�&�5�5�<�%�3�3�
�Z�
(�
(�*�*D�*D�E�m�m�F�m�`!�G�!�H1�}�1�hl
�l
�^O�
�O�d�G��!�!�H!����!5��!5�!5�!7�8������
�Z�
!�
!�:�#=�#=�>�2�|�2�?�2�j
�Z�
!�
!�"�
�
� 2� 2�
�#�
��
����z�3�3�Z�5I�5I��

�Z�
!�
!�"�
�
� 2� 2�
�#�
��
����z�3�3�Z�5I�5I��

�Z�
(�
(�)�<�l�<�*�<�~H�H�V
�Z�
'�
'�(��/��)��4� 0��,
�Z�
"�
"�#�L�L�$�L�^
�r
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!