Author: toad
Date: 2007-06-13 18:37:30 +0000 (Wed, 13 Jun 2007)
New Revision: 13574
Modified:
trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
trunk/freenet/src/freenet/node/updater/NodeUpdater.java
trunk/freenet/src/freenet/node/updater/RevocationChecker.java
Log:
More UOM fixes. It seems to work now.
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
2007-06-13 18:33:23 UTC (rev 13573)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdateManager.java
2007-06-13 18:37:30 UTC (rev 13574)
@@ -77,6 +77,7 @@
private long startedFetchingNextMainJar;
/** If another ext jar is being fetched, when did the fetch start? */
private long startedFetchingNextExtJar;
+ private long gotJarTime;
// Revocation alert
private RevocationKeyFoundUserAlert revocationAlert;
@@ -351,14 +352,17 @@
if(!ignoreRevocation) {
if(now - revocationChecker.lastSucceeded() <
RECENT_REVOCATION_INTERVAL)
return true;
- if(revocationChecker.startedFetch > 0 && now -
revocationChecker.startedFetch >= REVOCATION_FETCH_TIMEOUT)
+ if(gotJarTime > 0 && now - gotJarTime >=
REVOCATION_FETCH_TIMEOUT)
return true;
}
}
if(logMINOR) Logger.minor(this, "Still here in
isReadyToDeployUpdate");
// Apparently everything is ready except the revocation fetch.
So start it.
revocationChecker.start(true);
- if(ignoreRevocation) return true;
+ if(ignoreRevocation) {
+ if(logMINOR) Logger.minor(this, "Returning true because
of ignoreRevocation");
+ return true;
+ }
deployOffThread(WAIT_FOR_SECOND_FETCH_TO_COMPLETE -
startedMillisAgo);
return false;
}
@@ -425,6 +429,9 @@
if(writeJars(ctx))
restart(ctx);
+ else {
+ if(logMINOR) Logger.minor(this, "Did not write jars");
+ }
}
/**
@@ -549,6 +556,8 @@
/** Restart the node. Does not return. */
private void restart(UpdateDeployContext ctx) {
+ if(logMINOR)
+ Logger.minor(this, "Restarting...");
node.getNodeStarter().restart();
try {
Thread.sleep(5*60*1000);
@@ -584,11 +593,13 @@
if(extUpdater.getFetchedVersion() >
ExtVersion.buildNumber) {
hasNewExtJar = true;
startedFetchingNextExtJar = -1;
+ gotJarTime = System.currentTimeMillis();
}
} else {
if(mainUpdater.getFetchedVersion() >
Version.buildNumber()) {
hasNewMainJar = true;
startedFetchingNextMainJar = -1;
+ gotJarTime = System.currentTimeMillis();
}
}
}
@@ -680,7 +691,13 @@
void deployOffThread(long delay) {
node.ps.queueTimedJob(new Runnable() {
public void run() {
- deployUpdate();
+ if(logMINOR) Logger.minor(this, "Running
deployOffThread");
+ try {
+ deployUpdate();
+ } catch (Throwable t) {
+ Logger.error(this, "Caught "+t+" trying
to deployOffThread", t);
+ }
+ if(logMINOR) Logger.minor(this, "Run
deployOffThread");
}
}, delay);
}
Modified: trunk/freenet/src/freenet/node/updater/NodeUpdater.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2007-06-13
18:33:23 UTC (rev 13573)
+++ trunk/freenet/src/freenet/node/updater/NodeUpdater.java 2007-06-13
18:37:30 UTC (rev 13574)
@@ -22,6 +22,7 @@
import freenet.node.Version;
import freenet.support.Logger;
import freenet.support.io.ArrayBucket;
+import freenet.support.io.BucketTools;
import freenet.support.io.FileBucket;
public class NodeUpdater implements ClientCallback, USKCallback {
@@ -160,14 +161,13 @@
fetched = fetchedVersion;
}
synchronized(writeJarSync) {
- ArrayBucket bucket = (ArrayBucket) result.asBucket();
- byte[] data = bucket.toByteArray();
fNew.delete();
FileOutputStream fos;
fos = new FileOutputStream(fNew);
- fos.write(data);
+ BucketTools.copyTo(result.asBucket(), fos, -1);
+
fos.flush();
fos.close();
}
Modified: trunk/freenet/src/freenet/node/updater/RevocationChecker.java
===================================================================
--- trunk/freenet/src/freenet/node/updater/RevocationChecker.java
2007-06-13 18:33:23 UTC (rev 13573)
+++ trunk/freenet/src/freenet/node/updater/RevocationChecker.java
2007-06-13 18:37:30 UTC (rev 13574)
@@ -32,8 +32,6 @@
private FetchContext ctxRevocation;
private ClientGetter revocationGetter;
private boolean wasAggressive;
- /** Last time we started a fetch, or restarted it aggressively */
- long startedFetch;
/** Last time at which we got 3 DNFs on the revocation key */
private long lastSucceeded;
@@ -118,8 +116,6 @@
if(cg != null) {
cg.start();
if(logMINOR) Logger.minor(this, "Started
revocation fetcher");
- if(reset)
- startedFetch =
System.currentTimeMillis();
}
} catch (FetchException e) {
Logger.error(this, "Not able to start the revocation
fetcher.");