Skip to content
This repository has been archived by the owner on Aug 23, 2019. It is now read-only.

Commit

Permalink
fix: tests and conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun committed May 1, 2018
1 parent 87b51a9 commit fe062a4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/dial.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,24 @@ class Dialer {

const tKeys = this.switch.availableTransports(this.peerInfo)

const circuitEnabled = Boolean(swtch.transports[Circuit.tag])
const circuitEnabled = Boolean(this.switch.transports[Circuit.tag])
let circuitTried = false

const nextTransport = (key) => {
let transport = key
const b58Id = this.peerInfo.id.toB58String()
if (!transport) {
if (!circuitEnabled) {
const msg = `Circuit not enabled and all transports failed to dial peer ${pi.id.toB58String()}!`
return cb(new Error(msg))
const msg = `Circuit not enabled and all transports failed to dial peer ${b58Id}!`
return callback(new Error(msg))
}

if (circuitTried) {
return cb(new Error(`No available transports to dial peer ${pi.id.toB58String()}!`))
return callback(new Error(`No available transports to dial peer ${b58Id}!`))
}

log(`Falling back to dialing over circuit`)
this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${this.peerInfo.id.toB58String()}`)
this.peerInfo.multiaddrs.add(`/p2p-circuit/ipfs/${b58Id}`)
circuitTried = true
transport = Circuit.tag
}
Expand Down

0 comments on commit fe062a4

Please sign in to comment.