forked from I2P_Developers/i2p.i2p
Profiles: Fixes for firstHeardAbout and/or lastHeardAbout being zero
This commit is contained in:
@ -269,7 +269,7 @@ public class PeerProfile {
|
||||
* Also sets FirstHeardAbout if earlier
|
||||
*/
|
||||
public synchronized void setLastHeardAbout(long when) {
|
||||
if (_lastHeardAbout <= 0 || when > _lastHeardAbout)
|
||||
if (when > _lastHeardAbout)
|
||||
_lastHeardAbout = when;
|
||||
// this is called by netdb PersistentDataStore, so fixup first heard
|
||||
if (when < _firstHeardAbout)
|
||||
|
@ -364,6 +364,7 @@ public class ProfileManagerImpl implements ProfileManager {
|
||||
PeerProfile prof = _context.profileOrganizer().getProfile(peer);
|
||||
if (prof == null) {
|
||||
prof = new PeerProfile(_context, peer);
|
||||
prof.setLastHeardAbout(prof.getFirstHeardAbout());
|
||||
_context.profileOrganizer().addProfile(prof);
|
||||
}
|
||||
return prof;
|
||||
|
@ -218,6 +218,7 @@ public class ProfileOrganizer {
|
||||
if (rv != null)
|
||||
return rv;
|
||||
rv = new PeerProfile(_context, peer);
|
||||
rv.setLastHeardAbout(rv.getFirstHeardAbout());
|
||||
rv.coalesceStats();
|
||||
if (!tryWriteLock())
|
||||
return null;
|
||||
|
@ -325,8 +325,14 @@ class ProfilePersistenceHelper {
|
||||
profile.setIntegrationBonus((int) getLong(props, "integrationBonus"));
|
||||
profile.setSpeedBonus((int) getLong(props, "speedBonus"));
|
||||
|
||||
profile.setLastHeardAbout(getLong(props, "lastHeardAbout"));
|
||||
profile.setFirstHeardAbout(getLong(props, "firstHeardAbout"));
|
||||
long fh = getLong(props, "firstHeardAbout");
|
||||
if (fh <= 0)
|
||||
fh = file.lastModified();
|
||||
profile.setFirstHeardAbout(fh);
|
||||
long lh = getLong(props, "lastHeardAbout");
|
||||
if (lh <= 0)
|
||||
lh = fh;
|
||||
profile.setLastHeardAbout(lh);
|
||||
profile.setLastSendSuccessful(getLong(props, "lastSentToSuccessfully"));
|
||||
profile.setLastSendFailed(getLong(props, "lastFailedSend"));
|
||||
profile.setLastHeardFrom(getLong(props, "lastHeardFrom"));
|
||||
|
Reference in New Issue
Block a user