*Move backoff reset to the ready method
This commit is contained in:
parent
54a817742c
commit
d3460ae956
|
@ -1,6 +1,6 @@
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { Client, factory } from "@lumeweb/libkernel-universal";
|
import { Client, factory } from "@lumeweb/libkernel-universal";
|
||||||
import { hexToBuf, DataFn, ErrTuple } from "@siaweb/libweb";
|
import { DataFn, ErrTuple, hexToBuf } from "@siaweb/libweb";
|
||||||
|
|
||||||
import type { EventEmitter } from "eventemitter3";
|
import type { EventEmitter } from "eventemitter3";
|
||||||
|
|
||||||
|
@ -43,10 +43,7 @@ export class SwarmClient extends Client {
|
||||||
return createSocket(resp.id);
|
return createSocket(resp.id);
|
||||||
}
|
}
|
||||||
async init(): Promise<ErrTuple> {
|
async init(): Promise<ErrTuple> {
|
||||||
const ret = await this.callModuleReturn("init", { swarm: this.swarm });
|
return await this.callModuleReturn("init", { swarm: this.swarm });
|
||||||
this._connectBackoff.reset();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
async ready(): Promise<void> {
|
async ready(): Promise<void> {
|
||||||
if (this._ready) {
|
if (this._ready) {
|
||||||
|
@ -66,6 +63,7 @@ export class SwarmClient extends Client {
|
||||||
await this._ready;
|
await this._ready;
|
||||||
|
|
||||||
this._ready = undefined;
|
this._ready = undefined;
|
||||||
|
this._connectBackoff.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue