connection.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:kytos 作者: kytos 项目源码 文件源码
def close(self):
        """Close the socket from connection instance."""
        self.state = ConnectionState.FINISHED
        if self.switch and self.switch.connection is self:
            self.switch.connection = None

        LOG.debug('Shutting down Connection %s', self.id)

        try:
            self.socket.shutdown(SHUT_RDWR)
            self.socket.close()
            self.socket = None
            LOG.debug('Connection Closed: %s', self.id)
        except OSError as exception:
            if exception.errno not in (ENOTCONN, EBADF):
                raise exception
        except AttributeError as exception:
            LOG.debug('Socket Already Closed: %s', self.id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号