Compare commits

..

3 Commits

Author SHA1 Message Date
Derrick Hammer 9333ab7a38
*Update dist 2022-12-31 14:21:32 -05:00
Derrick Hammer 0a335997bf
*Fix check 2022-12-31 14:21:14 -05:00
Derrick Hammer 9b2e04ae3c
*switch to _seenTopics since they are stored in hex already 2022-12-31 14:21:04 -05:00
2 changed files with 4 additions and 4 deletions

4
dist/index.js vendored
View File

@ -123,11 +123,11 @@ class DHTFlood extends events_1.default {
const { id, messageNumber } = this;
let topicString = this.topic.toString("hex");
let peers = [...this.swarm.peers.values()]
.filter((peerInfo) => peerInfo.topics.includes(topicString))
.filter((peerInfo) => peerInfo._seenTopics.has(topicString))
.map((peerInfo) => peerInfo.publicKey);
for (const peer of peers) {
const conn = this.swarm._allConnections.get(peer);
if (conn) {
if (!conn) {
continue;
}
const message = this.setupPeer(conn);

View File

@ -162,12 +162,12 @@ export default class DHTFlood extends EventEmitter {
let topicString = this.topic.toString("hex");
let peers: Buffer[] = [...this.swarm.peers.values()]
.filter((peerInfo: any) => peerInfo.topics.includes(topicString))
.filter((peerInfo: any) => peerInfo._seenTopics.has(topicString))
.map((peerInfo) => peerInfo.publicKey);
for (const peer of peers) {
const conn = this.swarm._allConnections.get(peer);
if (conn) {
if (!conn) {
continue;
}