mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-31 03:01:20 +00:00
fix RST_STREAM bug
This commit is contained in:
parent
93509debe1
commit
1ed32f6531
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.port = parseInt(process.env.IPFS_SWARM_PORT, 10) || 4001
|
||||||
|
|
||||||
self.connections = {}
|
self.connections = {}
|
||||||
self.handles = []
|
self.handles = []
|
||||||
|
|
||||||
// set the listener
|
// set the listener
|
||||||
|
|
||||||
self.listen = function (port, ready) {
|
self.listen = function (port, ready) {
|
||||||
if (!ready) { ready = function noop () {} }
|
if (!ready) {
|
||||||
|
ready = function noop () {}
|
||||||
|
}
|
||||||
if (typeof port === 'function') {
|
if (typeof port === 'function') {
|
||||||
ready = port
|
ready = port
|
||||||
} else if (port) { self.port = port }
|
} else if (port) { self.port = port }
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
self.listener = tcp.createServer(function (socket) {
|
self.listener = tcp.createServer(function (socket) {
|
||||||
errorUp(self, socket)
|
socket.on('error', function (err) {
|
||||||
|
console.log('listener socket err - ', err)
|
||||||
|
})
|
||||||
|
|
||||||
var ms = new Select()
|
var ms = new Select()
|
||||||
ms.handle(socket)
|
ms.handle(socket)
|
||||||
ms.addHandler('/spdy/3.1.0', function (ds) {
|
ms.addHandler('/spdy/3.1.0', function (ds) {
|
||||||
log.info('Negotiated spdy with incoming socket')
|
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
|
// attach multistream handlers to incoming streams
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ afterEach(function (done) {
|
|||||||
swarmB.closeListener()
|
swarmB.closeListener()
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
/*
|
|
||||||
experiment('BASE', function () {
|
experiment('BASE', function () {
|
||||||
test('Open a stream', function (done) {
|
test('Open a stream', function (done) {
|
||||||
var protocol = '/sparkles/3.3.3'
|
var protocol = '/sparkles/3.3.3'
|
||||||
@ -73,7 +73,7 @@ experiment('BASE', function () {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
experiment('IDENTIFY', function () {
|
experiment('IDENTIFY', function () {
|
||||||
test('Attach Identify, open a stream, see a peer update', function (done) {
|
test('Attach Identify, open a stream, see a peer update', function (done) {
|
||||||
swarmA.on('error', function (err) {
|
swarmA.on('error', function (err) {
|
||||||
@ -102,7 +102,7 @@ experiment('IDENTIFY', function () {
|
|||||||
identifyA.on('peer-update', function (answer) {})
|
identifyA.on('peer-update', function (answer) {})
|
||||||
}, 500)
|
}, 500)
|
||||||
})
|
})
|
||||||
/*
|
|
||||||
test('Attach Identify, open a stream, reuse stream', function (done) {
|
test('Attach Identify, open a stream, reuse stream', function (done) {
|
||||||
var protocol = '/sparkles/3.3.3'
|
var protocol = '/sparkles/3.3.3'
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ test('Attach Identify, open a stream, reuse stream', function (done) {
|
|||||||
})
|
})
|
||||||
identifyA.on('peer-update', function (answer) {})
|
identifyA.on('peer-update', function (answer) {})
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
})
|
})
|
||||||
|
|
||||||
experiment('HARDNESS', function () {})
|
experiment('HARDNESS', function () {})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user