Skip to content

Commit

Permalink
feat: update to the latest switch (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobheun authored Mar 21, 2019
1 parent e52ce66 commit eee60ed
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@
"./test/utils/bundle-nodejs": "./test/utils/bundle-browser"
},
"dependencies": {
"async": "^2.6.1",
"debug": "^4.1.0",
"async": "^2.6.2",
"debug": "^4.1.1",
"err-code": "^1.1.2",
"fsm-event": "^2.1.0",
"libp2p-connection-manager": "~0.0.2",
"libp2p-floodsub": "~0.15.7",
"libp2p-floodsub": "~0.15.8",
"libp2p-ping": "~0.8.5",
"libp2p-switch": "~0.41.5",
"libp2p-websockets": "~0.12.1",
"mafmt": "^6.0.4",
"multiaddr": "^6.0.3",
"libp2p-switch": "~0.42.1",
"libp2p-websockets": "~0.12.2",
"mafmt": "^6.0.7",
"multiaddr": "^6.0.6",
"once": "^1.4.0",
"peer-book": "~0.9.1",
"peer-id": "~0.12.2",
Expand All @@ -57,34 +57,34 @@
},
"devDependencies": {
"@nodeutils/defaults-deep": "^1.1.0",
"aegir": "^18.2.0",
"aegir": "^18.2.1",
"chai": "^4.2.0",
"chai-checkmark": "^1.0.1",
"cids": "~0.5.5",
"cids": "~0.5.8",
"dirty-chai": "^2.0.1",
"electron-webrtc": "~0.3.0",
"interface-datastore": "~0.6.0",
"libp2p-bootstrap": "~0.9.3",
"libp2p-circuit": "~0.3.0",
"libp2p-bootstrap": "~0.9.7",
"libp2p-circuit": "~0.3.6",
"libp2p-delegated-content-routing": "~0.2.2",
"libp2p-delegated-peer-routing": "~0.2.2",
"libp2p-kad-dht": "~0.14.5",
"libp2p-mdns": "~0.12.0",
"libp2p-kad-dht": "~0.14.8",
"libp2p-mdns": "~0.12.2",
"libp2p-mplex": "~0.8.4",
"libp2p-secio": "~0.11.0",
"libp2p-spdy": "~0.13.0",
"libp2p-secio": "~0.11.1",
"libp2p-spdy": "~0.13.2",
"libp2p-tcp": "~0.13.0",
"libp2p-webrtc-star": "~0.15.5",
"libp2p-websocket-star": "~0.10.1",
"libp2p-webrtc-star": "~0.15.8",
"libp2p-websocket-star": "~0.10.2",
"libp2p-websocket-star-rendezvous": "~0.3.0",
"lodash.times": "^4.3.2",
"nock": "^10.0.2",
"nock": "^10.0.6",
"pull-goodbye": "0.0.2",
"pull-mplex": "~0.1.0",
"pull-mplex": "~0.1.2",
"pull-serializer": "~0.3.2",
"pull-stream": "^3.6.9",
"sinon": "^7.2.4",
"wrtc": "~0.3.2"
"sinon": "^7.2.7",
"wrtc": "~0.3.5"
},
"contributors": [
"Alan Shaw <alan.shaw@protocol.ai>",
Expand Down
5 changes: 2 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,12 @@ class Node extends EventEmitter {
this._getPeerInfo(peer, (err, peerInfo) => {
if (err) { return callback(err) }

const connFSM = this._switch.dialFSM(peerInfo, protocol, (err) => {
this._switch.dialFSM(peerInfo, protocol, (err, connFSM) => {
if (!err) {
this.peerBook.put(peerInfo)
}
callback(err, connFSM)
})

callback(null, connFSM)
})
}

Expand Down
6 changes: 3 additions & 3 deletions test/stream-muxing.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@ describe('stream muxing', () => {
expect(Object.keys(nodeA._switch.muxers)).to.have.length(1)
expect(Object.keys(nodeB._switch.muxers)).to.have.length(1)

nodeA.dial(nodeB.peerInfo, (err) => {
nodeA.dialFSM(nodeB.peerInfo, (err, connFSM) => {
expect(err).to.not.exist()
expect(nodeA._switch.connection.getAll()).to.have.length(0)
cb()
// The connection should fall back to 'unmuxed'
connFSM.once('unmuxed', () => cb())
})
},
(cb) => teardown(nodeA, nodeB, cb)
Expand Down

0 comments on commit eee60ed

Please sign in to comment.