�
Ϫ�f� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZm
Z
mZmZmZ ddlmZ dd lmZ dd
lmZ d� Z G d� d
ej0 � Z G d� de� Z G d� de� ZdZdZ G d� de� Z G d� de� Z G d� de� Z G d� de� Z! G d� de� Z" G d� de� Z# G d � d!e� Z$ G d"� d#e� Z% G d$� d%e� Z& G d&� d'e� Z' G d(� d)e� Z( G d*� d+ej0 � Z) G d,� d-ej0 � Z* G d.� d/� Z+ G d0� d1� Z,d2d3d4efd5�Z- e-� Z.d6� Z/ G d7� d8� Z0 G d9� d:ej0 � Z1g d;�Z2y<)=a�
Reactor-based Services
Here are services to run clients, servers and periodic services using
the reactor.
If you want to run a server service, L{StreamServerEndpointService} defines a
service that can wrap an arbitrary L{IStreamServerEndpoint
<twisted.internet.interfaces.IStreamServerEndpoint>}
as an L{IService}. See also L{twisted.application.strports.service} for
constructing one of these directly from a descriptive string.
Additionally, this module (dynamically) defines various Service subclasses that
let you represent clients and servers in a Service hierarchy. Endpoints APIs
should be preferred for stream server services, but since those APIs do not yet
exist for clients or datagram services, many of these are still useful.
They are as follows::
TCPServer, TCPClient,
UNIXServer, UNIXClient,
SSLServer, SSLClient,
UDPServer,
UNIXDatagramServer, UNIXDatagramClient,
MulticastServer
These classes take arbitrary arguments in their constructors and pass
them straight on to their respective reactor.listenXXX or
reactor.connectXXX calls.
For example, the following service starts a web server on port 8080:
C{TCPServer(8080, server.Site(r))}. See the documentation for the
reactor.listen/connect* methods for more information.
� )�random)�List)�MethodicalMachine)�service)�task)�CancelledError�Deferred�fail�
maybeDeferred�succeed)�Logger)�log)�Failurec � � | �ddl m} |S | S )zR
@return: the argument, or the global reactor if the argument is L{None}.
r )�reactor)�twisted.internetr )�maybeReactorr s �>/usr/lib/python3/dist-packages/twisted/application/internet.py�_maybeGlobalReactorr < |