I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 76c1f47b authored by zzz's avatar zzz
Browse files

* Profiles: Fix lack of profiles at router startup, especially for new routers

parent ce74e492
No related branches found
No related tags found
No related merge requests found
...@@ -155,6 +155,7 @@ public interface ProfileManager { ...@@ -155,6 +155,7 @@ public interface ProfileManager {
* through an explicit dbStore or in a dbLookupReply * through an explicit dbStore or in a dbLookupReply
*/ */
void heardAbout(Hash peer); void heardAbout(Hash peer);
void heardAbout(Hash peer, long when);
/** /**
* Note that the router received a message from the given peer on the specified * Note that the router received a message from the given peer on the specified
......
...@@ -411,6 +411,10 @@ class PersistentDataStore extends TransientDataStore { ...@@ -411,6 +411,10 @@ class PersistentDataStore extends TransientDataStore {
try { try {
// persist = false so we don't write what we just read // persist = false so we don't write what we just read
_facade.store(ri.getIdentity().getHash(), ri, false); _facade.store(ri.getIdentity().getHash(), ri, false);
// when heardAbout() was removed from TransientDataStore, it broke
// profile bootstrapping for new routers,
// so add it here.
getContext().profileManager().heardAbout(ri.getIdentity().getHash(), ri.getPublished());
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
_log.info("Refused locally loaded routerInfo - deleting"); _log.info("Refused locally loaded routerInfo - deleting");
corrupt = true; corrupt = true;
......
...@@ -311,6 +311,17 @@ public class ProfileManagerImpl implements ProfileManager { ...@@ -311,6 +311,17 @@ public class ProfileManagerImpl implements ProfileManager {
if (data == null) return; if (data == null) return;
data.setLastHeardAbout(_context.clock().now()); data.setLastHeardAbout(_context.clock().now());
} }
/**
* Note that the local router received a reference to the given peer
* at a certain time. Only update the time if newer.
*/
public void heardAbout(Hash peer, long when) {
PeerProfile data = getProfile(peer);
if (data == null) return;
if (when > data.getLastHeardAbout())
data.setLastHeardAbout(when);
}
/** /**
* Note that the router received a message from the given peer on the specified * Note that the router received a message from the given peer on the specified
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment