forked from I2P_Developers/i2p.i2p
* EepGet command line: Fix byte counts after a failed resume
* UpdateHandler: Cleanup, clarify failure message
This commit is contained in:
@ -121,7 +121,6 @@ public class UpdateHandler {
|
|||||||
try {
|
try {
|
||||||
proxyPort = Integer.parseInt(port);
|
proxyPort = Integer.parseInt(port);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -135,7 +134,6 @@ public class UpdateHandler {
|
|||||||
get.fetch();
|
get.fetch();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
_context.logManager().getLog(UpdateHandler.class).error("Error updating", t);
|
_context.logManager().getLog(UpdateHandler.class).error("Error updating", t);
|
||||||
System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,15 +174,14 @@ public class UpdateHandler {
|
|||||||
err = err + " from " + url;
|
err = err + " from " + url;
|
||||||
_log.log(Log.CRIT, err);
|
_log.log(Log.CRIT, err);
|
||||||
_status = "<b>" + err + "</b>";
|
_status = "<b>" + err + "</b>";
|
||||||
System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||||
_log.log(Log.CRIT, "Update from " + url + " did not download completely (" + bytesTransferred + " with "
|
// don't display bytesTransferred as it is meaningless
|
||||||
+ bytesRemaining + " after " + currentAttempt + " tries)");
|
_log.log(Log.CRIT, "Update from " + url + " did not download completely (" +
|
||||||
|
bytesRemaining + " remaining after " + currentAttempt + " tries)");
|
||||||
|
|
||||||
_status = "<b>Transfer failed</b>";
|
_status = "<b>Transfer failed</b>";
|
||||||
System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
|
|
||||||
}
|
}
|
||||||
public void headerReceived(String url, int attemptNum, String key, String val) {}
|
public void headerReceived(String url, int attemptNum, String key, String val) {}
|
||||||
public void attempting(String url) {}
|
public void attempting(String url) {}
|
||||||
|
@ -214,12 +214,17 @@ public class EepGet {
|
|||||||
public static interface StatusListener {
|
public static interface StatusListener {
|
||||||
/**
|
/**
|
||||||
* alreadyTransferred - total of all attempts, not including currentWrite
|
* alreadyTransferred - total of all attempts, not including currentWrite
|
||||||
* If nonzero on the first call, a partial file of that length was found
|
* If nonzero on the first call, a partial file of that length was found,
|
||||||
|
* _and_ the server supports resume.
|
||||||
|
* If zero on a subsequent call after some bytes are transferred
|
||||||
|
* (and presumably after an attemptFailed), the server does _not_
|
||||||
|
* support resume and we had to start over.
|
||||||
* To track _actual_ transfer if the output file could already exist,
|
* To track _actual_ transfer if the output file could already exist,
|
||||||
* the listener should keep its own counter,
|
* the listener should keep its own counter,
|
||||||
* or subtract the initial alreadyTransferred value.
|
* or subtract the initial alreadyTransferred value.
|
||||||
|
* And watch out for alreadyTransferred resetting if a resume failed...
|
||||||
* currentWrite - since last call to the listener
|
* currentWrite - since last call to the listener
|
||||||
* bytesTransferred - includes headers, retries, redirects, ...
|
* bytesTransferred - includes headers, retries, redirects, discarded partial downloads, ...
|
||||||
* bytesRemaining - on this attempt only, currentWrite already subtracted -
|
* bytesRemaining - on this attempt only, currentWrite already subtracted -
|
||||||
* or -1 if chunked encoding or server does not return a length
|
* or -1 if chunked encoding or server does not return a length
|
||||||
*
|
*
|
||||||
@ -239,6 +244,7 @@ public class EepGet {
|
|||||||
private long _startedOn;
|
private long _startedOn;
|
||||||
private long _written;
|
private long _written;
|
||||||
private long _previousWritten;
|
private long _previousWritten;
|
||||||
|
private long _discarded;
|
||||||
private long _lastComplete;
|
private long _lastComplete;
|
||||||
private boolean _firstTime;
|
private boolean _firstTime;
|
||||||
private DecimalFormat _pct = new DecimalFormat("00.0%");
|
private DecimalFormat _pct = new DecimalFormat("00.0%");
|
||||||
@ -251,6 +257,7 @@ public class EepGet {
|
|||||||
_lineSize = lineSize;
|
_lineSize = lineSize;
|
||||||
_written = 0;
|
_written = 0;
|
||||||
_previousWritten = 0;
|
_previousWritten = 0;
|
||||||
|
_discarded = 0;
|
||||||
_lastComplete = _context.clock().now();
|
_lastComplete = _context.clock().now();
|
||||||
_startedOn = _lastComplete;
|
_startedOn = _lastComplete;
|
||||||
_firstTime = true;
|
_firstTime = true;
|
||||||
@ -263,6 +270,12 @@ public class EepGet {
|
|||||||
}
|
}
|
||||||
_firstTime = false;
|
_firstTime = false;
|
||||||
}
|
}
|
||||||
|
if (_written == 0 && alreadyTransferred == 0 && _previousWritten > 0) {
|
||||||
|
// boo
|
||||||
|
System.out.println("Server does not support resume, discarding " + _previousWritten + " bytes");
|
||||||
|
_discarded += _previousWritten;
|
||||||
|
_previousWritten = 0;
|
||||||
|
}
|
||||||
for (int i = 0; i < currentWrite; i++) {
|
for (int i = 0; i < currentWrite; i++) {
|
||||||
_written++;
|
_written++;
|
||||||
if ( (_markSize > 0) && (_written % _markSize == 0) ) {
|
if ( (_markSize > 0) && (_written % _markSize == 0) ) {
|
||||||
@ -318,10 +331,12 @@ public class EepGet {
|
|||||||
} else {
|
} else {
|
||||||
if ( bytesRemaining > 0 ) {
|
if ( bytesRemaining > 0 ) {
|
||||||
System.out.println("== Transfer of " + url + " completed with " + transferred
|
System.out.println("== Transfer of " + url + " completed with " + transferred
|
||||||
+ " transferred and " + (bytesRemaining - bytesTransferred) + " remaining");
|
+ " transferred and " + (bytesRemaining - bytesTransferred) + " remaining" +
|
||||||
|
(_discarded > 0 ? (" and " + _discarded + " bytes discarded") : ""));
|
||||||
} else {
|
} else {
|
||||||
System.out.println("== Transfer of " + url + " completed with " + transferred
|
System.out.println("== Transfer of " + url + " completed with " + transferred
|
||||||
+ " bytes transferred");
|
+ " bytes transferred" +
|
||||||
|
(_discarded > 0 ? (" and " + _discarded + " bytes discarded") : ""));
|
||||||
}
|
}
|
||||||
if (transferred > 0)
|
if (transferred > 0)
|
||||||
System.out.println("== Output saved to " + outputFile + " (" + alreadyTransferred + " bytes)");
|
System.out.println("== Output saved to " + outputFile + " (" + alreadyTransferred + " bytes)");
|
||||||
@ -616,6 +631,8 @@ public class EepGet {
|
|||||||
|
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("rc: " + responseCode + " for " + _actualURL);
|
_log.debug("rc: " + responseCode + " for " + _actualURL);
|
||||||
|
if(_transferFailed)
|
||||||
|
_log.error("Already failed for " + _actualURL);
|
||||||
boolean rcOk = false;
|
boolean rcOk = false;
|
||||||
switch (responseCode) {
|
switch (responseCode) {
|
||||||
case 200: // full
|
case 200: // full
|
||||||
|
11
history.txt
11
history.txt
@ -1,3 +1,14 @@
|
|||||||
|
2008-09-06 zzz
|
||||||
|
* EepGet command line: Fix byte counts after a failed resume
|
||||||
|
* NTCP: Mark unreachable on outbound connection timeout
|
||||||
|
* Shitlist: Fix partial shitlisting (still unused though)
|
||||||
|
* Summary Bar: Warn if firewalled and floodfill
|
||||||
|
* Throttle: Combine current and last bw measurement,
|
||||||
|
reduce default max tunnels to 2500 (was 3000)
|
||||||
|
* Tunnel BuildHandler: Logging cleanup
|
||||||
|
* UpdateHandler: Cleanup, clarify failure message
|
||||||
|
* DataHelper: Prepare for 999 day uptime :)
|
||||||
|
|
||||||
2008-08-29 zzz
|
2008-08-29 zzz
|
||||||
* Tunnel BuildExecutor: Debug cleanup
|
* Tunnel BuildExecutor: Debug cleanup
|
||||||
* Profiles: Penalize capacity when tunnel build request times out
|
* Profiles: Penalize capacity when tunnel build request times out
|
||||||
|
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
|||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
||||||
public final static String VERSION = "0.6.3";
|
public final static String VERSION = "0.6.3";
|
||||||
public final static long BUILD = 2;
|
public final static long BUILD = 3;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user