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

Update/libp2p ipfs #165

Merged
merged 2 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@
},
"homepage": "https://github.com/ipfs/js-ipfs#readme",
"devDependencies": {
"aegir": "^2.1.1",
"aegir": "^2.1.2",
"async": "^1.5.2",
"buffer-loader": "0.0.1",
"chai": "^3.5.0",
"expose-loader": "^0.7.1",
"form-data": "^1.0.0-rc3",
"idb-plus-blob-store": "^1.0.0",
"local-storage-blob-store": "0.0.3",
"idb-plus-blob-store": "^1.1.2",
"lodash": "^4.11.1",
"mocha": "^2.3.4",
"ncp": "^2.0.0",
Expand All @@ -70,7 +69,7 @@
"ipfs-multipart": "^0.1.0",
"ipfs-repo": "^0.6.1",
"joi": "^8.0.2",
"libp2p-ipfs": "^0.3.1",
"libp2p-ipfs": "^0.3.3",
"lodash.get": "^4.2.1",
"lodash.set": "^4.0.0",
"multiaddr": "^1.3.0",
Expand Down Expand Up @@ -111,4 +110,4 @@
"kumavis <[email protected]>",
"nginnever <[email protected]>"
]
}
}
12 changes: 9 additions & 3 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,9 @@ function IPFS (repo) {
patch: {
appendData: (multihash, data, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.data = Buffer.concat([obj.data, data])
dagS.add(obj, (err) => {
if (err) {
Expand All @@ -217,7 +219,9 @@ function IPFS (repo) {
},
addLink: (multihash, link, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.addRawLink(link)
dagS.add(obj, (err) => {
if (err) {
Expand All @@ -229,7 +233,9 @@ function IPFS (repo) {
},
rmLink: (multihash, linkRef, callback) => {
this.object.get(multihash, (err, obj) => {
if (err) { return callback(err) }
if (err) {
return callback(err)
}
obj.links = obj.links.filter((link) => {
// filter by name when linkRef is a string, or by hash otherwise
if (typeof linkRef === 'string') {
Expand Down
13 changes: 10 additions & 3 deletions src/http-api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,15 @@ exports = module.exports = function HttpApi (repo) {
this.stop = (callback) => {
const repoPath = this.ipfs.repo.path()
fs.unlinkSync(path.join(repoPath, 'api'))
this.ipfs.libp2p.stop(() => {
this.server.stop(callback)
})
let counter = 0

this.server.stop(closed)
this.ipfs.libp2p.stop(closed)

function closed () {
if (++counter === 2) {
callback()
}
}
}
}
1 change: 0 additions & 1 deletion test/http-api-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('http api', () => {
after((done) => {
api.stop((err) => {
expect(err).to.not.exist

clean(repoTests)
done()
})
Expand Down
2 changes: 1 addition & 1 deletion test/http-api-tests/test-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ module.exports = (httpAPI) => {
it('updates value for request with both args and JSON flag with valid JSON argument', (done) => {
api.inject({
method: 'POST',
url: '/api/v0/config?arg=Datastore.Path&arg={\"kitten\": true}&json'
url: '/api/v0/config?arg=Datastore.Path&arg={"kitten": true}&json'
}, (res) => {
expect(res.statusCode).to.equal(200)
expect(res.result.Key).to.equal('Datastore.Path')
Expand Down