mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-30 01:11:34 +00:00
remove unnecessary logs
This commit is contained in:
@ -15,8 +15,6 @@ function Identify (swarm, peerSelf) {
|
|||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
swarm.registerHandler('/ipfs/identify/1.0.0', function (stream) {
|
swarm.registerHandler('/ipfs/identify/1.0.0', function (stream) {
|
||||||
console.log('DO I EVER GET CALLED?')
|
|
||||||
|
|
||||||
var identifyMsg = {}
|
var identifyMsg = {}
|
||||||
identifyMsg = {}
|
identifyMsg = {}
|
||||||
identifyMsg.sender = exportPeer(peerSelf)
|
identifyMsg.sender = exportPeer(peerSelf)
|
||||||
@ -42,22 +40,12 @@ function Identify (swarm, peerSelf) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
swarm.on('connection-unknown', function (conn) {
|
swarm.on('connection-unknown', function (conn) {
|
||||||
console.log('IDENTIFY - DIALING STREAM FROM SERVER')
|
|
||||||
|
|
||||||
conn.on('error', function (err) {
|
|
||||||
console.log('CAPUT-A', err)
|
|
||||||
})
|
|
||||||
conn.dialStream(function (err, stream) {
|
conn.dialStream(function (err, stream) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return console.log(err)
|
return console.log(err)
|
||||||
}
|
}
|
||||||
stream.on('error', function (err) {
|
|
||||||
console.log('CAPUT-B', err)
|
|
||||||
})
|
|
||||||
console.log('GOT STREAM')
|
|
||||||
var msi = new Interactive()
|
var msi = new Interactive()
|
||||||
msi.handle(stream, function () {
|
msi.handle(stream, function () {
|
||||||
console.log('HANDLE GOOD')
|
|
||||||
msi.select('/ipfs/identify/1.0.0', function (err, ds) {
|
msi.select('/ipfs/identify/1.0.0', function (err, ds) {
|
||||||
if (err) { return console.log(err) }
|
if (err) { return console.log(err) }
|
||||||
var identifyMsg = {}
|
var identifyMsg = {}
|
||||||
@ -78,7 +66,6 @@ function Identify (swarm, peerSelf) {
|
|||||||
|
|
||||||
swarm.connections[answer.sender.id] = conn
|
swarm.connections[answer.sender.id] = conn
|
||||||
|
|
||||||
console.log('BAM')
|
|
||||||
self.emit('peer-update', answer)
|
self.emit('peer-update', answer)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
25
src/swarm.js
25
src/swarm.js
@ -35,10 +35,7 @@ function Swarm () {
|
|||||||
//
|
//
|
||||||
|
|
||||||
self.listener = tcp.createServer(function (socket) {
|
self.listener = tcp.createServer(function (socket) {
|
||||||
socket.on('error', function (err) {
|
errorUp(self, socket)
|
||||||
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) {
|
||||||
@ -48,13 +45,6 @@ function Swarm () {
|
|||||||
|
|
||||||
// attach multistream handlers to incoming streams
|
// attach multistream handlers to incoming streams
|
||||||
|
|
||||||
conn.on('stream', function () {
|
|
||||||
console.log('HERE')
|
|
||||||
})
|
|
||||||
conn.on('error', function () {
|
|
||||||
console.log('error here')
|
|
||||||
})
|
|
||||||
|
|
||||||
conn.on('stream', registerHandles)
|
conn.on('stream', registerHandles)
|
||||||
errorUp(self, conn)
|
errorUp(self, conn)
|
||||||
|
|
||||||
@ -109,12 +99,6 @@ function Swarm () {
|
|||||||
if (err) { cb(err) }
|
if (err) { cb(err) }
|
||||||
|
|
||||||
var conn = new Muxer().attach(ds, false)
|
var conn = new Muxer().attach(ds, false)
|
||||||
conn.on('stream', function () {
|
|
||||||
console.log('WOOHO NEW STREAM')
|
|
||||||
})
|
|
||||||
conn.on('error', function () {
|
|
||||||
console.log('BADUM TSS')
|
|
||||||
})
|
|
||||||
conn.on('stream', registerHandles)
|
conn.on('stream', registerHandles)
|
||||||
self.connections[peer.id.toB58String()] = conn
|
self.connections[peer.id.toB58String()] = conn
|
||||||
conn.on('close', function () { delete self.connections[peer.id.toB58String()] })
|
conn.on('close', function () { delete self.connections[peer.id.toB58String()] })
|
||||||
@ -131,9 +115,6 @@ function Swarm () {
|
|||||||
conn.dialStream(function (err, stream) {
|
conn.dialStream(function (err, stream) {
|
||||||
if (err) { return cb(err) }
|
if (err) { return cb(err) }
|
||||||
errorUp(self, stream)
|
errorUp(self, stream)
|
||||||
stream.on('error', function (err) {
|
|
||||||
console.log('error here - ', err)
|
|
||||||
})
|
|
||||||
// negotiate desired protocol
|
// negotiate desired protocol
|
||||||
var msi = new Interactive()
|
var msi = new Interactive()
|
||||||
msi.handle(stream, function () {
|
msi.handle(stream, function () {
|
||||||
@ -147,9 +128,7 @@ function Swarm () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.registerHandler = function (protocol, handlerFunc) {
|
self.registerHandler = function (protocol, handlerFunc) {
|
||||||
console.log('new handler coming in for - ', protocol)
|
|
||||||
if (self.handles[protocol]) {
|
if (self.handles[protocol]) {
|
||||||
console.log('here already - ', protocol)
|
|
||||||
return handlerFunc(new Error('Handle for protocol already exists', protocol))
|
return handlerFunc(new Error('Handle for protocol already exists', protocol))
|
||||||
}
|
}
|
||||||
self.handles.push({ protocol: protocol, func: handlerFunc })
|
self.handles.push({ protocol: protocol, func: handlerFunc })
|
||||||
@ -174,12 +153,10 @@ function Swarm () {
|
|||||||
|
|
||||||
function registerHandles (stream) {
|
function registerHandles (stream) {
|
||||||
log.info('Registering protocol handlers on new stream')
|
log.info('Registering protocol handlers on new stream')
|
||||||
console.log('REGISTERING HANDLES')
|
|
||||||
errorUp(self, stream)
|
errorUp(self, stream)
|
||||||
var msH = new Select()
|
var msH = new Select()
|
||||||
msH.handle(stream)
|
msH.handle(stream)
|
||||||
self.handles.forEach(function (handle) {
|
self.handles.forEach(function (handle) {
|
||||||
console.log(' ->', handle.protocol)
|
|
||||||
msH.addHandler(handle.protocol, handle.func)
|
msH.addHandler(handle.protocol, handle.func)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ experiment('IDENTIFY', function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
identifyB.on('peer-update', function (answer) {
|
identifyB.on('peer-update', function (answer) {
|
||||||
console.log('SUCH PEER-UPDATE')
|
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
identifyA.on('peer-update', function (answer) {})
|
identifyA.on('peer-update', function (answer) {})
|
||||||
|
Reference in New Issue
Block a user