Skip to content

Commit

Permalink
feat: more debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jun 17, 2018
1 parent f86fae5 commit 464da9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,19 @@ class Exchange extends ExchangeBase {

// TODO: check peerBook for key, add a cache

log('looking up pubKey for %s', id.toB58String())

this._rpc('lookup', id.toB58String(), cb)
}

request (peerId, ns, data, cb) {
log('request on %s to %s', ns, peerId.toB58String())
this._getPubKey(peerId, (err, peerId) => {
if (err) {
return cb(err)
}

log('sending request on %s to %s', ns, peerId.toB58String())
this._rpc('request', peerId, ns, data, cb)
})
}
Expand Down
6 changes: 6 additions & 0 deletions src/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Server {
}

start () {
log('server started')

this.swarm.handle(TAG, (proto, conn) => {
conn.getPeerInfo((err, pi) => {
if (err) {
Expand All @@ -38,6 +40,10 @@ class Server {
}

stop () {
log('server stopped')

// TODO: close conns

this.swarm.unhandle(TAG)
}
}
Expand Down

0 comments on commit 464da9c

Please sign in to comment.