mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-04-25 14:02:37 +00:00
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:
parent
872e15af46
commit
605ee279ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ node_modules
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
coverage
|
coverage
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
docs
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
"aegir": "^20.0.0",
|
"aegir": "^20.0.0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"interface-transport": "^0.6.1",
|
"interface-transport": "^0.7.0",
|
||||||
"sinon": "^7.3.1"
|
"sinon": "^7.3.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -45,7 +45,7 @@
|
|||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"err-code": "^2.0.0",
|
"err-code": "^2.0.0",
|
||||||
"ip-address": "^6.1.0",
|
"ip-address": "^6.1.0",
|
||||||
"mafmt": "^6.0.9",
|
"mafmt": "^7.0.0",
|
||||||
"multiaddr": "^7.1.0",
|
"multiaddr": "^7.1.0",
|
||||||
"stream-to-it": "^0.1.1"
|
"stream-to-it": "^0.1.1"
|
||||||
},
|
},
|
||||||
|
@ -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
|
return maConn
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,7 @@ describe('interface-transport compliance', () => {
|
|||||||
const addrs = [
|
const addrs = [
|
||||||
multiaddr('/ip4/127.0.0.1/tcp/9091'),
|
multiaddr('/ip4/127.0.0.1/tcp/9091'),
|
||||||
multiaddr('/ip4/127.0.0.1/tcp/9092'),
|
multiaddr('/ip4/127.0.0.1/tcp/9092'),
|
||||||
multiaddr('/ip4/127.0.0.1/tcp/9093'),
|
multiaddr('/ip4/127.0.0.1/tcp/9093')
|
||||||
multiaddr('/dns4/ipfs.io')
|
|
||||||
]
|
]
|
||||||
|
|
||||||
// Used by the dial tests to simulate a delayed connect
|
// Used by the dial tests to simulate a delayed connect
|
||||||
|
Loading…
x
Reference in New Issue
Block a user