async def _address_relay(self):
    while (not self.is_closed):
        try:
            try:
                (relay_peer, num_peers) = (await self.relay_queue.get())
            except asyncio.CancelledError:
                return None
            relay_peer_info = PeerInfo(relay_peer.host, relay_peer.port)
            if (not relay_peer_info.is_valid()):
                continue
            connections = self.server.get_full_node_connections()
            hashes = []
            cur_day = (int(time.time()) // ((24 * 60) * 60))
            for connection in connections:
                peer_info = connection.get_peer_info()
                if (peer_info is None):
                    continue
                cur_hash = int.from_bytes(bytes(std_hash(((self.key.to_bytes(32, byteorder='big') + peer_info.get_key()) + cur_day.to_bytes(3, byteorder='big')))), byteorder='big')
                hashes.append((cur_hash, connection))
            hashes.sort(key=(lambda x: x[0]))
            for (index, (_, connection)) in enumerate(hashes):
                if (index >= num_peers):
                    break
                peer_info = connection.get_peer_info()
                pair = (peer_info.host, peer_info.port)
                async with self.lock:
                    if ((pair in self.neighbour_known_peers) and (relay_peer.host in self.neighbour_known_peers[pair])):
                        continue
                    if (pair not in self.neighbour_known_peers):
                        self.neighbour_known_peers[pair] = set()
                    self.neighbour_known_peers[pair].add(relay_peer.host)
                if (connection.peer_node_id is None):
                    continue
                msg = make_msg(ProtocolMessageTypes.respond_peers, full_node_protocol.RespondPeers([relay_peer]))
                (await connection.send_message(msg))
        except Exception as e:
            self.log.error(f'Exception in address relay: {e}')
            self.log.error(f'Traceback: {traceback.format_exc()}')
async def _address_relay(self):
    while (not self.is_closed):
        try:
            try:
                (relay_peer, num_peers) = (await self.relay_queue.get())
            except asyncio.CancelledError:
                return None
            relay_peer_info = PeerInfo(relay_peer.host, relay_peer.port)
            if (not relay_peer_info.is_valid()):
                continue
            connections = self.server.get_full_node_connections()
            hashes = []
            cur_day = (int(time.time()) // ((24 * 60) * 60))
            for connection in connections:
                peer_info = connection.get_peer_info()
                if (peer_info is None):
                    continue
                cur_hash = int.from_bytes(bytes(std_hash(((self.key.to_bytes(32, byteorder='big') + peer_info.get_key()) + cur_day.to_bytes(3, byteorder='big')))), byteorder='big')
                hashes.append((cur_hash, connection))
            hashes.sort(key=(lambda x: x[0]))
            for (index, (_, connection)) in enumerate(hashes):
                if (index >= num_peers):
                    break
                peer_info = connection.get_peer_info()
                pair = (peer_info.host, peer_info.port)
                async with self.lock:
                    if ((pair in self.neighbour_known_peers) and (relay_peer.host in self.neighbour_known_peers[pair])):
                        continue
                    if (pair not in self.neighbour_known_peers):
                        self.neighbour_known_peers[pair] = set()
                    self.neighbour_known_peers[pair].add(relay_peer.host)
                if (connection.peer_node_id is None):
                    continue
                msg = make_msg(ProtocolMessageTypes.respond_peers, full_node_protocol.RespondPeers([relay_peer]))
                (await connection.send_message(msg))
        except Exception as e:
            self.log.error(f'Exception in address relay: {e}')
            self.log.error(f'Traceback: {traceback.format_exc()}')