From 395edfe75ac79d6f4e06271039d6f036c8c05735 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 3 Aug 2022 21:36:30 -0400 Subject: [PATCH] *dht missing on connect call --- src/index.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 11a9100..0b4d3e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import { EventEmitter } from "events"; import { DataFn, ErrTuple } from "libskynet"; import { Buffer } from "buffer"; -import {create} from "domain"; +import { create } from "domain"; const DHT_MODULE = "AQD1IgE4lTZkq1fqdoYGojKRNrSk0YQ_wrHbRtIiHDrnow"; @@ -32,7 +32,11 @@ export class DHT { public async connect(pubkey: string): Promise { await this.setup(); - const [resp, err] = await callModule(DHT_MODULE, "connect", { pubkey }); + const dht = !this.useDefaultDht ? this.id : undefined; + const [resp, err] = await callModule(DHT_MODULE, "connect", { + pubkey, + dht, + }); if (err) { throw new Error(err); } @@ -99,9 +103,9 @@ export class DHT { return true; } - private async setup(){ - await loadLibs(); - await this.create(); + private async setup() { + await loadLibs(); + await this.create(); } }