- Only store LS with more than 6 leases to routers that support it

This commit is contained in:
zzz
2014-01-28 22:35:33 +00:00
parent 28575dbdae
commit ec22a1dafc

View File

@ -171,6 +171,12 @@ class StoreJob extends JobImpl {
if (_log.shouldLog(Log.INFO))
_log.info(getJobId() + ": Skipping router that doesn't support key certs " + peer + " : " + ds);
_state.addSkipped(peer);
} else if (_state.getData().getType() == DatabaseEntry.KEY_TYPE_LEASESET &&
((LeaseSet)_state.getData()).getLeaseCount() > 6 &&
!supportsBigLeaseSets((RouterInfo)ds)) {
if (_log.shouldLog(Log.INFO))
_log.info(getJobId() + ": Skipping router that doesn't support big leasesets " + peer + " : " + ds);
_state.addSkipped(peer);
} else {
int peerTimeout = _facade.getPeerTimeout(peer);
@ -508,6 +514,19 @@ class StoreJob extends JobImpl {
return VersionComparator.comp(v, MIN_KEYCERT_VERSION) >= 0;
}
private static final String MIN_BIGLEASESET_VERSION = "0.9";
/**
* Does he support more than 6 leasesets?
* @since 0.9.11
*/
private static boolean supportsBigLeaseSets(RouterInfo ri) {
String v = ri.getOption("router.version");
if (v == null)
return false;
return VersionComparator.comp(v, MIN_BIGLEASESET_VERSION) >= 0;
}
/**
* Called after sending a dbStore to a peer successfully,
* marking the store as successful