U e5d«‰ã@s ddlZddlTddlZddlZddlZddlZddlmZmZz ddlZWne k rddZYnXe eddƒZ e eddƒZ e eddƒZ d d d d d ddgZe e e¡¡e dedd„¡e dedd„¡e dedd„¡e dedd„¡dZdZdd„ZeZej ¡ d¡r iZded<ded<d ed!<d"ed#<d$ed%<d&ed'<d(ed)<d*ed+<d,ed-<d.ed/<d0ed1<d2ed3<d4ed5<d6ed7<d8ed9<d:ed;<ded?<d@edA<dBedC<dDedE<dFedG<dHedI<dJedK<dLedM<dNedO<dPedQ<dRedS<dTedU<dVedW<dXedY<dZed[<d\ed]<d^ed_<d`eda<dbedc<ddede<dfedg<dhedi<djedk<dledm<dnedo<dpedq<dreds<dtedu<dvedw<dxedy<dzed{<d|ed}<d~ed<d€ed<d‚edƒ<d„ed…<d†ed‡<dˆed‰<dŠed‹<dŒed<dŽed<ded‘<d’ed“<d”ed•<d†ed–<d—ed˜<d™edš<d›edœ<dedž<dŸed <d¡ed¢<d£ed¤<d¥ed¦<d§ed¨<d©edª<d«ed¬<d­ed®<d¯ed°<d±ed²<d³ed´<dµed¶<d·ed¸<d¹edº<d»ed¼<d½ed¾<d¿edÀ<d¿edÁ<dÂedÃ<dÄedÅ<dÆedÇ<dÈedÉ<dÊedË<dÌedÍ<dÎedÏ<dÐedÑ<dÒedÓ<dÔedÕ<dÖed×<e dØ¡GdÙdÚ„dÚeƒZGdÛdÜ„dÜejƒZdðdÝd „Ze ejdÞƒrldßdà„Z!e dà¡e edáƒrŠde"dfdâdá„Z#ne$e"dfdãdá„Z#e dá¡däe#_%e e hZ&Gdådæ„dæej'ƒZ(dñdèd „Z)e*ƒZ+e+dfdéd „Z,dêd „Z-e$ddëdëdìœdíd „Z.dòdîdï„Z/dS)óéN)Ú*)ÚIntEnumÚIntFlagÚEBADFé ÚEAGAINé Ú EWOULDBLOCKÚfromfdÚgetfqdnÚcreate_connectionÚ create_serverÚhas_dualstack_ipv6Ú AddressFamilyÚ SocketKindcCs| ¡o| d¡S)NZAF_©ÚisupperÚ startswith©ÚC©rú/usr/lib64/python3.8/socket.pyÚLórcCs| ¡o| d¡S)NZSOCK_rrrrrrQrZMsgFlagcCs| ¡o| d¡S)NZMSG_rrrrrrVrZ AddressInfocCs| ¡o| d¡S)NZAI_rrrrrr[rz 127.0.0.1z::1cCs(z ||ƒWStk r"|YSXdS©N)Ú ValueError)ÚvalueZ enum_klassrrrÚ_intenum_converteras rÚwinz)Specified event object handle is invalid.ézInsufficient memory available.éz#One or more parameters are invalid.éWzOverlapped operation aborted.iãz2Overlapped I/O event object not in signaled state.iäz)Overlapped operation will complete later.iåzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'zToo many open files.i('z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zOperation already in progress.i5'zSocket operation on nonsocket.i6'zDestination address required.i7'zMessage too long.i8'zProtocol wrong type for socket.i9'zBad protocol option.i:'zProtocol not supported.i;'zSocket type not supported.i<'zOperation not supported.i='zProtocol family not supported.i>'z0Address family not supported by protocol family.i?'zThe network address is in use.i@'z Cannot assign requested address.iA'zNetwork is down.iB'zNetwork is unreachable.iC'z$Network dropped connection on reset.iD'z!Software caused connection abort.iE'zThe connection has been reset.iF'zNo buffer space available.iG'zSocket is already connected.iH'zSocket is not connected.iI'zThe network has been shut down.iJ'zToo many references.iK'zThe operation timed out.iL'zConnection refused.iM'zCannot translate name.iN'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'zDirectory not empty.iR'zToo many processes.iS'zUser quota exceeded.iT'zDisk quota exceeded.iU'zStale file handle reference.iV'zItem is remote.iW'z!Network subsystem is unavailable.ik'z!Winsock.dll version out of range.il'z(Successful WSAStartup not yet performed.im'zGraceful shutdown in progress.iu'z*No more results from WSALookupServiceNext.iv'zCall has been canceled.iw'z Procedure call table is invalid.ix'zService provider is invalid.iy'z&Service provider failed to initialize.iz'zSystem call failure.i{'zService not found.i|'zClass type not found.i}'i~'zCall was canceled.i'zDatabase query was refused.i€'zHost not found.iù*z Nonauthoritative host not found.iú*zThis is a nonrecoverable error.iû*z*Valid name, no data record requested type.iü*zQoS receivers.iý*z QoS senders.iþ*zNo QoS senders.iÿ*zQoS no receivers.i+zQoS request confirmed.i+zQoS admission error.i+zQoS policy failure.i+zQoS bad style.i+zQoS bad object.i+zQoS traffic control error.i+zQoS generic error.i+zQoS service type error.i+zQoS flowspec error.i +zInvalid QoS provider buffer.i +zInvalid QoS filter style.i +i +zIncorrect QoS filter count.i +zInvalid QoS object length.i+zIncorrect QoS flow count.i+zUnrecognized QoS object.i+zInvalid QoS policy object.i+zInvalid QoS flow descriptor.i+z'Invalid QoS provider-specific flowspec.i+z)Invalid QoS provider-specific filterspec.i+z&Invalid QoS shape discard mode object.i+z Invalid QoS shaping rate object.i+z!Reserved policy QoS element type.i+ÚerrorTabc@s eZdZdS)Ú_GiveupOnSendfileN)Ú__name__Ú __module__Ú __qualname__rrrrr#Òsr#cs(eZdZdddgZd8dd„Zdd „Zd d „Zd d „Zdd„Zdd„Z dd„Z d9ddddœdd„Z e e dƒrvd:dd„Zn d;dd„ZdÚsocketÚ __weakref__Ú_io_refsÚ_closedéÿÿÿÿNcCsP|dkr,|dkrt}|dkr t}|dkr,d}tj |||||¡d|_d|_dS)Nr+rF)ÚAF_INETÚ SOCK_STREAMÚ_socketr'Ú__init__r)r*)ÚselfÚfamilyÚtypeÚprotoÚfilenorrrr/Ûszsocket.__init__cCs|Srr©r0rrrÚ __enter__ëszsocket.__enter__cGs|js| ¡dSr)r*Úclose)r0ÚargsrrrÚ__exit__îszsocket.__exit__cCs¸t|ddƒ}d|jj|jj|r"dnd| ¡|j|j|jf}|s¬z | ¡}|r^|dt |ƒ7}Wnt k rtYnXz |  ¡}|r”|dt |ƒ7}Wnt k rªYnX|d7}|S) Nr*Fz,<%s.%s%s fd=%i, family=%s, type=%s, proto=%iz [closed]Úz , laddr=%sz , raddr=%sú>) ÚgetattrÚ __class__r%r&r4r1r2r3Ú getsocknameÚstrÚerrorZ getpeername)r0ÚclosedÚsZladdrZraddrrrrÚ__repr__òs4  úÿzsocket.__repr__cCstd|jj›dƒ‚dS)Nzcannot pickle z object)Ú TypeErrorr=r$r5rrrÚ __getstate__szsocket.__getstate__cCs6t| ¡ƒ}|j|j|j|j|d}| | ¡¡|S)N©r4)Údupr4r=r1r2r3Ú settimeoutÚ gettimeout)r0ÚfdÚsockrrrrGs z socket.dupcCsF| ¡\}}t|j|j|j|d}tƒdkr>| ¡r>| d¡||fS)NrFT)Z_acceptr'r1r2r3ZgetdefaulttimeoutrIÚ setblocking)r0rJÚaddrrKrrrÚaccepts   z socket.acceptÚr)ÚencodingÚerrorsÚnewlinec Csüt|ƒdddhks td|fƒ‚d|k}d|kp4| }d|k}d} |rN| d7} |rZ| d7} t|| ƒ} |jd7_|dkr~d}|dkrŒtj}|dkr¤|s td ƒ‚| S|r¼|r¼t | | |¡} n|rÎt | |¡} n t | |¡} |râ| St  | |||¡} || _ | S) NrOÚwÚbz&invalid mode %r (only r, w, b allowed)r:ér+rz!unbuffered streams must be binary) ÚsetrÚSocketIOr)ÚioÚDEFAULT_BUFFER_SIZEÚBufferedRWPairÚBufferedReaderÚBufferedWriterÚ TextIOWrapperÚmode) r0r^Ú bufferingrPrQrRZwritingZreadingZbinaryZrawmodeÚrawÚbufferÚtextrrrÚmakefile-s<  zsocket.makefileÚsendfilerc Csò| |||¡| ¡}z | ¡}Wn0ttjfk rR}z t|ƒ‚W5d}~XYnXzt |¡j}Wn*t k rŽ}z t|ƒ‚W5d}~XYnX|s˜dSt |p |dƒ}|  ¡} | dkr¾t dƒ‚t tdƒrÒt ¡} nt ¡} |  |tj¡d} | j} tj} zÒ| r| | ƒst d¡‚|r0|| }|dkr0qÄz| ||||ƒ}Wn`tk rh| s`| ƒYqúYqút k r¢}z| dkrŒt|ƒ‚|d‚W5d}~XYqúX|dkr²qÄ||7}| |7} qú| W¢S| dkrìt |dƒrì| |¡XdS)Nri@ú&non-blocking sockets are not supportedÚ PollSelectorÚseekz timed out)Ú_check_sendfile_paramsr4ÚAttributeErrorrXÚUnsupportedOperationr#ÚosÚfstatÚst_sizeÚOSErrorÚminrIrÚhasattrÚ selectorsrfZSelectSelectorÚregisterZ EVENT_WRITEZselectrdrgr.ÚtimeoutÚBlockingIOError)r0ÚfileÚoffsetÚcountZsocknor4ÚerrZfsizeÚ blocksizersZselectorÚ total_sentZselector_selectZ os_sendfileÚsentrrrÚ_sendfile_use_sendfileYs^        zsocket._sendfile_use_sendfilecCs tdƒ‚dS)Nz,os.sendfile() not available on this platform)r#©r0rurvrwrrrr|šsÿc Csþ| |||¡| ¡dkr"tdƒ‚|r0| |¡|r>t|dƒnd}d}|j}|j}z„|rpt|||ƒ}|dkrpqÐt||ƒƒ}|s‚qÐz ||ƒ} Wnt k r¦Yq‚Yq‚X|| 7}| t |ƒkrÎ|| d…}q‚qTq‚qT|W¢S|dkrøt|dƒrø| ||¡XdS)Nrrei rg) rhrIrrgroÚreadÚsendrpÚ memoryviewrtÚlen) r0rurvrwryrzZ file_readZ sock_sendÚdatar{rrrÚ_sendfile_use_sendžs8      zsocket._sendfile_use_sendcCsddt|ddƒkrtdƒ‚|jt@s*tdƒ‚|dk r`t|tƒsJtd |¡ƒ‚|dkr`td |¡ƒ‚dS)NrTr^z$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r)r<rr2r-Ú isinstanceÚintrDÚformatr}rrrrhÂs  ÿÿzsocket._check_sendfile_paramscCs8z| |||¡WStk r2| |||¡YSXdSr)r|r#rƒr}rrrrdÏszsocket.sendfilecCs*|jdkr|jd8_|jr&| ¡dS)NrrU)r)r*r7r5rrrÚ_decref_socketiosæs zsocket._decref_socketioscCs| |¡dSr)r7)r0Z_ssrrrÚ _real_closeìszsocket._real_closecCsd|_|jdkr| ¡dS)NTr)r*r)rˆr5rrrr7ðs z socket.closecsd|_tƒ ¡S)NT)r*ÚsuperÚdetachr5©r=rrrŠösz socket.detachcsttƒjtƒSr)rr‰r1rr5r‹rrr1sz socket.familycsttƒjtƒSr)rr‰r2rr5r‹rrr2sz socket.typeÚntcCst | ¡¡Sr)rkZget_handle_inheritabler4r5rrrÚget_inheritable szsocket.get_inheritablecCst | ¡|¡dSr)rkZset_handle_inheritabler4©r0Z inheritablerrrÚset_inheritableszsocket.set_inheritablecCst | ¡¡Sr)rkrr4r5rrrrscCst | ¡|¡dSr)rkrr4rŽrrrrsz&Get the inheritable flag of the socketz&Set the inheritable flag of the socket)r+r+r+N)rON)rN)rN)rN)rN) r$r%r&Ú __slots__r/r6r9rCrErGrNrcrprkr|rƒrhrdr‡r.r'rˆr7rŠÚpropertyr1r2ÚnamerrÚ__doc__Ú __classcell__rrr‹rr'ÕsD   ÿ *  A  $    r'cCst|ƒ}t||||ƒSr)rGr')rJr1r2r3Znfdrrrr sZsharecCstddd|ƒS©Nr)r')ÚinforrrÚ fromshare#sr—Ú socketpaircCsh|dkr*zt}Wntk r(t}YnXt |||¡\}}t|||| ¡ƒ}t|||| ¡ƒ}||fSr)ZAF_UNIXÚ NameErrorr,r.r˜r'rŠ)r1r2r3ÚarTrrrr˜.s c Cs|tkrt}n|tkrt}ntdƒ‚|tkr4tdƒ‚|dkrDtdƒ‚t|||ƒ}z¢| |df¡|  ¡|  ¡dd…\}}t|||ƒ}zP|  d¡z|  ||f¡Wnt tfk r¾YnX|  d¡| ¡\}} Wn| ¡‚YnXW5| ¡X||fS)Nz?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedrzOnly protocol zero is supportedéFT)r,Ú _LOCALHOSTÚAF_INET6Ú _LOCALHOST_V6rr-r'r7ÚbindÚlistenr>rLÚconnectrtÚInterruptedErrorrN) r1r2r3ÚhostZlsockrMÚportZcsockZssockÚ_rrrr˜Cs8      a8socketpair([family[, type[, proto]]]) -> (socket object, socket object) Create a pair of socket objects from the sockets returned by the platform socketpair() function. The arguments are the same as for socket() except the default family is AF_UNIX if defined on the platform; otherwise, the default is AF_INET. csleZdZdd„Zdd„Zdd„Zdd„Zd d „Z‡fd d „Zd d„Z e dd„ƒZ e dd„ƒZ dd„Z ‡ZS)rWcCsZ|dkrtd|ƒ‚tj |¡||_d|kr6|d7}||_d|k|_d|k|_d|_dS)N)rOrSZrwÚrbÚwbZrwbzinvalid mode: %rrTrOrSF) rrXÚ RawIOBaser/Ú_sockÚ_modeÚ_readingÚ_writingÚ_timeout_occurred)r0rKr^rrrr/ƒs    zSocketIO.__init__c CsŠ| ¡| ¡|jrtdƒ‚z|j |¡WStk rHd|_‚Yqtk r‚}z|jdt krpWY¢ dS‚W5d}~XYqXqdS)Nz!cannot read from timed out objectTr) Ú _checkClosedÚ_checkReadabler­rnr©Z recv_intorsr@r8Ú_blocking_errnos©r0rTÚerrrÚreadintos zSocketIO.readintoc Cs`| ¡| ¡z|j |¡WStk rZ}z|jdtkrHWY¢ dS‚W5d}~XYnXdSr•)r®Ú_checkWritabler©rr@r8r°r±rrrÚwrite¦s zSocketIO.writecCs|jrtdƒ‚|jS©NzI/O operation on closed socket.)rArr«r5rrrÚreadable¶szSocketIO.readablecCs|jrtdƒ‚|jSr¶)rArr¬r5rrrÚwritable½szSocketIO.writablecs|jrtdƒ‚tƒ ¡Sr¶)rArr‰Úseekabler5r‹rrr¹ÄszSocketIO.seekablecCs| ¡|j ¡Sr)r®r©r4r5rrrr4ËszSocketIO.filenocCs|js| ¡SdSdS)Nr+)rAr4r5rrrr’Ñsz SocketIO.namecCs|jSr)rªr5rrrr^Øsz SocketIO.modecCs*|jr dStj |¡|j ¡d|_dSr)rArXr¨r7r©r‡r5rrrr7Üs   zSocketIO.close)r$r%r&r/r³rµr·r¸r¹r4r‘r’r^r7r”rrr‹rrWrs    rWr:cCsl| ¡}|r|dkrtƒ}zt|ƒ\}}}Wntk r@Yn(X| d|¡|D]}d|krRqhqR|}|S)Nz0.0.0.0rÚ.)ÚstripZ gethostnameZ gethostbyaddrr@Úinsert)r’ZhostnameÚaliasesZipaddrsrrrr çs   c CsÔ|\}}d}t||dtƒD]’}|\}}} } } d} zDt||| ƒ} |tk rP|  |¡|r^|  |¡|  | ¡d}| WStk rª} z| }| dk rš|  ¡W5d} ~ XYqXq|dk rÈz|‚W5d}Xntdƒ‚dS)Nrz!getaddrinfo returns an empty list) Ú getaddrinfor-r'Ú_GLOBAL_DEFAULT_TIMEOUTrHrŸr¡r@r7)ÚaddressrsZsource_addressr£r¤rxÚresÚafÚsocktyper3Ú canonnameÚsarKr¥rrrr s.     c CsltrttdƒrttdƒsdSz4tttƒ }| ttd¡W5QR£WdSQRXWnt k rfYdSXdS)NÚ IPPROTO_IPV6Ú IPV6_V6ONLYFrT) Úhas_ipv6rpr.r'rr-Ú setsockoptrÆrÇr@)rKrrrr0sÿþ F)r1ÚbacklogÚ reuse_portÚdualstack_ipv6c Csn|rttdƒstdƒ‚|r8tƒs(tdƒ‚|tkr8tdƒ‚t|tƒ}ztjdkr‚ttdƒr‚z|  t t d¡Wnt k r€YnX|r”|  t t d¡trÖ|tkrÖ|r´|  ttd¡n"ttd ƒrÖttd ƒrÖ|  ttd¡z| |¡Wn@t k r$}z d |j|f}t |j|ƒd‚W5d}~XYnX|dkr:| ¡n | |¡|WSt k rh| ¡‚YnXdS) NÚ SO_REUSEPORTz+SO_REUSEPORT not supported on this platformz-dualstack_ipv6 not supported on this platformz'dualstack_ipv6 requires AF_INET6 family)rŒÚcygwinÚ SO_REUSEADDRrUrrÇrÆz+%s (while attempting to bind on address %r))rpr.rrrr'r-rkr’rÉZ SOL_SOCKETrÏr@rÍrÈrÆrÇrŸÚstrerrorÚerrnor r7)rÀr1rÊrËrÌrKrxÚmsgrrrr @sN  ÿ  ÿÿ    c CsPg}t ||||||¡D]2}|\}} }} } | t|tƒt| tƒ|| | f¡q|Sr)r.r¾Úappendrrr) r£r¤r1r2r3ÚflagsZaddrlistrÁrÂrÃrÄrÅrrrr¾…s þr¾)r)r:)rrrr)0r.rkÚsysrXrqÚenumrrrÑÚ ImportErrorr<rrr Ú__all__ÚextendÚ_get_exports_listÚ _convert_r$rœržrr'Z _realsocketÚplatformÚlowerrr"rÓÚ Exceptionr#r rpr—r-r˜r,r“r°r¨rWr Úobjectr¿r rr r¾rrrrÚ1sF      ÿýýýý  F   $ u ÿ -ÿ E