*Add peerHasItem method

This commit is contained in:
Derrick Hammer 2022-11-24 01:46:34 -05:00
parent eab1d70df4
commit 24b97d5288
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 7 additions and 0 deletions

View File

@ -89,6 +89,13 @@ export default class DHTCache extends EventEmitter {
return items.sort();
}
public peerHasItem(peer: string | Buffer, item: string | Buffer): boolean {
peer = this._maybeHexify(peer);
item = this._maybeHexify(item);
return this.graph.hasSuccessor(peer, item);
}
public addItem(item: string | Buffer) {
item = this._maybeHexify(item);
this._cache.add(item);