mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-03-15 15:30:49 +00:00
Merge 10bcbabae611b0bc567254d6dd715003f8fa0698 into e712d88019bc2be5f7517d236b39449c47dbffb5
This commit is contained in:
commit
223861b06f
@ -25,6 +25,7 @@ import { IMarineHost } from "../marine/interfaces.js";
|
|||||||
import { relayOptionToMultiaddr } from "../util/libp2pUtils.js";
|
import { relayOptionToMultiaddr } from "../util/libp2pUtils.js";
|
||||||
import { logger } from "../util/logger.js";
|
import { logger } from "../util/logger.js";
|
||||||
|
|
||||||
|
import { checkConnection } from './checkConnection.js'
|
||||||
import {
|
import {
|
||||||
ClientConfig,
|
ClientConfig,
|
||||||
IFluenceClient,
|
IFluenceClient,
|
||||||
@ -128,7 +129,14 @@ export class ClientPeer extends FluencePeer implements IFluenceClient {
|
|||||||
log.trace("connecting to Fluence network");
|
log.trace("connecting to Fluence network");
|
||||||
this.changeConnectionState("connecting");
|
this.changeConnectionState("connecting");
|
||||||
await super.start();
|
await super.start();
|
||||||
// TODO: check connection (`checkConnection` function) here
|
|
||||||
|
const connected = await checkConnection(this);
|
||||||
|
if (!connected) {
|
||||||
|
this.changeConnectionState("disconnected");
|
||||||
|
log.trace("Disconnected");
|
||||||
|
throw new Error(`Failed to establish a connection with ClientPeer ID '${this.getPeerId()}'`);
|
||||||
|
}
|
||||||
|
|
||||||
this.changeConnectionState("connected");
|
this.changeConnectionState("connected");
|
||||||
log.trace("connected");
|
log.trace("connected");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user