add last seen date to the peer

This commit is contained in:
David Dias 2015-07-30 14:35:59 -07:00
parent b08107dc63
commit 648eb7c666

View File

@ -19,7 +19,7 @@ function Swarm () {
}
self.port = parseInt(process.env.IPFS_SWARM_PORT, 10) || 4001
self.connections = {} // {conn: <>, socket: <>}
self.connections = {} // {peerIdB58: {conn: <>, socket: <>}
self.handles = []
// set the listener
@ -128,6 +128,7 @@ function Swarm () {
msi.handle(stream, function () {
msi.select(protocol, function (err, ds) {
if (err) { return cb(err) }
peer.lastSeen = new Date()
cb(null, ds) // return the stream
})
})