fix: ensure timeline.close is set (#113)

* fix(test): dns4 isnt a valid tcp multiaddr

It should be resolved first

* fix: ensure timeline.close is set on the multiaddrConn

* chore: add docs to gitignore

They are generated and uploaded on release
This commit is contained in:
Jacob Heun 2019-09-19 15:20:54 +02:00 committed by GitHub
parent 872e15af46
commit 605ee279ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules
package-lock.json
coverage
.nyc_output
docs

View File

@ -36,7 +36,7 @@
"aegir": "^20.0.0",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"interface-transport": "^0.6.1",
"interface-transport": "^0.7.0",
"sinon": "^7.3.1"
},
"dependencies": {
@ -45,7 +45,7 @@
"debug": "^4.1.1",
"err-code": "^2.0.0",
"ip-address": "^6.1.0",
"mafmt": "^6.0.9",
"mafmt": "^7.0.0",
"multiaddr": "^7.1.0",
"stream-to-it": "^0.1.1"
},

View File

@ -79,5 +79,14 @@ module.exports = (socket, options) => {
}
}
socket.once('close', () => {
// In instances where `close` was not explicitly called,
// such as an iterable stream ending, ensure we have set the close
// timeline
if (!maConn.timeline.close) {
maConn.timeline.close = Date.now()
}
})
return maConn
}

View File

@ -14,8 +14,7 @@ describe('interface-transport compliance', () => {
const addrs = [
multiaddr('/ip4/127.0.0.1/tcp/9091'),
multiaddr('/ip4/127.0.0.1/tcp/9092'),
multiaddr('/ip4/127.0.0.1/tcp/9093'),
multiaddr('/dns4/ipfs.io')
multiaddr('/ip4/127.0.0.1/tcp/9093')
]
// Used by the dial tests to simulate a delayed connect