mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-05-29 10:11:19 +00:00
add last seen date to the peer
This commit is contained in:
parent
b08107dc63
commit
648eb7c666
@ -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
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user