File: //usr/lib/python3/dist-packages/twisted/internet/__pycache__/posixbase.cpython-38.pyc
U
��W[�f � @ s� d Z ddlmZmZ ddlZddlZddlZddlZddlm Z m
Z
ddlmZm
Z
mZ ddlmZmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZ dd l m!Z!m"Z"m#Z# dd
l$m%Z%m&Z& e�'d�Z(e�'d�Z)zdd
l*m+Z+ W nF e,k
�r6 dZ+zddlm-Z- W n e,k
�r0 dZ-Y nX Y nX e%dkZ.dZ/e.�rnddlm0Z0m1Z1 ddlm2Z2m3Z3 dZ/e&�4� �r�zddl5Z5dZ/W n e,k
�r� dZ5Y nX G dd� de!j6�Z7G dd� de!j6e8�Z9G dd� de9�Z:e%dk�r�e:Z;ne7Z;G dd� de9�Z<G dd� de8�Z=e eee�G dd� dee=e��Z>G d d!� d!e8�Z?e e�G d"d#� d#e?e=��Z@e+dk �sle-dk �rve
e>e� e.�r�e
e>ee� e/�r�e
e>e� eAed$d�dk �r�e
e>e� dgZBdS )%z
Posix reactor base class
� )�division�absolute_importN)�implementer�classImplements)�error�udp�tcp)�ReactorBase�_SignalReactorMixin)�CONNECTION_DONE�CONNECTION_LOST)
�IReactorUNIX�IReactorUNIXDatagram�IReactorTCP�IReactorUDP�IReactorSSL�IReactorSocket�IHalfCloseableDescriptor�IReactorProcess�IReactorMulticast�
IReactorFDSet)�log�failure�util)�platformType�platformzHandler has no fileno methodzFile descriptor lost)�tls)�ssl�posixF)�fdesc�unix)�process�_signalsTc @ s4 e Zd ZdZdZdd� Zdd� Zdd� Zd d
� ZdS )�_SocketWakerz�
The I{self-pipe trick<http://cr.yp.to/docs/selfpipe.html>}, implemented
using a pair of sockets rather than pipes (due to the lack of support in
select() on Windows for pipes), used to wake up the main loop from
another thread.
r c C s� || _ t�tjtj�}t�tjtj�}|�tjtjd� |�d� |�d� |� |�
� � |�� \}}|�d� |�d� || _
|| _| j
j| _dS )�Initialize.
� )z 127.0.0.1r r N)�reactor�socket�AF_INETZSOCK_STREAMZ
setsockoptZIPPROTO_TCPZTCP_NODELAYZbindZlisten�connectZgetsocknameZacceptZsetblocking�r�w�fileno)�selfr&