*Check if we are bootstrapped and queue broadcast in removeItem like with addItem
This commit is contained in:
parent
323530c4bc
commit
e53b4eadda
18
src/index.ts
18
src/index.ts
|
@ -136,11 +136,19 @@ export default class DHTCache extends EventEmitter {
|
||||||
|
|
||||||
this._removeEntity(item);
|
this._removeEntity(item);
|
||||||
|
|
||||||
this._broadcastMessage({
|
const broadcast = () => {
|
||||||
type: Type.REMOVE_ITEM,
|
this._broadcastMessage({
|
||||||
data: b4a.from(item, "hex"),
|
type: Type.REMOVE_ITEM,
|
||||||
signature: this._signItem(item),
|
data: b4a.from(item as string, "hex"),
|
||||||
});
|
signature: this._signItem(item),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!this.bootstrapped) {
|
||||||
|
this.once("bootstrapped", broadcast);
|
||||||
|
} else {
|
||||||
|
broadcast();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue