(
        network_info, timestamp_peeraddress_tuple_queue=None,
        create_connection=asyncio.get_event_loop().create_connection,
        getaddrinfo=asyncio.get_event_loop().getaddrinfo)
return timestamp_peeraddress_tuple_queue
Returns a queue which is populated with (time, host, port) tuples of
    addresses of regular peers that we can connect to.

    This works by connecting to superpeers at the DNS addresses passed and
    fetching addr records. Once we have enough, stop.
Returns a queue which is populated with (time, host, port) tuples of
    addresses of regular peers that we can connect to.
Returns a queue which is populated with ( time host port ) tuples of addresses of regular peers that we can connect to .
def new_queue_of_timestamp_peeraddress_tuples(
        network_info, timestamp_peeraddress_tuple_queue=None,
        create_connection=asyncio.get_event_loop().create_connection,
        getaddrinfo=asyncio.get_event_loop().getaddrinfo):
    """
    Returns a queue which is populated with (time, host, port) tuples of
    addresses of regular peers that we can connect to.

    This works by connecting to superpeers at the DNS addresses passed and
    fetching addr records. Once we have enough, stop.
    """

    magic_header = network_info["MAGIC_HEADER"]

    superpeer_ip_queue = dns_bootstrap_host_port_q(network_info, getaddrinfo=getaddrinfo)

    if timestamp_peeraddress_tuple_queue is None:
        timestamp_peeraddress_tuple_queue = PriorityQueue()

    @asyncio.coroutine
    def loop_connect_to_superpeer(superpeer_ip_queue):
        while 1:
            try:
                pair = yield from superpeer_ip_queue.get()
                if pair is None:
                    break
                peer_name = "%s:%d" % pair
                host, port = pair
                logging.debug("connecting to superpeer at %s", peer_name)
                transport, peer = yield from create_connection(
                    lambda: BitcoinPeerProtocol(magic_header), host=host, port=port)

                logging.debug("connected to superpeer at %s", peer_name)
                yield from initial_handshake(peer, version_data_for_peer(peer))
                logging.debug("handshake complete on %s", peer_name)

                date_address_tuples = yield from get_date_address_tuples(peer)

                logging.debug("got addresses from %s", peer_name)
                for da in date_address_tuples:
                    yield from timestamp_peeraddress_tuple_queue.put((-da[0], da[1]))
                logging.debug("closing connection to %s", peer_name)
                transport.close()
            except Exception:
                logging.exception("failed during connect to %s", peer_name)

    timestamp_peeraddress_tuple_queue.tasks = [
        asyncio.Task(loop_connect_to_superpeer(superpeer_ip_queue)) for i in range(30)]

    return timestamp_peeraddress_tuple_queue


    return timestamp_peeraddress_tuple_queue
def new_queue_of_timestamp_peeraddress_tuples ( network_info , timestamp_peeraddress_tuple_queue = None , create_connection = asyncio . get_event_loop ( ) . create_connection , getaddrinfo = asyncio . get_event_loop ( ) . getaddrinfo ) : magic_header = network_info [ "MAGIC_HEADER" ] superpeer_ip_queue = dns_bootstrap_host_port_q ( network_info , getaddrinfo = getaddrinfo ) if timestamp_peeraddress_tuple_queue is None : timestamp_peeraddress_tuple_queue = PriorityQueue ( ) @ asyncio . coroutine def loop_connect_to_superpeer ( superpeer_ip_queue ) : while 1 : try : pair = yield from superpeer_ip_queue . get ( ) if pair is None : break peer_name = "%s:%d" % pair host , port = pair logging . debug ( "connecting to superpeer at %s" , peer_name ) transport , peer = yield from create_connection ( lambda : BitcoinPeerProtocol ( magic_header ) , host = host , port = port ) logging . debug ( "connected to superpeer at %s" , peer_name ) yield from initial_handshake ( peer , version_data_for_peer ( peer ) ) logging . debug ( "handshake complete on %s" , peer_name ) date_address_tuples = yield from get_date_address_tuples ( peer ) logging . debug ( "got addresses from %s" , peer_name ) for da in date_address_tuples : yield from timestamp_peeraddress_tuple_queue . put ( ( - da [ 0 ] , da [ 1 ] ) ) logging . debug ( "closing connection to %s" , peer_name ) transport . close ( ) except Exception : logging . exception ( "failed during connect to %s" , peer_name ) timestamp_peeraddress_tuple_queue . tasks = [ asyncio . Task ( loop_connect_to_superpeer ( superpeer_ip_queue ) ) for i in range ( 30 ) ] return timestamp_peeraddress_tuple_queue return timestamp_peeraddress_tuple_queue