![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/twisted/protocols/__pycache__/ |
o �b{S � @ sB d Z ddlZddlmZmZ ddlmZmZ ddlm Z m Z ddlmZ ddl mZmZmZ ddlmZ d d � ZG dd� de�ZG d d� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�ZG d!d"� d"e�ZG d#d$� d$�Z dS )%z] Resource limiting policies. @seealso: See also L{twisted.protocols.htb} for rate limiting. � N)�Optional�Type)�directlyProvides� providedBy)�error� interfaces)�ILoggingContext)� ClientFactory�Protocol� ServerFactory)�logc C s0 t �|�r |�� }n|jj}|� d| jj� d�S )zY Compute a log prefix for a wrapper and the object it wraps. @rtype: C{str} z (�))r r � logPrefix� __class__�__name__)�wrapper�wrappedr � r �</usr/lib/python3/dist-packages/twisted/protocols/policies.py�_wrappedLogPrefix s r c @ s� e Zd ZdZdZdddejfdd�Zdd � Zd d� Z dd � Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"S )#�ProtocolWrappera� Wraps protocol instances and acts as their transport as well. @ivar wrappedProtocol: An L{IProtocol<twisted.internet.interfaces.IProtocol>} provider to which L{IProtocol<twisted.internet.interfaces.IProtocol>} method calls onto this L{ProtocolWrapper} will be proxied. @ivar factory: The L{WrappingFactory} which created this L{ProtocolWrapper}. r �factory�WrappingFactory�wrappedProtocolc C s || _ || _d S �N)r r )�selfr r r r r �__init__5 s zProtocolWrapper.__init__c C � t | | j�S )zo Use a customized log prefix mentioning both the wrapped protocol and the current one. )r r �r r r r r ; s zProtocolWrapper.logPrefixc C s6 t | t|�� t�| |� | j�| � | j�| � dS )z� When a connection is made, register this wrapper with its factory, save the real transport, and connect the wrapped protocol to this L{ProtocolWrapper} to intercept any transport calls it makes. N)r r r �makeConnectionr �registerProtocolr )r � transportr r r r B s zProtocolWrapper.makeConnectionc C � | j �|� d S r )r! �write�r �datar r r r# O � zProtocolWrapper.writec C r"