touch device lastSeen on ws pong
This commit is contained in:
parent
d48707d265
commit
50c0449206
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var Devices = module.exports;
|
||||
// TODO enumerate store's keys and device's keys for documentation
|
||||
Devices.addPort = function (store, serverport, newDevice) {
|
||||
// TODO make special
|
||||
return Devices.add(store, serverport, newDevice, true);
|
||||
|
@ -146,6 +147,12 @@ Devices.next = function (store, servername) {
|
|||
if (device) { Devices.touch(store, servername); }
|
||||
return device;
|
||||
};
|
||||
Devices.touchDevice = function (store, device) {
|
||||
// TODO use device.id (which will be pubkey thumbprint) and store._devices[id].domainsMap
|
||||
Object.keys(device.domainsMap).forEach(function (servername) {
|
||||
Devices.touch(store, servername);
|
||||
});
|
||||
};
|
||||
Devices.touch = function (store, servername) {
|
||||
if (!store._recency) { store._recency = {}; }
|
||||
store._recency[servername] = Date.now();
|
||||
|
|
|
@ -172,6 +172,7 @@ var Server = {
|
|||
, _initSocketHandlers: function (state, srv) {
|
||||
function refreshTimeout() {
|
||||
srv.lastActivity = Date.now();
|
||||
Devices.touchDevice(state.deviceLists, srv);
|
||||
}
|
||||
|
||||
function checkTimeout() {
|
||||
|
|
Loading…
Reference in New Issue