btcomm.py 文件源码

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

项目:BlueDot 作者: martinohanlon 项目源码 文件源码
def _handle_bt_error(self, bt_error):
        assert isinstance(bt_error, IOError)
        #'timed out' is caused by the wait_for_connection loop
        if isinstance(bt_error, socket.timeout):
            pass
        #'resource unavailable' is when data cannot be read because there is nothing in the buffer
        elif bt_error.errno == errno.EAGAIN:
            pass
        #'connection reset' is caused when the client disconnects
        elif bt_error.errno == errno.ECONNRESET:
            self._client_connected = False
            if self.when_client_disconnects:
                self.when_client_disconnects()
        #'conection timeout' is caused when the server can no longer connect to read from the client
        # (perhaps the client has gone out of range)
        elif bt_error.errno == errno.ETIMEDOUT:
            self._client_connected = False
            if self.when_client_disconnects:
                self.when_client_disconnects()
        else:
            raise bt_error
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号