+
    i}|  c                   s   ^ RI t ^ RIt^ RIt ^ RIt^RIHt ^RIHt ^RIHt ^RIH	t	 ^RI
Ht ]e   ]P                  ]P                  3t ! R R]P                  4      t ! R	 R
]P                  4      tR tR t ! R R]	P(                  ]	P*                  4      t ! R R]P.                  4      tR#   ] d    Rt Li ; i)    N)	constants)
exceptions)	protocols)
transports)loggerc                   s*    ] tR t^tRtRtRtRtRtRt	R# )SSLProtocolState	UNWRAPPEDDO_HANDSHAKEWRAPPEDFLUSHINGSHUTDOWN N)
__name__
__module____qualname____firstlineno__r   r   r	   r
   r   __static_attributes__r       )/usr/lib64/python3.14/asyncio/sslproto.pyr   r      s    I!LGHHr   r   c                   s&    ] tR t^tRtRtRtRtRtR# )AppProtocolState
STATE_INITSTATE_CON_MADE	STATE_EOFSTATE_CON_LOSTr   N)	r   r   r   r   r   r   r   r   r   r   r   r   r   r      s     J%NI%Nr   r   c                 st    V '       d   \        R 4      h\        P                  ! 4       pV'       g   RVn        V# )z(Server side SSL needs a valid SSLContextF)
ValueErrorsslZcreate_default_contextZcheck_hostname)server_sideserver_hostname
sslcontext   && r   _create_transport_contextr   /   s2    CDD ++-J$)
!r   c                 s    V f   Vf   VR,          pMTp^V,          pMT pVf   V^,          pMTpY4u;8  d   ^ 8  g   M \        RV: RV: R24      hW43# )Ni   zhigh (z) must be >= low (z) must be >= 0)r   )highlowZkbZhiZlos   &&&  r   add_flowcontrol_defaultsr"   =   sd    |;dBBRB
{1W=q=b" # 	# 6Mr   c                   s   a  ] tR t^Rt o Rt]P                  P                  tR t	RR lt
R tR tR tR t]3R	 ltR
 tR tR tRR ltR tR tRR ltR tR t]R 4       tR tR tR tR tR t R t!R t"Rt#V t$R# )_SSLProtocolTransportTc                s,    Wn         W n        R V n        R# )FN)_loop_ssl_protocol_closed)selfloopZssl_protocol   &&&r   __init__Z_SSLProtocolTransport.__init__X   s    
)r   Nc                s8    V P                   P                  W4      # )z#Get optional transport information.)r%   _get_extra_infor'   ZnameZdefaultr)   r   get_extra_infoZ$_SSLProtocolTransport.get_extra_info]   s    !!11$@@r   c                s<    V P                   P                  V4       R # N)r%   _set_app_protocol)r'   protocol   &&r   set_protocolZ"_SSLProtocolTransport.set_protocola   s    ,,X6r   c                .    V P                   P                  # r.   )r%   _app_protocolr'      &r   get_protocolZ"_SSLProtocolTransport.get_protocold   s    !!///r   c                s^    V P                   ;'       g    V P                  P                  4       # r.   )r&   r%   _is_transport_closingr5   r6   r   
is_closingZ _SSLProtocolTransport.is_closingg   s#    ||IIt11GGIIr   c                s~    V P                   '       g$   RV n         V P                  P                  4        R# RV n        R# )zClose the transport.

Buffered data will be flushed asynchronously.  No more data
will be received.  After all buffered data is flushed, the
protocol's connection_lost() method will (eventually) called
with None as its argument.
TN)r&   r%   _start_shutdownr5   r6   r   closeZ_SSLProtocolTransport.closej   s.     |||DL..0!%Dr   c                sh    V P                   '       g    R V n         VP                  R\        4       R# R# )Tz9unclosed transport <asyncio._SSLProtocolTransport object>N)r&   ZwarnZResourceWarning)r'   Z	_warningsr1   r   __del__Z_SSLProtocolTransport.__del__x   s+    |||DLNN*, r   c                s8    V P                   P                  '       * # r.   )r%   _app_reading_pausedr5   r6   r   
is_readingZ _SSLProtocolTransport.is_reading   s    %%9999r   c                :    V P                   P                  4        R# )z|Pause the receiving end.

No data will be passed to the protocol's data_received()
method until resume_reading() is called.
N)r%   _pause_readingr5   r6   r   pause_readingZ#_SSLProtocolTransport.pause_reading   s     	))+r   c                r?   )zmResume the receiving end.

Data received will once again be passed to the protocol's
data_received() method.
N)r%   _resume_readingr5   r6   r   resume_readingZ$_SSLProtocolTransport.resume_reading   s     	**,r   c                p    V P                   P                  W4       V P                   P                  4        R# )a.  Set the high- and low-water limits for write flow control.

These two values control when to call the protocol's
pause_writing() and resume_writing() methods.  If specified,
the low-water limit must be less than or equal to the
high-water limit.  Neither value can be negative.

The defaults are implementation-specific.  If only the
high-water limit is given, the low-water limit defaults to an
implementation-specific value less than or equal to the
high-water limit.  Setting high to zero forces low to zero as
well, and causes pause_writing() to be called whenever the
buffer becomes non-empty.  Setting low to zero causes
resume_writing() to be called only once the buffer is empty.
Use of zero for either limit is generally sub-optimal as it
reduces opportunities for doing I/O and computation
concurrently.
N)r%   _set_write_buffer_limits_control_app_writingr'   r    r!   r)   r   set_write_buffer_limitsZ-_SSLProtocolTransport.set_write_buffer_limits   s*    & 	33D>//1r   c                Z    V P                   P                  V P                   P                  3# r.   )r%   _outgoing_low_water_outgoing_high_waterr5   r6   r   get_write_buffer_limitsZ-_SSLProtocolTransport.get_write_buffer_limits   *    ""66""779 	9r   c                6    V P                   P                  4       # )z-Return the current size of the write buffers.)r%   _get_write_buffer_sizer5   r6   r   get_write_buffer_sizeZ+_SSLProtocolTransport.get_write_buffer_size   s    !!88::r   c                rD   )a7  Set the high- and low-water limits for read flow control.

These two values control when to call the upstream transport's
pause_reading() and resume_reading() methods.  If specified,
the low-water limit must be less than or equal to the
high-water limit.  Neither value can be negative.

The defaults are implementation-specific.  If only the
high-water limit is given, the low-water limit defaults to an
implementation-specific value less than or equal to the
high-water limit.  Setting high to zero forces low to zero as
well, and causes pause_reading() to be called whenever the
buffer becomes non-empty.  Setting low to zero causes
resume_reading() to be called only once the buffer is empty.
Use of zero for either limit is generally sub-optimal as it
reduces opportunities for doing I/O and computation
concurrently.
N)r%   _set_read_buffer_limits_control_ssl_readingrG   r)   r   set_read_buffer_limitsZ,_SSLProtocolTransport.set_read_buffer_limits   s*    & 	224=//1r   c                rI   r.   )r%   _incoming_low_water_incoming_high_waterr5   r6   r   get_read_buffer_limitsZ,_SSLProtocolTransport.get_read_buffer_limits   rM   r   c                rN   )z+Return the current size of the read buffer.)r%   _get_read_buffer_sizer5   r6   r   get_read_buffer_sizeZ*_SSLProtocolTransport.get_read_buffer_size   s    !!7799r   c                r3   r.   )r%   _app_writing_pausedr5   r6   r   _protocol_pausedZ&_SSLProtocolTransport._protocol_paused   s     !!555r   c                s    \        V\        \        \        34      '       g"   \	        R\        V4      P                   24      hV'       g   R# V P                  P                  V34       R# )zWrite some data bytes to the transport.

This does not block; it buffers the data and arranges for it
to be sent out asynchronously.
z+data: expecting a bytes-like instance, got N)	
isinstanceZbytes	bytearray
memoryviewZ	TypeErrorZtyper   r%   _write_appdatar'   datar1   r   writeZ_SSLProtocolTransport.write   s[     $	: >?? ##':#6#6"79 : :))4'2r   c                s<    V P                   P                  V4       R# )zWrite a list (or any iterable) of data bytes to the transport.

The default implementation concatenates the arguments and
calls write() on the result.
N)r%   r^   )r'   list_of_datar1   r   
writelinesZ _SSLProtocolTransport.writelines   s     	)),7r   c                s    \         h)zeClose the write end after flushing buffered data.

This raises :exc:`NotImplementedError` right now.
)ZNotImplementedErrorr5   r6   r   	write_eofZ_SSLProtocolTransport.write_eof   s
    
 "!r   c                s    R# )zAReturn True if this transport supports write_eof(), False if not.Fr   r5   r6   r   can_write_eofZ#_SSLProtocolTransport.can_write_eof   s    r   c                s(    V P                  R4       R# )zClose the transport immediately.

Buffered data will be lost.  No more data will be received.
The protocol's connection_lost() method will (eventually) be
called with None as its argument.
N)_force_closer5   r6   r   abortZ_SSLProtocolTransport.abort   s     	$r   c                sj    R V n         V P                  e   V P                  P                  V4       R# R# TN)r&   r%   _abortr'   excr1   r   rf   Z"_SSLProtocolTransport._force_close   s.    )%%c* *r   c                s    V P                   P                  P                  V4       V P                   ;P                  \	        V4      ,          un        R # r.   )r%   _write_backlogappend_write_buffer_sizelenr_   r1   r   _test__append_write_backlogZ1_SSLProtocolTransport._test__append_write_backlog  s7    ))006--T:-r   )r&   r$   r%   r.   NN)%r   r   r   r   Z_start_tls_compatibler   Z_SendfileModeZFALLBACKZ_sendfile_compatibler*   r-   r2   r7   r9   r;   warningsr<   r>   rA   rC   rH   rL   rP   rS   rV   rX   ZpropertyrZ   ra   rc   rd   re   rg   rf   rp   r   __classdictcell__Z__classdict__   @r   r#   r#   R   s      !$22;;
A70J& !) ,:,-2,9;2,9: 6 638" +
; ;r   r#   c                   s8  a  ] tR tRt o R,tRtRtRtR-R ltR t	R.R lt
R tR tR tR	 tR
 tR tR tR.R ltR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$R  t%R! t&R/R" lt'R# t(R$ t)R% t*R/R& lt+R' t,R( t-R) t.R0R* lt/R+t0V t1R# )1SSLProtocoli  Nc
                s   \         f   \        R4      h\        V P                  4      V n        \        V P                  4      V n        Vf   \        P                  pMV^ 8:  d   \        RV 24      hV	f   \        P                  p	MV	^ 8:  d   \        RV	 24      hV'       g   \        WV4      pWPn        V'       d   V'       g   W`n        MR V n        W0n        \        VR7      V n        \"        P$                  ! 4       V n        ^ V n        W@n        Wn        V P/                  V4       R V n        RV n        R V n        Wn        Wn        \         P:                  ! 4       V n        \         P:                  ! 4       V n        \@        PB                  V n"        ^ V n#        V'       d   \H        PJ                  V n&        M\H        PN                  V n&        V P                  PQ                  V P<                  V P>                  V P                  V P                  R7      V n)        RV n*        RV n+        RV n,        ^ V n-        ^ V n.        V P_                  4        RV n0        RV n1        ^ V n2        ^ V n3        V Pi                  4        V Pk                  4        R # )Nzstdlib ssl module not availablez7ssl_handshake_timeout should be a positive number, got z6ssl_shutdown_timeout should be a positive number, got )r   F)r   r   )6r   RuntimeErrorr\   max_size_ssl_bufferr]   _ssl_buffer_viewr   ZSSL_HANDSHAKE_TIMEOUTr   ZSSL_SHUTDOWN_TIMEOUTr   _server_side_server_hostname_sslcontextZdict_extracollectionsZdequerl   rn   _waiterr$   r/   _app_transport_app_transport_created
_transport_ssl_handshake_timeout_ssl_shutdown_timeoutZ	MemoryBIO	_incoming	_outgoingr   r   _state
_conn_lostr   r   
_app_stater   Zwrap_bio_sslobj_ssl_writing_pausedr=   _ssl_reading_pausedrU   rT   rQ   _eof_receivedrY   rK   rJ   rE   _get_app_transport)
r'   r(   app_protocolr   Zwaiterr   r   Zcall_connection_madeZssl_handshake_timeoutZssl_shutdown_timeouts
   &&&&&&&&&&r   r*   ZSSLProtocol.__init__  s5   
 ;@AA$T]]3 *4+;+; < ($-$C$C!"a',-/0 0  '#,#A#A !Q&+,./ / 2.J (;$3!$(D!% j1 *//1"#
|,"&+#&;#%9"&00.99DO.==DO''00NNDNN)) 11 1 3 $) #( #( $%!#$ $$&"#( $%!#$ %%'!r   c                s    Wn         \        VR 4      '       dL   \        V\        P                  4      '       d,   VP
                  V n        VP                  V n        RV n	        R# RV n	        R# )
get_bufferTFN)
r4   Zhasattrr[   r   BufferedProtocolr   _app_protocol_get_bufferbuffer_updated_app_protocol_buffer_updated_app_protocol_is_buffer)r'   r   r1   r   r/   ZSSLProtocol._set_app_protocola  sT    )L,//<)C)CDD,8,C,CD)0<0K0KD-+/D(+0D(r   c                s    V P                   f   R # V P                   P                  4       '       g<   Ve   V P                   P                  V4       MV P                   P                  R 4       R V n         R # r.   )r   Z	cancelledZset_exceptionZ
set_resultrj   r1   r   _wakeup_waiterZSSLProtocol._wakeup_waiterl  sR    <<||%%''**3/''-r   c                s    V P                   f@   V P                  '       d   \        R4      h\        V P                  V 4      V n         RV n        V P                   # )Nz$Creating _SSLProtocolTransport twiceT)r   r   rw   r#   r$   r5   r6   r   r   ZSSLProtocol._get_app_transportv  sM    &***"#IJJ"7

D"ID*.D'"""r   c                sb    V P                   R J;'       d    V P                   P                  4       # r.   )r   r9   r5   r6   r   r8   Z!SSLProtocol._is_transport_closing~  s&    d*KKt/I/I/KKr   c                s2    Wn         V P                  4        R# )zHCalled when the low-level connection is made.

Start the SSL handshake.
N)r   _start_handshake)r'   	transportr1   r   connection_madeZSSLProtocol.connection_made  s    
 $r   c                s|   V P                   P                  4        V P                  P                  4        V ;P                  ^,          un        V P
                  e   RV P
                  n        V P                  \        P                  8w  d   V P                  \        P                  8X  g    V P                  \        P                  8X  dF   \        P                  V n
        V P                  P!                  V P"                  P$                  V4       V P'                  \        P(                  4       RV n        RV n        RV n        V P-                  V4       V P.                  '       d"   V P.                  P1                  4        RV n        V P2                  '       d$   V P2                  P1                  4        RV n        R# R# )zCalled when the low-level connection is lost or closed.

The argument is an exception object or None (the latter
meaning a regular EOF is received or the connection was
aborted or closed).
NT)rl   Zclearr   readr   r   r&   r   r   r   r   r   r   r   r   r$   	call_soonr4   connection_lost
_set_stater   r   r   _shutdown_timeout_handlecancel_handshake_timeout_handlerj   r1   r   r   ZSSLProtocol.connection_lost  s?    	!!#1 **.D';;*777#3#B#BB#3#=#=="2"A"A

$$T%7%7%G%GM(223"!C ((())002,0D))))**113-1D* *r   c                s    TpV^ 8:  g   W P                   8  d   V P                   p\        V P                  4      V8  d+   \        V4      V n        \	        V P                  4      V n        V P
                  # )r    )rx   ro   ry   r\   r]   rz   )r'   ZnZwantr   r   r   ZSSLProtocol.get_buffer  s^    19}},==Dt 4'(D$.t/?/?$@D!$$$r   c                s   V P                   P                  V P                  R V 4       V P                  \        P
                  8X  d   V P                  4        R # V P                  \        P                  8X  d   V P                  4        R # V P                  \        P                  8X  d   V P                  4        R # V P                  \        P                  8X  d   V P                  4        R # R # r.   )r   ra   rz   r   r   r   _do_handshaker	   _do_readr
   	_do_flushr   _do_shutdown)r'   Znbytesr1   r   r   ZSSLProtocol.buffer_updated  s    T227F;<;;*777 [[,444MMO[[,555NN[[,555 6r   c                s.   RV n          V P                  P                  4       '       d   \        P                  ! RV 4       V P
                  \        P                  8X  d   V P                  \        4       R# V P
                  \        P                  8X  dF   V P                  \        P                  4       V P                  '       d   R# V P                  4        R# V P
                  \        P                  8X  dB   V P                  4        V P                  \        P                   4       V P#                  4        R# V P
                  \        P                   8X  d   V P#                  4        R# R#   \$         d    T P&                  P)                  4        h i ; i)zCalled when the other end of the low-level stream
is half-closed.

If this returns a false value (including None), the transport
will close itself.  If it returns a true value, closing the
transport is up to the protocol.
Tz%r received EOFN)r   r$   	get_debugr   debugr   r   r   _on_handshake_completeZConnectionResetErrorr	   r   r
   r=   r   	_do_writer   r   	Exceptionr   r;   r5   r6   r   eof_receivedZSSLProtocol.eof_received  s    "	zz##%%.5{{.;;;++,@A 0 8 88 0 9 9:+++NN$ 0 9 99  0 9 9:!!# 0 9 99!!# :  	OO!!#	s+   E- AE- 6AE- E- AE- :/E- -'Fc                s    WP                   9   d   V P                   V,          # V P                  e   V P                  P                  W4      # V# r.   )r~   r   r-   r,   r)   r   r+   ZSSLProtocol._get_extra_info  s?    ;;;;t$$__(??11$@@Nr   c                sV   R pV\         P                  8X  d   RpMV P                  \         P                  8X  d   V\         P                  8X  d   RpMV P                  \         P                  8X  d   V\         P                  8X  d   RpMmV P                  \         P                  8X  d   V\         P
                  8X  d   RpM6V P                  \         P
                  8X  d   V\         P                  8X  d   RpV'       d	   Wn        R# \        RP                  V P                  V4      4      h)FTz!cannot switch state from {} to {}N)	r   r   r   r   r	   r
   r   rw   Zformat)r'   Z	new_stateZallowedr   r   r   ZSSLProtocol._set_state  s    (222G KK+555)666G KK+888)111G KK+333)222G KK+444)222G#K 3::KK,- -r   c                s   V P                   P                  4       '       d8   \        P                  ! R V 4       V P                   P	                  4       V n        MRV n        V P                  \        P                  4       V P                   P                  V P                  V P                  4      V n        V P                  4        R# )z%r starts SSL handshakeN)r$   r   r   r   time_handshake_start_timer   r   r   
call_laterr   _check_handshake_timeoutr   r   r5   r6   r   r   ZSSLProtocol._start_handshake  s    ::!!LL2D9)-):D&)-D&(556 JJ!!$"="="&"?"?A 	& 	r   c                s    V P                   \        P                  8X  d-   R V P                   R2pV P	                  \        V4      4       R# R# )z$SSL handshake is taking longer than z! seconds: aborting the connectionN)r   r   r   r   _fatal_errorZConnectionAbortedError)r'   msg   & r   r   Z$SSLProtocol._check_handshake_timeout(  sN    ;;*7776../ 0*+ 
 4S9: 8r   c                s     V P                   P                  4        V P                  R 4       R #   \         d    T P	                  4         R # \
        P                   d   pT P                  T4        R p?R # R p?ii ; ir.   )r   Zdo_handshaker   SSLAgainErrors_process_outgoingr   SSLErrorrj   r   r   r   ZSSLProtocol._do_handshake1  sb    	.LL%%' ''-  	%""$|| 	-'',,	-s!   / A=A= A=!A88A=c                s.   V P                   e"   V P                   P                  4        R V n         V P                  p Vf!   V P                  \        P
                  4       MVhVP                  4       pT P                  P                  4       '       dJ   T P                  P!                  4       T P"                  ,
          p\$        P&                  ! RYR,          4       T P(                  P+                  TTP-                  4       TP/                  4       TR7       T P0                  \2        P4                  8X  d?   \2        P6                  T n        T P8                  P;                  T P=                  4       4       T P                  4        T P?                  4        R #   \         dt   pR pT P                  \        P                  4       \        T\        P                  4      '       d   RpMRpT P                  YE4       T P                  T4        R p?R # R p?ii ; i)Nz1SSL handshake failed on verifying the certificatezSSL handshake failedz%r: SSL handshake took %.1f msg     @@)peercertciphercompressionZ
ssl_object) r   r   r   r   r   r	   Zgetpeercertr   r   r[   r   ZCertificateErrorr   r   r$   r   r   r   r   r   r~   Zupdater   r   r   r   r   r   r4   r   r   r   )r'   Zhandshake_excZsslobjr   rk   r   Zdts   &&     r   r   Z"SSLProtocol._on_handshake_complete;  s   ))5**113-1D*	$ 0 8 89##))+H ::!!"T%?%??BLL94cJ 	H"(--/'-'9'9';&, 	 	. ??.999.==DO..t/F/F/HI1  		 MOO,667#s3344I,c'$		s   6F H!A(HHc                s   V P                   \        P                  \        P                  \        P                  39   d   R # V P
                  e   RV P
                  n        V P                   \        P                  8X  d   V P                  R 4       R # V P                  \        P                  4       V P                  P                  V P                  V P                  4      V n        V P                  4        R # )NT)r   r   r
   r   r   r   r&   r   ri   r   r$   r   r   _check_shutdown_timeoutr   r   r5   r6   r   r:   ZSSLProtocol._start_shutdownd  s    KK )) )) **  **.D';;*777KKOO,556,0JJ,A,A**,,-D) NNr   c                s    V P                   \        P                  \        P                  39   d2   V P                  P                  \        P                  ! R 4      4       R# R# )zSSL shutdown timed outN)r   r   r
   r   r   rf   r   ZTimeoutErrorr5   r6   r   r   Z#SSLProtocol._check_shutdown_timeouty  sN    KK )) )) 
 OO((''(@ACr   c                s    V P                  4        V P                  \        P                  4       V P	                  4        R # r.   )r   r   r   r   r   r5   r6   r   r   ZSSLProtocol._do_flush  s*    (112r   c                sd    V P                   '       g   V P                  P                  4        V P                  4        V P	                  4        V P                  R 4       R #   \         d    T P                  4         R # \        P                   d   pT P                  T4        R p?R # R p?ii ; ir.   )	r   r   Zunwrapr   _call_eof_received_on_shutdown_completer   r   r   rj   r   r   r   ZSSLProtocol._do_shutdown  s    
	-%%%##% ""$##%&&t,  	%""$|| 	,&&s++	,s(   A! A! !B/?B/B/B**B/c                s    V P                   e"   V P                   P                  4        R V n         V'       d   V P                  V4       R # V P                  P	                  V P
                  P                  4       R # r.   )r   r   r   r$   r   r   r;   )r'   Zshutdown_excr1   r   r   Z!SSLProtocol._on_shutdown_complete  sU    ((4))002,0D)l+JJ  !6!67r   c                s    V P                  \        P                  4       V P                  e   V P                  P	                  V4       R # R # r.   )r   r   r   r   rf   rj   r1   r   ri   ZSSLProtocol._abort  s6    (223??&OO((- 'r   c                sh   V P                   \        P                  \        P                  \        P                  39   dQ   V P
                  \        P                  8  d   \        P                  ! R 4       V ;P
                  ^,          un        R# V F@  pV P                  P                  V4       V ;P                  \        V4      ,          un        KB  	   V P                   \        P                  8X  d   V P                  4        R# R#   \          d   pT P#                  TR4        Rp?R# Rp?ii ; i)zSSL connection is closedNFatal error on SSL protocol)r   r   r
   r   r   r   r   Z!LOG_THRESHOLD_FOR_CONNLOST_WRITESr   warningrl   rm   rn   ro   r	   r   r   r   )r'   rb   r`   exs   &&  r   r^   ZSSLProtocol._write_appdata  s    KK )) )) **  )"M"MM9:OOq O D&&t,##s4y0# !	A{{.666  7  	Ab"?@@	As   /D	 	D1D,,D1c                s    V P                   '       d   V P                   ^ ,          pV P                  P                  V4      p\        V4      pW#8  d-   WR V P                   ^ &   V ;P                  V,          un        K}  V P                   ^  V ;P                  V,          un        K   V P                  4        R#   \
         d     Li ; ir    N)rl   r   ra   ro   rn   r   r   )r'   r`   countZdata_lens   &   r   r   ZSSLProtocol._do_write  s    	%%%**1-**40t9#-1&\D''*++u4+++A.++x7+ & 	   		s   B: BB: :CCc                s    V P                   '       gG   V P                  P                  4       p\        V4      '       d   V P                  P                  V4       V P                  4        R # r.   )r   r   r   ro   r   ra   rF   r_   r   r   r   ZSSLProtocol._process_outgoing  sG    '''>>&&(D4yy%%d+!!#r   c                s   V P                   \        P                  \        P                  39  d   R #  V P                  '       gg   V P
                  '       d   V P                  4        MV P                  4        V P                  '       d   V P                  4        MV P                  4        V P                  4        R #   \         d   pT P                  TR4        R p?R # R p?ii ; i)Nr   )r   r   r	   r
   r=   r   _do_read__buffered_do_read__copiedrl   r   r   rR   r   r   )r'   r   r   r   r   ZSSLProtocol._do_read  s    KK (( ))  
 	A+++///++-))+&&&NN$**,%%' 	Ab"?@@	As)   B= B= 2B= 
1B= =C%C  C%c                s   ^ p^pV P                  V P                  4       4      p\        V4      p V P                  P	                  WC4      pV^ 8  dd   TpW8  d7   V P                  P	                  WA,
          W1R 4      pV^ 8  d   W,          pK;  M%V P
                  P                  V P                  4       V^ 8  d   V P                  V4       V'       g#   V P                  4        V P                  4        R# R#   \         d     LQi ; ir   )r   rW   ro   r   r   r$   r   r   r   r   r   r:   )r'   Zoffsetr   ZbufZwantss   &    r   r   ZSSLProtocol._do_read__buffered  s    ++D,F,F,HIC	LL%%e1Eqyn LL--enc'lKEqyJJ((7 A:--f5##%  " 	  		s   AC9 %C9 9DDc                s   R pRpRp  V P                   P                  V P                  4      pV'       g   M3V'       d	   RpRpTpK?  V'       d	   RpXV.pKO  XP                  V4       Kb  V'       d   V P
                  P                  X4       M2V'       g+   V P
                  P                  RP                  X4      4       V'       g#   V P                  4        V P                  4        R# R#   \         d     Li ; i)s   1TFr   N)
r   r   rx   rm   r   r4   Zdata_receivedZjoinr   r:   )r'   ZchunkZzeroZoneZfirstr`   s   &     r   r   ZSSLProtocol._do_read__copied
  s    	))$--8 DC!EC!5>DKK& ,,U3,,SXXd^<##%  "   		s!   -C, C, C, C, ,C:9C:c                s`    V P                   \        P                  8X  dR   \        P                  V n         V P                  P                  4       pV'       d   \        P                  ! R 4       R# R# R#   \        \        3 d    h \         d   pT P                  TR4        Rp?R# Rp?ii ; i)z?returning true from eof_received() has no effect when using sslzError calling eof_received()N)r   r   r   r   r4   r   r   r   KeyboardInterrupt
SystemExitBaseExceptionr   )r'   Z	keep_openr      &  r   r   ZSSLProtocol._call_eof_received(  s    
	B"2"A"AA"2"<"< ..;;=	NN $B C  B ":. 	 	Bb"@AA	Bs$   AA4 A4 4B-B-B((B-c                s   V P                  4       pWP                  8  d7   V P                  '       g%   R V n         V P                  P	                  4        R# WP                  8:  d9   V P                  '       d%   RV n         V P                  P                  4        R# R# R#   \
        \        3 d    h \         d9   pT P                  P                  RRRTRT P                  RT /4        Rp?R# Rp?ii ; i  \
        \        3 d    h \         d9   pT P                  P                  RRRTRT P                  RT /4        Rp?R# Rp?ii ; i)	Tmessagezprotocol.pause_writing() failed	exceptionr   r0   NFz protocol.resume_writing() failed)rO   rK   rY   r4   pause_writingr   r   r   r$   call_exception_handlerr   rJ   resume_writing)r'   sizerk   r   r   rF   Z SSLProtocol._control_app_writing7  s8   **,,,,T5M5M5M'+D$
""002 ---$2J2J2J',D$
""113 3K- &z2   

11@!4!4	3   &z2   

11A!4!4	3  s;   B! C8 !C5<C5=-C00C58EE-EEc                sP    V P                   P                  V P                  ,           # r.   )r   pendingrn   r5   r6   r   rO   Z"SSLProtocol._get_write_buffer_sizeT  s    ~~%%(?(???r   c                V    \        W\        P                  4      w  rWn        W n        R # r.   )r"   r   Z!FLOW_CONTROL_HIGH_WATER_SSL_WRITErK   rJ   rG   r)   r   rE   Z$SSLProtocol._set_write_buffer_limitsW  s&    ,yBBD	$(!#& r   c                s    R V n         R# rh   )r=   r5   r6   r   r@   ZSSLProtocol._pause_reading_  s
    #' r   c                s   a  S P                   '       d+   R S n         V 3R lpS P                  P                  V4       R# R# )Fc                  s.  < S P                   \        P                  8X  d   S P                  4        R # S P                   \        P                  8X  d   S P                  4        R # S P                   \        P                  8X  d   S P                  4        R # R # r.   )r   r   r	   r   r
   r   r   r   r5   s   r   resumeZ+SSLProtocol._resume_reading.<locals>.resumef  s`    ;;"2":"::MMO[[$4$=$==NN$[[$4$=$==%%' >r   N)r=   r$   r   )r'   r   s   f r   rB   ZSSLProtocol._resume_readingb  s5    ###',D$( JJ  ( $r   c                s>   V P                  4       pWP                  8  d6   V P                  '       g$   R V n        V P                  P	                  4        R# WP
                  8:  d8   V P                  '       d$   RV n        V P                  P                  4        R# R# R# )TFN)rW   rU   r   r   rA   rT   rC   )r'   r   r   r   rR   Z SSLProtocol._control_ssl_readingq  sw    ))+,,,T5M5M5M'+D$OO))+---$2J2J2J',D$OO**, 3K-r   c                r   r.   )r"   r   Z FLOW_CONTROL_HIGH_WATER_SSL_READrU   rT   rG   r)   r   rQ   Z#SSLProtocol._set_read_buffer_limitsz  s&    ,yAAC	$(!#& r   c                r3   r.   )r   r   r5   r6   r   rW   Z!SSLProtocol._get_read_buffer_size  s    ~~%%%r   c                s    RV n         R# )zLCalled when the low-level transport's buffer goes over
the high-water mark.
TN)r   r5   r6   r   r   ZSSLProtocol.pause_writing  s    
 $( r   c                s4    RV n         V P                  4        R# )zNCalled when the low-level transport's buffer drains below
the low-water mark.
FN)r   r   r5   r6   r   r   ZSSLProtocol.resume_writing  s    
 $)  r   c           
     s   V P                   '       d   V P                   P                  V4       \        V\        4      '       d>   V P                  P                  4       '       d   \        P                  ! R WRR7       R# R# \        V\        P                  4      '       g0   V P                  P                  RVRVRV P                   RV /4       R# R# )z%r: %sT)Zexc_infor   r   r   r0   N)r   rf   r[   ZOSErrorr$   r   r   r   r   ZCancelledErrorr   )r'   rk   r   r)   r   r   ZSSLProtocol._fatal_error  s    ???OO((-c7##zz##%%XttD &C!:!:;;JJ--7ST__D	/  <r   )%r4   r   r   r   r=   r   r   r   rY   r   r   r~   r   r   r   rU   rT   r$   r   rK   rJ   r|   r{   r   ry   rz   r   r   r   r   r}   r   r   r   r   rl   rn   i   )FNTNNr.   rq   )zFatal error on transport)2r   r   r   r   rx   r   r   r   r*   r/   r   r   r8   r   r   r   r   r   r+   r   r   r   r   r   r:   r   r   r   r   ri   r^   r   r   r   r   r   r   rF   rO   rE   r@   rB   rR   rQ   rW   r   r   r   r   rs   rt   ru   r   rv   rv     s     H  $#Q"f	1#L "2H% !F$-P ;.%R*C
-8.A0! $A,#:#<B:@'()-'&
(! r   rv   )r   Zenumrr   r   ZImportErrorZ r   r   r   r   Zlogr   ZSSLWantReadErrorZSSLSyscallErrorr   ZEnumr   r   r   r"   Z_FlowControlMixinZ	Transportr#   r   rv   r   r   r   <module>r      s   
        ?**C,?,?@Ntyy &tyy & *r;J88&00r;jZ
),, Z
{  
Cs   B3 3	B?>B?