ACC SHELL

Path : /usr/lib/python/
File Upload :
Current File : //usr/lib/python/asyncore.pyo

Ñò
nÄMc@sËdZddkZddkZddkZddkZddkZddklZlZl	Z	l
Z
lZlZl
Z
lZlZlZlZyeWnej
o
hZnXd„Zdefd„ƒYZeeefZd„Zd„Zd	„Zd
„Zded„Zded
„Z e Z!de"eed„Z#dfd„ƒYZ$de$fd„ƒYZ%d„Z&ee"d„Z'ei(djo9ddk)Z)dfd„ƒYZ*de$fd„ƒYZ+ndS(s Basic infrastructure for asynchronous socket service clients and servers.

There are only two ways to have a program on a single processor do "more
than one thing at a time".  Multi-threaded programming is the simplest and
most popular way to do it, but there is another very different technique,
that lets you have nearly all the advantages of multi-threading, without
actually using multiple threads. it's really only practical if your program
is largely I/O bound. If your program is CPU bound, then pre-emptive
scheduled threads are probably what you really need. Network servers are
rarely CPU-bound, however.

If your operating system supports the select() system call in its I/O
library (and nearly all do), then you can use it to juggle multiple
communication channels at once; doing other work while your I/O is taking
place in the "background."  Although this strategy can seem strange and
complex, especially at first, it is in many ways easier to understand and
control than multi-threaded programming. The module documented here solves
many of the difficult problems for you, making the task of building
sophisticated high-performance network servers and clients a snap.
iÿÿÿÿN(tEALREADYtEINPROGRESStEWOULDBLOCKt
ECONNRESETtENOTCONNt	ESHUTDOWNtEINTRtEISCONNtEBADFtECONNABORTEDt	errorcodecCs.ti|ƒ}|djot|}n|S(Ns
Unknown error(toststrerrorR
(terrtres((s/usr/lib/python2.6/asyncore.pyt	_strerror?s
tExitNowcBseZRS((t__name__t
__module__(((s/usr/lib/python2.6/asyncore.pyREscCs;y|iƒWn&tj
o
‚n|iƒnXdS(N(thandle_read_eventt_reraised_exceptionsthandle_error(tobj((s/usr/lib/python2.6/asyncore.pytreadJscCs;y|iƒWn&tj
o
‚n|iƒnXdS(N(thandle_write_eventRR(R((s/usr/lib/python2.6/asyncore.pytwriteRscCs;y|iƒWn&tj
o
‚n|iƒnXdS(N(thandle_expt_eventRR(R((s/usr/lib/python2.6/asyncore.pyt
_exceptionZscCs¯y‚|ti@o|iƒn|ti@o|iƒn|titiBtiB@o|iƒn|ti	@o|i
ƒnWn&tj
o
‚n|iƒnXdS(N(
tselecttPOLLINRtPOLLOUTRtPOLLHUPtPOLLERRtPOLLNVALthandle_closetPOLLPRIRRR(Rtflags((s/usr/lib/python2.6/asyncore.pyt	readwritebsgc
Cs|djo
t}n|oïg}g}g}x|iƒD]s\}}|iƒ}|iƒ}|o|i|ƒn|o|i|ƒn|p|o|i|ƒq=q=Wg|jo|jo
|jnoti|ƒdSy%ti||||ƒ\}}}Wn7ti	j
o(}	|	i
dtjo‚qOdSnXx;|D]3}|i|ƒ}|djoqVnt
|ƒqVWx;|D]3}|i|ƒ}|djoq”nt|ƒq”Wx?|D]3}|i|ƒ}|djoqÒnt|ƒqÒWndS(Ni(tNonet
socket_maptitemstreadabletwritabletappendttimetsleepRterrortargsRtgetRRR(
ttimeouttmaptrtwtetfdRtis_rtis_wR
((s/usr/lib/python2.6/asyncore.pytpollqsV


*
%	


c	Cs…|djo
t}n|dj	ot|dƒ}ntiƒ}|o6x™|iƒD]‹\}}d}|iƒo|titiBO}n|i	ƒo|ti
O}n|o/|titiBti
BO}|i||ƒqXqXWy|i|ƒ}Wn9tij
o*}|idtjo‚ng}nXxH|D]<\}}|i|ƒ}|djoq=nt||ƒq=WndS(Nièi(R&R'tintRR9R(R)RR#R*RR RR!tregisterR.R/RR0R%(R1R2tpollsterR6RR$R3R
((s/usr/lib/python2.6/asyncore.pytpoll2s8






g>@cCs¢|djo
t}n|ottdƒo
t}nt}|djo xP|o|||ƒqNWn4x0|o(|djo|||ƒ|d}qnWdS(NR9ii(R&R'thasattrRR=R9(R1tuse_pollR2tcounttpoll_fun((s/usr/lib/python2.6/asyncore.pytloop¿s




t
dispatchercBsUeZeZeZeZeZd Ze	dgƒZ
d d d„Zd„Zd d„Z
d d„Zd„Zd d„Zd„Zd„Zd	„Zd
„Zd„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd„Z d„Z!d„Z"d„Z#d„Z$d„Z%d„Z&d„Z'd„Z(RS(!twarningcCsÉ|djo
t|_n
||_d|_|o‰|idƒ|i||ƒt|_y|iƒ|_	WqÅt
ij
o:}|idt
jo
t|_q¸|i|ƒ‚qÅXn
d|_
dS(Ni(R&R't_mapt_filenotsetblockingt
set_sockettTruet	connectedtgetpeernametaddrtsocketR.R/RtFalsetdel_channel(tselftsockR2R
((s/usr/lib/python2.6/asyncore.pyt__init__Ús 

		
	

cCsÒ|iid|iig}|io|io|idƒn|io|idƒn|idj	oHy|id|iƒWqµtj
o|it	|iƒƒqµXnddi
|ƒt|ƒfS(Nt.t	listeningRJs%s:%ds<%s at %#x>t (t	__class__RRt	acceptingRLR+RJR&t	TypeErrortreprtjointid(RPtstatus((s/usr/lib/python2.6/asyncore.pyt__repr__ús
cCs+|djo
|i}n|||i<dS(N(R&RERF(RPR2((s/usr/lib/python2.6/asyncore.pytadd_channels

cCsH|i}|djo
|i}n||jo||=nd|_dS(N(RFR&RE(RPR2R6((s/usr/lib/python2.6/asyncore.pyRO
s	


cCs?||f|_ti||ƒ}|idƒ|i|ƒdS(Ni(tfamily_and_typeRMRGRH(RPtfamilyttypeRQ((s/usr/lib/python2.6/asyncore.pyt
create_sockets
cCs)||_|iƒ|_|i|ƒdS(N(RMtfilenoRFR^(RPRQR2((s/usr/lib/python2.6/asyncore.pyRHs	c	CsVy9|iititi|iititiƒdBƒWntij
onXdS(Ni(RMt
setsockoptt
SOL_SOCKETtSO_REUSEADDRt
getsockoptR.(RP((s/usr/lib/python2.6/asyncore.pytset_reuse_addr"s	cCstS(N(RI(RP((s/usr/lib/python2.6/asyncore.pyR)3scCstS(N(RI(RP((s/usr/lib/python2.6/asyncore.pyR*6scCs@t|_tidjo|djo
d}n|ii|ƒS(Ntnti(RIRWRtnameRMtlisten(RPtnum((s/usr/lib/python2.6/asyncore.pyRk=s	
cCs||_|ii|ƒS(N(RLRMtbind(RPRL((s/usr/lib/python2.6/asyncore.pyRmCs	cCszt|_|ii|ƒ}|tttfjodS|dtfjo||_|i	ƒnti
|t|ƒ‚dS(Ni(RNRJRMt
connect_exRRRRRLthandle_connect_eventR.R
(RPtaddressR
((s/usr/lib/python2.6/asyncore.pytconnectGs		cCs]y#|iiƒ\}}||fSWn3tij
o$}|idtjoqY‚nXdS(Ni(RMtacceptR.R/R(RPtconnRLtwhy((s/usr/lib/python2.6/asyncore.pyRrSscCs„y|ii|ƒ}|SWnctij
oT}|idtjodS|idttttfjo|i	ƒdS‚nXdS(Ni(
RMtsendR.R/RRRRR	R"(RPtdatatresultRt((s/usr/lib/python2.6/asyncore.pyRu^s 
cCsy0|ii|ƒ}|p|iƒdS|SWnJtij
o;}|idttttgjo|iƒdS‚nXdS(Nti(	RMtrecvR"R.R/RRRR	(RPtbuffer_sizeRvRt((s/usr/lib/python2.6/asyncore.pyRyks
 
cCsmt|_t|_|iƒy|iiƒWn9tij
o*}|idtt	fjo‚qinXdS(Ni(
RNRJRWRORMtcloseR.R/RR(RPRt((s/usr/lib/python2.6/asyncore.pyR{}s		
cCst|i|ƒS(N(tgetattrRM(RPtattr((s/usr/lib/python2.6/asyncore.pyt__getattr__‰scCstiidt|ƒƒdS(Nslog: %s
(tsyststderrRtstr(RPtmessage((s/usr/lib/python2.6/asyncore.pytlogstinfocCs'||ijod||fGHndS(Ns%s: %s(tignore_log_types(RPR‚Ra((s/usr/lib/python2.6/asyncore.pytlog_info“scCsH|io|iƒn-|ip|iƒ|iƒn|iƒdS(N(RWt
handle_acceptRJRothandle_read(RP((s/usr/lib/python2.6/asyncore.pyR—s


cCst|_|iƒdS(N(RIRJthandle_connect(RP((s/usr/lib/python2.6/asyncore.pyRo¢s	cCsy|iodS|ipR|iititiƒ}|djoti|t|ƒƒ‚n|iƒn|i	ƒdS(Ni(
RWRJRMRgRetSO_ERRORR.RRothandle_write(RPR
((s/usr/lib/python2.6/asyncore.pyR¦s


cCsD|iititiƒ}|djo|iƒn|iƒdS(Ni(RMRgReRŠR"thandle_expt(RPR
((s/usr/lib/python2.6/asyncore.pyRµs
c	Csmtƒ\}}}}yt|ƒ}Wndt|ƒ}nX|id||||fdƒ|iƒdS(Ns)<__repr__(self) failed for object at %0x>s:uncaptured python exception, closing channel %s (%s:%s %s)R.(tcompact_tracebackRYR[R†R"(RPtniltttvttbinfot	self_repr((s/usr/lib/python2.6/asyncore.pyRÄscCs|iddƒdS(Ns!unhandled incoming priority eventRD(R†(RP((s/usr/lib/python2.6/asyncore.pyRŒØscCs|iddƒdS(Nsunhandled read eventRD(R†(RP((s/usr/lib/python2.6/asyncore.pyRˆÛscCs|iddƒdS(Nsunhandled write eventRD(R†(RP((s/usr/lib/python2.6/asyncore.pyR‹ÞscCs|iddƒdS(Nsunhandled connect eventRD(R†(RP((s/usr/lib/python2.6/asyncore.pyR‰áscCs|iddƒdS(Nsunhandled accept eventRD(R†(RP((s/usr/lib/python2.6/asyncore.pyR‡äscCs|iddƒ|iƒdS(Nsunhandled close eventRD(R†R{(RP((s/usr/lib/python2.6/asyncore.pyR"çsN()RRRNtdebugRJRWtclosingR&RLt	frozensetR…RRR]R^RORbRHRhR)R*RkRmRqRrRuRyR{R~RƒR†RRoRRRRŒRˆR‹R‰R‡R"(((s/usr/lib/python2.6/asyncore.pyRCÑsH 	
										
														tdispatcher_with_sendcBs;eZddd„Zd„Zd„Zd„Zd„ZRS(cCs ti|||ƒd|_dS(NRx(RCRRt
out_buffer(RPRQR2((s/usr/lib/python2.6/asyncore.pyRRòscCs3d}ti||id ƒ}|i||_dS(Nii(RCRuR—(RPtnum_sent((s/usr/lib/python2.6/asyncore.pyt
initiate_sendöscCs|iƒdS(N(R™(RP((s/usr/lib/python2.6/asyncore.pyR‹ûscCs|ip
t|iƒS(N(RJtlenR—(RP((s/usr/lib/python2.6/asyncore.pyR*þscCsC|io|idt|ƒƒn|i||_|iƒdS(Ns
sending %s(R“R†RYR—R™(RPRv((s/usr/lib/python2.6/asyncore.pyRus
N(RRR&RRR™R‹R*Ru(((s/usr/lib/python2.6/asyncore.pyR–ðs
			c
CsØtiƒ\}}}g}|ptdƒ‚nxF|o>|i|iii|iiit|i	ƒfƒ|i
}q5W~|d\}}}dig}|D]}|d|q¢~ƒ}	|||f|||	fS(Nstraceback does not existiÿÿÿÿRUs
[%s|%s|%s](Rtexc_infotAssertionErrorR+ttb_frametf_codetco_filenametco_nameRt	tb_linenottb_nextRZ(
RRttbR‘tfiletfunctiontlinet_[1]txR„((s/usr/lib/python2.6/asyncore.pyRs.cCs±|djo
t}nx‰|iƒD]{}y|iƒWq$tj
o/}|idtjoqŸ|p‚qŸq$tj
o
‚q$|p‚qŸq$Xq$W|iƒdS(Ni(	R&R'tvaluesR{tOSErrorR/RRtclear(R2t
ignore_allR¨((s/usr/lib/python2.6/asyncore.pyt	close_alls"


tposixtfile_wrappercBsAeZd„Zd„Zd„ZeZeZd„Zd„ZRS(cCsti|ƒ|_dS(N(RtdupR6(RPR6((s/usr/lib/python2.6/asyncore.pyRRFscGsti|i|ŒS(N(RRR6(RPR/((s/usr/lib/python2.6/asyncore.pyRyIscGsti|i|ŒS(N(RRR6(RPR/((s/usr/lib/python2.6/asyncore.pyRuLscCsti|iƒdS(N(RR{R6(RP((s/usr/lib/python2.6/asyncore.pyR{RscCs|iS(N(R6(RP((s/usr/lib/python2.6/asyncore.pyRcUs(	RRRRRyRuRRR{Rc(((s/usr/lib/python2.6/asyncore.pyR¯As				tfile_dispatchercBseZdd„Zd„ZRS(cCsŽti|d|ƒt|_y|iƒ}Wntj
onX|i|ƒti|ti	dƒ}|t
iB}ti|ti|ƒdS(Ni(
RCRRR&RIRJRctAttributeErrortset_filetfcntltF_GETFLRt
O_NONBLOCKtF_SETFL(RPR6R2R$((s/usr/lib/python2.6/asyncore.pyRRZs	

cCs/t|ƒ|_|iiƒ|_|iƒdS(N(R¯RMRcRFR^(RPR6((s/usr/lib/python2.6/asyncore.pyR³gsN(RRR&RRR³(((s/usr/lib/python2.6/asyncore.pyR±Xs
(,t__doc__RRMRR,RterrnoRRRRRRRRRR	R
R't	NameErrorRt	ExceptionRtKeyboardInterruptt
SystemExitRRRRR%R&R9R=tpoll3RNRBRCR–RR­RjR´R¯R±(((s/usr/lib/python2.6/asyncore.pyt<module>/s<L					, ÿ 	

ACC SHELL 2018