This commit is contained in:
David Dias
2015-09-23 20:34:31 +01:00
parent 5b7a6051ad
commit 1ba8e80d4d
4 changed files with 31 additions and 34 deletions

View File

@ -6,7 +6,6 @@
"scripts": {
"test": "./node_modules/.bin/lab tests/*-test.js",
"coverage": "./node_modules/.bin/lab -t 88 tests/*-test.js",
"laf": "./node_modules/.bin/standard --format",
"lint": "./node_modules/.bin/standard"
},
"repository": {

View File

@ -38,14 +38,14 @@ function identify (muxedConns, peerInfoSelf, socket, conn, muxer) {
socket: socket
}
// TODO: Pass the new discovered info about the peer that contacted us
// to something like the Kademlia Router, so the peerInfo for this peer
// is fresh
// - before this was exectued through a event emitter
// self.emit('peer-update', {
// peerId: peerId,
// listenAddrs: msg.listenAddrs.map(function (mhb) {return multiaddr(mhb)})
// })
// TODO: Pass the new discovered info about the peer that contacted us
// to something like the Kademlia Router, so the peerInfo for this peer
// is fresh
// - before this was exectued through a event emitter
// self.emit('peer-update', {
// peerId: peerId,
// listenAddrs: msg.listenAddrs.map(function (mhb) {return multiaddr(mhb)})
// })
})
var mh = getMultiaddr(socket)

View File

@ -67,9 +67,7 @@ function Swarm (peerInfo) {
})
}
self.addUpgrade = function (ConnUpgrade, options) {
}
self.addUpgrade = function (ConnUpgrade, options) {}
self.addStreamMuxer = function (name, StreamMuxer, options) {
self.muxers[name] = {
@ -260,7 +258,7 @@ function Swarm (peerInfo) {
// we pass muxedConns so that identify can access the socket of the other
// peer
self.handleProtocol(identify.protoId,
identify.getHandlerFunction(self.peerInfo, self.muxedConns))
identify.getHandlerFunction(self.peerInfo, self.muxedConns))
}
self.handleProtocol = function (protocol, handlerFunction) {
@ -299,7 +297,7 @@ function Swarm (peerInfo) {
muxer.on('stream', userProtocolMuxer)
})
} else {
// if no stream muxer, then
// if no stream muxer, then
userProtocolMuxer(conn)
}
}

View File

@ -32,15 +32,15 @@ experiment('Without a Stream Muxer', function () {
var sw = new Swarm(p)
sw.addTransport('tcp', tcp,
{ multiaddr: mh }, {}, {port: 8010}, function () {
expect(sw.transports['tcp'].options).to.deep.equal({ multiaddr: mh })
expect(sw.transports['tcp'].dialOptions).to.deep.equal({})
expect(sw.transports['tcp'].listenOptions).to.deep.equal({port: 8010})
expect(sw.transports['tcp'].transport).to.deep.equal(tcp)
sw.closeListener('tcp', function () {
done()
{ multiaddr: mh }, {}, {port: 8010}, function () {
expect(sw.transports['tcp'].options).to.deep.equal({ multiaddr: mh })
expect(sw.transports['tcp'].dialOptions).to.deep.equal({})
expect(sw.transports['tcp'].listenOptions).to.deep.equal({port: 8010})
expect(sw.transports['tcp'].transport).to.deep.equal(tcp)
sw.closeListener('tcp', function () {
done()
})
})
})
})
test('dial a conn', function (done) {
@ -185,9 +185,9 @@ experiment('Without a Stream Muxer', function () {
}
})
// test('add an upgrade', function (done) { done() })
// test('dial a conn on top of a upgrade', function (done) { done() })
// test('dial a conn on a protocol on top of a upgrade', function (done) { done() })
// test('add an upgrade', function (done) { done() })
// test('dial a conn on top of a upgrade', function (done) { done() })
// test('dial a conn on a protocol on top of a upgrade', function (done) { done() })
})
/* TODO
@ -210,15 +210,15 @@ experiment('Without a Stream Muxer', function () {
test('dial a conn on a protocol on top of a upgrade', function (done) { done() })
}) */
/* TODO
experiment('utp', function () {
test('add the transport', function (done) { done() })
test('dial a conn', function (done) { done() })
test('dial a conn on a protocol', function (done) { done() })
test('add an upgrade', function (done) { done() })
test('dial a conn on top of a upgrade', function (done) { done() })
test('dial a conn on a protocol on top of a upgrade', function (done) { done() })
}) */
/* TODO
experiment('utp', function () {
test('add the transport', function (done) { done() })
test('dial a conn', function (done) { done() })
test('dial a conn on a protocol', function (done) { done() })
test('add an upgrade', function (done) { done() })
test('dial a conn on top of a upgrade', function (done) { done() })
test('dial a conn on a protocol on top of a upgrade', function (done) { done() })
}) */
})
experiment('With a SPDY Stream Muxer', function () {