î j fÙNã@s_dZdgZddlZddlZddlmZddlmZddlmZddlmZdd lm Z dd lm Z dd l m Z Gd d „d e j e jƒZGdd„dee jƒZGdd„dee jƒZGdd„deƒZGdd„deee jƒZGdd„deee jƒZGdd„dejƒZdS)z¦Event loop using a proactor and related classes. A proactor is a "notify-on-completion" multiplexer. Currently a proactor is only implemented on Windows with IOCP. ÚBaseProactorEventLoopéNé)Ú base_events)Úcompat)Ú constants)Úfutures)Ússlproto)Ú transports)Úloggercs¬eZdZdZddd‡fdd†Zdd„Zdd„Zd d „Zd d „Ze j rud d„Z nddd„Z dd„Z dd„Zdd„Z‡S)Ú_ProactorBasePipeTransportz*Base class for pipe and socket transports.NcsÞtƒj||ƒ|j|ƒ||_||_||_d|_d|_d|_d|_ d|_ d|_ d|_ |jdk r™|jj ƒn|jj|jj|ƒ|dk rÚ|jjtj|dƒndS)NrF)ÚsuperÚ__init__Ú _set_extraÚ_sockÚ _protocolÚ_serverÚ_bufferÚ _read_futÚ _write_futÚ_pending_writeÚ _conn_lostÚ_closingÚ _eof_writtenZ_attachÚ_loopÚ call_soonZconnection_maderZ_set_result_unless_cancelled)ÚselfÚloopÚsockÚprotocolÚwaiterÚextraÚserver)Ú __class__©úú ) r"Ú__name__rÚappendrÚfilenorrrÚlenrÚjoin)rÚinfoÚbufsizer#r#r$Ú__repr__/s"   z#_ProactorBasePipeTransport.__repr__cCs||jdr5)rr\r#r#r$rr8s   z(_ProactorWritePipeTransport._pipe_closed)r(rKrLr rrr#r#)r"r$rp2s rpc@s.eZdZdZdd„Zdd„ZdS)Ú_ProactorDuplexPipeTransportzTransport for duplex pipes.cCsdS)NFr#)rr#r#r$rmMsz*_ProactorDuplexPipeTransport.can_write_eofcCs t‚dS)N)ÚNotImplementedError)rr#r#r$rnPsz&_ProactorDuplexPipeTransport.write_eofN)r(rKrLrMrmrnr#r#r#r$ruHs  ruc@s:eZdZdZdd„Zdd„Zdd„ZdS) Ú_ProactorSocketTransportz Transport for connected sockets.cCsÝ||jd            "z2BaseProactorEventLoop._start_serving..loop)r)rršrr‚r!r#)rršrr!rr‚r$Ú_start_servingñs$$z$BaseProactorEventLoop._start_servingcCsdS)Nr#)rZ event_listr#r#r$Ú_process_eventssz%BaseProactorEventLoop._process_eventscCs5x!|jjƒD]}|jƒqW|jjƒdS)N)r}Úvaluesr4Úclear)rZfuturer#r#r$rˆsz*BaseProactorEventLoop._stop_accept_futurescCs(|jƒ|jj|ƒ|jƒdS)N)rˆrVÚ _stop_servingr5)rrr#r#r$rŸ#s z#BaseProactorEventLoop._stop_serving)r(rKrLr rrƒr„r…r†r5r‹rŒr�r‘r’r‰r~r–r˜r›rœrˆrŸr#r#)r"r$rts4          (  )rMÚ__all__rHr6Úrrrrrr Úlogr Z_FlowControlMixinZ BaseTransportr Z ReadTransportrNZWriteTransportr^rpZ TransportrurwZ BaseEventLooprr#r#r#r$Ús0    z M S