*Refactor start
This commit is contained in:
parent
3ede7224aa
commit
ba0832588d
|
@ -69,8 +69,6 @@ export class SwarmClient extends Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
let ready = this.ready();
|
|
||||||
|
|
||||||
const backoff = () => setImmediate(() => this._connectBackoff.backoff());
|
const backoff = () => setImmediate(() => this._connectBackoff.backoff());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -78,11 +76,10 @@ export class SwarmClient extends Client {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.logErr(e);
|
this.logErr(e);
|
||||||
backoff();
|
backoff();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.once("close", backoff);
|
await this.ready();
|
||||||
|
|
||||||
await ready;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async addRelay(pubkey: string): Promise<void> {
|
public async addRelay(pubkey: string): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue