*dht missing on connect call
This commit is contained in:
parent
cc2def1901
commit
395edfe75a
14
src/index.ts
14
src/index.ts
|
@ -1,7 +1,7 @@
|
||||||
import { EventEmitter } from "events";
|
import { EventEmitter } from "events";
|
||||||
import { DataFn, ErrTuple } from "libskynet";
|
import { DataFn, ErrTuple } from "libskynet";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import {create} from "domain";
|
import { create } from "domain";
|
||||||
|
|
||||||
const DHT_MODULE = "AQD1IgE4lTZkq1fqdoYGojKRNrSk0YQ_wrHbRtIiHDrnow";
|
const DHT_MODULE = "AQD1IgE4lTZkq1fqdoYGojKRNrSk0YQ_wrHbRtIiHDrnow";
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@ export class DHT {
|
||||||
|
|
||||||
public async connect(pubkey: string): Promise<Socket> {
|
public async connect(pubkey: string): Promise<Socket> {
|
||||||
await this.setup();
|
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) {
|
if (err) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
}
|
}
|
||||||
|
@ -99,9 +103,9 @@ export class DHT {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async setup(){
|
private async setup() {
|
||||||
await loadLibs();
|
await loadLibs();
|
||||||
await this.create();
|
await this.create();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue