mirror of
https://github.com/waku-org/js-waku.git
synced 2025-02-23 17:48:19 +00:00
rm: comments
This commit is contained in:
parent
89f312dc6d
commit
5959fe4a2c
@ -49,37 +49,6 @@ export async function selectLowestLatencyPeer(
|
|||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Returns the list of peers that supports the given protocol and shard.
|
|
||||||
// * If shard is not configured, all peers that support the protocol are returned.
|
|
||||||
// */
|
|
||||||
|
|
||||||
// export async function getPeersForProtocolAndShard(
|
|
||||||
// peerStore: PeerStore,
|
|
||||||
// protocols: string[],
|
|
||||||
// shardInfo?: ShardInfo
|
|
||||||
// ): Promise<Peer[]> {
|
|
||||||
// const peers: Peer[] = [];
|
|
||||||
// await peerStore.forEach((peer) => {
|
|
||||||
// if (shardInfo) {
|
|
||||||
// const encodedPeerShardInfo = peer.metadata.get("shardInfo");
|
|
||||||
// const peerShardInfo =
|
|
||||||
// encodedPeerShardInfo && decodeRelayShard(encodedPeerShardInfo);
|
|
||||||
|
|
||||||
// if (peerShardInfo && shardInfo.clusterId === peerShardInfo.clusterId) {
|
|
||||||
// if (protocols.some((protocol) => peer.protocols.includes(protocol))) {
|
|
||||||
// peers.push(peer);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (protocols.some((protocol) => peer.protocols.includes(protocol))) {
|
|
||||||
// peers.push(peer);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// return peers;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of peers that supports the given protocol.
|
* Returns the list of peers that supports the given protocol.
|
||||||
*/
|
*/
|
||||||
@ -99,27 +68,6 @@ export async function getPeersForProtocol(
|
|||||||
return peers;
|
return peers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// export async function getConnectedPeersForProtocol(
|
|
||||||
// connections: Connection[],
|
|
||||||
// peerStore: PeerStore,
|
|
||||||
// protocols: string[]
|
|
||||||
// ): Promise<Peer[]> {
|
|
||||||
// const openConnections = connections.filter(
|
|
||||||
// (connection) => connection.status === "open"
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const peerPromises = openConnections.map(async (connection) => {
|
|
||||||
// const peer = await peerStore.get(connection.remotePeer);
|
|
||||||
// const supportsProtocol = peer.protocols.some((protocol) =>
|
|
||||||
// protocols.includes(protocol)
|
|
||||||
// );
|
|
||||||
// return supportsProtocol ? peer : null;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const peersWithNulls = await Promise.all(peerPromises);
|
|
||||||
// return peersWithNulls.filter((peer): peer is Peer => peer !== null);
|
|
||||||
// }
|
|
||||||
|
|
||||||
export async function getConnectedPeersForProtocolAndShard(
|
export async function getConnectedPeersForProtocolAndShard(
|
||||||
connections: Connection[],
|
connections: Connection[],
|
||||||
peerStore: PeerStore,
|
peerStore: PeerStore,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user