mirror of
https://github.com/fluencelabs/js-libp2p-interfaces
synced 2025-07-10 15:41:50 +00:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
6203109751 | |||
25eeedd20e | |||
5c88d77aaa | |||
f6871afd76 | |||
734c491bb0 |
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,3 +1,13 @@
|
|||||||
|
<a name="0.2.5"></a>
|
||||||
|
## [0.2.5](https://github.com/libp2p/js-interfaces/compare/v0.2.4...v0.2.5) (2020-02-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **connection:** tracks streams properly ([#25](https://github.com/libp2p/js-interfaces/issues/25)) ([5c88d77](https://github.com/libp2p/js-interfaces/commit/5c88d77))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.2.4"></a>
|
<a name="0.2.4"></a>
|
||||||
## [0.2.4](https://github.com/libp2p/js-interfaces/compare/v0.2.3...v0.2.4) (2020-02-04)
|
## [0.2.4](https://github.com/libp2p/js-interfaces/compare/v0.2.3...v0.2.4) (2020-02-04)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "libp2p-interfaces",
|
"name": "libp2p-interfaces",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"description": "Interfaces for JS Libp2p",
|
"description": "Interfaces for JS Libp2p",
|
||||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"homepage": "https://github.com/libp2p/js-interfaces#readme",
|
"homepage": "https://github.com/libp2p/js-interfaces#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"abort-controller": "^3.0.0",
|
"abort-controller": "^3.0.0",
|
||||||
"abortable-iterator": "^2.1.0",
|
"abortable-iterator": "^3.0.0",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-checkmark": "^1.0.1",
|
"chai-checkmark": "^1.0.1",
|
||||||
"class-is": "^1.1.0",
|
"class-is": "^1.1.0",
|
||||||
@ -50,7 +50,7 @@
|
|||||||
"p-wait-for": "^3.1.0",
|
"p-wait-for": "^3.1.0",
|
||||||
"peer-id": "^0.13.3",
|
"peer-id": "^0.13.3",
|
||||||
"peer-info": "^0.17.0",
|
"peer-info": "^0.17.0",
|
||||||
"sinon": "^7.5.0",
|
"sinon": "^8.1.1",
|
||||||
"streaming-iterables": "^4.1.0"
|
"streaming-iterables": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -78,6 +78,7 @@
|
|||||||
"Sathya Narrayanan <plasmashadowx@gmail.com>",
|
"Sathya Narrayanan <plasmashadowx@gmail.com>",
|
||||||
"Vasco Santos <vasco.santos@moxy.studio>",
|
"Vasco Santos <vasco.santos@moxy.studio>",
|
||||||
"Vasco Santos <vasco.santos@ua.pt>",
|
"Vasco Santos <vasco.santos@ua.pt>",
|
||||||
|
"dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>",
|
||||||
"dirkmc <dirkmdev@gmail.com>",
|
"dirkmc <dirkmdev@gmail.com>",
|
||||||
"dmitriy ryajov <dryajov@dmitriys-MBP.HomeNET>",
|
"dmitriy ryajov <dryajov@dmitriys-MBP.HomeNET>",
|
||||||
"greenkeeperio-bot <support@greenkeeper.io>",
|
"greenkeeperio-bot <support@greenkeeper.io>",
|
||||||
|
@ -138,7 +138,7 @@ class Connection {
|
|||||||
|
|
||||||
const { stream, protocol } = await this._newStream(protocols)
|
const { stream, protocol } = await this._newStream(protocols)
|
||||||
|
|
||||||
this.addStream(stream, protocol)
|
this.addStream(stream, { protocol })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stream,
|
stream,
|
||||||
|
@ -120,6 +120,19 @@ module.exports = (test) => {
|
|||||||
expect(connection.stat.status).to.equal(Status.CLOSED)
|
expect(connection.stat.status).to.equal(Status.CLOSED)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should properly track streams', async () => {
|
||||||
|
// Open stream
|
||||||
|
const protocol = '/echo/0.0.1'
|
||||||
|
const { stream } = await connection.newStream(protocol)
|
||||||
|
const trackedStream = connection.registry.get(stream.id)
|
||||||
|
expect(trackedStream).to.have.property('protocol', protocol)
|
||||||
|
|
||||||
|
// Close stream
|
||||||
|
await stream.close()
|
||||||
|
|
||||||
|
expect(connection.registry.get(stream.id)).to.not.exist()
|
||||||
|
})
|
||||||
|
|
||||||
it('should support a proxy on the timeline', async () => {
|
it('should support a proxy on the timeline', async () => {
|
||||||
sinon.spy(proxyHandler, 'set')
|
sinon.spy(proxyHandler, 'set')
|
||||||
expect(connection.stat.timeline.close).to.not.exist()
|
expect(connection.stat.timeline.close).to.not.exist()
|
||||||
|
@ -25,7 +25,7 @@ describe('compliance tests', () => {
|
|||||||
const openStreams = []
|
const openStreams = []
|
||||||
let streamId = 0
|
let streamId = 0
|
||||||
|
|
||||||
return new Connection({
|
const connection = new Connection({
|
||||||
localPeer,
|
localPeer,
|
||||||
remotePeer,
|
remotePeer,
|
||||||
localAddr,
|
localAddr,
|
||||||
@ -43,7 +43,10 @@ describe('compliance tests', () => {
|
|||||||
const id = streamId++
|
const id = streamId++
|
||||||
const stream = pair()
|
const stream = pair()
|
||||||
|
|
||||||
stream.close = () => stream.sink([])
|
stream.close = async () => {
|
||||||
|
await stream.sink([])
|
||||||
|
connection.removeStream(stream.id)
|
||||||
|
}
|
||||||
stream.id = id
|
stream.id = id
|
||||||
|
|
||||||
openStreams.push(stream)
|
openStreams.push(stream)
|
||||||
@ -57,6 +60,7 @@ describe('compliance tests', () => {
|
|||||||
getStreams: () => openStreams,
|
getStreams: () => openStreams,
|
||||||
...properties
|
...properties
|
||||||
})
|
})
|
||||||
|
return connection
|
||||||
},
|
},
|
||||||
async teardown () {
|
async teardown () {
|
||||||
// cleanup resources created by setup()
|
// cleanup resources created by setup()
|
||||||
|
Reference in New Issue
Block a user