Skip to content

Commit

Permalink
rm: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Jan 10, 2024
1 parent 89f312d commit 5959fe4
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions packages/utils/src/libp2p/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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,
Expand Down

0 comments on commit 5959fe4

Please sign in to comment.