Changeset 9a2792e


Ignore:
Timestamp:
Sep 6, 2008 1:52:46 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2ac5361
Parents:
1091a28
Message:
  • EepGet? command line: Fix byte counts after a failed resume
  • UpdateHandler?: Cleanup, clarify failure message
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/UpdateHandler.java

    r1091a28 r9a2792e  
    122122                proxyPort = Integer.parseInt(port);
    123123            } catch (NumberFormatException nfe) {
    124                 System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
    125124                return;
    126125            }
     
    136135            } catch (Throwable t) {
    137136                _context.logManager().getLog(UpdateHandler.class).error("Error updating", t);
    138                 System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
    139137            }
    140138        }
     
    177175                _log.log(Log.CRIT, err);
    178176                _status = "<b>" + err + "</b>";
    179                 System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
    180177            }
    181178        }
    182179        public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
    183             _log.log(Log.CRIT, "Update from " + url + " did not download completely (" + bytesTransferred + " with "
    184                                + bytesRemaining + " after " + currentAttempt + " tries)");
     180            // don't display bytesTransferred as it is meaningless
     181            _log.log(Log.CRIT, "Update from " + url + " did not download completely (" +
     182                               bytesRemaining + " remaining after " + currentAttempt + " tries)");
    185183
    186184            _status = "<b>Transfer failed</b>";
    187             System.setProperty(PROP_UPDATE_IN_PROGRESS, "false");
    188185        }
    189186        public void headerReceived(String url, int attemptNum, String key, String val) {}
  • core/java/src/net/i2p/util/EepGet.java

    r1091a28 r9a2792e  
    215215        /**
    216216         *  alreadyTransferred - total of all attempts, not including currentWrite
    217          *                       If nonzero on the first call, a partial file of that length was found
     217         *                       If nonzero on the first call, a partial file of that length was found,
     218         *                       _and_ the server supports resume.
     219         *                       If zero on a subsequent call after some bytes are transferred
     220         *                       (and presumably after an attemptFailed), the server does _not_
     221         *                       support resume and we had to start over.
    218222         *                       To track _actual_ transfer if the output file could already exist,
    219223         *                       the listener should keep its own counter,
    220224         *                       or subtract the initial alreadyTransferred value.
     225         *                       And watch out for alreadyTransferred resetting if a resume failed...
    221226         *  currentWrite - since last call to the listener
    222          *  bytesTransferred - includes headers, retries, redirects, ...
     227         *  bytesTransferred - includes headers, retries, redirects, discarded partial downloads, ...
    223228         *  bytesRemaining - on this attempt only, currentWrite already subtracted -
    224229         *                   or -1 if chunked encoding or server does not return a length
     
    240245        private long _written;
    241246        private long _previousWritten;
     247        private long _discarded;
    242248        private long _lastComplete;
    243249        private boolean _firstTime;
     
    252258            _written = 0;
    253259            _previousWritten = 0;
     260            _discarded = 0;
    254261            _lastComplete = _context.clock().now();
    255262            _startedOn = _lastComplete;
     
    263270                }
    264271                _firstTime = false;
     272            }
     273            if (_written == 0 && alreadyTransferred == 0 && _previousWritten > 0) {
     274                // boo
     275                System.out.println("Server does not support resume, discarding " + _previousWritten + " bytes");
     276                _discarded += _previousWritten;
     277                _previousWritten = 0;
    265278            }
    266279            for (int i = 0; i < currentWrite; i++) {
     
    319332                if ( bytesRemaining > 0 ) {
    320333                    System.out.println("== Transfer of " + url + " completed with " + transferred
    321                             + " transferred and " + (bytesRemaining - bytesTransferred) + " remaining");
     334                            + " transferred and " + (bytesRemaining - bytesTransferred) + " remaining" +
     335                            (_discarded > 0 ? (" and " + _discarded + " bytes discarded") : ""));
    322336                } else {
    323337                    System.out.println("== Transfer of " + url + " completed with " + transferred
    324                             + " bytes transferred");
     338                            + " bytes transferred" +
     339                            (_discarded > 0 ? (" and " + _discarded + " bytes discarded") : ""));
    325340                }
    326341                if (transferred > 0)
     
    617632        if (_log.shouldLog(Log.DEBUG))
    618633            _log.debug("rc: " + responseCode + " for " + _actualURL);
     634        if(_transferFailed)
     635            _log.error("Already failed for " + _actualURL);
    619636        boolean rcOk = false;
    620637        switch (responseCode) {
  • history.txt

    r1091a28 r9a2792e  
     12008-09-06 zzz
     2    * EepGet command line: Fix byte counts after a failed resume
     3    * NTCP: Mark unreachable on outbound connection timeout
     4    * Shitlist: Fix partial shitlisting (still unused though)
     5    * Summary Bar: Warn if firewalled and floodfill
     6    * Throttle: Combine current and last bw measurement,
     7      reduce default max tunnels to 2500 (was 3000)
     8    * Tunnel BuildHandler: Logging cleanup
     9    * UpdateHandler: Cleanup, clarify failure message
     10    * DataHelper: Prepare for 999 day uptime :)
     11
    1122008-08-29 zzz
    213    * Tunnel BuildExecutor: Debug cleanup
  • router/java/src/net/i2p/router/RouterVersion.java

    r1091a28 r9a2792e  
    1818    public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
    1919    public final static String VERSION = "0.6.3";
    20     public final static long BUILD = 2;
     20    public final static long BUILD = 3;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
Note: See TracChangeset for help on using the changeset viewer.