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
|
||||
|
||||
swarm.registerHandler('/ipfs/identify/1.0.0', function (stream) {
|
||||
console.log('DO I EVER GET CALLED?')
|
||||
|
||||
var identifyMsg = {}
|
||||
identifyMsg = {}
|
||||
identifyMsg.sender = exportPeer(peerSelf)
|
||||
@ -42,22 +40,12 @@ function Identify (swarm, peerSelf) {
|
||||
})
|
||||
|
||||
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) {
|
||||
if (err) {
|
||||
return console.log(err)
|
||||
}
|
||||
stream.on('error', function (err) {
|
||||
console.log('CAPUT-B', err)
|
||||
})
|
||||
console.log('GOT STREAM')
|
||||
var msi = new Interactive()
|
||||
msi.handle(stream, function () {
|
||||
console.log('HANDLE GOOD')
|
||||
msi.select('/ipfs/identify/1.0.0', function (err, ds) {
|
||||
if (err) { return console.log(err) }
|
||||
var identifyMsg = {}
|
||||
@ -78,7 +66,6 @@ function Identify (swarm, peerSelf) {
|
||||
|
||||
swarm.connections[answer.sender.id] = conn
|
||||
|
||||
console.log('BAM')
|
||||
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) {
|
||||
socket.on('error', function (err) {
|
||||
console.log('listener socket err - ', err)
|
||||
})
|
||||
|
||||
errorUp(self, socket)
|
||||
var ms = new Select()
|
||||
ms.handle(socket)
|
||||
ms.addHandler('/spdy/3.1.0', function (ds) {
|
||||
@ -48,13 +45,6 @@ function Swarm () {
|
||||
|
||||
// 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)
|
||||
errorUp(self, conn)
|
||||
|
||||
@ -109,12 +99,6 @@ function Swarm () {
|
||||
if (err) { cb(err) }
|
||||
|
||||
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)
|
||||
self.connections[peer.id.toB58String()] = conn
|
||||
conn.on('close', function () { delete self.connections[peer.id.toB58String()] })
|
||||
@ -131,9 +115,6 @@ function Swarm () {
|
||||
conn.dialStream(function (err, stream) {
|
||||
if (err) { return cb(err) }
|
||||
errorUp(self, stream)
|
||||
stream.on('error', function (err) {
|
||||
console.log('error here - ', err)
|
||||
})
|
||||
// negotiate desired protocol
|
||||
var msi = new Interactive()
|
||||
msi.handle(stream, function () {
|
||||
@ -147,9 +128,7 @@ function Swarm () {
|
||||
}
|
||||
|
||||
self.registerHandler = function (protocol, handlerFunc) {
|
||||
console.log('new handler coming in for - ', protocol)
|
||||
if (self.handles[protocol]) {
|
||||
console.log('here already - ', protocol)
|
||||
return handlerFunc(new Error('Handle for protocol already exists', protocol))
|
||||
}
|
||||
self.handles.push({ protocol: protocol, func: handlerFunc })
|
||||
@ -174,12 +153,10 @@ function Swarm () {
|
||||
|
||||
function registerHandles (stream) {
|
||||
log.info('Registering protocol handlers on new stream')
|
||||
console.log('REGISTERING HANDLES')
|
||||
errorUp(self, stream)
|
||||
var msH = new Select()
|
||||
msH.handle(stream)
|
||||
self.handles.forEach(function (handle) {
|
||||
console.log(' ->', handle.protocol)
|
||||
msH.addHandler(handle.protocol, handle.func)
|
||||
})
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ experiment('IDENTIFY', function () {
|
||||
})
|
||||
|
||||
identifyB.on('peer-update', function (answer) {
|
||||
console.log('SUCH PEER-UPDATE')
|
||||
done()
|
||||
})
|
||||
identifyA.on('peer-update', function (answer) {})
|
||||
|
Reference in New Issue
Block a user