Skip to content

Commit

Permalink
feat: new libp2p API and update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Mar 27, 2017
1 parent 02c1794 commit 9477b79
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@
},
"homepage": "https://github.com/ipfs/js-ipfs-bitswap#readme",
"devDependencies": {
"aegir": "^11.0.0",
"aegir": "^11.0.1",
"benchmark": "^2.1.3",
"chai": "^3.5.0",
"dirty-chai": "^1.2.2",
"ipfs-repo": "~0.12.0",
"libp2p-ipfs-nodejs": "~0.19.0",
"ipfs-repo": "~0.13.0",
"libp2p-ipfs-nodejs": "~0.21.0",
"lodash": "^4.17.4",
"multiaddr": "^2.2.2",
"multiaddr": "^2.2.3",
"ncp": "^2.0.0",
"peer-book": "~0.3.1",
"peer-id": "~0.8.4",
"peer-info": "~0.8.4",
"peer-book": "~0.3.2",
"peer-id": "~0.8.5",
"peer-info": "~0.8.5",
"rimraf": "^2.6.1",
"safe-buffer": "^5.0.1"
},
"dependencies": {
"async": "^2.1.5",
"async": "^2.2.0",
"cids": "~0.4.2",
"debug": "^2.6.3",
"ipfs-block": "~0.6.0",
Expand All @@ -66,7 +66,7 @@
"lodash.sortby": "^4.7.0",
"lodash.uniqwith": "^4.5.0",
"lodash.values": "^4.3.0",
"multihashing-async": "^0.4.4",
"multihashing-async": "^0.4.5",
"protocol-buffers": "^3.2.1",
"pull-defer": "^0.2.2",
"pull-length-prefixed": "^1.2.0",
Expand Down
4 changes: 2 additions & 2 deletions src/components/network/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ class Network {
// dialByPeerInfo throws if no network is there
try {
// Attempt Bitswap 1.1.0
this.libp2p.dialByPeerInfo(peerInfo, BITSWAP110, (err, conn) => {
this.libp2p.dial(peerInfo, BITSWAP110, (err, conn) => {
if (err) {
// Attempt Bitswap 1.0.0
this.libp2p.dialByPeerInfo(peerInfo, BITSWAP100, (err, conn) => {
this.libp2p.dial(peerInfo, BITSWAP100, (err, conn) => {
if (err) {
return callback(err)
}
Expand Down
8 changes: 4 additions & 4 deletions test/components/network/network.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe('network', () => {
}
}

libp2pNodeA.dialByPeerInfo(peerInfoB, (err) => {
libp2pNodeA.dial(peerInfoB, (err) => {
expect(err).to.not.exist()
})

Expand Down Expand Up @@ -203,7 +203,7 @@ describe('network', () => {
expect(err).to.not.exist()
}

libp2pNodeA.dialByPeerInfo(peerInfoB, '/ipfs/bitswap/1.0.0', (err, conn) => {
libp2pNodeA.dial(peerInfoB, '/ipfs/bitswap/1.0.0', (err, conn) => {
expect(err).to.not.exist()

pull(
Expand Down Expand Up @@ -236,7 +236,7 @@ describe('network', () => {
expect(err).to.not.exist()
}

libp2pNodeA.dialByPeerInfo(peerInfoB, '/ipfs/bitswap/1.1.0', (err, conn) => {
libp2pNodeA.dial(peerInfoB, '/ipfs/bitswap/1.1.0', (err, conn) => {
expect(err).to.not.exist()

pull(
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('network', () => {
}
}

libp2pNodeA.dialByPeerInfo(peerInfoC, (err) => {
libp2pNodeA.dial(peerInfoC, (err) => {
expect(err).to.not.exist()
})

Expand Down
5 changes: 2 additions & 3 deletions test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,11 @@ exports.genBitswapNetwork = (n, callback) => {
function establishLinks () {
eachSeries(netArray, (from, cbI) => {
eachSeries(netArray, (to, cbJ) => {
if (from.peerInfo.id.toB58String() ===
to.peerInfo.id.toB58String()) {
if (from.peerInfo.id.toB58String() === to.peerInfo.id.toB58String()) {
return cbJ()
}

from.libp2p.dialByPeerInfo(to.peerInfo, cbJ)
from.libp2p.dial(to.peerInfo, cbJ)
}, cbI)
}, finish)
}
Expand Down

0 comments on commit 9477b79

Please sign in to comment.