Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
refactor: enable DHT by default
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
alanshaw committed Apr 15, 2019
1 parent 5c5d9c4 commit 3100536
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 24 deletions.
5 changes: 2 additions & 3 deletions src/core/components/libp2p.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ function defaultBundle ({ datastore, peerInfo, peerBook, options, config }) {
},
dht: {
kBucketSize: get(options, 'dht.kBucketSize', 20),
// enabled: !get(options, 'offline', false), // disable if offline, on by default
enabled: false,
enabled: !get(options, 'offline', false), // disable if offline, on by default
randomWalk: {
enabled: false // disabled waiting for https://github.com/libp2p/js-libp2p-kad-dht/issues/86
enabled: true
},
validators: {
ipns: ipnsUtils.validator
Expand Down
4 changes: 2 additions & 2 deletions src/core/runtime/config-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ module.exports = () => ({
],
Swarm: {
ConnMgr: {
LowWater: 200,
HighWater: 500
LowWater: 20,
HighWater: 50
}
}
})
2 changes: 1 addition & 1 deletion src/core/runtime/libp2p-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Node extends libp2p {
}
},
dht: {
enabled: false
enabled: true
},
EXPERIMENTAL: {
pubsub: false
Expand Down
4 changes: 2 additions & 2 deletions src/core/runtime/libp2p-nodejs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class Node extends libp2p {
},
dht: {
kBucketSize: 20,
enabled: false,
enabled: true,
randomWalk: {
enabled: false
enabled: true
}
},
EXPERIMENTAL: {
Expand Down
3 changes: 1 addition & 2 deletions test/cli/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ const daemonOpts = {
initOptions: { bits: 512 }
}

// TODO: unskip when DHT is enabled in 0.36
describe.skip('dht', () => {
describe('dht', () => {
let nodes = []
let ipfsA
let ipfsB
Expand Down
3 changes: 1 addition & 2 deletions test/core/dht.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ const isNode = require('detect-node')
const IPFSFactory = require('ipfsd-ctl')
const IPFS = require('../../src/core')

// TODO: unskip when DHT is enabled in 0.36
describe.skip('dht', () => {
describe('dht', () => {
describe('enabled', () => {
let ipfsd, ipfs

Expand Down
10 changes: 7 additions & 3 deletions test/core/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ describe('interface-ipfs-core tests', function () {
initOptions: { bits: 512 }
}
}), {
skip: {
reason: 'TODO: unskip when DHT is enabled in 0.36'
}
skip: isNode ? [
// dht.get
{
name: 'should get a value after it was put on another node',
reason: 'Needs https://github.com/ipfs/interface-ipfs-core/pull/383'
}
] : true
})

tests.filesRegular(defaultCommonFactory, {
Expand Down
3 changes: 1 addition & 2 deletions test/core/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ describe('name', function () {
})
})

// TODO: unskip when DHT is enabled in 0.36
describe.skip('work with dht', () => {
describe('work with dht', () => {
let nodes
let nodeA
let nodeB
Expand Down
3 changes: 1 addition & 2 deletions test/core/ping.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ describe('ping', function () {
})
})

// TODO: unskip when DHT enabled in 0.36
describe.skip('DHT enabled', function () {
describe('DHT enabled', function () {
// Our bootstrap process will run 3 IPFS daemons where
// A ----> B ----> C
// Allowing us to test the ping command using the DHT peer routing
Expand Down
3 changes: 1 addition & 2 deletions test/http-api/inject/dht.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const expect = chai.expect
chai.use(dirtyChai)

module.exports = (http) => {
// TODO: unskip when DHT is enabled in 0.36
describe.skip('/dht', () => {
describe('/dht', () => {
let api

before(() => {
Expand Down
10 changes: 7 additions & 3 deletions test/http-api/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ describe('interface-ipfs-core over ipfs-http-client tests', () => {
}
}
}), {
skip: {
reason: 'TODO: unskip when DHT is enabled in 0.36'
}
skip: [
// dht.get
{
name: 'should get a value after it was put on another node',
reason: 'Needs https://github.com/ipfs/interface-ipfs-core/pull/383'
}
]
})

tests.filesRegular(defaultCommonFactory)
Expand Down

0 comments on commit 3100536

Please sign in to comment.