Python errno 模块,EBADFD 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用errno.EBADFD

项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def connect(self, address):
        if self.act_non_blocking:
            return self.fd.connect(address)
        fd = self.fd
        if self.gettimeout() is None:
            while not socket_connect(fd, address):
                try:
                    self._trampoline(fd, write=True)
                except IOClosed:
                    raise socket.error(errno.EBADFD)
                socket_checkerr(fd)
        else:
            end = time.time() + self.gettimeout()
            while True:
                if socket_connect(fd, address):
                    return
                if time.time() >= end:
                    raise socket.timeout("timed out")
                try:
                    self._trampoline(fd, write=True, timeout=end - time.time(),
                                     timeout_exc=socket.timeout("timed out"))
                except IOClosed:
                    # ... we need some workable errno here.
                    raise socket.error(errno.EBADFD)
                socket_checkerr(fd)
项目:parsec-cloud    作者:Scille    | 项目源码 | 文件源码
def _get_fd(self, fh):
        try:
            return self.fds[fh]
        except KeyError:
            raise FuseOSError(EBADFD)
项目:parsec-cloud    作者:Scille    | 项目源码 | 文件源码
def release(self, path, fh):
        try:
            file = self.fds.pop(fh)
            file.flush()
        except KeyError:
            raise FuseOSError(EBADFD)
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def connect_ex(self, address):
        if self.act_non_blocking:
            return self.fd.connect_ex(address)
        fd = self.fd
        if self.gettimeout() is None:
            while not socket_connect(fd, address):
                try:
                    self._trampoline(fd, write=True)
                    socket_checkerr(fd)
                except socket.error as ex:
                    return get_errno(ex)
                except IOClosed:
                    return errno.EBADFD
        else:
            end = time.time() + self.gettimeout()
            while True:
                try:
                    if socket_connect(fd, address):
                        return 0
                    if time.time() >= end:
                        raise socket.timeout(errno.EAGAIN)
                    self._trampoline(fd, write=True, timeout=end - time.time(),
                                     timeout_exc=socket.timeout(errno.EAGAIN))
                    socket_checkerr(fd)
                except socket.error as ex:
                    return get_errno(ex)
                except IOClosed:
                    return errno.EBADFD
项目:sublimeTextConfig    作者:luoye-fe    | 项目源码 | 文件源码
def send(self) -> int:
        """Send outgoing data
        """

        with self._write_lock:
            while len(self.outbuffer) > 0:
                try:
                    sent = self.sock.send(self.outbuffer)
                    self.outbuffer = self.outbuffer[sent:]
                except socket.error as error:
                    if error.args[0] == errno.EAGAIN:
                        time.sleep(0.1)
                    elif error.args[0] in (
                        errno.ECONNRESET, errno.ENOTCONN, errno.ESHUTDOWN,
                        errno.ECONNABORTED, errno.EPIPE
                    ):
                        self.close()
                        return 0
                    elif os.name == 'posix':
                        # Windows doesn't seems to have EBADFD
                        if sys.platform == 'darwin':
                            # OS X uses EBADF as EBADFD. why? no idea asks Tim
                            if error.args[0] == errno.EBADF:
                                self.close()
                                return 0
                        else:
                            if error.args[0] == errno.EBADFD:
                                self.close()
                                return 0
                        raise
                    else:
                        raise
项目:deb-python-eventlet    作者:openstack    | 项目源码 | 文件源码
def connect(self, address):
        if self.act_non_blocking:
            return self.fd.connect(address)
        fd = self.fd
        _timeout_exc = socket_timeout('timed out')
        if self.gettimeout() is None:
            while not socket_connect(fd, address):
                try:
                    self._trampoline(fd, write=True)
                except IOClosed:
                    raise socket.error(errno.EBADFD)
                socket_checkerr(fd)
        else:
            end = time.time() + self.gettimeout()
            while True:
                if socket_connect(fd, address):
                    return
                if time.time() >= end:
                    raise _timeout_exc
                timeout = end - time.time()
                try:
                    self._trampoline(fd, write=True, timeout=timeout, timeout_exc=_timeout_exc)
                except IOClosed:
                    # ... we need some workable errno here.
                    raise socket.error(errno.EBADFD)
                socket_checkerr(fd)
项目:deb-python-eventlet    作者:openstack    | 项目源码 | 文件源码
def connect_ex(self, address):
        if self.act_non_blocking:
            return self.fd.connect_ex(address)
        fd = self.fd
        if self.gettimeout() is None:
            while not socket_connect(fd, address):
                try:
                    self._trampoline(fd, write=True)
                    socket_checkerr(fd)
                except socket.error as ex:
                    return get_errno(ex)
                except IOClosed:
                    return errno.EBADFD
        else:
            end = time.time() + self.gettimeout()
            timeout_exc = socket.timeout(errno.EAGAIN)
            while True:
                try:
                    if socket_connect(fd, address):
                        return 0
                    if time.time() >= end:
                        raise timeout_exc
                    self._trampoline(fd, write=True, timeout=end - time.time(),
                                     timeout_exc=timeout_exc)
                    socket_checkerr(fd)
                except socket.error as ex:
                    return get_errno(ex)
                except IOClosed:
                    return errno.EBADFD
项目:tm-librarian    作者:FabricAttachedMemory    | 项目源码 | 文件源码
def _consistent(self, cached):
        try:
            all_fh = [ ]
            for vlist in cached.open_handle.values():
                all_fh += vlist
            for v_fh in all_fh:
                assert (None, v_fh) in self._shelfcache, 'Inconsistent list members'
        except Exception as e:
            self.logger.error('Shadow cache is corrupt: %s' % str(e))
            if self.verbose > 3:
                set_trace()
            raise TmfsOSError(errno.EBADFD)

    # Most uses send an open handle fh (integer) as key.  truncate by name
    # is the exception.  An update needs to be reflected for all keys.