|
|
@ -1,7 +1,7 @@
|
|
|
|
/* global setTimeout, clearTimeout */
|
|
|
|
/* global setTimeout, clearTimeout */
|
|
|
|
|
|
|
|
|
|
|
|
const EventEmitter = require('events');
|
|
|
|
const EventEmitter = require('events');
|
|
|
|
const { isEmpty } = require('lodash')
|
|
|
|
const { isEmpty } = require('lodash');
|
|
|
|
|
|
|
|
|
|
|
|
const offlinePingTime = 2 * 60 * 1000; // 2 minutes
|
|
|
|
const offlinePingTime = 2 * 60 * 1000; // 2 minutes
|
|
|
|
|
|
|
|
|
|
|
@ -39,9 +39,10 @@ class LokiP2pAPI extends EventEmitter {
|
|
|
|
isOnline: false,
|
|
|
|
isOnline: false,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const contactExists = isEmpty(baseDetails)
|
|
|
|
const contactExists = isEmpty(baseDetails);
|
|
|
|
const { isOnline } = baseDetails;
|
|
|
|
const { isOnline } = baseDetails;
|
|
|
|
const detailsChanged = baseDetails.address !== address || baseDetails.port !== port
|
|
|
|
const detailsChanged =
|
|
|
|
|
|
|
|
baseDetails.address !== address || baseDetails.port !== port;
|
|
|
|
|
|
|
|
|
|
|
|
// If we had the contact details
|
|
|
|
// If we had the contact details
|
|
|
|
// And we got a P2P message
|
|
|
|
// And we got a P2P message
|
|
|
@ -52,7 +53,7 @@ class LokiP2pAPI extends EventEmitter {
|
|
|
|
// We also need to set the current contact details to show online
|
|
|
|
// We also need to set the current contact details to show online
|
|
|
|
// because they get reset to `false` above
|
|
|
|
// because they get reset to `false` above
|
|
|
|
this.setContactOnline(pubKey);
|
|
|
|
this.setContactOnline(pubKey);
|
|
|
|
return
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|