Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/internet/test/__pycache__/connectionmixins.cpython-39.pyc
Ðазад
a k�h�N � @ s� d Z ddlZddlmZ ddlmZ ddlmZ ddlm Z ddl mZmZ ddl mZmZ dd lmZmZmZ dd lmZ ddlmZmZ ddlmZ dd lmZmZmZ ddlm Z ddl!m"Z" ddl#m$Z$ dej%ej&fdd�Z'G dd� de�Z(G dd� d�Z)G dd� de�Z*dd� Z+dd� Z,G dd� de�Z-G d d!� d!�Z.G d"d#� d#e�Z/G d$d%� d%e(�Z0G d&d'� d'�Z1G d(d)� d)�Z2G d*d+� d+�Z3G d,d-� d-�Z4dS ).z? Various helpers for tests for connection-oriented transports. � N)�collect)�Optional)�ref)�verifyObject)�Deferred� gatherResults)� IConnector� IReactorFDSet)� ClientFactory�Protocol� ServerFactory)�needsRunningReactor)�context�log)�Failure)�ILogContext�err�msg)�platform)�ClosingProtocol)�SkipTestz 127.0.0.1c C s� t �| d�d d }t � ||�}zh|�|� |t jkrl|�� }t �|t jt jB �d }||d fW |�� S |�� W |�� S W |�� n |�� 0 dS )a� Ask the platform to allocate a free port on the specified interface, then release the socket and return the address which was allocated. @param interface: The local address to try to bind the port on. @type interface: C{str} @param type: The socket type which will use the resulting port. @return: A two-tuple of address and port, like that returned by L{socket.getsockname}. r � � N) �socket�getaddrinfo�bind�AF_INET6�getsockname�getnameinfo�NI_NUMERICHOST�NI_NUMERICSERV�close)Z interface�family�type�addrZprobeZsockname�hostname� r&