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