Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_asyncore.cpython-310.pyc
o

�9j�h�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddlm
Z
ddlmZddlmZddlmZe
jrPe�d��ddlZe���e�d	e�ddlZWd�n1smwYeed
�ZGdd�d�ZGd
d�d�ZGdd�d�ZGdd�d�Zdd�Zdd�Z Gdd�dej!�Z"Gdd�dej!�Z#Gdd�dej$�Z%Gdd�dej!�Z&e�'eed�d �Gd!d"�d"ej!��Z(Gd#d$�d$ej)�Z*Gd%d&�d&ej)�Z+Gd'd(�d(e*�Z,Gd)d*�d*�Z-Gd+d,�d,e-�Z.e�'e
j/d-�Gd.d/�d/e-��Z0e�'ed0�Gd1d2�d2e-��Z1Gd3d4�d4e.ej!�Z2e�'eed5�d6�Gd7d8�d8e.ej!��Z3Gd9d:�d:e0ej!�Z4e�'eed5�d6�Gd;d<�d<e0ej!��Z5Gd=d>�d>e1ej!�Z6e�'eed5�d6�Gd?d@�d@e1ej!��Z7e8dAk�rye�9�dSdS)B�N)�support)�	os_helper)�
socket_helper)�threading_helper)�warnings_helper)�BytesIOztest is not helpful for PGO�ignore�AF_UNIXc@�$eZdZdd�Zdd�Zdd�ZdS)�dummysocketcC�
d|_dS�NF��closed��self�r�)/usr/lib/python3.10/test/test_asyncore.py�__init__�
zdummysocket.__init__cCr�NTrrrrr�close!rzdummysocket.closecC�dS)N�*rrrrr�fileno$�zdummysocket.filenoN)�__name__�
__module__�__qualname__rrrrrrrrsrc@�eZdZdd�Zdd�ZdS)�dummychannelcCst�|_dS�N)r�socketrrrrr(�zdummychannel.__init__cCs|j��dSr!)r"rrrrrr+�zdummychannel.closeN)rrrrrrrrrr '�r c@s(eZdZdd�Zdd�ZeZeZeZdS)�exitingdummycC�dSr!rrrrrr/rzexitingdummy.__init__cCst���r!)�asyncore�ExitNowrrrr�handle_read_event2�zexitingdummy.handle_read_eventN)rrrrr*�handle_write_event�handle_close�handle_expt_eventrrrrr&.sr&c@s0eZdZdd�Zdd�ZeZeZeZdd�ZdS)�
crashingdummycCrr
��
error_handledrrrrr:rzcrashingdummy.__init__cCst��r!��	Exceptionrrrrr*=szcrashingdummy.handle_read_eventcCrrr0rrrr�handle_errorDrzcrashingdummy.handle_errorN�	rrrrr*r,r-r.r4rrrrr/9sr/cCszxz|��|��\}}Wn	tyYnXwd}t��}|dkr_t��|dkr_t�|gggd�\}}}	|rN|d8}|�d�}
|�|
�dd��d|
vrNnt�	d	�|dkr_t��|dks)|�
�W|�
�|��dSW|�
�|��dS|�
�|��w)
N��rg@皙�����?��
�
��{�G�z�?)�listen�accept�TimeoutError�time�	monotonic�select�recv�write�replace�sleepr�set)�evt�buf�serv�conn�addr�n�start�r�w�e�datarrr�capture_serverHs4�

�
��
rScCs8tr|jtjkrt�|�t�||�dS|�|�dS)z9Helper function to bind a socket according to its family.N)	�HAS_UNIX_SOCKETS�familyr"r	r�unlinkr�bind_unix_socket�bind)�sockrLrrr�
bind_af_awareas
rZc@sNeZdZdd�Ze�eed�d�dd��Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�HelperFunctionTestscCs�t�}|�tjtj|�|�tjtj|�|�tjtj|�t�}t�|�|�|j	d�t�}t�|�|�|j	d�t�}t�|�|�|j	d�dSr)
r&�assertRaisesr(r)�readrD�
_exceptionr/�assertEqualr1)r�tr1�tr2rrr�test_readwriteexcls


z%HelperFunctionTests.test_readwriteexc�poll�select.poll requiredc
Cs�d}tjdftjdftjdftjdftjdftjdff}Gdd�d�}|D]J\}}|�}|�t||�d�t	�
||�|D]
}|�t||�||k�q=t�}|�t	j
t	j
||�t�}	|�|	jd�t	�
|	|�|�|	jd	�q%dS)
N)r]�exptrDrr1r]rerDrc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)z3HelperFunctionTests.test_readwrite.<locals>.testobjcSs"d|_d|_d|_d|_d|_dSr
)r]rDrrer1rrrrr�s

z<HelperFunctionTests.test_readwrite.<locals>.testobj.__init__cSrr)r]rrrrr*�rzEHelperFunctionTests.test_readwrite.<locals>.testobj.handle_read_eventcSrr)rDrrrrr,�rzFHelperFunctionTests.test_readwrite.<locals>.testobj.handle_write_eventcSrrrrrrrr-�rz@HelperFunctionTests.test_readwrite.<locals>.testobj.handle_closecSrr)rerrrrr.�rzEHelperFunctionTests.test_readwrite.<locals>.testobj.handle_expt_eventcSrrr0rrrrr4�rz@HelperFunctionTests.test_readwrite.<locals>.testobj.handle_errorNr5rrrr�testobj�srfFT)rB�POLLIN�POLLPRI�POLLOUT�POLLERR�POLLHUP�POLLNVALr_�getattrr(�	readwriter&r\r)r/r1)
r�
attributes�expectedrf�flag�expectedattr�tobj�attrr`rarrr�test_readwrite�s,�	�z"HelperFunctionTests.test_readwritecC�|�d�dSr
��closeall_checkrrrr�
test_closeall�r$z!HelperFunctionTests.test_closeallcCrvrrwrrrr�test_closeall_default�r$z)HelperFunctionTests.test_closeall_defaultcCs�g}i}td�D]}t�}|�|�|�|jjd�|||<q|r=tj}z|t_t��Wtj|}t_n
tj|}t_wt�|�|�t	|�d�|D]
}|�|jjd�qLdS)Nr9FrT)
�ranger �appendr_r"rr(�
socket_map�	close_all�len)r�
usedefault�l�testmap�i�c�	socketmaprrrrx�s$


 
�z"HelperFunctionTests.closeall_checkcCs�ztd��t��\}}}t��}Y|\\}}}}}	}
|�tj�	|�dd�|�|d�|�||�|�|	|�|�|
d|||f�dS)N�I don't like spam!zExpected exception���ztest_asyncore.py�test_compact_tracebackz
[%s|%s|%s])
r3�sys�exc_infor(�compact_traceback�failr_�os�path�split)r�real_t�real_v�real_tbrO�f�function�line�t�v�inforrrr��s
z*HelperFunctionTests.test_compact_tracebackN)
rrrrb�unittest�
skipUnless�hasattrrBruryrzrxr�rrrrr[ks
;r[c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�DispatcherTestscCr'r!rrrrr�setUp�rzDispatcherTests.setUpcC�t��dSr!�r(r~rrrr�tearDown�r#zDispatcherTests.tearDowncCs,t��}|�|��d�|�|��d�dSr)r(�
dispatcherr_�readable�writable�r�drrr�
test_basic�szDispatcherTests.test_basiccCs$t��}|�t|�dt|��dS)Nz<asyncore.dispatcher at %#x>)r(r�r_�repr�idr�rrr�	test_reprszDispatcherTests.test_reprcCstt��}d}d}t���}|�|�|�|�Wd�n1s!wY|����}|�|d|d|g�dS)NzLovely spam! Wonderful spam!r�zlog: %s)r(r�r�captured_stderr�log�getvalue�
splitlinesr_)rr��l1�l2�stderr�linesrrr�test_logs

�zDispatcherTests.test_logcCs�t��}d}d}d}t���}|�|d�|�|�|�|d�Wd�n1s*wY|����}d|d|d|g}|�||�dS)	Nz#Have you got anything without spam?z.Why can't she have egg bacon spam and sausage?zTHAT'S got spam in it!�EGGS�SPAMzEGGS: %szinfo: %szSPAM: %s)r(r�r�captured_stdout�log_infor�r�r_)rr�r�r��l3�stdoutr�rprrr�
test_log_infos

�zDispatcherTests.test_log_infocCszt��}d|_t���}|��|��|��|��Wd�n1s&wY|�	��
�}gd�}|�||�dS)Nr)z*warning: unhandled incoming priority eventzwarning: unhandled read eventzwarning: unhandled write eventz warning: unhandled connect event)r(r��ignore_log_typesrr��handle_expt�handle_read�handle_write�handle_connectr�r�r_)rr�r�r�rprrr�test_unhandled#s

�zDispatcherTests.test_unhandledcCsFt�tj�}ttd�r|�|t�tj��t�d�}|�|dk�dS)N�strerrorr��)	r(�	_strerror�errno�EPERMr�r�r_r��
assertTrue)r�errrrr�
test_strerror5s


zDispatcherTests.test_strerrorN)rrrr�r�r�r�r�r�r�r�rrrrr��s
r�c@r)�dispatcherwithsend_noreadcCrr
rrrrrr�?rz"dispatcherwithsend_noread.readablecCr'r!rrrrrr�Brz(dispatcherwithsend_noread.handle_connectN)rrrr�r�rrrrr�>r%r�c@s*eZdZdd�Zdd�Zejdd��ZdS)�DispatcherWithSendTestscCr'r!rrrrrr�GrzDispatcherWithSendTests.setUpcCr�r!r�rrrrr�Jr#z DispatcherWithSendTests.tearDownc
	Cst��}t��}|�d�t�|�}t�}|||f}tjt|d�}|�	�zXt
�d�d}t�}|�
�|�tj|f�t
�d�|�|�|�|�|�d�d}	|jrh|	dkrht��|	d	8}	|jrh|	dksY|��|�|��|d
�Wt�|�dSt�|�w)N�)�target�args皙�����?s$Suppose there isn't a 16-ton weight?r7r:i�rr8�)�	threading�Eventr"�
settimeoutr�	bind_portr�ThreadrSrNr@rFr��
create_socket�connect�HOST�send�
out_bufferr(rc�waitr_r�r�join_thread)
rrHrY�port�capr�r�rRr�rMrrr�	test_sendMs4







�z!DispatcherWithSendTests.test_sendN)rrrr�r�r�reap_threadsr�rrrrr�Fs
r��file_wrapperzasyncore.file_wrapper requiredc@sVeZdZdd�Zdd�Zdd�Zdd�Ze�e	e
d	�d
�dd��Zd
d�Zdd�Z
dS)�FileWrapperTestcCsDd|_ttjd��}|�|j�Wd�dS1swYdS)NsIt's not dead, it's sleeping!�wb)r��openr�TESTFNrD)r�filerrrr�xs"�zFileWrapperTest.setUpcCst�tj�dSr!)rrVr�rrrrr�}�zFileWrapperTest.tearDowncCs�t�tjtj�}t�|�}t�|�|�|j	|�|�|�
�|�|�|�d�d�|�|�
d�d�|��|�t|j
d�dS)N�
s
It's not dead�s, it'sr8)r�r�rr��O_RDONLYr(r�r�assertNotEqual�fdrr_rCr]r\�OSError)rr�rPrrr�	test_recv�s

zFileWrapperTest.test_recvcCs�d}d}t�tjtjtjB�}t�|�}t�|�|�	|�|�
|�|��ttjd��}|�|��|j
||�Wd�dS1sFwYdS)NsCome again?sI want to buy some cheese.�rb)r�r�rr��O_WRONLY�O_APPENDr(r�rrDr�r_r]r�)r�d1�d2r�rPr�rrrr��s



"�zFileWrapperTest.test_send�file_dispatcherz!asyncore.file_dispatcher requiredcsdt�tjtj�}g�G�fdd�dtj�}||�}t�|�tjdddd�|�	d�
��|j�dS)NcseZdZ�fdd�ZdS)z7FileWrapperTest.test_dispatcher.<locals>.FileDispatchercs��|�d��dS)N�)r|rCr�rRrrr��szCFileWrapperTest.test_dispatcher.<locals>.FileDispatcher.handle_readN�rrrr�rr�rr�FileDispatcher�sr�r<Tr���timeout�use_poll�countr;)r�r�rr�r�r(r�r�loopr_�joinr�)rr�r��srr�r�test_dispatcher�s
zFileWrapperTest.test_dispatchercCsdt�tjtj�}t�|�}t�|�t�	dt
f��d}t��Wd�dS1s+wYdS)Nr�)
r�r�rr�r�r(r�rr�check_warnings�ResourceWarningr�
gc_collect�rr�r�rrr�test_resource_warning�s


"�z%FileWrapperTest.test_resource_warningcCs|t�tjtj�}t�|�}t�|�t�|j�|�	t
��|��Wd�n1s,wY|�|jd�|��dS)Nr�)r�r�rr�r�r(r�rr�r\r�r_rrrr�test_close_twice�s


�z FileWrapperTest.test_close_twiceN)rrrr�r�r�r�r�r�r�r(r�rrrrrrr�us
�

r�c@sFeZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�BaseTestHandlerNcCstj�||�d|_dSr
)r(r�rrq)rrYrrrr�s
zBaseTestHandler.__init__cC�td��)Nz'handle_accept not supposed to be calledr2rrrr�
handle_accept�r+zBaseTestHandler.handle_acceptcCr)Nz)handle_accepted not supposed to be calledr2rrrr�handle_accepted�r+zBaseTestHandler.handle_acceptedcCr)Nz(handle_connect not supposed to be calledr2rrrrr��r+zBaseTestHandler.handle_connectcCr)Nz%handle_expt not supposed to be calledr2rrrrr��r+zBaseTestHandler.handle_exptcCr)Nz&handle_close not supposed to be calledr2rrrrr-�r+zBaseTestHandler.handle_closecC��r!rrrrrr4��zBaseTestHandler.handle_errorr!)
rrrrrrr�r�r-r4rrrrr�s
rc@s8eZdZdZefdd�Zedd��Zdd�Zdd	�Z	d
S)�
BaseServerzYA server which listens on an address and dispatches the
    connection to a handler.
    cCs>tj�|�|�|�|��t|j|�|�d�||_dS�N�)	r(r�rr��set_reuse_addrrZr"r=�handler)rrUrLrrrrr�s


zBaseServer.__init__cCs
|j��Sr!)r"�getsocknamerrrr�address�s
zBaseServer.addresscCs|�|�dSr!)r�rrYrLrrrr�r$zBaseServer.handle_acceptedcCr	r!rrrrrr4�r
zBaseServer.handle_errorN)
rrr�__doc__rr�propertyrrr4rrrrr�s
rc@r)�
BaseClientcCs"t�|�|�|�|�|�dSr!)rrr�r�)rrUrrrrr�s

zBaseClient.__init__cCr'r!rrrrrr��rzBaseClient.handle_connectN)rrrrr�rrrrr��rc@s�eZdZdd�Zd%dd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Ze�
ej�d�d�dd��Zdd�Zdd�Zdd�Zdd�Zd d!�Zejd"d#��Zd$S)&�BaseTestAPIcCstjdd�dS)NT)�
ignore_allr�rrrrr��r�zBaseTestAPI.tearDownr
cCsht|�d}d}tjr-|dkr-tjdd|jd�|jrdS|d8}t�|�tjr-|dks|�d�dS)N�drr<r8)r�r�r�zflag not set)	�floatr(r}r�r�rqr@rFr�)r�instancer�r�rrr�loop_waiting_for_flag�s
�z!BaseTestAPI.loop_waiting_for_flagcC�:Gdd�dt�}t|j|j�}||j|j�}|�|�dS)Nc@�eZdZdd�ZdS)z3BaseTestAPI.test_handle_connect.<locals>.TestClientcSrr�rqrrrrr�rzBBaseTestAPI.test_handle_connect.<locals>.TestClient.handle_connectN)rrrr�rrrr�
TestClient
�r �rrrUrLrr�rr �server�clientrrr�test_handle_connect
�zBaseTestAPI.test_handle_connectcC�:Gdd�dt�}||j|j�}t|j|j�}|�|�dS)Nc@r)z4BaseTestAPI.test_handle_accept.<locals>.TestListenercS�:t�|�|�|�t|j|�|�d�|j��|_dSr�rrr�rZr"r=rr�rrUrLrrrr�



z=BaseTestAPI.test_handle_accept.<locals>.TestListener.__init__cSrrrrrrrr!rzBBaseTestAPI.test_handle_accept.<locals>.TestListener.handle_acceptN)rrrrrrrrr�TestListenersr-�rrUrLrrr�rr-r$r%rrr�test_handle_acceptszBaseTestAPI.test_handle_acceptcCr()Nc@r
)z6BaseTestAPI.test_handle_accepted.<locals>.TestListenercSr)rr*r+rrrr-r,z?BaseTestAPI.test_handle_accepted.<locals>.TestListener.__init__cSstj�|�dSr!)r(r�rrrrrr4r�zDBaseTestAPI.test_handle_accepted.<locals>.TestListener.handle_acceptcSs|��d|_dSr)rrqrrrrr7s
zFBaseTestAPI.test_handle_accepted.<locals>.TestListener.handle_acceptedN)rrrrrrrrrrr-+sr-r.r/rrr�test_handle_accepted(sz BaseTestAPI.test_handle_acceptedcC�LGdd�dt�}Gdd�dt�}t|j|j|�}||j|j�}|�|�dS)Nc@r)z0BaseTestAPI.test_handle_read.<locals>.TestClientcSrrrrrrrr�Drz<BaseTestAPI.test_handle_read.<locals>.TestClient.handle_readNr�rrrrr Cr!r c@r)z1BaseTestAPI.test_handle_read.<locals>.TestHandlercSst�||�|�d�dS)Nsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)rrr��rrKrrrrH�z:BaseTestAPI.test_handle_read.<locals>.TestHandler.__init__N�rrrrrrrr�TestHandlerGr!r6�rrrrUrLrr�rr r6r$r%rrr�test_handle_read@s
zBaseTestAPI.test_handle_readcCr)Nc@r)z1BaseTestAPI.test_handle_write.<locals>.TestClientcSrrrrrrrr�Trz>BaseTestAPI.test_handle_write.<locals>.TestClient.handle_writeN)rrrr�rrrrr Sr!r r"r#rrr�test_handle_writePr'zBaseTestAPI.test_handle_writecCr2)Nc@r)z1BaseTestAPI.test_handle_close.<locals>.TestClientcSrv)N�)rCrrrrr�asz=BaseTestAPI.test_handle_close.<locals>.TestClient.handle_readcS�d|_|��dSr�rqrrrrrr-f�z>BaseTestAPI.test_handle_close.<locals>.TestClient.handle_closeN)rrrr�r-rrrrr _rr c@r)z2BaseTestAPI.test_handle_close.<locals>.TestHandlercSst�||�|��dSr!)rrrr3rrrrksz;BaseTestAPI.test_handle_close.<locals>.TestHandler.__init__Nr5rrrrr6jr!r6r7r8rrr�test_handle_close[s
zBaseTestAPI.test_handle_closecsXd�G�fdd�dt�}G�fdd�dt�}t|j|j|�}||j|j�}|�|�dS)Ns�cs(eZdZ�fdd�Zdd�Zdd�ZdS)zCBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestClientcs|���dSr!)r�rr�rrr�{r$zPBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestClient.handle_writecSr<rr=rrrrr-~r>zPBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestClient.handle_closecSr<rr=rrrrr��r>zOBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestClient.handle_exptN)rrrr�r-r�rr�rrr ysr cs eZdZ�fdd�Zdd�ZdS)zDBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestHandlercs|�t���|��dSr!)rCrrrr�rrr��szPBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestHandler.handle_readcSrr
rrrrrr��rzMBaseTestAPI.test_handle_close_after_conn_broken.<locals>.TestHandler.writableN)rrrr�r�rr�rrr6�sr6r7r8rr�r�#test_handle_close_after_conn_brokenss
	z/BaseTestAPI.test_handle_close_after_conn_broken�sunosz OOB support is broken on SolariscCs�tr
|jtjkr
|�d�tjdkr|jr|�d�Gdd�dt�}Gdd�dt	�}t
|j|j|�}||j|j�}|�
|�dS)N�"Not applicable to AF_UNIX sockets.�darwinz(poll may fail on macOS; see issue #28087c@r)z0BaseTestAPI.test_handle_expt.<locals>.TestClientcSs|j�dtj�d|_dS)Nr;T)r"rC�MSG_OOBrqrrrrr��s
z<BaseTestAPI.test_handle_expt.<locals>.TestClient.handle_exptN)rrrr�rrrrr �r!r c@r)z1BaseTestAPI.test_handle_expt.<locals>.TestHandlercSs*t�||�|j�ttd�d�tj�dS)N��zlatin-1)rrr"r��bytes�chrrDr3rrrr�sz:BaseTestAPI.test_handle_expt.<locals>.TestHandler.__init__Nr5rrrrr6�r!r6)rTrUr"r	�skipTestr��platformr�rrrrLrrr8rrr�test_handle_expt�s

zBaseTestAPI.test_handle_exptcCr)Nc@r)z1BaseTestAPI.test_handle_error.<locals>.TestClientcSsdddS)Ng�?rrrrrrr��r#z>BaseTestAPI.test_handle_error.<locals>.TestClient.handle_writecSsd|_z�tyYdSwr)rq�ZeroDivisionErrorr3rrrrr4�s�z>BaseTestAPI.test_handle_error.<locals>.TestClient.handle_errorN)rrrr�r4rrrrr �sr r"r#rrr�test_handle_error�szBaseTestAPI.test_handle_errorcCs�t|j|j�}t|j|j�}|�|j�|�|j�|�|j�t	j
d|jdd�|�|j�|�|j�|�|j�|�|j�|��|�|j�|�|j�|�|j�|�|j�|��|�|j�|�|j�dS)Nr<rr�)
rrUrLrr�assertFalse�	connectedr��	acceptingr(r�r�r)rr$r%rrr�test_connection_attributes�s$z&BaseTestAPI.test_connection_attributescCs^t��}|�|j�|�|jjtj�|�|jj|j�|�|j��d�|�	|j�
��dS)Nr)r(r�r�rUr_r"�type�SOCK_STREAM�
gettimeoutrM�get_inheritable)rr�rrr�test_create_socket�szBaseTestAPI.test_create_socketcCs�tr
|jtjkr
|�d�t��}|�|j�|�|j	�|�
d�|j��d}t��}|�|j�|�t
|j|j	d|f�dS)NrBr
r8r)rTrUr"r	rHr(r�r�rXrLr=rr\r�)r�s1r��s2rrr�	test_bind�s

zBaseTestAPI.test_bindc	Cs�tr
|jtjkr
|�d�t�|j��[}z|�tjtjd�Wnty-t	�
d�Yn9wt�t�|j��}|�
|j�tjtj��|j��|�|j�|��|�|j�tjtj��Wd�dSWd�dS1sqwYdS)NrBr8z+SO_REUSEADDR not supported on this platform)rTrUr"r	rH�
setsockopt�
SOL_SOCKET�SO_REUSEADDRr�r��skipr(r�rM�
getsockoptrr�rr�)rrYr�rrr�test_set_reuse_addr�s*
��
��"�zBaseTestAPI.test_set_reuse_addrc
Cs�|jtjttdt��fvr|�d�t|j|j�}tj	dd�d�}|�
�zMt�|jtj��-}|�d�|�
tjtjt�ddd	��z|�|j�Wn	tySYnwWd�n1s^wYWt�|�dSWt�|�dSt�|�w)
N�AF_INET6z%test specific to AF_INET and AF_INET6cSstjddd�S)Nr7r
)r�r�)r(r�rrrr�<lambda>s�z0BaseTestAPI.test_quick_connect.<locals>.<lambda>)r�r��iir8r)rUr"�AF_INETrm�objectrHrrLr�r�rNrRr�rYrZ�	SO_LINGER�struct�packr�rr�rr�)rr$r�r�rrr�test_quick_connects*

����
�
zBaseTestAPI.test_quick_connectN)r
)rrrr�rr&r0r1r9r:r?r@r��skipIfr�rI�
startswithrJrLrPrUrXr^rr�rgrrrrr�s*
 �
rc@�eZdZejZejdfZdS)�TestAPI_UseIPv4SocketsrN)	rrrr"rbrUrr�rLrrrrrk srkzIPv6 support requiredc@rj)�TestAPI_UseIPv6SocketsrN)	rrrr"r_rUr�HOSTv6rLrrrrrl$srlzUnix sockets requiredc@s$eZdZer	ejZejZ	dd�Z
dS)�TestAPI_UseUnixSocketscCst�|j�t�|�dSr!)rrVrLrr�rrrrr�/r4zTestAPI_UseUnixSockets.tearDownN)rrrrTr"r	rUrr�rLr�rrrrrn)s
rnc@�eZdZdZdS)�TestAPI_UseIPv4SelectFN�rrrr�rrrrrp3�rprcrdc@ro)�TestAPI_UseIPv4PollTNrqrrrrrs6�rsc@ro)�TestAPI_UseIPv6SelectFNrqrrrrru:rrruc@ro)�TestAPI_UseIPv6PollTNrqrrrrrv=rtrvc@ro)�TestAPI_UseUnixSocketsSelectFNrqrrrrrwArrrwc@ro)�TestAPI_UseUnixSocketsPollTNrqrrrrrxDrtrx�__main__):r�rBr�r"r�r@r�rer��testr�test.supportrrrr�ior�PGO�SkipTest�warnings�catch_warnings�simplefilter�DeprecationWarningr(r�rTrr r&r/rSrZ�TestCaser[r��dispatcher_with_sendr�r�r�r�r�rrrrrk�IPV6_ENABLEDrlrnrprsrurvrwrxr�mainrrrr�<module>sz


�


H/�G(
	
�

Youez - 2016 - github.com/yon3zu
LinuXploit