Skip to content

Commit

Permalink
fix: no shared param passed to sendRpc in a for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Sep 28, 2022
1 parent 4c73e81 commit 5afb3ca
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1915,10 +1915,9 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements Initiali
// Note: Don't throw if tosend is empty, we can have a mesh with a single peer

// forward the message to peers
const rpc = createGossipRpc([rawMsg])
tosend.forEach((id) => {
// self.send_message(*peer_id, event.clone())?;
this.sendRpc(id, rpc)
this.sendRpc(id, createGossipRpc([rawMsg]))
})

this.metrics?.onForwardMsg(rawMsg.topic, tosend.size)
Expand Down Expand Up @@ -1967,11 +1966,9 @@ export class GossipSub extends EventEmitter<GossipsubEvents> implements Initiali
this.publishedMessageIds.put(msgIdStr)

// Send to set of peers aggregated from direct, mesh, fanout
const rpc = createGossipRpc([rawMsg])

for (const id of tosend) {
// self.send_message(*peer_id, event.clone())?;
const sent = this.sendRpc(id, rpc)
const sent = this.sendRpc(id, createGossipRpc([rawMsg]))

// did not actually send the message
if (!sent) {
Expand Down

0 comments on commit 5afb3ca

Please sign in to comment.