*add send method to broadcast to one peer

This commit is contained in:
Derrick Hammer 2022-11-15 15:53:04 -05:00
parent ce3a3fa8ad
commit d61076be57
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 0 deletions

View File

@ -141,4 +141,17 @@ export default class DHTFlood extends EventEmitter {
}); });
} }
} }
send(peer: any, data: any, ttl = this.ttl) {
this.messageNumber++;
const { id, messageNumber } = this;
const message = this.setupPeer(peer);
message.send({
originId: id,
messageNumber,
ttl,
data: b4a.from(data),
});
}
} }