hope i have fixed that bug, where the "download $version" kept showing, while already having downloaded it

This commit is contained in:
dev
2009-04-21 20:17:07 +00:00
parent 311ec4eb54
commit e126233fbc
2 changed files with 14 additions and 2 deletions

View File

@ -92,14 +92,25 @@ public class UpdateHandler {
return _updateRunner.getStatus(); return _updateRunner.getStatus();
} }
public boolean isDone() {
if(this._updateRunner == null)
return true;
return this._updateRunner.isDone();
}
public class UpdateRunner implements Runnable, EepGet.StatusListener { public class UpdateRunner implements Runnable, EepGet.StatusListener {
protected boolean _isRunning; protected boolean _isRunning;
protected boolean done;
protected String _status; protected String _status;
public UpdateRunner() { public UpdateRunner() {
_isRunning = false; _isRunning = false;
this.done = false;
_status = "<b>Updating</b>"; _status = "<b>Updating</b>";
} }
public boolean isRunning() { return _isRunning; } public boolean isRunning() { return _isRunning; }
public boolean isDone() {
return this.done;
}
public String getStatus() { return _status; } public String getStatus() { return _status; }
public void run() { public void run() {
_isRunning = true; _isRunning = true;
@ -159,6 +170,7 @@ public class UpdateHandler {
f.delete(); f.delete();
if (err == null) { if (err == null) {
String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY); String policy = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_POLICY);
this.done = true;
if ("install".equals(policy)) { if ("install".equals(policy)) {
_log.log(Log.CRIT, "Update was VERIFIED, restarting to install it"); _log.log(Log.CRIT, "Update was VERIFIED, restarting to install it");
_status = "<b>Update verified</b><br />Restarting"; _status = "<b>Update verified</b><br />Restarting";

View File

@ -25,7 +25,7 @@
// display all the time so we display the final failure message // display all the time so we display the final failure message
out.print("<br />" + update.getStatus()); out.print("<br />" + update.getStatus());
if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) { if ("true".equals(System.getProperty("net.i2p.router.web.UpdateHandler.updateInProgress", "false"))) {
} else { } else if(!update.isDone()) {
long nonce = new java.util.Random().nextLong(); long nonce = new java.util.Random().nextLong();
String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce"); String prev = System.getProperty("net.i2p.router.web.UpdateHandler.nonce");
if (prev != null) System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev); if (prev != null) System.setProperty("net.i2p.router.web.UpdateHandler.noncePrev", prev);