mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-07-16 17:11:57 +00:00
fix RST_STREAM bug
This commit is contained in:
14
src/swarm.js
14
src/swarm.js
@@ -19,26 +19,32 @@ function Swarm () {
|
||||
}
|
||||
|
||||
self.port = parseInt(process.env.IPFS_SWARM_PORT, 10) || 4001
|
||||
|
||||
self.connections = {}
|
||||
self.handles = []
|
||||
|
||||
// set the listener
|
||||
|
||||
self.listen = function (port, ready) {
|
||||
if (!ready) { ready = function noop () {} }
|
||||
if (!ready) {
|
||||
ready = function noop () {}
|
||||
}
|
||||
if (typeof port === 'function') {
|
||||
ready = port
|
||||
} else if (port) { self.port = port }
|
||||
|
||||
//
|
||||
|
||||
self.listener = tcp.createServer(function (socket) {
|
||||
errorUp(self, socket)
|
||||
socket.on('error', function (err) {
|
||||
console.log('listener socket err - ', err)
|
||||
})
|
||||
|
||||
var ms = new Select()
|
||||
ms.handle(socket)
|
||||
ms.addHandler('/spdy/3.1.0', function (ds) {
|
||||
log.info('Negotiated spdy with incoming socket')
|
||||
|
||||
var conn = new Muxer().attach(ds, false)
|
||||
var conn = new Muxer().attach(ds, true)
|
||||
|
||||
// attach multistream handlers to incoming streams
|
||||
|
||||
|
Reference in New Issue
Block a user