*add core.shutdown hook for bootstrap DHT
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Derrick Hammer 2023-01-05 19:44:43 -05:00
parent 831612bc77
commit ba86b3587b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 5 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import sodium from "sodium-universal";
import b4a from "b4a"; import b4a from "b4a";
import log from "../log.js"; import log from "../log.js";
import { getKeyPair } from "../lib/seed.js"; import { getKeyPair } from "../lib/seed.js";
import { getPluginAPI } from "./plugin";
const LUMEWEB = b4a.from("lumeweb"); const LUMEWEB = b4a.from("lumeweb");
export const LUMEWEB_TOPIC_HASH = b4a.allocUnsafe(32); export const LUMEWEB_TOPIC_HASH = b4a.allocUnsafe(32);
@ -44,6 +45,10 @@ export async function start() {
await node.listen(); await node.listen();
node.join(LUMEWEB_TOPIC_HASH); node.join(LUMEWEB_TOPIC_HASH);
getPluginAPI().on("core.shutdown", async () => {
return bootstrap.destroy();
});
log.info( log.info(
"Relay Identity is %s", "Relay Identity is %s",
b4a.from(getKeyPair().publicKey).toString("hex") b4a.from(getKeyPair().publicKey).toString("hex")