Python socket 模块,EBADF 实例源码

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

项目:touch-pay-client    作者:HackPucBemobi    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:true_review_web2py    作者:lucadealfaro    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:yt    作者:yt-project    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()


# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:yt    作者:yt-project    | 项目源码 | 文件源码
def send_response(self, status):
        stat_msg = status.split(' ', 1)[1]
        msg = RESPONSE % (status,
                          len(stat_msg),
                          'text/plain',
                          stat_msg)
        try:
            self.conn.sendall(b(msg))
        except socket.error:
            self.closeConnection = True
            self.err_log.error('Tried to send "%s" to client but received socket'
                           ' error' % status)

    #def kill(self):
    #    if self.isAlive() and hasattr(self, 'conn'):
    #        try:
    #            self.conn.shutdown(socket.SHUT_RDWR)
    #        except socket.error:
    #            info = sys.exc_info()
    #            if info[1].args[0] != socket.EBADF:
    #                self.err_log.debug('Error on shutdown: '+str(info))
项目:Problematica-public    作者:TechMaz    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:rekall-agent-server    作者:rekall-innovations    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:web3py    作者:web2py    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:CSC376KnowledgeManagement    作者:WCotterman    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:slugiot-client    作者:slugiot    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:StuffShare    作者:StuffShare    | 项目源码 | 文件源码
def close(self):
        if hasattr(self.socket, '_sock'):
            try:
                self.socket._sock.close()
            except socket.error:
                info = sys.exc_info()
                if info[1].args[0] != socket.EBADF:
                    raise info[1]
                else:
                    pass
        self.socket.close()

# Monolithic build...end of module: rocket/connection.py
# Monolithic build...start of module: rocket/filelike.py

# Import System Modules
项目:libpurecoollink    作者:CharlesBlonde    | 项目源码 | 文件源码
def run(self):
        while not self.zc.done:
            with self.condition:
                rs = self.readers.keys()
                if len(rs) == 0:
                    # No sockets to manage, but we wait for the timeout
                    # or addition of a socket
                    self.condition.wait(self.timeout)

            if len(rs) != 0:
                try:
                    rr, wr, er = select.select(rs, [], [], self.timeout)
                    if not self.zc.done:
                        for socket_ in rr:
                            reader = self.readers.get(socket_)
                            if reader:
                                reader.handle_read(socket_)

                except (select.error, socket.error) as e:
                    # If the socket was closed by another thread, during
                    # shutdown, ignore it and exit
                    if e.args[0] != socket.EBADF or not self.zc.done:
                        raise