Compare commits

...

13 Commits

Author SHA1 Message Date
e9e1f56b87 chore: release version v0.15.1 2020-08-11 15:35:36 +02:00
dee839efa5 chore: update contributors 2020-08-11 15:35:36 +02:00
8ff9f607b0 chore: update deps (#136)
Updates to the latest mafmt which has the latest multiaddr
2020-08-11 15:34:44 +02:00
f17525a9b2 chore: update deps (#135)
Pulls in the latest interface module that depends on modules that
use Uint8Arrays in place of node Buffers.
2020-08-10 13:28:55 +02:00
b524848352 chore: release version v0.15.0 2020-08-07 18:09:07 +02:00
926a99caea chore: update contributors 2020-08-07 18:09:06 +02:00
d9f9912dac chore: update deps (#134)
* chore: update deps

Upgrades to the latest multiaddrs with Uint8Arrays

Also removes redundant deps.

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
2020-08-07 18:07:34 +02:00
82b99076d0 chore: release version v0.14.6 2020-07-17 12:37:16 +02:00
6590651e97 chore: update contributors 2020-07-17 12:37:16 +02:00
5757c7ea11 chore: update dependencies (#133)
* chore: update dependencies

This includes a memory leak fix in stream-to-it 0.2.1

* chore: update stream-to-it

* chore: remove bundlesize from CI, it's for browser support
2020-07-17 12:34:55 +02:00
562b3adf1f chore: release version v0.14.5 2020-04-28 14:46:01 +02:00
eac9129bc0 chore: update contributors 2020-04-28 14:46:01 +02:00
0fe0815514 fix: catch error from maConn.close (#128) 2020-04-28 14:34:37 +02:00
7 changed files with 70 additions and 29 deletions

View File

@ -27,7 +27,6 @@ jobs:
- stage: check
os: linux
script:
- npx aegir build --bundlesize
- npx aegir dep-check
- npm run lint

View File

@ -1,3 +1,43 @@
<a name="0.15.1"></a>
## [0.15.1](https://github.com/libp2p/js-libp2p-tcp/compare/v0.15.0...v0.15.1) (2020-08-11)
<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)

View File

@ -1,6 +1,6 @@
{
"name": "libp2p-tcp",
"version": "0.14.4",
"version": "0.15.1",
"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,41 +33,39 @@
"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",
"it-pipe": "^1.1.0",
"libp2p-interfaces": "^0.4.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": "^8.0.0",
"multiaddr": "^8.0.0",
"stream-to-it": "^0.2.2"
},
"contributors": [
"David Dias <daviddias.p@gmail.com>",
"Jacob Heun <jacobheun@gmail.com>",
"Stephen Whitmore <stephen.whitmore@gmail.com>",
"Friedel Ziegelmayer <dignifiedquire@gmail.com>",
"Alex Potsides <alex@achingbrain.net>",
"Vasco Santos <vasco.santos@moxy.studio>",
"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>"
]
}

View File

@ -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())
})
}

View File

@ -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')

View File

@ -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')

View File

@ -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')