Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyc


0Nc@sdZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
ddlmZm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZmZyddlmZWn*ek
rdZdZejdn
XejfZdd
l m!Z!dZ"dZ#e$d\Z%Z&e
j'dZ(e
j'dZ)dej*ej+efdYZ,dZ-ddgZ.dS(s'
Reactor that uses IO completion ports
iN(t
implements(tbaset
interfacestmainterror(tlogtfailure(tProcess(t_ThreadedWin32EventsMixin(tiocpsupport(tWAIT_TIMEOUT(ttcptudp(tTLSMemoryBIOFactorys|pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. It is missing, so the reactor will not support SSL APIs.(tsetiiis#Handler has no getFileHandle methodsFiledescriptor went awaytIOCPReactorcBs2eZeejejejejedZ
dZdZdZ
dZdZdZdZdZdZd	d
dZddd
Zedk	rd	d
dZdddZnd	d
dZdddZd
ddZd
dedZdiddddddZdZRS(cCs/tjj|tj|_t|_dS(N(RtReactorBaset__init__t_iocptCompletionPorttportRthandles(tself((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyR:scCs|jj|dS(N(Rtadd(Rthandle((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytaddActiveHandle@scCs|jj|dS(N(Rtdiscard(RR((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytremoveActiveHandleDscCsd}|dkrt}ntttd|}|jj|\}}}}x|tkrePn|tkr|tkst	t
j|j|j
||||d7}n|tkrPn|jjd\}}}}qUdS(s=
        Poll the IO completion port for new events.
        iiiN(tNonetMAX_TIMEOUTtmintintRtgetEventR
t
KEY_WAKEUPt
KEY_NORMALtAssertionErrorRtcallWithLoggertownert_callEventCallbacktEVENTS_PER_LOOP(Rttimeouttprocessed_eventstrctbytestkeytevt((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytdoIterationHs 	

cCs|j}d}yZ|j|||t|dd}|sFt}n|dkr^t}n|rhdSWn!tjd}tj	nX|r|j
tj|ndS(Nt
getFileHandleii(
R%Rtcallbacktgetattrt
_NO_GETHANDLEt_NO_FILEDESCtsystexc_infoRterrtloseConnectionRtFailure(RR*R+R-R%twhythandfn((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyR&ts 			cCsdS(N((R((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytinstallWakerscCs|jjdtddS(Ni(Rt	postEventR!R(R((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytwakeUpscCs|jj|tdS(N(Rt	addHandleR"(RR((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytregisterHandlescCs)tj||}|j|j|S(N(tsocketR?tfileno(Rtaftstypetskt((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytcreateSocketsi2tcCs)tj|||||}|j|S(sI
        @see: twisted.internet.interfaces.IReactorTCP.listenTCP
        (RtPorttstartListening(RRtfactorytbacklogt	interfacetp((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt	listenTCPs
icCs,tj||||||}|j|S(sJ
        @see: twisted.internet.interfaces.IReactorTCP.connectTCP
        (Rt	Connectortconnect(RthostRRIR(tbindAddresstc((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt
connectTCPs
cCs1|j|t|t|||}d|_|S(sQ
            @see: twisted.internet.interfaces.IReactorSSL.listenSSL
            tTLS(RMR
tFalset_type(RRRItcontextFactoryRJRK((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt	listenSSLs	cCs%|j||t|t|||S(sR
            @see: twisted.internet.interfaces.IReactorSSL.connectSSL
            (RSR
tTrue(RRPRRIRWR(RQ((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt
connectSSLscCstddS(s
            Non-implementation of L{IReactorSSL.listenSSL}.  Some dependency
            is not satisfied.  This implementation always raises
            L{NotImplementedError}.
            s|pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. It is missing, so the reactor does not support SSL APIs.N(tNotImplementedError(RRRIRWRJRK((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyRXscCstddS(s
            Non-implementation of L{IReactorSSL.connectSSL}.  Some dependency
            is not satisfied.  This implementation always raises
            L{NotImplementedError}.
            s|pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. It is missing, so the reactor does not support SSL APIs.N(R[(RRPRRIRWR(RQ((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyRZsi cCs)tj|||||}|j|S(s
        Connects a given L{DatagramProtocol} to the given numeric UDP port.

        @returns: object conforming to L{IListeningPort}.
        (RRGRH(RRtprotocolRKt
maxPacketSizeRL((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt	listenUDPs
cCs,tj||||||}|j|S(s
        Connects a given DatagramProtocol to the given numeric UDP port.

        EXPERIMENTAL.

        @returns: object conforming to IListeningPort.
        (Rt
MulticastPortRH(RRR\RKR]tlistenMultipleRL((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytlistenMulticasts		
ic

Cs|dk	rtdn|dk	r6tdn|rKtdn|	dk	rftdn|j||\}}t||||||S(s"
        Spawn a process.
        s,Setting UID is unsupported on this platform.s,Setting GID is unsupported on this platform.s&PTYs are unsupported on this platform.sGCustom child file descriptor mappings are unsupported on this platform.N(Rt
ValueErrort_checkProcessArgsR(
RtprocessProtocolt
executabletargstenvtpathtuidtgidtusePTYtchildFDs((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytspawnProcessscCs t|j}|jj|S(N(tlistRtclear(Rtres((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt	removeAlls
N((t__name__t
__module__RRtIReactorTCPtIReactorUDPtIReactorMulticasttIReactorProcesst_extraInterfacesRRRRRR.R&R;R=R?RERMRSR
RXRZR^RURaRmRq(((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyR2s4				,								cCst}tj|dS(N(RRtinstallReactor(tr((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pytinstall
s	R{((/t__doc__twarningsR@R4tzope.interfaceRttwisted.internetRRRRttwisted.pythonRRttwisted.internet._dumbwin32procRt"twisted.internet.win32eventreactorRttwisted.internet.iocpreactorR	Rt"twisted.internet.iocpreactor.constR
RRttwisted.protocols.tlsR
tImportErrorRRxtwarntIReactorSSLttwisted.python.compatRRR'trangeR"R!tConnectionFdescWentAwayR2R3t_SignalReactorMixinRRR{t__all__(((sH/usr/lib/python2.7/dist-packages/twisted/internet/iocpreactor/reactor.pyt<module>s8$"