rm: comments

This commit is contained in:
danisharora099 2024-01-10 17:52:37 +05:30
parent 89f312dc6d
commit 5959fe4a2c
No known key found for this signature in database
GPG Key ID: FBD2BF500037F135

View File

@ -49,37 +49,6 @@ export async function selectLowestLatencyPeer(
: 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.
*/
@ -99,27 +68,6 @@ export async function getPeersForProtocol(
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(
connections: Connection[],
peerStore: PeerStore,