mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-29 00:41:34 +00:00
chore: refactor connection manager and registrar
This commit is contained in:
committed by
Vasco Santos
parent
7627f96c4f
commit
a55a4dcd27
@ -29,6 +29,7 @@ class Circuit {
|
||||
constructor ({ libp2p, upgrader }) {
|
||||
this._dialer = libp2p.dialer
|
||||
this._registrar = libp2p.registrar
|
||||
this._connectionManager = libp2p.connectionManager
|
||||
this._upgrader = upgrader
|
||||
this._options = libp2p._config.relay
|
||||
this.addresses = libp2p.addresses
|
||||
@ -107,7 +108,7 @@ class Circuit {
|
||||
const destinationPeer = PeerId.createFromCID(destinationAddr.getPeerId())
|
||||
|
||||
let disconnectOnFailure = false
|
||||
let relayConnection = this._registrar.getConnection(relayPeer)
|
||||
let relayConnection = this._connectionManager.get(relayPeer)
|
||||
if (!relayConnection) {
|
||||
relayConnection = await this._dialer.connectToPeer(relayAddr, options)
|
||||
disconnectOnFailure = true
|
||||
|
Reference in New Issue
Block a user