AlkantarClanX12
Current Path : /proc/self/root/opt/alt/python35/lib64/python3.5/asyncio/__pycache__/ |
Current File : //proc/self/root/opt/alt/python35/lib64/python3.5/asyncio/__pycache__/windows_utils.cpython-35.pyc |
��Yf� � @ sJ d Z d d l Z e j d k r- e d � � d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d d d d g Z d Z e j Z e j Z e j � Z e e d � r� e j Z n e j e j d d d � Z d d d d d e d d � Z Gd d � d � Z Gd d � d e j � Z d S)z* Various Windows specific bits and pieces � N�win32z win32 only� socketpair�pipe�Popen�PIPE� PipeHandlei c C sk | t j k r d } n$ | t j k r0 d } n t d � � | t j k rW t d � � | d k ro t d � � t j | | | � } z� | j | d f � | j d � | j � d d � \ } } t j | | | � } yb | j d � y | j | | f � Wn t t f k rYn X| j d � | j � \ } } Wn | j � � Yn XWd | j � X| | f S)z�A socket pair usable as a self-pipe, for Windows. Origin: https://gist.github.com/4325783, by Geert Jansen. Public domain. z 127.0.0.1z::1z?Only AF_INET and AF_INET6 socket address families are supportedz)Only SOCK_STREAM socket type is supportedr zOnly protocol zero is supported� N� FT)�socket�AF_INETZAF_INET6� ValueError�SOCK_STREAMZbindZlistenZgetsocknameZsetblockingZconnect�BlockingIOError�InterruptedErrorZaccept�close) Zfamily�type�proto�hostZlsockZaddrZportZcsockZssock�_� r �:/opt/alt/python35/lib64/python3.5/asyncio/windows_utils.pyr % s8 �duplexF� overlappedT�bufsizec C s� t j d d t j � t t � f � } | rW t j } t j t j B} | | } } n t j } t j } d | } } | t j O} | d r� | t j O} | d r� t j } n d } d } } y� t j | | t j d | | t j t j � } t j | | d t j t j | t j � } t j | d d �} | j d � | | f SWn= | d k rft j | � | d k rt j | � � Yn Xd S)zELike os.pipe() but with overlapped support and using handles not fds.�prefixz\\.\pipe\python-pipe-%d-%d-r r Nr T)�tempfileZmktemp�os�getpid�next� _mmap_counter�_winapiZPIPE_ACCESS_DUPLEXZGENERIC_READZ GENERIC_WRITEZPIPE_ACCESS_INBOUNDZFILE_FLAG_FIRST_PIPE_INSTANCEZFILE_FLAG_OVERLAPPEDZCreateNamedPipeZ PIPE_WAITZNMPWAIT_WAIT_FOREVERZNULLZ CreateFileZ OPEN_EXISTINGZConnectNamedPipeZGetOverlappedResult�CloseHandle)r r r ZaddressZopenmode�accessZobsizeZibsizeZflags_and_attribsZh1Zh2Zovr r r r S s@ c @ s� e Z d Z d Z d d � Z d d � Z e d d � � Z d d � Z d e j d d � Z d d � Z d d � Z d d � Z d S)r z�Wrapper for an overlapped pipe handle which is vaguely file-object like. The IOCP event loop can use these instead of socket objects. c C s | | _ d S)N)�_handle)�self�handler r r �__init__� s zPipeHandle.__init__c C s9 | j d k r d | j } n d } d | j j | f S)Nz handle=%r�closedz<%s %s>)r# � __class__�__name__)r$ r% r r r �__repr__� s zPipeHandle.__repr__c C s | j S)N)r# )r$ r r r r% � s zPipeHandle.handlec C s"