(num)
从streams获取另外一个流对象，如果当前为空，则等待
从streams获取另外一个流对象，如果当前为空，则等待
从streams获取另外一个流对象，如果当前为空，则等待
def _get_another_stream(num):
    """
    从streams获取另外一个流对象，如果当前为空，则等待
    """
    if num == 0:
        num = 1
    elif num == 1:
        num = 0
    else:
        raise 'ERROR'

    while True:
        if streams[num] == 'quit':
            print('can not connect to the target, quit now!')
            sys.exit(1)

        if streams[num] is not None:
            return streams[num]
        elif streams[num] is None and streams[num^1] is None:
            print('stream CLOSED')
            return None
        else:
            time.sleep(1)
def _get_another_stream ( num ) : if num == 0 : num = 1 elif num == 1 : num = 0 else : raise 'ERROR' while True : if streams [ num ] == 'quit' : print ( 'can not connect to the target, quit now!' ) sys . exit ( 1 ) if streams [ num ] is not None : return streams [ num ] elif streams [ num ] is None and streams [ num ^ 1 ] is None : print ( 'stream CLOSED' ) return None else : time . sleep ( 1 )