python类POLLOUT的实例源码

pollreactor.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log, 
        faildict={
            error.ConnectionDone: failure.Failure(error.ConnectionDone()),
            error.ConnectionLost: failure.Failure(error.ConnectionLost())
        }):
        why = None
        inRead = False
        if event & POLL_DISCONNECTED and not (event & POLLIN):
            why = main.CONNECTION_LOST
        else:
            try:
                if event & POLLIN:
                    why = selectable.doRead()
                    inRead = True
                if not why and event & POLLOUT:
                    why = selectable.doWrite()
                    inRead = False
                if not selectable.fileno() == fd:
                    why = error.ConnectionFdescWentAway('Filedescriptor went away')
                    inRead = False
            except:
                log.deferr()
                why = sys.exc_info()[1]
        if why:
            self._disconnectSelectable(selectable, why, inRead)
asyncore.py 文件源码 项目:kinect-2-libras 作者: inessadl 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def readwrite(obj, flags):
    try:
        if flags & select.POLLIN:
            obj.handle_read_event()
        if flags & select.POLLOUT:
            obj.handle_write_event()
        if flags & select.POLLPRI:
            obj.handle_expt_event()
        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
            obj.handle_close()
    except socket.error, e:
        if e.args[0] not in _DISCONNECTED:
            obj.handle_error()
        else:
            obj.handle_close()
    except _reraised_exceptions:
        raise
    except:
        obj.handle_error()
connection.py 文件源码 项目:ave 作者: sonyxperiadev 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def write(self, payload, timeout=None):
        size  = len(payload)
        done  = 0
        limit = None
        if timeout != None: # first and last test of 'timeout'
            limit = time.time() + timeout
        while done < size:
            try:
                done += Connection.write(self, payload[done:])
            except ConnectionAgain:
                if limit:
                    timeout == limit - time.time()
                else:
                    timeout = -1
                events = self.poll(select.POLLOUT, timeout)
                if not events:
                    raise ConnectionTimeout('write attempt timed out')
                if events[0][1] & (select.POLLHUP | select.POLLERR):
                    raise ConnectionClosed(
                        'write attempt failed with %d at %d %f'
                        % (events[0][1], done, timeout)
                    )
                if events[0][1] & select.POLLOUT:
                    continue
                raise Exception('unknown events: %s' % events)
connection.py 文件源码 项目:ave 作者: sonyxperiadev 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def write(self, payload, timeout=None):
        size  = len(payload)
        done  = 0
        limit = None
        if timeout != None: # first and last test of 'timeout'
            limit = time.time() + timeout
        while done < size:
            try:
                done += Connection.write(self, payload[done:])
            except ConnectionAgain:
                if limit:
                    timeout == limit - time.time()
                else:
                    timeout = -1
                events = self.poll(select.POLLOUT, timeout)
                if not events:
                    raise ConnectionTimeout('write attempt timed out')
                if events[0][1] & (select.POLLHUP | select.POLLERR):
                    raise ConnectionClosed(
                        'write attempt failed with %d at %d %f'
                        % (events[0][1], done, timeout)
                    )
                if events[0][1] & select.POLLOUT:
                    continue
                raise Exception('unknown events: %s' % events)
e2reactor.py 文件源码 项目:enigma2 作者: OpenLD 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def _updateRegistration(self, fd):
        """Register/unregister an fd with the poller."""
        try:
            poller.unregister(fd)
        except KeyError:
            pass

        mask = 0
        if fd in reads:
            mask = mask | select.POLLIN
        if fd in writes:
            mask = mask | select.POLLOUT
        if mask != 0:
            poller.register(fd, mask)
        else:
            if fd in selectables:
                del selectables[fd]


        poller.eApp.interruptPoll()
selectors.py 文件源码 项目:annotated-py-asyncio 作者: hhstore 项目源码 文件源码 阅读 61 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._poll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:annotated-py-asyncio 作者: hhstore 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
select.py 文件源码 项目:RealtimePythonChat 作者: quangtqag 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def register(self, fd, eventmask=_NONE):
            if eventmask is _NONE:
                flags = _EV_READ | _EV_WRITE
            else:
                flags = 0
                if eventmask & POLLIN:
                    flags = _EV_READ
                if eventmask & POLLOUT:
                    flags |= _EV_WRITE
                # If they ask for POLLPRI, we can't support
                # that. Should we raise an error?

            fileno = get_fileno(fd)
            watcher = self.loop.io(fileno, flags)
            watcher.priority = self.loop.MAXPRI
            self.fds[fileno] = watcher
e2reactor.py 文件源码 项目:enigma2 作者: Openeight 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _updateRegistration(self, fd):
        """Register/unregister an fd with the poller."""
        try:
            poller.unregister(fd)
        except KeyError:
            pass

        mask = 0
        if reads.has_key(fd): mask = mask | select.POLLIN
        if writes.has_key(fd): mask = mask | select.POLLOUT
        if mask != 0:
            poller.register(fd, mask)
        else:
            if selectables.has_key(fd): del selectables[fd]


        poller.eApp.interruptPoll()
e2reactor.py 文件源码 项目:enigma2 作者: Openeight 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log,
        faildict={
            error.ConnectionDone: failure.Failure(error.ConnectionDone()),
            error.ConnectionLost: failure.Failure(error.ConnectionLost())
        }):
        why = None
        inRead = False
        if event & POLL_DISCONNECTED and not (event & POLLIN):
            why = main.CONNECTION_LOST
        else:
            try:
                if event & POLLIN:
                    why = selectable.doRead()
                    inRead = True
                if not why and event & POLLOUT:
                    why = selectable.doWrite()
                    inRead = False
                if not selectable.fileno() == fd:
                    why = error.ConnectionFdescWentAway('Filedescriptor went away')
                    inRead = False
            except:
                log.deferr()
                why = sys.exc_info()[1]
        if why:
            self._disconnectSelectable(selectable, why, inRead)
asyncore.py 文件源码 项目:zippy 作者: securesystemslab 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def readwrite(obj, flags):
    try:
        if flags & select.POLLIN:
            obj.handle_read_event()
        if flags & select.POLLOUT:
            obj.handle_write_event()
        if flags & select.POLLPRI:
            obj.handle_expt_event()
        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
            obj.handle_close()
    except socket.error as e:
        if e.args[0] not in _DISCONNECTED:
            obj.handle_error()
        else:
            obj.handle_close()
    except _reraised_exceptions:
        raise
    except:
        obj.handle_error()
selectors.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:ShelbySearch 作者: Agentscreech 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:ShelbySearch 作者: Agentscreech 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
asyncore.py 文件源码 项目:oil 作者: oilshell 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def readwrite(obj, flags):
    try:
        if flags & select.POLLIN:
            obj.handle_read_event()
        if flags & select.POLLOUT:
            obj.handle_write_event()
        if flags & select.POLLPRI:
            obj.handle_expt_event()
        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
            obj.handle_close()
    except socket.error, e:
        if e.args[0] not in _DISCONNECTED:
            obj.handle_error()
        else:
            obj.handle_close()
    except _reraised_exceptions:
        raise
    except:
        obj.handle_error()
asyncore.py 文件源码 项目:python2-tracer 作者: extremecoders-re 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def readwrite(obj, flags):
    try:
        if flags & select.POLLIN:
            obj.handle_read_event()
        if flags & select.POLLOUT:
            obj.handle_write_event()
        if flags & select.POLLPRI:
            obj.handle_expt_event()
        if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL):
            obj.handle_close()
    except socket.error, e:
        if e.args[0] not in _DISCONNECTED:
            obj.handle_error()
        else:
            obj.handle_close()
    except _reraised_exceptions:
        raise
    except:
        obj.handle_error()
temp_test.py 文件源码 项目:_ 作者: zengchunyun 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, server_address):
        self.server_address = server_address  # ?????IP???
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # ??TCP??socket
        self.__setblock = False  # ??????????
        self.message_queue = {}  # ??????
        self.rlist = (select.POLLIN or select.POLLHUP or select.POLLPRI or select.POLLERR)  # ????
        self.wlist = (self.rlist or select.POLLOUT)  # ????
        self.fd_socket = {}  # ??????????socket????
        self.poll = select.poll()  # ????????

        self.logger = logging.getLogger(__name__)  # ??????
        if self.output_console:
            self.console_handler = logging.StreamHandler()  # ???????????
        if self.logfile:  # ???????,????????
            self.file_handler = logging.FileHandler(filename=self.logfile, encoding=self.encoding)  # ????????
        self.set_log()  # ????
        self.bind()  # ????IP???
server.py 文件源码 项目:_ 作者: zengchunyun 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, server_address):
        """?????,socket???
        :param server_address:
        :return:
        """
        self.server_address = server_address  # ?????IP???
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # ??TCP??socket
        self.__setblock = False  # ??????????
        self.message_queue = {}  # ??????
        self.rlist = (select.POLLIN or select.POLLHUP or select.POLLPRI or select.POLLERR)  # ????
        self.wlist = (self.rlist or select.POLLOUT)  # ????
        self.fd_socket = {}  # ??????????socket????
        self.poll = select.poll()  # ????????

        self.logger = logging.getLogger(__name__)  # ??????
        if self.output_console:
            self.console_handler = logging.StreamHandler()  # ???????????
        if self.logfile:  # ???????,????????
            self.file_handler = logging.FileHandler(filename=self.logfile, encoding=self.encoding)  # ????????
        self.set_log()  # ????
        self.bind()  # ????IP???
ftp_client.py 文件源码 项目:_ 作者: zengchunyun 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, server_address):
        self.server_address = server_address  # ?????IP???
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # ??TCP??socket
        self.message_queue = {}  # ??????
        self.rlist = (select.POLLIN or select.POLLHUP or select.POLLPRI or select.POLLERR)  # ????
        self.wlist = (self.rlist or select.POLLOUT)  # ????
        self.fd_socket = {}  # ??????????socket????
        self.poll = select.poll()  # ????????
        self.logger = logging.getLogger(__name__)  # ??????
        if self.output_console:
            self.console_handler = logging.StreamHandler()  # ???????????
        if self.logfile:  # ???????,????????
            self.file_handler = logging.FileHandler(filename=self.logfile, encoding=self.encoding)  # ????????
        self.set_log()  # ????
        self.connect_server()
        self.is_send = None  # ????????,????None,???????????
ftpclient.py 文件源码 项目:_ 作者: zengchunyun 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, server_address):
        self.server_address = server_address  # ?????IP???
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # ??TCP??socket
        self.message_queue = {}  # ??????
        self.rlist = (select.POLLIN or select.POLLHUP or select.POLLPRI or select.POLLERR)  # ????
        self.wlist = (self.rlist or select.POLLOUT)  # ????
        self.fd_socket = {}  # ??????????socket????
        self.poll = select.poll()  # ????????
        self.logger = logging.getLogger(__name__)  # ??????
        if self.output_console:
            self.console_handler = logging.StreamHandler()  # ???????????
        if self.logfile:  # ???????,????????
            self.file_handler = logging.FileHandler(filename=self.logfile, encoding=self.encoding)  # ????????
        self.set_log()  # ????
        self.connect_server()
        self.is_send = None  # ????????,????None,???????????
        self.local_file = None
        self.remote_file = None
event_loop.py 文件源码 项目:JimV-N 作者: jamesiter 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def events_from_poll(events):
        ret = 0
        if events & select.POLLIN:
            ret |= libvirt.VIR_EVENT_HANDLE_READABLE
        if events & select.POLLOUT:
            ret |= libvirt.VIR_EVENT_HANDLE_WRITABLE
        if events & select.POLLNVAL:
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR
        if events & select.POLLERR:
            ret |= libvirt.VIR_EVENT_HANDLE_ERROR
        if events & select.POLLHUP:
            ret |= libvirt.VIR_EVENT_HANDLE_HANGUP
        return ret


###########################################################################
# Now glue an instance of the general event loop into libvirt's event loop
###########################################################################

# This single global instance of the event loop wil be used for
# monitoring libvirt events
selectors.py 文件源码 项目:tabmaster 作者: NicolasMinghetti 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # poll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = int(math.ceil(timeout * 1e3))
            ready = []
            try:
                fd_event_list = wrap_error(self._poll.poll, timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
selectors.py 文件源码 项目:tabmaster 作者: NicolasMinghetti 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def select(self, timeout=None):
            if timeout is None:
                timeout = None
            elif timeout <= 0:
                timeout = 0
            else:
                # devpoll() has a resolution of 1 millisecond, round away from
                # zero to wait *at least* timeout seconds.
                timeout = math.ceil(timeout * 1e3)
            ready = []
            try:
                fd_event_list = self._devpoll.poll(timeout)
            except InterruptedError:
                return ready
            for fd, event in fd_event_list:
                events = 0
                if event & ~select.POLLIN:
                    events |= EVENT_WRITE
                if event & ~select.POLLOUT:
                    events |= EVENT_READ

                key = self._key_from_fd(fd)
                if key:
                    ready.append((key, events & key.events))
            return ready
pollreactor.py 文件源码 项目:sslstrip-hsts-openwrt 作者: adde88 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _doReadOrWrite(self, selectable, fd, event, POLLIN, POLLOUT, log, 
        faildict={
            error.ConnectionDone: failure.Failure(error.ConnectionDone()),
            error.ConnectionLost: failure.Failure(error.ConnectionLost())
        }):
        why = None
        inRead = False
        if event & POLL_DISCONNECTED and not (event & POLLIN):
            why = main.CONNECTION_LOST
        else:
            try:
                if event & POLLIN:
                    why = selectable.doRead()
                    inRead = True
                if not why and event & POLLOUT:
                    why = selectable.doWrite()
                    inRead = False
                if not selectable.fileno() == fd:
                    why = error.ConnectionFdescWentAway('Filedescriptor went away')
                    inRead = False
            except:
                log.deferr()
                why = sys.exc_info()[1]
        if why:
            self._disconnectSelectable(selectable, why, inRead)
manager.py 文件源码 项目:pssh 作者: lilydjwg 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def poll(self, timeout=None):
        """Performs a poll and dispatches the resulting events."""
        if not self.readmap and not self.writemap:
            return
        try:
            event_list = self._poller.poll(timeout)
        except select.error:
            _, e, _ = sys.exc_info()
            errno = e.args[0]
            if errno == EINTR:
                return
            else:
                raise
        for fd, event in event_list:
            if event & (select.POLLIN | select.POLLHUP):
                handler = self.readmap[fd]
                handler(fd, self)
            if event & (select.POLLOUT | select.POLLERR):
                handler = self.writemap[fd]
                handler(fd, self)


问题


面经


文章

微信
公众号

扫码关注公众号