Compare commits

...

3 Commits

Author SHA1 Message Date
0c2d84e395 chore: release version v0.14.3
License: MIT
Signed-off-by: Jacob Heun <jacobheun@gmail.com>
2019-12-20 09:02:38 -08:00
13fb6ba6e4 chore: update contributors 2019-12-20 09:02:37 -08:00
21f87476f6 fix: transport should not handle connection if upgradeInbound throws (#119) 2019-12-20 08:33:36 -08:00
3 changed files with 24 additions and 4 deletions

View File

@ -1,3 +1,13 @@
<a name="0.14.3"></a>
## [0.14.3](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.2...v0.14.3) (2019-12-20)
### Bug Fixes
* transport should not handle connection if upgradeInbound throws ([#119](https://github.com/libp2p/js-libp2p-tcp/issues/119)) ([21f8747](https://github.com/libp2p/js-libp2p-tcp/commit/21f8747))
<a name="0.14.2"></a>
## [0.14.2](https://github.com/libp2p/js-libp2p-tcp/compare/v0.14.1...v0.14.2) (2019-12-06)

View File

@ -1,6 +1,6 @@
{
"name": "libp2p-tcp",
"version": "0.14.2",
"version": "0.14.3",
"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",
@ -36,7 +36,7 @@
"aegir": "^20.4.1",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"libp2p-interfaces": "^0.1.6",
"libp2p-interfaces": "^0.2.0",
"it-pipe": "^1.1.0",
"sinon": "^7.5.0",
"streaming-iterables": "^4.1.1"

View File

@ -2,7 +2,10 @@
const net = require('net')
const EventEmitter = require('events')
const log = require('debug')('libp2p:tcp:listener')
const debug = require('debug')
const log = debug('libp2p:tcp:listener')
log.error = debug('libp2p:tcp:listener:error')
const toConnection = require('./socket-to-conn')
const { CODE_P2P } = require('./constants')
const {
@ -20,7 +23,14 @@ module.exports = ({ handler, upgrader }, options) => {
const maConn = toConnection(socket, { listeningAddr })
log('new inbound connection %s', maConn.remoteAddr)
const conn = await upgrader.upgradeInbound(maConn)
let conn
try {
conn = await upgrader.upgradeInbound(maConn)
} catch (err) {
log.error('inbound connection failed to upgrade', err)
return maConn.close()
}
log('inbound connection %s upgraded', maConn.remoteAddr)
trackConn(server, maConn)