Skip to content

Commit

Permalink
Merge branch 'next' into avoid-not-opened-module-errors-for-now
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBab committed Oct 17, 2021
2 parents 04404ad + c28aa6f commit 7091611
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/freenet/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ public String[] getPossibleValues() {
private String storeType;
private boolean storeUseSlotFilters;
private boolean storeSaltHashResizeOnStart;

private int storeSaltHashSlotFilterPersistenceTime;

/** Minimum total datastore size */
static final long MIN_STORE_SIZE = 32 * 1024 * 1024;
/** Default datastore size (must be at least MIN_STORE_SIZE) */
Expand Down Expand Up @@ -2028,20 +2029,21 @@ public void set(Boolean val) throws InvalidConfigValueException,

@Override
public Integer get() {
return ResizablePersistentIntBuffer.getPersistenceTime();
return storeSaltHashSlotFilterPersistenceTime;
}

@Override
public void set(Integer val)
throws InvalidConfigValueException,
NodeNeedRestartException {
if(val >= -1)
throws InvalidConfigValueException {
if(val >= -1) {
ResizablePersistentIntBuffer.setPersistenceTime(val);
else
storeSaltHashSlotFilterPersistenceTime = val;
} else
throw new InvalidConfigValueException(l10n("slotFilterPersistenceTimeError"));
}

}, false);
storeSaltHashSlotFilterPersistenceTime = nodeConfig.getInt("storeSaltHashSlotFilterPersistenceTime");

nodeConfig.register("storeSaltHashResizeOnStart", false, sortOrder++, true, false,
"Node.storeSaltHashResizeOnStart", "Node.storeSaltHashResizeOnStartLong", new BooleanCallback() {
Expand Down
12 changes: 11 additions & 1 deletion src/freenet/support/io/SkipShieldingInputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ public SkipShieldingInputStream(InputStream in) {

@Override
public long skip(long n) throws IOException {
return n < 0 ? 0 : read(SKIP_BUFFER, 0, (int) Math.min(n, SKIP_BUFFER_SIZE));
int retval;
if (n < 0) {
retval = 0;
}
else {
retval = read(SKIP_BUFFER, 0, (int) Math.min(n, SKIP_BUFFER_SIZE));
if (retval < 0) {
retval = 0;
}
}
return retval;
}
}

0 comments on commit 7091611

Please sign in to comment.