mirror of
https://github.com/fluencelabs/js-libp2p-tcp
synced 2025-07-01 18:31:33 +00:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
b524848352 | |||
926a99caea | |||
d9f9912dac | |||
82b99076d0 | |||
6590651e97 | |||
5757c7ea11 | |||
562b3adf1f | |||
eac9129bc0 | |||
0fe0815514 |
@ -27,7 +27,6 @@ jobs:
|
||||
- stage: check
|
||||
os: linux
|
||||
script:
|
||||
- npx aegir build --bundlesize
|
||||
- npx aegir dep-check
|
||||
- npm run lint
|
||||
|
||||
|
35
CHANGELOG.md
35
CHANGELOG.md
@ -1,3 +1,38 @@
|
||||
<a name="0.15.0"></a>
|
||||
# [0.15.0](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.6...v0.15.0) (2020-08-07)
|
||||
|
||||
|
||||
### Chores
|
||||
|
||||
* update deps ([#134](https://github.com/libp2p/js-libp2p-tcp/issues/134)) ([d9f9912](https://github.com/libp2p/js-libp2p-tcp/commit/d9f9912))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* - The multiaddr dep used by this module returns Uint8Arrays and may
|
||||
not be compatible with previous versions
|
||||
|
||||
* chore: update utils
|
||||
|
||||
* chore: remove gh dep url
|
||||
|
||||
|
||||
|
||||
<a name="0.14.6"></a>
|
||||
## [0.14.6](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.5...v0.14.6) (2020-07-17)
|
||||
|
||||
|
||||
|
||||
<a name="0.14.5"></a>
|
||||
## [0.14.5](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.4...v0.14.5) (2020-04-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* catch error from maConn.close ([#128](https://github.com/libp2p/js-libp2p-tcp/issues/128)) ([0fe0815](https://github.com/libp2p/js-libp2p-tcp/commit/0fe0815))
|
||||
|
||||
|
||||
|
||||
<a name="0.14.4"></a>
|
||||
## [0.14.4](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.3...v0.14.4) (2020-02-24)
|
||||
|
||||
|
26
package.json
26
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "libp2p-tcp",
|
||||
"version": "0.14.4",
|
||||
"version": "0.15.0",
|
||||
"description": "Node.js implementation of the TCP module that libp2p uses, which implements the interface-connection and interface-transport interfaces",
|
||||
"leadMaintainer": "Jacob Heun <jacobheun@gmail.com>",
|
||||
"main": "src/index.js",
|
||||
@ -33,23 +33,21 @@
|
||||
"npm": ">=3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aegir": "^21.0.2",
|
||||
"chai": "^4.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"libp2p-interfaces": "^0.2.0",
|
||||
"aegir": "^25.0.0",
|
||||
"libp2p-interfaces": "^0.3.1",
|
||||
"it-pipe": "^1.1.0",
|
||||
"sinon": "^9.0.0",
|
||||
"streaming-iterables": "^4.1.1"
|
||||
"streaming-iterables": "^5.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"abortable-iterator": "^3.0.0",
|
||||
"class-is": "^1.1.0",
|
||||
"debug": "^4.1.1",
|
||||
"err-code": "^2.0.0",
|
||||
"libp2p-utils": "~0.1.0",
|
||||
"mafmt": "^7.0.0",
|
||||
"multiaddr": "^7.2.1",
|
||||
"stream-to-it": "^0.2.0"
|
||||
"libp2p-utils": "^0.2.0",
|
||||
"mafmt": "^7.1.0",
|
||||
"multiaddr": "^8.0.0",
|
||||
"stream-to-it": "^0.2.2"
|
||||
},
|
||||
"contributors": [
|
||||
"David Dias <daviddias.p@gmail.com>",
|
||||
@ -57,17 +55,17 @@
|
||||
"Stephen Whitmore <stephen.whitmore@gmail.com>",
|
||||
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
|
||||
"Vasco Santos <vasco.santos@moxy.studio>",
|
||||
"Alex Potsides <alex@achingbrain.net>",
|
||||
"Richard Littauer <richard.littauer@gmail.com>",
|
||||
"Tom White <tomtinkerer@gmail.com>",
|
||||
"Alan Shaw <alan@tableflip.io>",
|
||||
"Pedro Teixeira <i@pgte.me>",
|
||||
"Prashanth Chandra <coolshanth94@gmail.com>",
|
||||
"João Antunes <j.goncalo.antunes@gmail.com>",
|
||||
"Alex Potsides <alex@achingbrain.net>",
|
||||
"Diogo Silva <fsdiogo@gmail.com>",
|
||||
"Dmitriy Ryajov <dryajov@gmail.com>",
|
||||
"Drew Stone <drewstone329@gmail.com>",
|
||||
"Evan Schwartz <evan.mark.schwartz@gmail.com>",
|
||||
"Linus Unnebäck <linus@folkdatorn.se>"
|
||||
"Linus Unnebäck <linus@folkdatorn.se>",
|
||||
"Pedro Teixeira <i@pgte.me>",
|
||||
"Prashanth Chandra <coolshanth94@gmail.com>"
|
||||
]
|
||||
}
|
||||
|
@ -13,6 +13,19 @@ const {
|
||||
multiaddrToNetConfig
|
||||
} = require('./utils')
|
||||
|
||||
/**
|
||||
* Attempts to close the given maConn. If a failure occurs, it will be logged.
|
||||
* @private
|
||||
* @param {MultiaddrConnection} maConn
|
||||
*/
|
||||
async function attemptClose (maConn) {
|
||||
try {
|
||||
maConn && await maConn.close()
|
||||
} catch (err) {
|
||||
log.error('an error occurred closing the connection', err)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ({ handler, upgrader }, options) => {
|
||||
const listener = new EventEmitter()
|
||||
|
||||
@ -28,7 +41,7 @@ module.exports = ({ handler, upgrader }, options) => {
|
||||
conn = await upgrader.upgradeInbound(maConn)
|
||||
} catch (err) {
|
||||
log.error('inbound connection failed', err)
|
||||
return maConn && maConn.close()
|
||||
return attemptClose(maConn)
|
||||
}
|
||||
|
||||
log('inbound connection %s upgraded', maConn.remoteAddr)
|
||||
@ -51,7 +64,7 @@ module.exports = ({ handler, upgrader }, options) => {
|
||||
if (!server.listening) return
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
server.__connections.forEach(maConn => maConn.close())
|
||||
server.__connections.forEach(maConn => attemptClose(maConn))
|
||||
server.close(err => err ? reject(err) : resolve())
|
||||
})
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
const { expect } = require('aegir/utils/chai')
|
||||
const TCP = require('../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
const { expect } = require('aegir/utils/chai')
|
||||
const TCP = require('../src')
|
||||
const multiaddr = require('multiaddr')
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
/* eslint-env mocha */
|
||||
'use strict'
|
||||
|
||||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
const expect = chai.expect
|
||||
chai.use(dirtyChai)
|
||||
const { expect } = require('aegir/utils/chai')
|
||||
const TCP = require('../src')
|
||||
const net = require('net')
|
||||
const os = require('os')
|
||||
|
Reference in New Issue
Block a user