Changes in / [44c0d93:50450ec]


Ignore:
Files:
26 added
198 edited

Legend:

Unmodified
Added
Removed
  • .tx/config

    r44c0d93 r50450ec  
    393393trans.zh_CN = apps/ministreaming/locale/messages_zh.po
    394394
     395[I2P.manpages]
     396type = PO
     397source_file = installer/resources/locale-man/man.pot
     398source_lang = en
     399; after adding languages here, add to debian/*.manpages also
     400trans.de = installer/resources/locale-man/man_de.po
     401trans.es = installer/resources/locale-man/man_es.po
     402trans.fr = installer/resources/locale-man/man_fr.po
     403trans.it = installer/resources/locale-man/man_it.po
     404trans.zh_CN = installer/resources/locale-man/man_zh.po
     405
    395406[main]
    396407host = https://www.transifex.com
  • README.md

    r44c0d93 r50450ec  
    1 Just to trigger automatic builds of docker image.
     1Prerequisites to build from source:
     2        Java SDK (preferably Oracle/Sun or OpenJDK) 1.7.0 or higher
     3          Non-linux operating systems and JVMs: See https://trac.i2p2.de/wiki/java
     4          Certain subsystems for embedded (core, router, mstreaming, streaming, i2ptunnel) require only Java 1.6
     5        Apache Ant 1.7.0 or higher
     6        The xgettext, msgfmt, and msgmerge tools installed
     7          from the GNU gettext package http://www.gnu.org/software/gettext/
     8        Build environment must use a UTF-8 locale.
    29
    3 Sorry for the mess in the root directory.
     10To build:
     11        On x86 systems do:
     12                ant pkg
    413
    5 TODO: Change content :)
     14        On non-x86, use one of the following instead:
     15                ant installer-linux
     16                ant installer-freebsd
     17                ant installer-osx
    618
    7 (hub.docker.io requires a Dockerfile + README.md in root, to build from a repo)
     19        Run 'ant' with no arguments to see other build options.
     20        See INSTALL.txt or https://geti2p.net/download for installation instructions.
    821
     22Documentation:
     23        https://geti2p.net/how
     24        API: http://docs.i2p-projekt.de/javadoc/
     25             or run 'ant javadoc' then start at build/javadoc/index.html
     26
     27Latest release:
     28        https://geti2p.net/download
     29
     30To get development branch from source control:
     31        https://geti2p.net/newdevelopers
     32
     33FAQ:
     34        https://geti2p.net/faq
     35
     36Need help?
     37        IRC irc.freenode.net #i2p
     38        http://forum.i2p/
     39
     40Bug reports:
     41        https://trac.i2p2.de/report/1
     42
     43Contact information, security issues, press inquiries:
     44        https://geti2p.net/en/contact
     45
     46Twitter:
     47        @i2p, @geti2p
     48
     49Licenses:
     50        See LICENSE.txt
     51
  • apps/BOB/src/net/i2p/BOB/BOB.java

    r44c0d93 r50450ec  
    156156         *  @param mgr may be null
    157157         *  @param args non-null
    158          *  @throws Exception on bad args
    159158         *  @since 0.9.10
    160159         */
  • apps/BOB/src/net/i2p/BOB/I2PtoTCP.java

    r44c0d93 r50450ec  
    2626
    2727/**
    28  * Process I2P->TCP
     28 * Process I2P->TCP
    2929 *
    3030 * @author sponge
  • apps/BOB/src/net/i2p/BOB/TCPtoI2P.java

    r44c0d93 r50450ec  
    3636/**
    3737 *
    38  * Process TCP->I2P
     38 * Process TCP->I2P
    3939 *
    4040 * @author sponge
  • apps/i2psnark/java/src/org/klomp/snark/BitField.java

    r44c0d93 r50450ec  
    4949   * Extra bytes will be ignored.
    5050   *
    51    * @exception ArrayOutOfBoundsException if give byte array is not large
     51   * @throws IndexOutOfBoundsException if give byte array is not large
    5252   * enough.
    5353   */
     
    9191   * Sets the given bit to true.
    9292   *
    93    * @exception IndexOutOfBoundsException if bit is smaller then zero
     93   * @throws IndexOutOfBoundsException if bit is smaller then zero
    9494   * bigger then size (inclusive).
    9595   */
     
    111111   * Sets the given bit to false.
    112112   *
    113    * @exception IndexOutOfBoundsException if bit is smaller then zero
     113   * @throws IndexOutOfBoundsException if bit is smaller then zero
    114114   * bigger then size (inclusive).
    115115   * @since 0.9.22
     
    142142   * Return true if the bit is set or false if it is not.
    143143   *
    144    * @exception IndexOutOfBoundsException if bit is smaller then zero
     144   * @throws IndexOutOfBoundsException if bit is smaller then zero
    145145   * bigger then size (inclusive).
    146146   */
  • apps/i2psnark/java/src/org/klomp/snark/I2PSnarkUtil.java

    r44c0d93 r50450ec  
    358358
    359359    /**
    360      * @param retries if < 0, set timeout to a few seconds
     360     * @param retries if &lt; 0, set timeout to a few seconds
    361361     */
    362362    public File get(String url, int retries) { return get(url, true, retries); }
    363363
    364364    /**
    365      * @param retries if < 0, set timeout to a few seconds
     365     * @param retries if &lt; 0, set timeout to a few seconds
    366366     */
    367367    public File get(String url, boolean rewrite, int retries) {
     
    414414    /**
    415415     * Fetch to memory
    416      * @param retries if < 0, set timeout to a few seconds
     416     * @param retries if &lt; 0, set timeout to a few seconds
    417417     * @param initialSize buffer size
    418418     * @param maxSize fails if greater
     
    660660     *  @param s string to be translated containing {0}
    661661     *    The {0} will be replaced by the parameter.
    662      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     662     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    663663     *  @param o parameter, not translated.
    664664     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • apps/i2psnark/java/src/org/klomp/snark/MagnetState.java

    r44c0d93 r50450ec  
    162162    /**
    163163     *  @return true if this was the last piece
    164      *  @throws NPE, IllegalArgumentException, IOException, ...
     164     *  @throws NullPointerException IllegalArgumentException, IOException, ...
    165165     */
    166166    public boolean saveChunk(int chunk, byte[] data, int off, int length) throws Exception {
     
    186186    /**
    187187     *  @return true if this was the last piece
    188      *  @throws NPE, IllegalArgumentException, IOException, ...
     188     *  @throws NullPointerException IllegalArgumentException, IOException, ...
    189189     */
    190190    private MetaInfo buildMetaInfo() throws Exception {
  • apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java

    r44c0d93 r50450ec  
    465465   * except for the last one (<code>getPieces()-1</code>).
    466466   *
    467    * @exception IndexOutOfBoundsException when piece is equal to or
     467   * @throws IndexOutOfBoundsException when piece is equal to or
    468468   * greater then the number of pieces in the torrent.
    469469   */
  • apps/i2psnark/java/src/org/klomp/snark/Peer.java

    r44c0d93 r50450ec  
    116116   *
    117117   * @param metainfo null if in magnet mode
    118    * @exception IOException when an error occurred during the handshake.
     118   * @throws IOException when an error occurred during the handshake.
    119119   */
    120120  public Peer(final I2PSocket sock, InputStream in, OutputStream out, byte[] my_id, byte[] infohash, MetaInfo metainfo)
  • apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java

    r44c0d93 r50450ec  
    386386  /**
    387387   *  Inbound.
    388    *  Not halted, peers < max.
     388   *  Not halted, peers &lt; max.
    389389   *  @since 0.9.1
    390390   */
     
    396396  /**
    397397   *  Outbound.
    398    *  Not halted, peers < max, and need pieces.
     398   *  Not halted, peers &lt; max, and need pieces.
    399399   *  @since 0.9.1
    400400   */
  • apps/i2psnark/java/src/org/klomp/snark/Snark.java

    r44c0d93 r50450ec  
    213213***********/
    214214
     215  /** max connections */
    215216  public static final String PROP_MAX_CONNECTIONS = "i2psnark.maxConnections";
    216217
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    r44c0d93 r50450ec  
    4343import net.i2p.util.SimpleTimer;
    4444import net.i2p.util.SimpleTimer2;
     45import net.i2p.util.SystemVersion;
    4546import net.i2p.util.Translate;
    4647
     
    303304     */
    304305    public void stop() {
     306        if (_log.shouldWarn())
     307            _log.warn("Snark stop() begin", new Exception("I did it"));
    305308        if (_umgr != null && _uhandler != null) {
    306309            //_uhandler.shutdown();
     
    313316        _idleChecker.cancel();
    314317        stopAllTorrents(true);
     318        if (_log.shouldWarn())
     319            _log.warn("Snark stop() end");
    315320    }
    316321   
     
    325330    /**
    326331     *  Use if it does not include a link.
    327      *  Escapes '<' and '>' before queueing
     332     *  Escapes '&lt;' and '&gt;' before queueing
    328333     */
    329334    public void addMessage(String message) {
     
    333338    /**
    334339     * Use if it includes a link.
    335      * Does not escape '<' and '>' before queueing
     340     * Does not escape '&lt;' and '&gt;' before queueing
    336341     * @since 0.9.14.1
    337342     */
     
    25592564     * Stop all running torrents, and close the tunnel after a delay
    25602565     * to allow for announces.
    2561      * If called at router shutdown via Jetty shutdown hook -> webapp destroy() -> stop(),
     2566     * If called at router shutdown via Jetty shutdown hook -&gt; webapp destroy() -&gt; stop(),
    25622567     * the tunnel won't actually be closed as the SimpleTimer2 is already shutdown
    25632568     * or will be soon, so we delay a few seconds inline.
     
    25812586                // Throttle since every unannounce is now threaded.
    25822587                // How to do this without creating a ton of threads?
    2583                 try { Thread.sleep(20); } catch (InterruptedException ie) {}
     2588                if (count % 8 == 0) {
     2589                    try { Thread.sleep(20); } catch (InterruptedException ie) {}
     2590                }
    25842591            }
    25852592        }
     
    25942601                addMessage(_t("Closing I2P tunnel after notifying trackers."));
    25952602                if (finalShutdown) {
    2596                     try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
     2603                    long toWait = 5*1000;
     2604                    if (SystemVersion.isARM())
     2605                        toWait *= 2;
     2606                    try { Thread.sleep(toWait); } catch (InterruptedException ie) {}
    25972607                }
     2608                _util.disconnect();
    25982609            } else {
    25992610                _util.disconnect();
  • apps/i2psnark/java/src/org/klomp/snark/Storage.java

    r44c0d93 r50450ec  
    437437   *  (which calls getPiecePriorities()) after calling this.
    438438   *  @param fileIndex as obtained from indexOf
    439    *  @param pri default 0; <0 to disable
     439   *  @param pri default 0; &lt;0 to disable
    440440   *  @since 0.8.1
    441441   */
     
    696696   * Just does an existence check but no length check or data reverification
    697697   *
    698    * @throws IOE on fail
     698   * @throws IOException on fail
    699699   */
    700700  public void reopen() throws IOException
     
    11121112   * @return true if the piece was correct (sha metainfo hash
    11131113   * matches), otherwise false.
    1114    * @exception IOException when some storage related error occurs.
     1114   * @throws IOException when some storage related error occurs.
    11151115   */
    11161116  public boolean putPiece(PartialPiece pp) throws IOException
  • apps/i2psnark/java/src/org/klomp/snark/bencode/BDecoder.java

    r44c0d93 r50450ec  
    103103   * has ended.
    104104   *
    105    * @exception InvalidBEncoding when the stream doesn't start with a
     105   * @throws InvalidBEncodingException when the stream doesn't start with a
    106106   * bencoded value or the stream isn't a bencoded stream at all.
    107    * @exception IOException when somthing bad happens with the stream
     107   * @throws IOException when somthing bad happens with the stream
    108108   * to read from.
    109109   */
  • apps/i2psnark/java/src/org/klomp/snark/dht/DHT.java

    r44c0d93 r50450ec  
    4343     *  @param ih the Info Hash (torrent)
    4444     *  @param max maximum number of peers to return
    45      *  @param maxWait the maximum time to wait (ms) must be > 0
     45     *  @param maxWait the maximum time to wait (ms) must be &gt; 0
    4646     *  @param annMax the number of peers to announce to
    4747     *  @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
     
    8282    /**
    8383     *  Announce to the closest DHT peers.
    84      *  Blocking unless maxWait <= 0
     84     *  Blocking unless maxWait &lt;= 0
    8585     *  Caller should run in a thread.
    8686     *  This also automatically announces ourself to our local tracker.
  • apps/i2psnark/java/src/org/klomp/snark/dht/KRPC.java

    r44c0d93 r50450ec  
    246246     *  @param target the key we are searching for
    247247     *  @param maxNodes how many to contact
    248      *  @param maxWait how long to wait for each to reply (not total) must be > 0
     248     *  @param maxWait how long to wait for each to reply (not total) must be &gt; 0
    249249     *  @param parallel how many outstanding at once (unimplemented, always 1)
    250250     */
     
    327327     *  @param ih the Info Hash (torrent)
    328328     *  @param max maximum number of peers to return
    329      *  @param maxWait the maximum time to wait (ms) must be > 0
     329     *  @param maxWait the maximum time to wait (ms) must be &gt; 0
    330330     *  @param annMax the number of peers to announce to
    331331     *  @param annMaxWait the maximum total time to wait for announces, may be 0 to return immediately without waiting for acks
     
    511511     *  This is NOT iterative - call getPeers() first to get the closest
    512512     *  peers into the local DHT.
    513      *  Blocking unless maxWait <= 0
     513     *  Blocking unless maxWait &lt;= 0
    514514     *  Caller should run in a thread.
    515515     *  This also automatically announces ourself to our local tracker.
     
    545545    /**
    546546     *  Announce to a single DHT peer.
    547      *  Blocking unless maxWait <= 0
     547     *  Blocking unless maxWait &lt;= 0
    548548     *  Caller should run in a thread.
    549549     *  For best results do a getPeers() first so we have a token.
     
    15101510        /**
    15111511         *  Should contain null if getReplyCode is REPLY_PONG.
    1512          *  Should contain List<Hash> if getReplyCode is REPLY_PEERS.
    1513          *  Should contain List<NodeInfo> if getReplyCode is REPLY_NODES.
    1514          *  Should contain String if getReplyCode is > 200.
     1512         *  Should contain List&lt;Hash&gt; if getReplyCode is REPLY_PEERS.
     1513         *  Should contain List&lt;NodeInfo&gt; if getReplyCode is REPLY_NODES.
     1514         *  Should contain String if getReplyCode is &gt; 200.
    15151515         *  @return may be null depending on what happened. Cast to expected type.
    15161516         */
  • apps/i2psnark/java/src/org/klomp/snark/dht/NodeInfo.java

    r44c0d93 r50450ec  
    7878     * @param offset starting at this offset in compactInfo
    7979     * @throws IllegalArgumentException
    80      * @throws AIOOBE
     80     * @throws ArrayIndexOutOfBoundsException
    8181     */
    8282    public NodeInfo(byte[] compactInfo, int offset) {
  • apps/i2psnark/java/src/org/klomp/snark/web/URIUtil.java

    r44c0d93 r50450ec  
    5858    /** Encode a URI path.
    5959     *
    60      *  Somewhat oddly, this encodes all chars >= 0x80 if buf is null, (strict RFC 2396)
     60     *  Somewhat oddly, this encodes all chars &gt;= 0x80 if buf is null, (strict RFC 2396)
    6161     *  but only the control, space, and special chars if buf is non-null.
    6262     *
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnel.java

    r44c0d93 r50450ec  
    560560    /**
    561561     * Run the server pointing at the host and port specified using the private i2p
    562      * destination loaded from the specified file. <p />
     562     * destination loaded from the specified file. <p>
    563563     *
    564564     * Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error)
     
    670670     * Run the HTTP server pointing at the host and port specified using the private i2p
    671671     * destination loaded from the specified file, replacing the HTTP headers
    672      * so that the Host: specified is the one spoofed. <p />
     672     * so that the Host: specified is the one spoofed. <p>
    673673     *
    674674     * Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error)
     
    734734     * destination loaded from the specified file, replacing the HTTP headers
    735735     * so that the Host: specified is the one spoofed. Also runs an HTTP proxy for
    736      * bidirectional communications on the same tunnel destination.<p />
     736     * bidirectional communications on the same tunnel destination.<p>
    737737     *
    738738     * Sets the event "serverTaskId" = Integer(taskId) after the tunnel has been started (or -1 on error)
     
    809809    /**
    810810     * Run the server pointing at the host and port specified using the private i2p
    811      * destination loaded from the given base64 stream. <p />
     811     * destination loaded from the given base64 stream. <p>
    812812     *
    813813     * Deprecated? Why run a server with a private destination?
     
    18221822    /**
    18231823     * Generates a Destination from a name. Now only supports base64
    1824      * names - may support naming servers later. "file:<filename>" is
     1824     * names - may support naming servers later. "file:&lt;filename&gt;" is
    18251825     * also supported, where filename is a file that either contains a
    18261826     * binary Destination structure or the Base64 encoding of that
    18271827     * structure.
    18281828     *
    1829      * Since file:<filename> isn't really used, this method is deprecated,
     1829     * Since file:&lt;filename&gt; isn't really used, this method is deprecated,
    18301830     * just call context.namingService.lookup() directly.
    18311831     * @deprecated Don't use i2ptunnel for lookup! Use I2PAppContext.getGlobalContext().namingService().lookup(name) from i2p.jar
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java

    r44c0d93 r50450ec  
    9494    /**
    9595     * This constructor is used to add a client to an existing socket manager.
    96      * <p/>
     96     * <p>
    9797     * As of 0.9.21 this does NOT open the local socket. You MUST call
    9898     * {@link #startRunning()} for that. The local socket will be opened
     
    120120    /**
    121121     * The main constructor.
    122      * <p/>
     122     * <p>
    123123     * As of 0.9.21 this is fast, and does NOT connect the manager to the router,
    124124     * or open the local socket. You MUST call startRunning() for that.
    125      * <p/>
     125     * <p>
    126126     * (0.9.20 claimed to be fast, but due to a bug it DID connect the manager
    127127     * to the router. It did NOT open the local socket however, so it was still
     
    140140    /**
    141141     * Use this to build a client with a persistent private key.
    142      * <p/>
     142     * <p>
    143143     * As of 0.9.21 this is fast, and does NOT connect the manager to the router,
    144144     * or open the local socket. You MUST call startRunning() for that.
    145      * <p/>
     145     * <p>
    146146     * (0.9.20 claimed to be fast, but due to a bug it DID connect the manager
    147147     * to the router. It did NOT open the local socket however, so it was still
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelConnectClient.java

    r44c0d93 r50450ec  
    1515import net.i2p.I2PAppContext;
    1616import net.i2p.I2PException;
     17import net.i2p.app.ClientApp;
     18import net.i2p.app.ClientAppManager;
     19import net.i2p.app.Outproxy;
    1720import net.i2p.client.streaming.I2PSocket;
    1821import net.i2p.client.streaming.I2PSocketOptions;
     
    3538 *   )
    3639 *
    37  *   (port and protocol are ignored for i2p destinations)
     40 *   (protocol is ignored for i2p destinations)
    3841 *   CONNECT host
    3942 *   CONNECT host protocol
     
    5053 *  INTERNET-DRAFT                                              Ari Luotonen
    5154 *  Expires: September 26, 1997          Netscape Communications Corporation
    52  *  <draft-luotonen-ssl-tunneling-03.txt>                     March 26, 1997
     55 *  draft-luotonen-ssl-tunneling-03.txt                       March 26, 1997
    5356 *                     Tunneling SSL Through a WWW Proxy
    5457 *</pre>
     
    148151        boolean usingWWWProxy = false;
    149152        String currentProxy = null;
     153        // local outproxy plugin
     154        boolean usingInternalOutproxy = false;
     155        Outproxy outproxy = null;
    150156        long requestId = __requestId.incrementAndGet();
    151157        try {
     
    155161            StringBuilder newRequest = new StringBuilder();
    156162            String authorization = null;
     163            int remotePort = 443;
    157164            while (true) {
    158165                // Use this rather than BufferedReader because we can't have readahead,
     
    173180
    174181                    pos = request.indexOf(':');
    175                     if (pos == -1)
     182                    if (pos == -1) {
    176183                       pos = request.indexOf(' ');
     184                    } else {
     185                       int spos = request.indexOf(' ');
     186                       if (spos > 0) {
     187                           try {
     188                               remotePort = Integer.parseInt(request.substring(pos + 1, spos));
     189                           } catch (NumberFormatException nfe) {
     190                               break;
     191                           } catch (IndexOutOfBoundsException ioobe) {
     192                               break;
     193                           }
     194                       }
     195                    }
    177196                    if (pos == -1) {
    178197                        host = request;
     
    186205                        // Destination gets the host name
    187206                        destination = host;
    188                     } else if (host.indexOf('.') != -1) {
    189                         // The request must be forwarded to a outproxy
    190                         currentProxy = selectProxy();
    191                         if (currentProxy == null) {
    192                             if (_log.shouldLog(Log.WARN))
    193                                 _log.warn(getPrefix(requestId) + "Host wants to be outproxied, but we dont have any!");
    194                             writeErrorMessage(ERR_NO_OUTPROXY, out);
    195                             s.close();
    196                             return;
     207                    } else if (host.contains(".") || host.startsWith("[")) {
     208                        if (Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_USE_OUTPROXY_PLUGIN, "true"))) {
     209                            ClientAppManager mgr = _context.clientAppManager();
     210                            if (mgr != null) {
     211                                ClientApp op = mgr.getRegisteredApp(Outproxy.NAME);
     212                                if (op != null) {
     213                                    outproxy = (Outproxy) op;
     214                                    usingInternalOutproxy = true;
     215                                    if (host.startsWith("[")) {
     216                                        host = host.substring(1);
     217                                        if (host.endsWith("]"))
     218                                            host = host.substring(0, host.length() - 1);
     219                                    }
     220                                }
     221                            }
    197222                        }
    198                         destination = currentProxy;
    199                         usingWWWProxy = true;
    200                         newRequest.append("CONNECT ").append(host).append(restofline).append("\r\n"); // HTTP spec
     223                        if (!usingInternalOutproxy) {
     224                            // The request must be forwarded to a outproxy
     225                            currentProxy = selectProxy();
     226                            if (currentProxy == null) {
     227                                if (_log.shouldLog(Log.WARN))
     228                                    _log.warn(getPrefix(requestId) + "Host wants to be outproxied, but we dont have any!");
     229                                writeErrorMessage(ERR_NO_OUTPROXY, out);
     230                                s.close();
     231                                return;
     232                            }
     233                            destination = currentProxy;
     234                            usingWWWProxy = true;
     235                            newRequest.append("CONNECT ").append(host).append(restofline).append("\r\n"); // HTTP spec
     236                         }
    201237                    } else if (host.toLowerCase(Locale.US).equals("localhost")) {
    202238                        writeErrorMessage(ERR_LOCALHOST, out);
     
    209245
    210246                    if (_log.shouldLog(Log.DEBUG)) {
    211                         _log.debug(getPrefix(requestId) + "METHOD:" + method + ":");
    212                         _log.debug(getPrefix(requestId) + "HOST  :" + host + ":");
    213                         _log.debug(getPrefix(requestId) + "REST  :" + restofline + ":");
    214                         _log.debug(getPrefix(requestId) + "DEST  :" + destination + ":");
     247                        _log.debug(getPrefix(requestId) + "METHOD:" + method + ":\n" +
     248                                   "HOST  :" + host + ":\n" +
     249                                   "PORT  :" + remotePort + ":\n" +
     250                                   "REST  :" + restofline + ":\n" +
     251                                   "DEST  :" + destination + ":\n" +
     252                                   "www proxy? " + usingWWWProxy + " internal proxy? " + usingInternalOutproxy);
    215253                    }
    216254                } else if (line.toLowerCase(Locale.US).startsWith("proxy-authorization: ")) {
     
    251289            }
    252290
    253             if (destination == null || method == null || !"CONNECT".equals(method.toUpperCase(Locale.US))) {
     291            if (method == null || !"CONNECT".equals(method.toUpperCase(Locale.US))) {
     292                writeErrorMessage(ERR_BAD_PROTOCOL, out);
     293                s.close();
     294                return;
     295            }
     296           
     297            // no destination, going to outproxy plugin
     298            if (usingInternalOutproxy) {
     299                Socket outSocket = outproxy.connect(host, remotePort);
     300                OnTimeout onTimeout = new OnTimeout(s, s.getOutputStream(), targetRequest, usingWWWProxy, currentProxy, requestId);
     301                byte[] response = SUCCESS_RESPONSE.getBytes("UTF-8");
     302                Thread t = new I2PTunnelOutproxyRunner(s, outSocket, sockLock, null, response, onTimeout);
     303                // we are called from an unlimited thread pool, so run inline
     304                t.run();
     305                return;
     306            }
     307
     308            if (destination == null) {
    254309                writeErrorMessage(ERR_BAD_PROTOCOL, out);
    255310                s.close();
     
    283338            }
    284339
    285             I2PSocket i2ps = createI2PSocket(clientDest, getDefaultOptions());
     340            I2PSocketOptions sktOpts = getDefaultOptions();
     341            if (!usingWWWProxy && remotePort > 0)
     342                sktOpts.setPort(remotePort);
     343            I2PSocket i2ps = createI2PSocket(clientDest, sktOpts);
    286344            byte[] data = null;
    287345            byte[] response = null;
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClient.java

    r44c0d93 r50450ec  
    358358    public static final String PROP_DISABLE_HELPER = "i2ptunnel.httpclient.disableAddressHelper";
    359359    /** @since 0.9.11 */
    360     public static final String PROP_USE_OUTPROXY_PLUGIN = "i2ptunnel.useLocalOutproxy";
    361     /** @since 0.9.11 */
    362360    public static final String PROP_SSL_OUTPROXIES = "i2ptunnel.httpclient.SSLOutproxies";
    363361    /** @since 0.9.14 */
     
    403401            int remotePort = 0;
    404402            String referer = null;
     403            URI origRequestURI = null;
    405404            while((line = reader.readLine(method)) != null) {
    406405                line = line.trim();
     
    435434                        // /eepproxy/foo.i2p/bar/baz.html
    436435                        String subRequest = request.substring("/eepproxy/".length());
    437                         if(subRequest.indexOf("/") == -1) {
    438                             subRequest += "/";
     436                        if(subRequest.indexOf('/') == -1) {
     437                            subRequest += '/';
    439438                        }
    440439                        request = "http://" + subRequest;
     
    479478                    URI requestURI;
    480479                    try {
    481                         requestURI = new URI(request);
     480                        origRequestURI = requestURI = new URI(request);
    482481                        if(requestURI.getRawUserInfo() != null || requestURI.getRawFragment() != null) {
    483482                            // these should never be sent to the proxy in the request line
     
    540539                        // pull the b64 _dest out of the first path element
    541540                        String oldPath = requestURI.getPath().substring(1);
    542                         int slash = oldPath.indexOf("/");
     541                        int slash = oldPath.indexOf('/');
    543542                        if(slash < 0) {
    544543                            slash = oldPath.length();
    545                             oldPath += "/";
     544                            oldPath += '/';
    546545                        }
    547546                        String _dest = oldPath.substring(0, slash);
     
    940939                        referer = line.substring(9);
    941940                        if (!Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_REFERER))) {
    942                             // Shouldn't we be more specific, like accepting in-site referers ?
    943                             //line = "Referer: i2p";
    944                             line = null;
    945                             continue; // completely strip the line
    946                         }
     941                            try {
     942                                // Either strip or rewrite the referer line
     943                                URI refererURI = new URI(referer);
     944                                String refererHost = refererURI.getHost();
     945                                if (refererHost != null) {
     946                                    String origHost = origRequestURI.getHost();
     947                                    if (!refererHost.equals(origHost) ||
     948                                        refererURI.getPort() != origRequestURI.getPort() ||
     949                                        !DataHelper.eq(refererURI.getScheme(), origRequestURI.getScheme())) {
     950                                        line = null;
     951                                        continue; // completely strip the line if everything doesn't match
     952                                    }
     953                                    // Strip to a relative URI, to hide the original host name
     954                                    StringBuilder buf = new StringBuilder();
     955                                    buf.append("Referer: ");
     956                                    String refererPath = refererURI.getRawPath();
     957                                    buf.append(refererPath != null ? refererPath : "/");
     958                                    String refererQuery = refererURI.getRawQuery();
     959                                    if (refererQuery != null)
     960                                        buf.append('?').append(refererQuery);
     961                                    line = buf.toString();
     962                                } // else relative URI, leave in
     963                            } catch (URISyntaxException use) {
     964                                line = null;
     965                                continue; // completely strip the line
     966                            }
     967                        } // else allow
    947968                    } else if(lowercaseLine.startsWith("via: ") &&
    948969                            !Boolean.parseBoolean(getTunnel().getClientOptions().getProperty(PROP_VIA))) {
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPClientBase.java

    r44c0d93 r50450ec  
    6060    private static final long MAX_NONCE_AGE = 60*60*1000L;
    6161    private static final int MAX_NONCE_COUNT = 1024;
     62    /** @since 0.9.11, moved to Base in 0.9.29 */
     63    public static final String PROP_USE_OUTPROXY_PLUGIN = "i2ptunnel.useLocalOutproxy";
    6264
    6365    private static final String ERR_AUTH1 =
     
    487489
    488490    /**
    489      *  foo => errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
     491     *  foo =&gt; errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
    490492     *  or the backup byte array on fail.
    491493     *
     
    502504
    503505    /**
    504      *  foo => errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
     506     *  foo =&gt; errordir/foo-header_xx.ht for lang xx, or errordir/foo-header.ht,
    505507     *  or the backup byte array on fail.
    506508     *
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java

    r44c0d93 r50450ec  
    388388            }
    389389
    390             if (Boolean.parseBoolean(opts.getProperty(OPT_REJECT_REFERER)) &&
    391                 headers.containsKey("Referer")) {
    392                 if (_log.shouldLog(Log.WARN))
    393                     _log.warn("Refusing access from: " +
    394                               Base32.encode(peerHash.getData()) + ".b32.i2p" +
    395                               " with Referer: " + headers.get("Referer").get(0));
    396                 try {
    397                     socket.getOutputStream().write(ERR_INPROXY.getBytes("UTF-8"));
    398                 } catch (IOException ioe) {}
    399                 try {
    400                     socket.close();
    401                 } catch (IOException ioe) {}
    402                 return;
     390            if (Boolean.parseBoolean(opts.getProperty(OPT_REJECT_REFERER))) {
     391                // reject absolute URIs only
     392                List<String> h = headers.get("Referer");
     393                if (h != null) {
     394                    String referer = h.get(0);
     395                    if (referer.length() > 9) {
     396                        // "Referer: "
     397                        referer = referer.substring(9);
     398                        if (referer.startsWith("http://") || referer.startsWith("https://")) {
     399                            if (_log.shouldLog(Log.WARN))
     400                                _log.warn("Refusing access from: " +
     401                                          Base32.encode(peerHash.getData()) + ".b32.i2p" +
     402                                          " with Referer: " + referer);
     403                            try {
     404                                socket.getOutputStream().write(ERR_INPROXY.getBytes("UTF-8"));
     405                            } catch (IOException ioe) {}
     406                            try {
     407                                socket.close();
     408                            } catch (IOException ioe) {}
     409                            return;
     410                        }
     411                    }
     412                }
    403413            }
    404414
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/SSLClientUtil.java

    r44c0d93 r50450ec  
    154154     *  No option prefix allowed.
    155155     *
    156      * @throws IOException; GeneralSecurityExceptions are wrapped in IOE for convenience
     156     * @throws IOException GeneralSecurityExceptions are wrapped in IOE for convenience
    157157     * @return factory, throws on all errors
    158158     */
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/DCCClientManager.java

    r44c0d93 r50450ec  
    1818 *
    1919 *                                            direct conn
    20  *                <---> I2PTunnelDCCServer <--------------->I2PTunnelDCCClient <---->
     20 *                &lt;---&gt; I2PTunnelDCCServer &lt;---------------&gt;I2PTunnelDCCClient &lt;----&gt;
    2121 *   originating                                                                     responding
    2222 *   chat client                                                                     chat client
    23  *        CHAT    ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
    24  *        SEND    ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
    25  *        RESUME  <--- I2PTunnelIRCClient <-- IRC server <-- I2TunnelIRCClient <-----
    26  *        ACCEPT  ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
     23 *        CHAT    ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
     24 *        SEND    ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
     25 *        RESUME  &lt;--- I2PTunnelIRCClient &lt;-- IRC server &lt;-- I2TunnelIRCClient &lt;-----
     26 *        ACCEPT  ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
    2727 *
    2828 * </pre>
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/I2PTunnelDCCServer.java

    r44c0d93 r50450ec  
    2828 *
    2929 *                                            direct conn
    30  *                <---> I2PTunnelDCCServer <--------------->I2PTunnelDCCClient <---->
     30 *                &lt;---&gt; I2PTunnelDCCServer &lt;---------------&gt;I2PTunnelDCCClient &lt;----&gt;
    3131 *   originating                                                                     responding
    3232 *   chat client                                                                     chat client
    33  *        CHAT    ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
    34  *        SEND    ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
    35  *        RESUME  <--- I2PTunnelIRCClient <-- IRC server <-- I2TunnelIRCClient <-----
    36  *        ACCEPT  ---> I2PTunnelIRCClient --> IRC server --> I2TunnelIRCClient ----->
     33 *        CHAT    ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
     34 *        SEND    ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
     35 *        RESUME  &lt;--- I2PTunnelIRCClient &lt;-- IRC server &lt;-- I2TunnelIRCClient &lt;-----
     36 *        ACCEPT  ---&gt; I2PTunnelIRCClient --&gt; IRC server --&gt; I2TunnelIRCClient -----&gt;
    3737 *
    3838 * </pre>
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSServer.java

    r44c0d93 r50450ec  
    1515import net.i2p.app.Outproxy;
    1616import net.i2p.client.streaming.I2PSocket;
    17 import net.i2p.i2ptunnel.I2PTunnelHTTPClient;
     17import net.i2p.i2ptunnel.I2PTunnelHTTPClientBase;
    1818import net.i2p.util.Log;
    1919
     
    9090     */
    9191    private boolean shouldUseOutproxyPlugin() {
    92         return Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN, "true"));
     92        return Boolean.parseBoolean(props.getProperty(I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN, "true"));
    9393    }
    9494
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSUDPPort.java

    r44c0d93 r50450ec  
    1515 *
    1616 * TX:
    17  *   UDPSource -> SOCKSUDPUnwrapper -> ReplyTracker ( -> I2PSink in SOCKSUDPTunnel)
     17 *   UDPSource -&gt; SOCKSUDPUnwrapper -&gt; ReplyTracker ( -&gt; I2PSink in SOCKSUDPTunnel)
    1818 *
    1919 * RX:
    20  *   UDPSink <- SOCKSUDPWrapper ( <- MultiSink <- I2PSource in SOCKSUDPTunnel)
     20 *   UDPSink &lt;- SOCKSUDPWrapper ( &lt;- MultiSink &lt;- I2PSource in SOCKSUDPTunnel)
    2121 *
    2222 * The Unwrapper passes headers to the Wrapper through a cache.
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKSUDPTunnel.java

    r44c0d93 r50450ec  
    1313 *
    1414 * TX:
    15  *   (ReplyTracker in multiple SOCKSUDPPorts -> ) I2PSink
     15 *   (ReplyTracker in multiple SOCKSUDPPorts -&gt; ) I2PSink
    1616 *
    1717 * RX:
    18  *   (SOCKSUDPWrapper in multiple SOCKSUDPPorts <- ) MultiSink <- I2PSource
     18 *   (SOCKSUDPWrapper in multiple SOCKSUDPPorts &lt;- ) MultiSink &lt;- I2PSource
    1919 *
    2020 * The reply from a dest goes to the last SOCKSUDPPort that sent to that dest.
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java

    r44c0d93 r50450ec  
    426426
    427427    /**
    428      *  @param newTunnelType used if tunnel < 0
     428     *  @param newTunnelType used if tunnel &lt; 0
    429429     */
    430430    public int getSigType(int tunnel, String newTunnelType) {
     
    580580     */
    581581    public boolean getUseOutproxyPlugin(int tunnel) {
    582         return getBooleanProperty(tunnel, I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN, true);
     582        return getBooleanProperty(tunnel, I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN, true);
    583583    }
    584584
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/TunnelConfig.java

    r44c0d93 r50450ec  
    250250    /**
    251251     * Controls how other tunnels are checked for access.
    252      * <p/>
     252     * <p>
    253253     * The list used for whitelisting/blacklisting can be set with
    254254     * {@link #setAccessList(String)}.
     
    281281    /**
    282282     * Controls how ephemeral the I2P Destination of a client tunnel is.
    283      * <p/>
     283     * <p>
    284284     * If {@link #setClose(boolean)} is set to false then mode 1 == mode 0.
    285285     *
     
    410410    public void setUseOutproxyPlugin(boolean val) {
    411411        if (val)
    412             _booleanOptions.add(I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN);
    413         else
    414             _booleanOptions.remove(I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN);
     412            _booleanOptions.add(I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN);
     413        else
     414            _booleanOptions.remove(I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN);
    415415    }
    416416   
     
    696696    private static final String _booleanProxyOpts[] = {
    697697        I2PTunnelHTTPClientBase.PROP_OUTPROXY_AUTH,
    698         I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN,
     698        I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN,
    699699        I2PTunnelHTTPClient.PROP_USER_AGENT,
    700700        I2PTunnelHTTPClient.PROP_REFERER,
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java

    r44c0d93 r50450ec  
    184184   
    185185    /**
    186      *  @param newTunnelType used if tunnel < 0
     186     *  @param newTunnelType used if tunnel &lt; 0
    187187     *  @since 0.9.12
    188188     */
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    r44c0d93 r50450ec  
    500500            if (TunnelController.TYPE_HTTP_CLIENT.equals(tun.getType())) {
    501501                Properties opts = tun.getClientOptionProps();
    502                 if (Boolean.parseBoolean(opts.getProperty(I2PTunnelHTTPClient.PROP_USE_OUTPROXY_PLUGIN, "true"))) {
     502                if (Boolean.parseBoolean(opts.getProperty(I2PTunnelHTTPClientBase.PROP_USE_OUTPROXY_PLUGIN, "true"))) {
    503503                    ClientAppManager mgr = _context.clientAppManager();
    504504                    if (mgr != null)
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/Messages.java

    r44c0d93 r50450ec  
    3131     *  @param s string to be translated containing {0}
    3232     *    The {0} will be replaced by the parameter.
    33      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     33     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    3434     *  @param o parameter, not translated.
    3535     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • apps/imagegen/imagegen/webapp/src/main/java/net/i2p/imagegen/IdenticonServlet.java

    r44c0d93 r50450ec  
    2626 * from 16x16 to 512x512 in size.
    2727 *
    28  * <h5>Supported Image Formats</h5>
     28 * <h3>Supported Image Formats</h3>
    2929 * <p>
    3030 * Currently only PNG is supported because <code>javax.imageio</code> package
     
    3232 * reasonable format.
    3333 * </p>
    34  * <h5>Initialization Parameters:</h5>
     34 * <h3>Initialization Parameters:</h3>
    3535 * <blockquote>
    3636 * <dl>
     
    4343 * </dl>
    4444 * </blockquote>
    45  * <h5>Request ParametersP</h5>
     45 * <h3>Request ParametersP</h3>
    4646 * <blockquote>
    4747 * <dl>
  • apps/imagegen/zxing/core/src/main/java/com/google/zxing/EncodeHintType.java

    r44c0d93 r50450ec  
    4141
    4242  /**
    43    * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
     43   * Specifies the matrix shape for Data Matrix (type com.google.zxing.datamatrix.encoder.SymbolShapeHint)
    4444   */
    4545  DATA_MATRIX_SHAPE,
    4646
    4747  /**
    48    * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
     48   * Specifies a minimum barcode size (type Dimension). Only applicable to Data Matrix now.
    4949   *
    5050   * @deprecated use width/height params in
    51    * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
     51   * com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)
    5252   */
    5353  @Deprecated
     
    5555
    5656  /**
    57    * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
     57   * Specifies a maximum barcode size (type Dimension). Only applicable to Data Matrix now.
    5858   *
    5959   * @deprecated without replacement
     
    7777  /**
    7878   * Specifies what compaction mode to use for PDF417 (type
    79    * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
     79   * com.google.zxing.pdf417.encoder.Compaction Compaction or {@link String} value of one of its
    8080   * enum values).
    8181   */
     
    8484  /**
    8585   * Specifies the minimum and maximum number of rows and columns for PDF417 (type
    86    * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
     86   * com.google.zxing.pdf417.encoder.Dimensions Dimensions).
    8787   */
    8888  PDF417_DIMENSIONS,
  • apps/imagegen/zxing/core/src/main/java/com/google/zxing/qrcode/decoder/FormatInformation.java

    r44c0d93 r50450ec  
    2222 *
    2323 * @author Sean Owen
    24  * @see DataMask
     24 * See DataMask
    2525 * @see ErrorCorrectionLevel
    2626 */
  • apps/jetty/java/src/org/mortbay/servlet/MultiPartRequest.java

    r44c0d93 r50450ec  
    3939 * This class decodes the multipart/form-data stream sent by
    4040 * a HTML form that uses a file input item.
     41 * </p>
    4142 *
    42  * <p><h4>Usage</h4>
     43 * <h3>Usage</h3>
    4344 * Each part of the form data is named from the HTML form and
    4445 * is available either via getString(name) or getInputStream(name).
     
    7273     * @param request The request containing a multipart/form-data
    7374     * request
    74      * @exception IOException IOException
     75     * @throws IOException IOException
    7576     */
    7677    public MultiPartRequest(HttpServletRequest request)
  • apps/jetty/java/src/org/mortbay/util/LineInput.java

    r44c0d93 r50450ec  
    114114     * @param bufferSize The buffer size and maximum line length.
    115115     * @param encoding the character encoding to use for readLine methods.
    116      * @exception UnsupportedEncodingException
     116     * @throws UnsupportedEncodingException
    117117     */
    118118    public LineInput(InputStream in, int bufferSize, String encoding)
     
    181181     * characters.
    182182     * @return The line as a String or null for EOF.
    183      * @exception IOException
     183     * @throws IOException
    184184     */
    185185    public synchronized String readLine()
     
    218218     * @param len Maximum length of line.
    219219     * @return The length of the line or -1 for EOF.
    220      * @exception IOException
     220     * @throws IOException
    221221     */
    222222    public int readLine(char[] c,int off,int len)
     
    252252     * @param len Maximum length of line.
    253253     * @return The length of the line or -1 for EOF.
    254      * @exception IOException
     254     * @throws IOException
    255255     */
    256256    public int readLine(byte[] b,int off,int len)
     
    278278     * characters.
    279279     * @return LineBuffer instance or null for EOF.
    280      * @exception IOException
     280     * @throws IOException
    281281     */
    282282    public LineBuffer readLineBuffer()
     
    294294     * @param len Maximum length of a line, or 0 for default
    295295     * @return LineBuffer instance or null for EOF.
    296      * @exception IOException
     296     * @throws IOException
    297297     */
    298298    public LineBuffer readLineBuffer(int len)
  • apps/jrobin/java/src/engine/misc/DeallocationHelper.java

    r44c0d93 r50450ec  
    331331                        // an early access build (Ubuntu)
    332332                        javaVersionElements[0] = javaVersionElements[0].substring(0, indexOfEarlyAccessSuffix);
     333                    } else {
     334                        indexOfEarlyAccessSuffix = javaVersionElements[0].lastIndexOf("-Ubuntu");
     335                        if (indexOfEarlyAccessSuffix != -1) {
     336                            // drops the "-Ubuntu suffix from the major version number for
     337                            // an early access build (Ubuntu)
     338                            javaVersionElements[0] = javaVersionElements[0].substring(0, indexOfEarlyAccessSuffix);
     339                        }
    333340                    }
    334341                }
     
    336343                if (javaVersionElements.length >= 2) {
    337344                    major = Integer.parseInt(javaVersionElements[0]);
    338                     minor = Integer.parseInt(javaVersionElements[1]);
     345                    int min;
     346                    try {
     347                        min = Integer.parseInt(javaVersionElements[1]);
     348                    } catch (NumberFormatException nfe) {
     349                        min = 7;
     350                    }
     351                    minor = min;
    339352                } else {
    340353                    major = 1;
    341                     minor = Integer.parseInt(javaVersionElements[0]);
     354                    int min;
     355                    try {
     356                        min = Integer.parseInt(javaVersionElements[0]);
     357                    } catch (NumberFormatException nfe) {
     358                        min = 7;
     359                    }
     360                    minor = min;
    342361                }
    343362                final String directBufferAttachmentFieldName;
  • apps/jrobin/java/src/org/jrobin/core/jrrd/RRDFile.java

    r44c0d93 r50450ec  
    3131 * to RRD files is not currently supported. As I said, this is a quick hack.
    3232 * Some thought should be put into the overall design of the file IO.
    33  * <p/>
     33 * <p>
    3434 * Currently this can read RRD files that were generated on Solaris (Sparc)
    3535 * and Linux (x86).
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketAddress.java

    r44c0d93 r50450ec  
    2727     *  May take several seconds for b32.
    2828     *  @param host hostname or b64 dest or b32, may have :port appended
    29      *  @throws IllegalArgumentException for port < 0 or port > 65535 or invalid port
     29     *  @throws IllegalArgumentException for port &lt; 0 or port &gt; 65535 or invalid port
    3030     *  @since 0.9.9
    3131     */
     
    5252    /**
    5353     *  Does not do a reverse lookup. Host will be null.
    54      *  @throws IllegalArgumentException for port < 0 or port > 65535
     54     *  @throws IllegalArgumentException for port &lt; 0 or port &gt; 65535
    5555     */
    5656    public I2PSocketAddress(Destination dest, int port) {
     
    6767     *  Does a naming service lookup to resolve the dest.
    6868     *  May take several seconds for b32.
    69      *  @throws IllegalArgumentException for port < 0 or port > 65535
     69     *  @throws IllegalArgumentException for port &lt; 0 or port &gt; 65535
    7070     */
    7171    public I2PSocketAddress(String host, int port) {
     
    7878
    7979    /**
    80      *  @throws IllegalArgumentException for port < 0 or port > 65535
     80     *  @throws IllegalArgumentException for port &lt; 0 or port &gt; 65535
    8181     */
    8282    public static I2PSocketAddress createUnresolved(String host, int port) {
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketException.java

    r44c0d93 r50450ec  
    3333     *  Standard codes from streaming are 512-767, defined here.
    3434     *
    35      *  @param status >= 0 from MessageStatusMessage or SendMessageStatusListener
     35     *  @param status &gt;= 0 from MessageStatusMessage or SendMessageStatusListener
    3636     */
    3737    public I2PSocketException(int status) {
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManager.java

    r44c0d93 r50450ec  
    241241     *  Like connect() but returns a real Socket, and throws only IOE,
    242242     *  for easier porting of apps.
    243      *  @param timeout ms if > 0, forces blocking (disables connectDelay)
     243     *  @param timeout ms if &gt; 0, forces blocking (disables connectDelay)
    244244     *  @since 0.8.4
    245245     */
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketManagerFactory.java

    r44c0d93 r50450ec  
    8181     *
    8282     * @param host I2CP host null to use default, ignored if in router context
    83      * @param port I2CP port <= 0 to use default, ignored if in router context
     83     * @param port I2CP port &lt;= 0 to use default, ignored if in router context
    8484     * @return the newly created socket manager, or null if there were errors
    8585     */
     
    9696     *
    9797     * @param i2cpHost I2CP host null to use default, ignored if in router context
    98      * @param i2cpPort I2CP port <= 0 to use default, ignored if in router context
     98     * @param i2cpPort I2CP port &lt;= 0 to use default, ignored if in router context
    9999     * @param opts Streaming and I2CP options, may be null
    100100     * @return the newly created socket manager, or null if there were errors
     
    158158     *                           or null for a transient destination. Caller must close.
    159159     * @param i2cpHost I2CP host null to use default, ignored if in router context
    160      * @param i2cpPort I2CP port <= 0 to use default, ignored if in router context
     160     * @param i2cpPort I2CP port &lt;= 0 to use default, ignored if in router context
    161161     * @param opts Streaming and I2CP options, may be null
    162162     * @return the newly created socket manager, or null if there were errors
     
    185185     *                           or null for a transient destination. Caller must close.
    186186     * @param i2cpHost I2CP host null to use default, ignored if in router context
    187      * @param i2cpPort I2CP port <= 0 to use default, ignored if in router context
     187     * @param i2cpPort I2CP port &lt;= 0 to use default, ignored if in router context
    188188     * @param opts Streaming and I2CP options, may be null
    189189     * @return the newly created socket manager, non-null (throws on error)
     
    217217     *                           non-null. Caller must close.
    218218     * @param i2cpHost I2CP host null to use default, ignored if in router context
    219      * @param i2cpPort I2CP port <= 0 to use default, ignored if in router context
     219     * @param i2cpPort I2CP port &lt;= 0 to use default, ignored if in router context
    220220     * @param opts Streaming and I2CP options, may be null
    221221     * @param connect true to connect (blocking)
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptions.java

    r44c0d93 r50450ec  
    1919     *
    2020     * Default 60 seconds. Max of 2 minutes enforced in Connection.java,
    21      * and it also interprets <= 0 as default.
     21     * and it also interprets &lt;= 0 as default.
    2222     *
    2323     * @return milliseconds to wait, or -1 if we will wait indefinitely
     
    2929     *
    3030     * Default 60 seconds. Max of 2 minutes enforced in Connection.java,
    31      * and it also interprets <= 0 as default.
     31     * and it also interprets &lt;= 0 as default.
    3232     *
    3333     * @param ms timeout in ms
  • apps/routerconsole/java/src/net/i2p/router/web/FormHandler.java

    r44c0d93 r50450ec  
    1414 * Simple form handler base class - does not depend on servlets or jsp,
    1515 * but instead the subclasses are populated with javabean properties.  e.g.
    16  * <jsp:setProperty name="handler" property="*" />
     16 * &lt;jsp:setProperty name="handler" property="*" /&gt;
    1717 *
    1818 * The form is "processed" after the properties are set and the first output
     
    127127     * Add an error message to display
    128128     * Use if it does not include a link.
    129      * Escapes '<' and '>' before queueing
     129     * Escapes '&lt;' and '&gt;' before queueing
    130130     */
    131131    protected void addFormError(String errorMsg) {
     
    137137     * Add a non-error message to display
    138138     * Use if it does not include a link.
    139      * Escapes '<' and '>' before queueing
     139     * Escapes '&lt;' and '&gt;' before queueing
    140140     */
    141141    protected void addFormNotice(String msg) {
     
    147147     * Add a non-error message to display
    148148     * Use if it includes a link or other formatting.
    149      * Does not escape '<' and '>' before queueing
     149     * Does not escape '&lt;' and '&gt;' before queueing
    150150     * @since 0.9.14.1
    151151     */
     
    158158     * Add an error message to display
    159159     * Use if it includes a link or other formatting.
    160      * Does not escape '<' and '>' before queueing
     160     * Does not escape '&lt;' and '&gt;' before queueing
    161161     * @since 0.9.19
    162162     */
     
    304304     *  @param s string to be translated containing {0}
    305305     *    The {0} will be replaced by the parameter.
    306      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     306     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    307307     *  @param o parameter, not translated.
    308308     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java

    r44c0d93 r50450ec  
    5757   
    5858    /**
    59      *  This must be output in the jsp since <meta> must be in the <head>
     59     *  This must be output in the jsp since *lt;meta&gt; must be in the &lt;head&gt;
    6060     *  @since 0.8.7
    6161     */
  • apps/routerconsole/java/src/net/i2p/router/web/HelperBase.java

    r44c0d93 r50450ec  
    6969     *  @param s string to be translated containing {0}
    7070     *    The {0} will be replaced by the parameter.
    71      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     71     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    7272     *  @param o parameter, not translated.
    7373     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • apps/routerconsole/java/src/net/i2p/router/web/Messages.java

    r44c0d93 r50450ec  
    2323     *  @param s string to be translated containing {0}
    2424     *    The {0} will be replaced by the parameter.
    25      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     25     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    2626     *  @param o parameter, not translated.
    2727     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java

    r44c0d93 r50450ec  
    264264    /**
    265265     *  @return true on success
    266      *  @throws just about anything, caller would be wise to catch Throwable
     266     *  @throws Exception just about anything, caller would be wise to catch Throwable
    267267     */
    268268    @SuppressWarnings("deprecation")
     
    467467    /**
    468468     *  @return true on success
    469      *  @throws just about anything, caller would be wise to catch Throwable
     469     *  @throws Exception just about anything, caller would be wise to catch Throwable
    470470     */
    471471    public static boolean stopPlugin(RouterContext ctx, String appName) throws Exception {
     
    703703    /**
    704704     *  @param action "start" or "stop" or "uninstall"
    705      *  @throws just about anything if an app has a delay less than zero, caller would be wise to catch Throwable
     705     *  @throws Exception just about anything if an app has a delay less than zero, caller would be wise to catch Throwable
    706706     *  If no apps have a delay less than zero, it shouldn't throw anything
    707707     */
  • apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java

    r44c0d93 r50450ec  
    2020import java.util.SortedSet;
    2121import java.util.StringTokenizer;
     22import java.util.Timer;
    2223import java.util.concurrent.LinkedBlockingQueue;
    2324
     
    9697    private volatile ClientAppState _state = UNINITIALIZED;
    9798    private static Server _server;
     99    private static Timer _jettyTimer;
    98100    private String _listenPort;
    99101    private String _listenHost;
     
    236238        portMapper.unregister(PortMapper.SVC_CONSOLE);
    237239        portMapper.unregister(PortMapper.SVC_HTTPS_CONSOLE);
     240        synchronized(RouterConsoleRunner.class) {
     241            if (_jettyTimer != null) {
     242                _jettyTimer.cancel();
     243                _jettyTimer = null;
     244            }
     245        }
    238246        changeState(STOPPED);
    239247    }
     
    274282        // if no permissions, don't even try
    275283        // isLaunchedAsService() always returns true on Linux
    276         if (SystemVersion.isLinuxService() ||
     284        if (GraphicsEnvironment.isHeadless() || SystemVersion.isLinuxService() ||
    277285            (SystemVersion.isWindows() && _context.hasWrapper() && WrapperManager.isLaunchedAsService())) {
    278286            // required true for jrobin to work
     
    286294                                        (sdtg == null && SystemVersion.isWindows());
    287295            if (desktopguiEnabled) {
    288                 //Check if we are in a headless environment, set properties accordingly
    289                 System.setProperty("java.awt.headless", Boolean.toString(GraphicsEnvironment.isHeadless()));
     296                System.setProperty("java.awt.headless", "false");
    290297                net.i2p.desktopgui.Main dtg = new net.i2p.desktopgui.Main(_context, _mgr, null);   
    291298                dtg.startup();
     
    848855            if (userpw.isEmpty()) {
    849856                enable = false;
    850                 ctx.router().saveConfig(PROP_CONSOLE_PW, "false");
     857                ctx.router().saveConfig(PROP_PW_ENABLE, "false");
    851858            } else {
    852859                HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
     
    933940
    934941        context.setSecurityHandler(sec);
    935     }
    936    
     942
     943        // No, we can't share the ConstraintSecurityHandler across all webapps
     944        // But we can force all webapps to use a single Timer thread
     945        // see HashSessionManager javadoc
     946        synchronized(RouterConsoleRunner.class) {
     947            if (_jettyTimer == null) {
     948                _jettyTimer = new Timer("Console HashSessionScavenger", true);
     949            }
     950            context.getServletContext().setAttribute("org.eclipse.jetty.server.session.timer", _jettyTimer);
     951        }
     952    }
     953
    937954    /**
    938955     * For logging authentication failures
  • apps/routerconsole/java/src/net/i2p/router/web/StatSummarizer.java

    r44c0d93 r50450ec  
    3939    // TODO remove static instance
    4040    private static StatSummarizer _instance;
    41     private static final int MAX_CONCURRENT_PNG = 3;
     41    private static final int MAX_CONCURRENT_PNG = SystemVersion.isARM() ? 2 : 3;
    4242    private final Semaphore _sem;
    4343    private volatile boolean _isRunning = true;
  • apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java

    r44c0d93 r50450ec  
    120120**/
    121121   
     122    /** allowReseed */
    122123    public boolean allowReseed() {
    123124        return _context.netDb().isInitialized() &&
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    r44c0d93 r50450ec  
    3838 *  No, wac.addClassPath() does not work. For more info see:
    3939 *
    40  *  http://servlets.com/archive/servlet/ReadMsg?msgId=511113&listName=jetty-support
     40 *  http://servlets.com/archive/servlet/ReadMsg?msgId=511113&amp;listName=jetty-support
    4141 *
    4242 *  @since 0.7.12
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java

    r44c0d93 r50450ec  
    2828 *  No, wac.addClassPath() does not work. For more info see:
    2929 *
    30  *  http://servlets.com/archive/servlet/ReadMsg?msgId=511113&listName=jetty-support
     30 *  http://servlets.com/archive/servlet/ReadMsg?msgId=511113&amp;listName=jetty-support
    3131 *
    3232 *  @since 0.7.12
     
    5252     *  Prior to 0.9.28, was not guaranteed to throw on failure.
    5353     *
    54      *  @throws just about anything, caller would be wise to catch Throwable
     54     *  @throws Exception just about anything, caller would be wise to catch Throwable
    5555     */
    5656    static void startWebApp(RouterContext ctx, ContextHandlerCollection server,
     
    124124
    125125    /**
    126      *  stop it and remove the context
    127      *  @throws just about anything, caller would be wise to catch Throwable
     126     *  Stop it and remove the context.
     127     *  Throws just about anything, caller would be wise to catch Throwable
    128128     */
    129129    static void stopWebApp(String appName) {
  • apps/sam/java/src/net/i2p/sam/MasterSession.java

    r44c0d93 r50450ec  
    5555         * @throws IOException
    5656         * @throws DataFormatException
    57          * @throws I2PSessionException
    5857         */
    5958        public MasterSession(String nick, SAMv3DatagramServer dgServer, SAMv3Handler handler, Properties props)
  • apps/sam/java/src/net/i2p/sam/SAMv3StreamSession.java

    r44c0d93 r50450ec  
    7878             * @throws DataFormatException
    7979             * @throws SAMException
    80              * @throws NPE if login nickname is not registered
     80             * @throws NullPointerException if login nickname is not registered
    8181             */
    8282            public SAMv3StreamSession(String login)
     
    9999             * @throws IOException
    100100             * @throws DataFormatException
    101              * @throws I2PSessionException
    102101             * @since 0.9.25
    103102             */
  • apps/sam/java/src/net/i2p/sam/SSLUtil.java

    r44c0d93 r50450ec  
    139139     *  No option prefix allowed.
    140140     *
    141      * @throws IOException; GeneralSecurityExceptions are wrapped in IOE for convenience
     141     * @throws IOException GeneralSecurityExceptions are wrapped in IOE for convenience
    142142     * @return factory, throws on all errors
    143143     */
  • apps/sam/java/src/net/i2p/sam/client/SSLUtil.java

    r44c0d93 r50450ec  
    140140     *  No option prefix allowed.
    141141     *
    142      * @throws IOException; GeneralSecurityExceptions are wrapped in IOE for convenience
     142     * @throws IOException GeneralSecurityExceptions are wrapped in IOE for convenience
    143143     * @return factory, throws on all errors
    144144     */
  • apps/streaming/java/src/net/i2p/client/streaming/impl/Connection.java

    r44c0d93 r50450ec  
    7070    private long _lastCongestionTime;
    7171    private volatile long _lastCongestionHighestUnacked;
     72    /** has the other side choked us? */
     73    private volatile boolean _isChoked;
     74    /** are we choking the other side? */
     75    private volatile boolean _isChoking;
     76    private final AtomicInteger _unchokesToSend = new AtomicInteger();
    7277    private final AtomicBoolean _ackSinceCongestion;
    7378    /** Notify this on connection (or connection failure) */
     
    103108
    104109    public static final int MAX_WINDOW_SIZE = 128;
     110    private static final int UNCHOKES_TO_SEND = 8;
    105111   
    106112/****
     
    178184     * @param timeoutMs 0 or negative means wait forever, 5 minutes max
    179185     * @return true if the packet should be sent, false for a fatal error
    180      *         will return false after 5 minutes even if timeoutMs is <= 0.
     186     *         will return false after 5 minutes even if timeoutMs is &lt;= 0.
    181187     */
    182188    public boolean packetSendChoke(long timeoutMs) throws IOException, InterruptedException {
     
    188194            synchronized (_outboundPackets) {
    189195                if (!started)
    190                     _context.statManager().addRateData("stream.chokeSizeBegin", _outboundPackets.size(), timeoutMs);
     196                    _context.statManager().addRateData("stream.chokeSizeBegin", _outboundPackets.size());
    191197                if (start + 5*60*1000 < _context.clock().now()) // ok, 5 minutes blocking?  I dont think so
    192198                    return false;
     
    206212                int unacked = _outboundPackets.size();
    207213                int wsz = _options.getWindowSize();
    208                 if (unacked >= wsz ||
     214                if (_isChoked || unacked >= wsz ||
    209215                    _activeResends.get() >= (wsz + 1) / 2 ||
    210216                    _lastSendId.get() - _highestAckedThrough >= Math.max(MAX_WINDOW_SIZE, 2 * wsz)) {
     
    212218                        if (timeLeft <= 0) {
    213219                            if (_log.shouldLog(Log.INFO))
    214                                 _log.info("Outbound window is full " + unacked
     220                                _log.info("Outbound window is full (choked? " + _isChoked + ' ' + unacked
    215221                                          + " unacked with " + _activeResends + " active resends"
    216222                                          + " and we've waited too long (" + (0-(timeLeft - timeoutMs)) + "ms): "
     
    219225                        }
    220226                        if (_log.shouldLog(Log.DEBUG))
    221                             _log.debug("Outbound window is full (" + unacked + "/" + wsz + "/"
     227                            _log.debug("Outbound window is full (choked? " + _isChoked + ' ' + unacked + '/' + wsz + '/'
    222228                                       + _activeResends + "), waiting " + timeLeft);
    223229                        try {
     
    241247                    }
    242248                } else {
    243                     _context.statManager().addRateData("stream.chokeSizeEnd", _outboundPackets.size(), _context.clock().now() - start);
     249                    _context.statManager().addRateData("stream.chokeSizeEnd", _outboundPackets.size());
    244250                    return true;
    245251                }
     
    258264   
    259265    void ackImmediately() {
    260         PacketLocal packet = null;
     266        PacketLocal packet;
    261267/*** why would we do this?
    262268     was it to force a congestion indication at the other end?
     
    344350    }
    345351   
     352    /**
     353     *  This sends all 'normal' packets (acks and data) for the first time.
     354     *  Retransmits are done in ResendPacketEvent below.
     355     *  Resets, pings, and pongs are done elsewhere in this class,
     356     *  or in ConnectionManager or ConnectionHandler.
     357     */
    346358    void sendPacket(PacketLocal packet) {
    347359        if (packet == null) return;
     
    354366       
    355367        if ( (packet.getSequenceNum() == 0) && (!packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) ) {
    356             //if (_log.shouldLog(Log.DEBUG))
    357             //    _log.debug("No resend for " + packet);
     368            // ACK-only
     369            if (_isChoking) {
     370                packet.setOptionalDelay(Packet.SEND_DELAY_CHOKE);
     371                packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     372            } else if (_unchokesToSend.decrementAndGet() > 0) {
     373                // don't worry about wrapping around
     374                packet.setOptionalDelay(0);
     375                packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     376            }
    358377        } else {
    359378            int windowSize;
     
    365384                _outboundPackets.notifyAll();
    366385            }
    367             // the other end has no idea what our window size is, so
    368             // help him out by requesting acks below the 1/3 point,
    369             // if remaining < 3, and every 8 minimum.
    370             if (packet.isFlagSet(Packet.FLAG_CLOSE) ||
    371                 (remaining < (windowSize + 2) / 3) ||
     386
     387            if (_isChoking) {
     388                packet.setOptionalDelay(Packet.SEND_DELAY_CHOKE);
     389                packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     390            } else if (packet.isFlagSet(Packet.FLAG_CLOSE) ||
     391                _unchokesToSend.decrementAndGet() > 0 ||
     392                // the other end has no idea what our window size is, so
     393                // help him out by requesting acks below the 1/3 point,
     394                // if remaining < 3, and every 8 minimum.
    372395                (remaining < 3) ||
    373                 (packet.getSequenceNum() % 8 == 0)) {
     396                (remaining < (windowSize + 2) / 3) /* ||
     397                (packet.getSequenceNum() % 8 == 0) */ ) {
    374398                packet.setOptionalDelay(0);
    375399                packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     
    381405                // which is always 2000, but it's good for diagnostics to see what the other end thinks
    382406                // the RTT is.
     407/**
    383408                int delay = _options.getRTT() / 2;
    384409                packet.setOptionalDelay(delay);
     
    387412                if (_log.shouldLog(Log.DEBUG))
    388413                    _log.debug("Requesting ack delay of " + delay + "ms for packet " + packet);
    389             }
    390             // WHY always set?
    391             packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     414**/
     415            }
    392416           
    393417            long timeout = _options.getRTO();
     
    636660     *  Always true at the start, even if we haven't gotten a reply on an
    637661     *  outbound connection. Only set to false on disconnect.
    638      *  For outbound, use getHighestAckedThrough() >= 0 also,
     662     *  For outbound, use getHighestAckedThrough() &gt;= 0 also,
    639663     *  to determine if the connection is up.
    640664     *
     
    962986
    963987    /**
    964      *  If the next send time is currently >= 0 (i.e. not "never"),
     988     *  If the next send time is currently &gt;= 0 (i.e. not "never"),
    965989     *  this may make the next time sooner but will not make it later.
    966      *  If the next send time is currently < 0 (i.e. "never"),
     990     *  If the next send time is currently &lt; 0 (i.e. "never"),
    967991     *  this will set it to the time specified, but not later than
    968992     *  options.getSendAckDelay() from now (1000 ms)
     
    9851009    }
    9861010   
     1011    /**
     1012     *  Set or clear if we are choking the other side.
     1013     *  If on is true or the value has changed, this will call ackImmediately().
     1014     *  @param on true for choking
     1015     *  @since 0.9.29
     1016     */
     1017    public void setChoking(boolean on) {
     1018        if (on != _isChoking) {
     1019            _isChoking = on;
     1020           if (!on)
     1021               _unchokesToSend.set(UNCHOKES_TO_SEND);
     1022           ackImmediately();
     1023        } else if (on) {
     1024           ackImmediately();
     1025        }
     1026    }
     1027   
     1028    /**
     1029     *  Set or clear if we are being choked by the other side.
     1030     *  @param on true for choked
     1031     *  @since 0.9.29
     1032     */
     1033    public void setChoked(boolean on) {
     1034        _isChoked = on;
     1035        if (on) {
     1036            congestionOccurred();
     1037            // https://en.wikipedia.org/wiki/Transmission_Control_Protocol
     1038            // When a receiver advertises a window size of 0, the sender stops sending data and starts the persist timer.
     1039            // The persist timer is used to protect TCP from a deadlock situation that could arise
     1040            // if a subsequent window size update from the receiver is lost,
     1041            // and the sender cannot send more data until receiving a new window size update from the receiver.
     1042            // When the persist timer expires, the TCP sender attempts recovery by sending a small packet
     1043            // so that the receiver responds by sending another acknowledgement containing the new window size.
     1044            // ...
     1045            // We don't do any of that, but we set the window size to 1, and let the retransmission
     1046            // of packets do the "attempted recovery".
     1047            getOptions().setWindowSize(1);
     1048        }
     1049    }
     1050   
     1051    /**
     1052     *  Is the other side choking us?
     1053     *  @return if choked
     1054     *  @since 0.9.29
     1055     */
     1056    public boolean isChoked() {
     1057        return _isChoked;
     1058    }
     1059
    9871060    /** how many packets have we sent and the other side has ACKed?
    9881061     * @return Count of how many packets ACKed.
     
    13291402         * to prevent duplicates in the timer queue.
    13301403         *
    1331          * don't synchronize this, deadlock with ackPackets->ackReceived->SimpleTimer2.cancel
     1404         * don't synchronize this, deadlock with ackPackets-&gt;ackReceived-&gt;SimpleTimer2.cancel
    13321405         *
    13331406         * @return true if the packet was sent, false if it was not
     
    13821455                // updateAcks done in enqueue()
    13831456                //_inputStream.updateAcks(_packet);
    1384                 int choke = getOptions().getChoke();
    1385                 _packet.setOptionalDelay(choke);
    1386                 if (choke > 0)
     1457                if (_isChoking) {
     1458                    _packet.setOptionalDelay(Packet.SEND_DELAY_CHOKE);
    13871459                    _packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     1460                } else if (_unchokesToSend.decrementAndGet() > 0) {
     1461                    // don't worry about wrapping around
     1462                    _packet.setOptionalDelay(0);
     1463                    _packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     1464                } else {
     1465                    // clear flag
     1466                    _packet.setFlag(Packet.FLAG_DELAY_REQUESTED, false);
     1467                }
     1468
    13881469                // this seems unnecessary to send the MSS again:
    13891470                //_packet.setOptionalMaxSize(getOptions().getMaxMessageSize());
     
    13971478                int newWindowSize = getOptions().getWindowSize();
    13981479
    1399                 if (_ackSinceCongestion.get()) {
     1480                if (_isChoked) {
     1481                    congestionOccurred();
     1482                    getOptions().setWindowSize(1);
     1483                } else if (_ackSinceCongestion.get()) {
    14001484                    // only shrink the window once per window
    14011485                    if (_packet.getSequenceNum() > _lastCongestionHighestUnacked) {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionDataReceiver.java

    r44c0d93 r50450ec  
    1212 * is the only one that builds useful outbound Packet objects.
    1313 *<p>
    14  * MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
     14 * MessageOutputStream -&gt; ConnectionDataReceiver -&gt; Connection -&gt; PacketQueue -&gt; I2PSession
    1515 *<p>
    1616 * There's one of these per MessageOutputStream.
     
    3737     * It won't flush if this returns true.
    3838     *
    39      * It was: return con.getUnackedPacketsSent() > 0 (i.e. Nagle)
     39     * It was: return con.getUnackedPacketsSent() &gt; 0 (i.e. Nagle)
    4040     * But then, for data that fills more than one packet, the last part of
    4141     * the data isn't sent until all the previous packets are acked. Which is very slow.
     
    157157   
    158158    /**
     159     * Compose a packet.
     160     * Most flags are set here; however, some are set in Connection.sendPacket()
     161     * and Connection.ResendPacketEvent.retransmit().
     162     * Take care not to set the same options both here and in Connection.
     163     *
    159164     * @param buf data to be sent - may be null
    160165     * @param off offset into the buffer to start writing from
     
    165170     */
    166171    private PacketLocal buildPacket(byte buf[], int off, int size, boolean forceIncrement) {
    167         Connection con = _connection;
    168172        if (size > Packet.MAX_PAYLOAD_SIZE) throw new IllegalArgumentException("size is too large (" + size + ")");
    169         boolean ackOnly = isAckOnly(con, size);
    170         boolean isFirst = (con.getAckedPackets() <= 0) && (con.getUnackedPacketsSent() <= 0);
    171        
    172         PacketLocal packet = new PacketLocal(_context, con.getRemotePeer(), con);
     173        boolean ackOnly = isAckOnly(_connection, size);
     174        boolean isFirst = (_connection.getAckedPackets() <= 0) && (_connection.getUnackedPacketsSent() <= 0);
     175       
     176        PacketLocal packet = new PacketLocal(_context, _connection.getRemotePeer(), _connection);
    173177        //ByteArray data = packet.acquirePayload();
    174178        ByteArray data = new ByteArray(new byte[size]);
     
    181185            packet.setSequenceNum(0);
    182186        else
    183             packet.setSequenceNum(con.getNextOutboundPacketNum());
    184         packet.setSendStreamId(con.getSendStreamId());
    185         packet.setReceiveStreamId(con.getReceiveStreamId());
     187            packet.setSequenceNum(_connection.getNextOutboundPacketNum());
     188        packet.setSendStreamId(_connection.getSendStreamId());
     189        packet.setReceiveStreamId(_connection.getReceiveStreamId());
    186190       
    187191        // not needed here, handled in PacketQueue.enqueue()
    188192        //con.getInputStream().updateAcks(packet);
    189         // note that the optional delay is usually rewritten in Connection.sendPacket()
    190         int choke = con.getOptions().getChoke();
    191         packet.setOptionalDelay(choke);
    192         if (choke > 0)
    193             packet.setFlag(Packet.FLAG_DELAY_REQUESTED);
     193
     194        // Do not set optional delay here, set in Connection.sendPacket()
     195
    194196        // bugfix release 0.7.8, we weren't dividing by 1000
    195         packet.setResendDelay(con.getOptions().getResendDelay() / 1000);
    196        
    197         if (con.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
     197        packet.setResendDelay(_connection.getOptions().getResendDelay() / 1000);
     198       
     199        if (_connection.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
    198200            packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, true);
    199201        else
    200202            packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, false);
    201        
    202         packet.setFlag(Packet.FLAG_SIGNATURE_REQUESTED, con.getOptions().getRequireFullySigned());
    203203       
    204204        //if ( (!ackOnly) && (packet.getSequenceNum() <= 0) ) {
     
    206206            packet.setFlag(Packet.FLAG_SYNCHRONIZE);
    207207            packet.setOptionalFrom();
    208             packet.setOptionalMaxSize(con.getOptions().getMaxMessageSize());
    209         }
    210         packet.setLocalPort(con.getLocalPort());
    211         packet.setRemotePort(con.getPort());
    212         if (con.getSendStreamId() == Packet.STREAM_ID_UNKNOWN) {
     208            packet.setOptionalMaxSize(_connection.getOptions().getMaxMessageSize());
     209        }
     210        packet.setLocalPort(_connection.getLocalPort());
     211        packet.setRemotePort(_connection.getPort());
     212        if (_connection.getSendStreamId() == Packet.STREAM_ID_UNKNOWN) {
    213213            packet.setFlag(Packet.FLAG_NO_ACK);
    214214        }
     
    222222        // throughout network?
    223223        //
    224         if (con.getOutputStream().getClosed() &&
    225             ( (size > 0) || (con.getUnackedPacketsSent() <= 0) || (packet.getSequenceNum() > 0) ) ) {
     224        if (_connection.getOutputStream().getClosed() &&
     225            ( (size > 0) || (_connection.getUnackedPacketsSent() <= 0) || (packet.getSequenceNum() > 0) ) ) {
    226226            packet.setFlag(Packet.FLAG_CLOSE);
    227             con.notifyCloseSent();
     227            _connection.notifyCloseSent();
    228228        }
    229229        if (_log.shouldLog(Log.DEBUG))
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionManager.java

    r44c0d93 r50450ec  
    106106        _context.statManager().createRateStat("stream.receiveActive", "How many streams are active when a new one is received (period being not yet dropped)", "Stream", new long[] { 60*60*1000, 24*60*60*1000 });
    107107        // Stats for Connection
    108         _context.statManager().createRateStat("stream.con.windowSizeAtCongestion", "How large was our send window when we send a dup?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    109         _context.statManager().createRateStat("stream.chokeSizeBegin", "How many messages were outstanding when we started to choke?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    110         _context.statManager().createRateStat("stream.chokeSizeEnd", "How many messages were outstanding when we stopped being choked?", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    111         _context.statManager().createRateStat("stream.fastRetransmit", "How long a packet has been around for if it has been resent per the fast retransmit timer?", "Stream", new long[] { 60*1000, 10*60*1000 });
     108        _context.statManager().createRateStat("stream.con.windowSizeAtCongestion", "How large was our send window when we send a dup?", "Stream", new long[] { 60*60*1000 });
     109        _context.statManager().createRateStat("stream.chokeSizeBegin", "How many messages were outstanding when we started to choke?", "Stream", new long[] { 60*60*1000 });
     110        _context.statManager().createRateStat("stream.chokeSizeEnd", "How many messages were outstanding when we stopped being choked?", "Stream", new long[] { 60*60*1000 });
     111        _context.statManager().createRateStat("stream.fastRetransmit", "How long a packet has been around for if it has been resent per the fast retransmit timer?", "Stream", new long[] { 10*60*1000 });
    112112        // Stats for PacketQueue
    113         _context.statManager().createRateStat("stream.con.sendMessageSize", "Size of a message sent on a connection", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    114         _context.statManager().createRateStat("stream.con.sendDuplicateSize", "Size of a message resent on a connection", "Stream", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
     113        _context.statManager().createRateStat("stream.con.sendMessageSize", "Size of a message sent on a connection", "Stream", new long[] { 10*60*1000, 60*60*1000 });
     114        _context.statManager().createRateStat("stream.con.sendDuplicateSize", "Size of a message resent on a connection", "Stream", new long[] { 10*60*1000, 60*60*1000 });
    115115    }
    116116   
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionOptions.java

    r44c0d93 r50450ec  
    3434    private int _sendAckDelay;
    3535    private int _maxMessageSize;
    36     private int _choke;
    3736    private int _maxResends;
    3837    private int _inactivityTimeout;
     
    228227     * (Before 0.6.2, the reply leaseSet was bundled with every message, so it didn't even
    229228     * fit in TWO tunnel messages - more like 2 1/3)
    230      * <p/>
     229     * <p>
    231230     * Now, it's not clear how often we will get the ideal situation (no reply leaseSet bundling,
    232231     * no key bundling, and especially not having a small message ahead of you, which will then cause
     
    236235     * But for long-lived streams (like with i2psnark) this should pay dividends.
    237236     * The tunnel.batch* stats should provide some data for test comparisons.
    238      * <p/>
     237     * <p>
    239238     * As MTU and MRU are identical and are negotiated to the lowest value
    240239     * for the two ends, you can't do widespread testing of a higher value.
     
    245244     * with i2p.streaming.maxMessageSize=738 (in configadvanced.jsp, or in i2ptunnel, or
    246245     * i2psnark, for example).
    247      * <p/>
     246     * <p>
    248247     * Not that an isolated single packet is very common, but
    249248     * in this case, 960 was 113.3% total overhead.
     
    328327            setResendDelay(opts.getResendDelay());
    329328            setMaxMessageSize(opts.getMaxMessageSize());
    330             setChoke(opts.getChoke());
    331329            setMaxResends(opts.getMaxResends());
    332330            setInactivityTimeout(opts.getInactivityTimeout());
     
    678676    public void setMaxMessageSize(int bytes) { _maxMessageSize = Math.max(bytes, MIN_MESSAGE_SIZE); }
    679677   
    680     /**
    681      * how long we want to wait before any data is transferred on the
    682      * connection in either direction
    683      *
    684      * @return how long to wait before any data is transferred in either direction in ms
    685      */
    686     public int getChoke() { return _choke; }
    687     public void setChoke(int ms) { _choke = ms; }
    688 
    689678    /**
    690679     * What profile do we want to use for this connection?
  • apps/streaming/java/src/net/i2p/client/streaming/impl/ConnectionPacketHandler.java

    r44c0d93 r50450ec  
    1414 * queue, marking packets as acked, updating various fields, etc.
    1515 *<p>
    16  * I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
     16 * I2PSession -&gt; MessageHandler -&gt; PacketHandler -&gt; ConnectionPacketHandler -&gt; MessageInputStream
    1717 *<p>
    1818 * One of these is instantiated per-Destination
     
    9797        boolean choke = false;
    9898        if (packet.isFlagSet(Packet.FLAG_DELAY_REQUESTED)) {
    99             if (packet.getOptionalDelay() > 60000) {
     99            if (packet.getOptionalDelay() >= Packet.MIN_DELAY_CHOKE) {
    100100                // requested choke
    101101                choke = true;
     102                if (_log.shouldWarn())
     103                    _log.warn("Got a choke on connection " + con + ": " + packet);
    102104                //con.getOptions().setRTT(con.getOptions().getRTT() + 10*1000);
    103105            }
     106            // Only call this if the flag is set
     107            con.setChoked(choke);
    104108        }
    105109       
     
    107111            if (_log.shouldWarn())
    108112                _log.warn("Inbound buffer exceeded on connection " + con +
    109                           ", dropping " + packet);
    110             con.getOptions().setChoke(61*1000);
     113                          ", choking and dropping " + packet);
     114            // this will call ackImmediately()
     115            con.setChoking(true);
     116            // TODO we could still process the acks for this packet before discarding
    111117            packet.releasePayload();
    112             con.ackImmediately();
    113118            return;
    114         }
    115         con.getOptions().setChoke(0);
     119        } // else we will call setChoking(false) below
    116120
    117121        _context.statManager().addRateData("stream.con.receiveMessageSize", packet.getPayloadSize());
     
    133137        // But not ack-only packets!
    134138        boolean isNew;
    135         if (seqNum > 0 || isSYN)
    136             isNew = con.getInputStream().messageReceived(seqNum, packet.getPayload());
    137         else
     139        if (seqNum > 0 || isSYN) {
     140            isNew = con.getInputStream().messageReceived(seqNum, packet.getPayload()) &&
     141                    !allowAck;
     142        } else {
    138143            isNew = false;
    139         if (!allowAck)
    140             isNew = false;
     144        }
     145
     146        if (isNew && packet.getPayloadSize() > 1500) {
     147            // don't clear choking unless it was new, and a big packet
     148            // this will call ackImmediately() if changed
     149            // TODO if this filled in a hole, we shouldn't unchoke
     150            // TODO a bunch of small packets should unchoke also
     151            con.setChoking(false);
     152        }
    141153       
    142154        //if ( (packet.getSequenceNum() == 0) && (packet.getPayloadSize() > 0) ) {
     
    159171        }
    160172
    161         boolean fastAck = false;
    162173        boolean ackOnly = false;
    163174       
     
    171182                //con.setNextSendTime(_context.clock().now() + con.getOptions().getSendAckDelay());
    172183                // honor request "almost" immediately
     184                // TODO the 250 below _may_ be a big limiter in how fast local "loopback" connections
     185                // can go, however if it goes too fast then we start choking which causes
     186                // frequent stalls anyway.
    173187                con.setNextSendTime(_context.clock().now() + 250);
    174188            } else {
     
    223237        }
    224238
     239        boolean fastAck;
    225240        if (isSYN && (packet.getSendStreamId() <= 0) ) {
    226241            // don't honor the ACK 0 in SYN packets received when the other side
    227242            // has obviously not seen our messages
     243            fastAck = false;
    228244        } else {
    229245            fastAck = ack(con, packet.getAckThrough(), packet.getNacks(), packet, isNew, choke);
    230246        }
    231247        con.eventOccurred();
    232         if (fastAck) {
     248        if (fastAck && !choke) {
    233249            if (!isNew) {
    234250                // if we're congested (fastAck) but this is also a new packet,
     
    267283    /**
    268284     * Process the acks in a received packet, and adjust our window and RTT
     285     * @param isNew was it a new packet? false for ack-only
     286     * @param choke did we get a choke in the packet?
    269287     * @return are we congested?
    270288     */
     
    355373    }
    356374   
    357     /** @return are we congested? */
     375    /**
     376     * This either does nothing or increases the window, it never decreases it.
     377     * Decreasing is done in Connection.ResendPacketEvent.retransmit()
     378     *
     379     * @param isNew was it a new packet? false for ack-only
     380     * @param sequenceNum 0 for ack-only
     381     * @param choke did we get a choke in the packet?
     382     * @return are we congested?
     383     */
    358384    private boolean adjustWindow(Connection con, boolean isNew, long sequenceNum, int numResends, int acked, boolean choke) {
    359         boolean congested = false;
    360         if ( (!isNew) && (sequenceNum > 0) ) {
     385        boolean congested;
     386        if (choke || (!isNew && sequenceNum > 0) || con.isChoked()) {
    361387            if (_log.shouldLog(Log.DEBUG))
    362388                _log.debug("Congestion occurred on the sending side. Not adjusting window "+con);
    363 
    364389            congested = true;
    365         }
    366        
     390        } else {
     391            congested = false;
     392        }
     393
    367394        long lowest = con.getHighestAckedThrough();
    368395        // RFC 2581
  • apps/streaming/java/src/net/i2p/client/streaming/impl/I2PSocketManagerFull.java

    r44c0d93 r50450ec  
    633633     *  Like connect() but returns a real Socket, and throws only IOE,
    634634     *  for easier porting of apps.
    635      *  @param timeout ms if > 0, forces blocking (disables connectDelay)
     635     *  @param timeout ms if &gt; 0, forces blocking (disables connectDelay)
    636636     *  @since 0.8.4
    637637     */
  • apps/streaming/java/src/net/i2p/client/streaming/impl/I2PSocketOptionsImpl.java

    r44c0d93 r50450ec  
    123123     *
    124124     * Default 60 seconds. Max of 2 minutes enforced in Connection.java,
    125      * and it also interprets <= 0 as default.
     125     * and it also interprets &lt;= 0 as default.
    126126     *
    127127     * @return milliseconds to wait, or -1 if we will wait indefinitely
     
    135135     *
    136136     * Default 60 seconds. Max of 2 minutes enforced in Connection.java,
    137      * and it also interprets <= 0 as default.
     137     * and it also interprets &lt;= 0 as default.
    138138     *
    139139     */
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageHandler.java

    r44c0d93 r50450ec  
    1616 * Packets, if we can.
    1717 *<p>
    18  * I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
     18 * I2PSession -&gt; MessageHandler -&gt; PacketHandler -&gt; ConnectionPacketHandler -&gt; MessageInputStream
    1919 */
    2020class MessageHandler implements I2PSessionMuxedListener {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageInputStream.java

    r44c0d93 r50450ec  
    1818 * yet present them in order.
    1919 *<p>
    20  * I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
     20 * I2PSession -&gt; MessageHandler -&gt; PacketHandler -&gt; ConnectionPacketHandler -&gt; MessageInputStream
    2121 *<p>
    2222 * This buffers unlimited data via messageReceived() -
     
    103103    /**
    104104     *  Determine if this packet will fit in our buffering limits.
     105     *  Always returns true for zero payloadSize.
    105106     *
    106107     *  @return true if we have room. If false, do not call messageReceived()
  • apps/streaming/java/src/net/i2p/client/streaming/impl/MessageOutputStream.java

    r44c0d93 r50450ec  
    1818 * to the data receiver's needs.
    1919 *<p>
    20  * MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
     20 * MessageOutputStream -&gt; ConnectionDataReceiver -&gt; Connection -&gt; PacketQueue -&gt; I2PSession
    2121 */
    2222class MessageOutputStream extends OutputStream {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/Packet.java

    r44c0d93 r50450ec  
    165165    public static final int DEFAULT_MAX_SIZE = 32*1024;
    166166    protected static final int MAX_DELAY_REQUEST = 65535;
     167    public static final int MIN_DELAY_CHOKE = 60001;
     168    public static final int SEND_DELAY_CHOKE = 61000;
    167169
    168170    /**
     
    233235
    234236    /**
    235      * @param id if < 0, sets FLAG_NO_ACK
     237     * @param id if &lt; 0, sets FLAG_NO_ACK
    236238     */
    237239    public void setAckThrough(long id) {
     
    260262     * Setters from options did not divide by 1000, and the options default
    261263     * is 1000, so the value sent in the 1-byte field was always
    262      * 1000 & 0xff = 0xe8 = 232
     264     * 1000 &amp; 0xff = 0xe8 = 232
    263265     *
    264266     * @return Delay before resending a packet in seconds.
     
    334336    public Signature getOptionalSignature() { return _optionSignature; }
    335337
     338    /**
     339     * This also sets flag FLAG_SIGNATURE_INCLUDED
     340     */
    336341    public void setOptionalSignature(Signature sig) {
    337342        setFlag(FLAG_SIGNATURE_INCLUDED, sig != null);
     
    347352     * This sets the from field in the packet to the Destination for the session
    348353     * provided in the constructor.
     354     * This also sets flag FLAG_FROM_INCLUDED
    349355     */
    350356    public void setOptionalFrom() {
     
    361367    public int getOptionalDelay() { return _optionDelay; }
    362368
     369    /**
     370     * Caller must also call setFlag(FLAG_DELAY_REQUESTED)
     371     */
    363372    public void setOptionalDelay(int delayMs) {
    364373        if (delayMs > MAX_DELAY_REQUEST)
     
    376385     */
    377386    public int getOptionalMaxSize() { return _optionMaxSize; }
     387
     388    /**
     389     * This also sets flag FLAG_MAX_PACKET_SIZE_INCLUDED
     390     */
    378391    public void setOptionalMaxSize(int numBytes) {
    379392        setFlag(FLAG_MAX_PACKET_SIZE_INCLUDED, numBytes > 0);
  • apps/streaming/java/src/net/i2p/client/streaming/impl/PacketHandler.java

    r44c0d93 r50450ec  
    1313 * the server socket, or queue a reply RST packet.
    1414 *<p>
    15  * I2PSession -> MessageHandler -> PacketHandler -> ConnectionPacketHandler -> MessageInputStream
     15 * I2PSession -&gt; MessageHandler -&gt; PacketHandler -&gt; ConnectionPacketHandler -&gt; MessageInputStream
    1616 */
    1717class PacketHandler {
  • apps/streaming/java/src/net/i2p/client/streaming/impl/PacketLocal.java

    r44c0d93 r50450ec  
    110110                         FLAG_CLOSE |
    111111                         FLAG_ECHO);
    112     }
    113    
    114     /** last minute update of ack fields, just before write/sign  */
    115     public void prepare() {
    116         if (_connection != null)
    117             _connection.getInputStream().updateAcks(this);
    118         int numSends = _numSends.get();
    119         if (numSends > 0) {
    120             // so we can debug to differentiate resends
    121             setOptionalDelay(numSends * 1000);
    122             setFlag(FLAG_DELAY_REQUESTED);
    123         }
    124112    }
    125113   
  • apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java

    r44c0d93 r50450ec  
    2525 * mode=bestEffort doesnt block in the SDK.
    2626 *<p>
    27  * MessageOutputStream -> ConnectionDataReceiver -> Connection -> PacketQueue -> I2PSession
     27 * MessageOutputStream -&gt; ConnectionDataReceiver -&gt; Connection -&gt; PacketQueue -&gt; I2PSession
    2828 */
    2929class PacketQueue implements SendMessageStatusListener, Closeable {
     
    6565   
    6666    /**
    67      * Add a new packet to be sent out ASAP
     67     * Add a new packet to be sent out ASAP.
     68     * This updates the acks.
    6869     *
    6970     * keys and tags disabled since dropped in I2PSession
     
    7374        if (_dead)
    7475            return false;
    75         // this updates the ack/nack field
    76         packet.prepare();
    7776       
    7877        //SessionKey keyUsed = packet.getKeyUsed();
     
    8887            return false;
    8988        }
     89
     90        Connection con = packet.getConnection();
     91        if (con != null) {
     92            // this updates the ack/nack fields
     93            con.getInputStream().updateAcks(packet);
     94        }
    9095   
    9196        ByteArray ba = _cache.acquire();
     
    97102        try {
    98103            int size = 0;
    99             long beforeWrite = System.currentTimeMillis();
     104            //long beforeWrite = System.currentTimeMillis();
    100105            if (packet.shouldSign())
    101106                size = packet.writeSignedPacket(buf, 0);
    102107            else
    103108                size = packet.writePacket(buf, 0);
    104             long writeTime = System.currentTimeMillis() - beforeWrite;
    105             if ( (writeTime > 1000) && (_log.shouldLog(Log.WARN)) )
    106                 _log.warn("took " + writeTime + "ms to write the packet: " + packet);
     109            //long writeTime = System.currentTimeMillis() - beforeWrite;
     110            //if ( (writeTime > 1000) && (_log.shouldLog(Log.WARN)) )
     111            //    _log.warn("took " + writeTime + "ms to write the packet: " + packet);
    107112
    108113            // last chance to short circuit...
     
    122127            boolean listenForStatus = false;
    123128            if (packet.isFlagSet(FLAGS_INITIAL_TAGS)) {
    124                 Connection con = packet.getConnection();
    125129                if (con != null) {
    126130                    if (con.isInbound())
     
    142146                options.setTagThreshold(FINAL_TAG_THRESHOLD);
    143147            } else {
    144                 Connection con = packet.getConnection();
    145148                if (con != null) {
    146149                    if (con.isInbound() && con.getLifetime() < 2*60*1000)
     
    158161                                 I2PSession.PROTO_STREAMING, packet.getLocalPort(), packet.getRemotePort(),
    159162                                 options, this);
    160                 _messageStatusMap.put(Long.valueOf(id), packet.getConnection());
     163                _messageStatusMap.put(Long.valueOf(id), con);
    161164                sent = true;
    162165            } else {
     
    174177                _context.statManager().addRateData("stream.con.sendDuplicateSize", size, packet.getLifetime());
    175178           
    176             Connection con = packet.getConnection();
    177179            if (con != null) {
    178180                con.incrementBytesSent(size);
     
    190192            if (_log.shouldLog(Log.WARN))
    191193                _log.warn("Send failed for " + packet);
    192             Connection c = packet.getConnection();
    193             if (c != null) // handle race on b0rk
    194                 c.disconnect(false);
     194            if (con != null) // handle race on b0rk
     195                con.disconnect(false);
    195196        } else {
    196197            //packet.setKeyUsed(keyUsed);
    197198            //packet.setTagsSent(tagsSent);
    198199            packet.incrementSends();
    199             Connection c = packet.getConnection();
    200             if (c != null && _log.shouldDebug()) {
    201                 String suffix = "wsize " + c.getOptions().getWindowSize() + " rto " + c.getOptions().getRTO();
    202                 c.getConnectionManager().getPacketHandler().displayPacket(packet, "SEND", suffix);
     200            if (con != null && _log.shouldDebug()) {
     201                String suffix = "wsize " + con.getOptions().getWindowSize() + " rto " + con.getOptions().getRTO();
     202                con.getConnectionManager().getPacketHandler().displayPacket(packet, "SEND", suffix);
    203203            }
    204204            if (I2PSocketManagerFull.pcapWriter != null &&
     
    249249            // no tunnels may fix itself, allow retx
    250250            case MessageStatusMessage.STATUS_SEND_FAILURE_NO_TUNNELS:
     251            // probably took a long time to open the tunnel, allow retx
     252            case MessageStatusMessage.STATUS_SEND_FAILURE_EXPIRED:
     253            // overflow in router-side I2CP queue, sent as of 0.9.29, will be retried
     254            case MessageStatusMessage.STATUS_SEND_FAILURE_LOCAL:
    251255                if (_log.shouldLog(Log.WARN))
    252256                    _log.warn("Rcvd soft failure status " + status + " for msg " + msgId + " on " + con);
     
    268272
    269273
    270             case MessageStatusMessage.STATUS_SEND_FAILURE_LOCAL:
    271274            case MessageStatusMessage.STATUS_SEND_FAILURE_ROUTER:
    272275            case MessageStatusMessage.STATUS_SEND_FAILURE_NETWORK:
     
    275278            case MessageStatusMessage.STATUS_SEND_FAILURE_BAD_OPTIONS:
    276279            case MessageStatusMessage.STATUS_SEND_FAILURE_OVERFLOW:
    277             case MessageStatusMessage.STATUS_SEND_FAILURE_EXPIRED:
    278280            case MessageStatusMessage.STATUS_SEND_FAILURE_LOCAL_LEASESET:
    279281            case MessageStatusMessage.STATUS_SEND_FAILURE_UNSUPPORTED_ENCRYPTION:
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerClosed.java

    r44c0d93 r50450ec  
    77 * ACKed, but the final timeout hasn't passed.</p>
    88 *
    9  * <h2>Entry conditions:</h2><ul>
     9 * <h2>Entry conditions:</h2>
     10 * <ul>
    1011 * <li>Both sides have closed and ACKed.</li>
    1112 * <li>Less than the final timeout period has passed since the last ACK.</li>
    1213 * </ul>
    1314 *
    14  * <h2>Events:</h2><ul>
     15 * <h2>Events:</h2>
     16 * <ul>
    1517 * <li>Packets received</li>
    1618 * <li>RESET received</li>
     
    1921 *
    2022 * <h2>Next states:</h2>
     23 * <ul>
    2124 * <li>{@link SchedulerDead dead} - after the final timeout passes</li>
    2225 * </ul>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerClosing.java

    r44c0d93 r50450ec  
    99 * they haven't ACKed ours.</p>
    1010 *
    11  * <h2>Entry conditions:</h2><ul>
     11 * <h2>Entry conditions:</h2>
     12 * <ul>
    1213 * <li>Both sides have closed.</li>
    1314 * <li>At least one direction has not ACKed the close.</li>
    1415 * </ul>
    1516 *
    16  * <h2>Events:</h2><ul>
     17 * <h2>Events:</h2>
     18 * <ul>
    1719 * <li>Packets received (which may or may not ACK the ones sent)</li>
    1820 * <li>RESET received</li>
     
    2224 *
    2325 * <h2>Next states:</h2>
     26 * <ul>
    2427 * <li>{@link SchedulerClosed closed} - after both sending and receiving ACKs on the CLOSE</li>
    2528 * <li>{@link SchedulerDead dead} - after sending or receiving a RESET</li>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerConnectedBulk.java

    r44c0d93 r50450ec  
    99 * profile.</p>
    1010 *
    11  * <h2>Entry conditions:</h2><ul>
     11 * <h2>Entry conditions:</h2>
     12 * <ul>
    1213 * <li>Packets sent and ACKs received.</li>
    1314 * <li>At least one direction is not closed</li>
    1415 * </ul>
    1516 *
    16  * <h2>Events:</h2><ul>
     17 * <h2>Events:</h2>
     18 * <ul>
    1719 * <li>Packets received (which may or may not ACK the ones sent)</li>
    1820 * <li>Message flush (explicitly, through a full buffer, or stream closure)</li>
     
    2325 *
    2426 * <h2>Next states:</h2>
     27 * <ul>
    2528 * <li>{@link SchedulerClosing closing} - after both sending and receiving a CLOSE</li>
    2629 * <li>{@link SchedulerClosed closed} - after both sending and receiving ACKs on the CLOSE</li>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerConnecting.java

    r44c0d93 r50450ec  
    88 * This connection may or may not be locally created.</p>
    99 *
    10  * <h2>Entry conditions:</h2><ul>
     10 * <h2>Entry conditions:</h2>
     11 * <ul>
    1112 * <li>Packets sent but none ACKed</li>
    1213 * </ul>
    1314 *
    14  * <h2>Events:</h2><ul>
     15 * <h2>Events:</h2>
     16 * <ul>
    1517 * <li>Packets received (which may or may not ACK the ones sent)</li>
    1618 * <li>Message flush (explicitly, through a full buffer, or stream closure)</li>
     
    2022 *
    2123 * <h2>Next states:</h2>
     24 * <ul>
    2225 * <li>{@link SchedulerConnectedBulk connected} - after receiving an ACK</li>
    2326 * <li>{@link SchedulerClosing closing} - after both sending and receiving a CLOSE</li>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerDead.java

    r44c0d93 r50450ec  
    77 * connection was reset.</p>
    88 *
    9  * <h2>Entry conditions:</h2><ul>
     9 * <h2>Entry conditions:</h2>
     10 * <ul>
    1011 * <li>Both sides have closed and ACKed and the timeout has passed. <br>
    1112 *     <b>or</b></li>
     
    1314 * </ul>
    1415 *
    15  * <h2>Events:</h2><ul>
     16 * <h2>Events:</h2>
     17 * <ul>
    1618 * <li>None</li>
    1719 * </ul>
    1820 *
    1921 * <h2>Next states:</h2>
     22 * <ul>
    2023 * <li>None</li>
    2124 * </ul>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerHardDisconnected.java

    r44c0d93 r50450ec  
    77 * but the final timeout hasn't passed.</p>
    88 *
    9  * <h2>Entry conditions:</h2><ul>
     9 * <h2>Entry conditions:</h2>
     10 * <ul>
    1011 * <li>Locally disconnected hard.</li>
    1112 * <li>Less than the final timeout period has passed since the last ACK.</li>
    1213 * </ul>
    1314 *
    14  * <h2>Events:</h2><ul>
     15 * <h2>Events:</h2>
     16 * <ul>
    1517 * <li>Packets received</li>
    1618 * <li>RESET received</li>
     
    1921 *
    2022 * <h2>Next states:</h2>
     23 * <ul>
    2124 * <li>{@link SchedulerDead dead} - after the final timeout passes</li>
    2225 * </ul>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/SchedulerPreconnect.java

    r44c0d93 r50450ec  
    88 * sent the initial SYN packet.</p>
    99 *
    10  * <h2>Entry conditions:</h2><ul>
     10 * <h2>Entry conditions:</h2>
     11 * <ul>
    1112 * <li>Locally created</li>
    1213 * <li>No packets sent or received</li>
    1314 * </ul>
    1415 *
    15  * <h2>Events:</h2><ul>
     16 * <h2>Events:</h2>
     17 * <ul>
    1618 * <li>Message flush (explicitly, through a full buffer, or stream closure)</li>
    1719 * <li>Initial delay timeout (causing implicit flush of any data available)</li>
     
    1921 *
    2022 * <h2>Next states:</h2>
     23 * <ul>
    2124 * <li>{@link SchedulerConnecting connecting} - after sending a packet</li>
    2225 * </ul>
  • apps/streaming/java/src/net/i2p/client/streaming/impl/StandardSocket.java

    r44c0d93 r50450ec  
    2222 *
    2323 * StandardSockets are always bound, and always start out connected
    24  * (unless connectDelay is > 0).
     24 * (unless connectDelay is &gt; 0).
    2525 * You may not create an unbound StandardSocket.
    2626 * Create this through the SocketManager.
  • apps/susidns/src/java/src/i2p/susi/dns/AddressBean.java

    r44c0d93 r50450ec  
    111111         * @param host will be converted to lower case
    112112         * @return name converted to lower case and punycoded if necessary
    113          * @throws IAE on various errors or if IDN is needed but not available
     113         * @throws IllegalArgumentException on various errors or if IDN is needed but not available
    114114         * @since 0.8.7
    115115         */
  • apps/susimail/src/src/i2p/susi/util/Folder.java

    r44c0d93 r50450ec  
    370370         * Does not re-sort. Caller must call sortBy()
    371371         *
    372          * @param direction @link UP or @link DOWN
     372         * @param direction UP or DOWN
    373373         */
    374374        public synchronized void setSortingDirection(SortOrder direction)
  • apps/susimail/src/src/i2p/susi/webmail/Mail.java

    r44c0d93 r50450ec  
    44 *  This file is part of susimail project, see http://susi.i2p/
    55 * 
    6  *  Copyright (C) 2004-2005  <susi23@mail.i2p>
     6 *  Copyright (C) 2004-2005  susi23@mail.i2p
    77 *
    88 *  This program is free software; you can redistribute it and/or modify
     
    205205
    206206        /**
    207          * Returns the first email address portion, enclosed by <>
     207         * Returns the first email address portion, enclosed by &lt;&gt;
    208208         * @param address
    209209         */
  • core/c/jbigi/download_gmp.sh

    r44c0d93 r50450ec  
    11#!/bin/sh
    22
    3 export GMP_VER=6.0.0
    4 export GMP_TARVER=${GMP_VER}a
     3export GMP_VER=6.1.2
     4export GMP_TARVER=${GMP_VER}
    55export GMP_DIR="gmp-$GMP_VER"
    66export GMP_TAR="gmp-$GMP_TARVER.tar.bz2"
  • core/java/src/gnu/crypto/prng/IRandomStandalone.java

    r44c0d93 r50450ec  
    105105    * @param attributes a set of name-value pairs that describe the desired
    106106    * future instance behaviour.
    107     * @exception IllegalArgumentException if at least one of the defined name/
     107    * @throws IllegalArgumentException if at least one of the defined name/
    108108    * value pairs contains invalid data.
    109109    */
     
    114114     *
    115115     * @return the next 8 bits of random data generated from this instance.
    116      * @exception IllegalStateException if the instance is not yet initialised.
    117      * @exception LimLimitReachedExceptionStandalone this instance has reached its
     116     * @throws IllegalStateException if the instance is not yet initialised.
     117     * @throws LimitReachedExceptionStandalone this instance has reached its
    118118     * theoretical limit for generating non-repetitive pseudo-random data.
    119119     */
     
    131131     * @param length the maximum number of required random bytes. This method
    132132     * does nothing if this parameter is less than <code>1</code>.
    133      * @exception IllegalStateException if the instance is not yet initialised.
    134      * @exception LimitLimitReachedExceptionStandalonehis instance has reached its
     133     * @throws IllegalStateException if the instance is not yet initialised.
     134     * @throws LimitReachedExceptionStandalone this instance has reached its
    135135     * theoretical limit for generating non-repetitive pseudo-random data.
    136136     */
     
    173173    * @param offset The offset from whence to begin reading random bytes.
    174174    * @param length The number of random bytes to add.
    175     * @exception IndexOutOfBoundsException If <i>offset</i>, <i>length</i>,
     175    * @throws IndexOutOfBoundsException If <i>offset</i>, <i>length</i>,
    176176    * or <i>offset</i>+<i>length</i> is out of bounds.
    177177    */
  • core/java/src/gnu/getopt/Getopt.java

    r44c0d93 r50450ec  
    337337  *     }
    338338  * //
    339   * for (int i = g.getOptind(); i < argv.length ; i++)
     339  * for (int i = g.getOptind(); i &lt; argv.length ; i++)
    340340  *   System.out.println("Non option argv element: " + argv[i] + "\n");
    341341  * </pre>
  • core/java/src/gnu/getopt/LongOpt.java

    r44c0d93 r50450ec  
    118118  * @param val The value to return for this long option, or the equivalent single letter option to emulate if flag is null.
    119119  *
    120   * @exception IllegalArgumentException If the has_arg param is not one of NO_ARGUMENT, REQUIRED_ARGUMENT or OPTIONAL_ARGUMENT.
     120  * @throws IllegalArgumentException If the has_arg param is not one of NO_ARGUMENT, REQUIRED_ARGUMENT or OPTIONAL_ARGUMENT.
    121121  */
    122122public
  • core/java/src/net/i2p/client/I2PClient.java

    r44c0d93 r50450ec  
    4848
    4949    /**
    50      * For router->client payloads.
     50     * For router-&gt;client payloads.
    5151     *
    5252     * If false, the router will send the MessageStatus,
  • core/java/src/net/i2p/client/I2PSession.java

    r44c0d93 r50450ec  
    7474     *
    7575     * Like sendMessage above, except the key used and the tags sent are exposed to the
    76      * application.  <p />
     76     * application.  <p>
    7777     *
    7878     * If some application layer message delivery confirmation is used,
     
    332332     *
    333333     *<pre>
    334      *  if (name.length() == 60 && name.toLowerCase(Locale.US).endsWith(".b32.i2p")) {
     334     *  if (name.length() == 60 &amp;&amp; name.toLowerCase(Locale.US).endsWith(".b32.i2p")) {
    335335     *      if (session != null)
    336336     *          return session.lookup(Hash.create(Base32.decode(name.toLowerCase(Locale.US).substring(0, 52))));
  • core/java/src/net/i2p/client/datagram/I2PDatagramDissector.java

    r44c0d93 r50450ec  
    3232
    3333    private static final int DGRAM_BUFSIZE = 32768;
     34    private static final int MIN_DGRAM_SIZE = 387 + 40;
    3435
    3536    private final DSAEngine dsaEng = DSAEngine.getInstance();
     
    6970     */
    7071    public void loadI2PDatagram(byte[] dgram) throws DataFormatException {
    71         ByteArrayInputStream dgStream = new ByteArrayInputStream(dgram);
    7272        // set invalid(very important!)
    7373        this.valid = false;
     74        if (dgram.length < MIN_DGRAM_SIZE)
     75            throw new DataFormatException("repliable datagram too small: " + dgram.length);
     76
     77        ByteArrayInputStream dgStream = new ByteArrayInputStream(dgram);
    7478       
    7579        try {
     
    97101            }
    98102        } catch (IOException e) {
    99             Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class);
    100             log.error("Error loading datagram", e);
     103            // let the application do the logging
     104            //Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class);
     105            //log.error("Error loading datagram", e);
    101106            throw new DataFormatException("Error loading datagram", e);
    102107        //} catch(AssertionError e) {
  • core/java/src/net/i2p/client/impl/I2PClientMessageHandlerMap.java

    r44c0d93 r50450ec  
    2828 */
    2929class I2PClientMessageHandlerMap {
    30     /** map of message type id --> I2CPMessageHandler */
     30    /** map of message type id --&gt; I2CPMessageHandler */
    3131    protected I2CPMessageHandler _handlers[];
    3232
  • core/java/src/net/i2p/client/impl/I2PSessionImpl.java

    r44c0d93 r50450ec  
    125125    /** class that generates new messages */
    126126    protected final I2CPMessageProducer _producer;
    127     /** map of Long --> MessagePayloadMessage */
     127    /** map of Long --&gt; MessagePayloadMessage */
    128128    protected Map<Long, MessagePayloadMessage> _availableMessages;
    129129
  • core/java/src/net/i2p/client/impl/I2PSessionMuxedImpl.java

    r44c0d93 r50450ec  
    3535 *
    3636 * Compatibility:
    37  *    old streaming -> new streaming: sends proto anything, rcvs proto anything
    38  *    new streaming -> old streaming: sends PROTO_STREAMING, ignores rcvd proto
    39  *    old datagram -> new datagram: sends proto anything, rcvs proto anything
    40  *    new datagram -> old datagram: sends PROTO_DATAGRAM, ignores rcvd proto
     37 *    old streaming -&gt; new streaming: sends proto anything, rcvs proto anything
     38 *    new streaming -&gt; old streaming: sends PROTO_STREAMING, ignores rcvd proto
     39 *    old datagram -&gt; new datagram: sends proto anything, rcvs proto anything
     40 *    new datagram -&gt; old datagram: sends PROTO_DATAGRAM, ignores rcvd proto
    4141 *    In all the above cases, streaming and datagram receive traffic for the other
    4242 *    protocol, same as before.
    4343 *
    44  *    old datagram -> new muxed: doesn't work because the old sends proto 0 but the udp side
     44 *    old datagram -&gt; new muxed: doesn't work because the old sends proto 0 but the udp side
    4545 *                               of the mux registers with PROTO_DATAGRAM, so the datagrams
    4646 *                               go to the streaming side, same as before.
    47  *    old streaming -> new muxed: works
     47 *    old streaming -&gt; new muxed: works
    4848 *
    4949 * Typical Usage:
     
    422422     *  No, we couldn't put any protocol byte in front of everything and
    423423     *  keep backward compatibility. But there are several bytes that
    424      *  are unused AND unchecked in the gzip header in releases <= 0.7.
     424     *  are unused AND unchecked in the gzip header in releases &lt;= 0.7.
    425425     *  So let's use 5 of them for a protocol and two 2-byte ports.
    426426     *
  • core/java/src/net/i2p/client/naming/NamingService.java

    r44c0d93 r50450ec  
    535535     *
    536536     *  @param hostname must be {52 chars}.b32.i2p
    537      *  @param timeout in seconds; <= 0 means use router default
     537     *  @param timeout in seconds; &lt;= 0 means use router default
    538538     *  @return dest or null
    539539     *  @since 0.8.7
     
    547547     *  This implementation returns null.
    548548     *
    549      *  @param timeout in seconds; <= 0 means use router default
     549     *  @param timeout in seconds; &lt;= 0 means use router default
    550550     *  @return dest or null
    551551     *  @since 0.8.7
  • core/java/src/net/i2p/crypto/CryptixRijndael_Algorithm.java

    r44c0d93 r50450ec  
    372372     *
    373373     * @param k The 128/192/256-bit user-key to use.
    374      * @exception  InvalidKeyException  If the key is invalid.
     374     * @throws  InvalidKeyException  If the key is invalid.
    375375     */
    376376    public static final Object makeKey(byte[] k) throws InvalidKeyException {
     
    551551     * @param k          The 128/192/256-bit user-key to use.
    552552     * @param blockSize  The block size in bytes of this Rijndael.
    553      * @exception  InvalidKeyException  If the key is invalid.
     553     * @throws  InvalidKeyException  If the key is invalid.
    554554     */
    555555    public static final/* synchronized */Object makeKey(byte[] k, int blockSize) throws InvalidKeyException {
  • core/java/src/net/i2p/crypto/CryptoCheck.java

    r44c0d93 r50450ec  
    66
    77/**
    8  * Moved from CryptixAESEngine and net.i2p.router.tasks.CryptoChecker
     8 * Moved from CryptixAESEngine and net.i2p.router.tasks.CryptoChecker.
     9 * This class does not do any logging. See CryptoChecker for the logging.
    910 *
    1011 * @since 0.9.23
     
    2930            } catch (GeneralSecurityException gse) {
    3031            }
     32        } catch (ExceptionInInitializerError eiie) {
     33            // Java 9 b134 bug
     34            // > java -jar build/i2p.jar cryptocheck
     35            // Exception in thread "main" java.lang.ExceptionInInitializerError
     36            //  at javax.crypto.JceSecurityManager.<clinit>(java.base@9-Ubuntu/JceSecurityManager.java:65)
     37            //  at javax.crypto.Cipher.getConfiguredPermission(java.base@9-Ubuntu/Cipher.java:2595)
     38            //  at javax.crypto.Cipher.getMaxAllowedKeyLength(java.base@9-Ubuntu/Cipher.java:2619)
     39            //  at net.i2p.crypto.CryptoCheck.<clinit>(CryptoCheck.java:19)
     40            //  at java.lang.Class.forName0(java.base@9-Ubuntu/Native Method)
     41            //  at java.lang.Class.forName(java.base@9-Ubuntu/Class.java:374)
     42            //  at net.i2p.util.CommandLine.exec(CommandLine.java:66)
     43            //  at net.i2p.util.CommandLine.main(CommandLine.java:51)
     44            // Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
     45            //  at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/JceSecurity.java:91)
     46            //  ... 8 more
     47            // Caused by: java.lang.NullPointerException
     48            //  at sun.nio.fs.UnixPath.normalizeAndCheck(java.base@9-Ubuntu/UnixPath.java:75)
     49            //  at sun.nio.fs.UnixPath.<init>(java.base@9-Ubuntu/UnixPath.java:69)
     50            //  at sun.nio.fs.UnixFileSystem.getPath(java.base@9-Ubuntu/UnixFileSystem.java:280)
     51            //  at java.nio.file.Paths.get(java.base@9-Ubuntu/Paths.java:84)
     52            //  at javax.crypto.JceSecurity.setupJurisdictionPolicies(java.base@9-Ubuntu/JceSecurity.java:254)
     53            //  at javax.crypto.JceSecurity.access$000(java.base@9-Ubuntu/JceSecurity.java:49)
     54            //  at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:82)
     55            //  at javax.crypto.JceSecurity$1.run(java.base@9-Ubuntu/JceSecurity.java:79)
     56            //  at java.security.AccessController.doPrivileged(java.base@9-Ubuntu/Native Method)
     57            //  at javax.crypto.JceSecurity.<clinit>(java.base@9-Ubuntu/JceSecurity.java:78)
     58            //  ... 8 more
    3159        }
    3260        _isUnlimited = unlimited;
  • core/java/src/net/i2p/crypto/ElGamalAESEngine.java

    r44c0d93 r50450ec  
    430430     * In the router, we always use garlic messages. A garlic message with a single
    431431     * clove and zero data is about 84 bytes, so that's 123 bytes minimum. So any paddingSize
    432      * <= 128 is a no-op as every message will be at least 128 bytes
     432     * &lt;= 128 is a no-op as every message will be at least 128 bytes
    433433     * (Streaming, if used, adds more overhead).
    434434     *
    435435     * Outside the router, with a client using its own message format, the minimum size
    436      * is 48, so any paddingSize <= 48 is a no-op.
     436     * is 48, so any paddingSize &lt;= 48 is a no-op.
    437437     *
    438438     * Not included in the minimum is a 32-byte session tag for an existing session,
  • core/java/src/net/i2p/crypto/SHA1.java

    r44c0d93 r50450ec  
    2929 * <p>The FIPS PUB 180-2 standard specifies four secure hash algorithms (SHA-1,
    3030 * SHA-256, SHA-384 and SHA-512) for computing a condensed representation of
    31  * electronic data (message).  When a message of any length < 2^^64 bits (for
    32  * SHA-1 and SHA-256) or < 2^^128 bits (for SHA-384 and SHA-512) is input to
     31 * electronic data (message).  When a message of any length &lt; 2^^64 bits (for
     32 * SHA-1 and SHA-256) or &lt; 2^^128 bits (for SHA-384 and SHA-512) is input to
    3333 * an algorithm, the result is an output called a message digest.  The message
    3434 * digests range in length from 160 to 512 bits, depending on the algorithm.
     
    6363 *   <li> Bruce Schneier, "Section 18.7 Secure Hash Algorithm (SHA)",
    6464 *      <cite>Applied Cryptography, 2nd edition</cite>, <br>
    65  *      John Wiley & Sons, 1996</li>
     65 *      John Wiley &amp; Sons, 1996</li>
    6666 * </ol>
    6767 */
  • core/java/src/net/i2p/crypto/eddsa/EdDSAEngine.java

    r44c0d93 r50450ec  
    436436
    437437    /**
    438      * @deprecated replaced with <a href="#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">
     438     * @deprecated replaced with <a href="#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">this</a>
    439439     */
    440440    @Override
  • core/java/src/net/i2p/crypto/eddsa/math/GroupElement.java

    r44c0d93 r50450ec  
    3434     * <li>PRECOMP: Precomputed representation (y+x, y-x, 2dxy).
    3535     * <li>CACHED: Cached representation (Y+X, Y-X, Z, 2dT)
     36     * </ul>
    3637     */
    3738    public enum Representation {
     
    221222     * <li>Set x := β.
    222223     * <li>If sign(x) != bit 255 of s then negate x.
     224     * </ul>
    223225     *
    224226     * @param curve The curve.
     
    861863     * <p>
    862864     * Preconditions: (TODO: Check this applies here)
    863      *   a[31] <= 127
     865     *   a[31] &lt;= 127
    864866     * @param a = a[0]+256*a[1]+...+256^31 a[31]
    865867     * @return the GroupElement
  • core/java/src/net/i2p/crypto/eddsa/math/ed25519/Ed25519FieldElement.java

    r44c0d93 r50450ec  
    5959     * <p><ul>
    6060     * <li>|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
     61     * </ul>
    6162     *
    6263     * @param val The field element to add.
     
    8788     * <p><ul>
    8889     * <li>|h| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
     90     * </ul>
    8991     *
    9092     * @param val The field element to subtract.
     
    112114     * <p><ul>
    113115     * <li>|h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
     116     * </ul>
    114117     *
    115118     * @return The field element (-1) * this.
  • core/java/src/net/i2p/crypto/eddsa/math/ed25519/Ed25519LittleEndianEncoding.java

    r44c0d93 r50450ec  
    1919     * <p><ul>
    2020     * <li>p = 2^255 - 19
    21      * <li>h = h0 + 2^25 * h1 + 2^(26+25) * h2 + ... + 2^230 * h9 where 0 <= |hi| < 2^27 for all i=0,...,9.
    22      * <li>h congruent r modulo p, i.e. h = r + q * p for some suitable 0 <= r < p and an integer q.
     21     * <li>h = h0 + 2^25 * h1 + 2^(26+25) * h2 + ... + 2^230 * h9 where 0 &lt;= |hi| &lt; 2^27 for all i=0,...,9.
     22     * <li>h congruent r modulo p, i.e. h = r + q * p for some suitable 0 &lt;= r &lt; p and an integer q.
    2323     * </ul><p>
    2424     * Then q = [2^-255 * (h + 19 * 2^-25 * h9 + 1/2)] where [x] = floor(x).
     
    2727     * <p>
    2828     * We begin with some very raw estimation for the bounds of some expressions:
    29      * <pre>|h| < 2^230 * 2^30 = 2^260 ==> |r + q * p| < 2^260 ==> |q| < 2^10.
    30      * ==> -1/4 <= a := 19^2 * 2^-255 * q < 1/4.
    31      * |h - 2^230 * h9| = |h0 + ... + 2^204 * h8| < 2^204 * 2^30 = 2^234.
    32      * ==> -1/4 <= b := 19 * 2^-255 * (h - 2^230 * h9) < 1/4</pre>
    33      * Therefore 0 < 1/2 - a - b < 1.
     29     * <pre>|h| &lt; 2^230 * 2^30 = 2^260 ==&gt; |r + q * p| &lt; 2^260 ==&gt; |q| &lt; 2^10.
     30     * ==&gt; -1/4 &lt;= a := 19^2 * 2^-255 * q &lt; 1/4.
     31     * |h - 2^230 * h9| = |h0 + ... + 2^204 * h8| &lt; 2^204 * 2^30 = 2^234.
     32     * ==&gt; -1/4 &lt;= b := 19 * 2^-255 * (h - 2^230 * h9) &lt; 1/4</pre>
     33     * Therefore 0 &lt; 1/2 - a - b &lt; 1.
    3434     * <p>
    3535     * Set x := r + 19 * 2^-255 * r + 1/2 - a - b then
    36      * 0 <= x < 255 - 20 + 19 + 1 = 2^255 ==> 0 <= 2^-255 * x < 1. Since q is an integer we have
     36     * 0 &lt;= x &lt; 255 - 20 + 19 + 1 = 2^255 ==&gt; 0 &lt;= 2^-255 * x &lt; 1. Since q is an integer we have
    3737     *
    3838     * <pre>[q + 2^-255 * x] = q        (1)</pre>
     
    214214     * <p><ul>
    215215     * <li>|x| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
     216     * </ul>
    216217     *
    217218     * @return true if x is in {1,3,5,...,q-2}, false otherwise.
  • core/java/src/net/i2p/crypto/elgamal/ElGamalSigEngine.java

    r44c0d93 r50450ec  
    148148
    149149    /**
    150      * @deprecated replaced with <a href="#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">
     150     * @deprecated replaced with <a href="#engineSetParameter(java.security.spec.AlgorithmParameterSpec)">this</a>
    151151     */
    152152    @Override
  • core/java/src/net/i2p/data/Certificate.java

    r44c0d93 r50450ec  
    117117
    118118    /**
    119      *  @throws IllegalArgumentException if type < 0
     119     *  @throws IllegalArgumentException if type &lt; 0
    120120     */
    121121    public Certificate(int type, byte[] payload) {
     
    132132
    133133    /**
    134      *  @throws IllegalArgumentException if type < 0
     134     *  @throws IllegalArgumentException if type &lt; 0
    135135     *  @throws IllegalStateException if already set
    136136     */
  • core/java/src/net/i2p/data/DataHelper.java

    r44c0d93 r50450ec  
    737737     * @param numBytes 1-8
    738738     * @return non-negative
    739      * @throws AIOOBE
     739     * @throws ArrayIndexOutOfBoundsException
    740740     * @throws IllegalArgumentException if negative (only possible if numBytes = 8)
    741741     */
     
    761761     * @param numBytes 1-8
    762762     * @return non-negative
    763      * @throws AIOOBE
     763     * @throws ArrayIndexOutOfBoundsException
    764764     * @throws IllegalArgumentException if negative (only possible if numBytes = 8)
    765765     * @since 0.8.12
     
    10071007    /**
    10081008     * Helper util to compare two objects, including null handling.
    1009      * <p />
     1009     * <p>
    10101010     *
    10111011     * This treats (null == null) as true, and (null == (!null)) as false.
     
    10221022    /**
    10231023     * Run a deep comparison across the two collections. 
    1024      * <p />
     1024     * <p>
    10251025     *
    10261026     * This treats (null == null) as true, (null == (!null)) as false, and then
    1027      * comparing each element via eq(object, object). <p />
     1027     * comparing each element via eq(object, object). <p>
    10281028     *
    10291029     * If the size of the collections are not equal, the comparison returns false.
     
    10441044
    10451045    /**
    1046      * Run a comparison on the byte arrays, byte by byte.  <p />
     1046     * Run a comparison on the byte arrays, byte by byte.  <p>
    10471047     *
    10481048     * This treats (null == null) as true, (null == (!null)) as false,
     
    16281628    /**
    16291629     *  Compress the data and return a new GZIP compressed byte array.
    1630      *  @throws IllegalArgumentException if size is over 40KB
     1630     *  @throws IllegalArgumentException if input size is over 40KB
    16311631     */
    16321632    public static byte[] compress(byte orig[]) {
  • core/java/src/net/i2p/data/Hash.java

    r44c0d93 r50450ec  
    4848    /**
    4949     * Pull from cache or return new
    50      * @throws AIOOBE if not enough bytes
     50     * @throws ArrayIndexOutOfBoundsException if not enough bytes
    5151     * @since 0.8.3
    5252     */
  • core/java/src/net/i2p/data/PrivateKeyFile.java

    r44c0d93 r50450ec  
    254254   
    255255    /**
    256      *  @param padding null OK, must be non-null if spubkey length < 128
     256     *  @param padding null OK, must be non-null if spubkey length &lt; 128
    257257     *  @throws IllegalArgumentException on mismatch of spubkey and spk types
    258258     *  @since 0.9.16
  • core/java/src/net/i2p/data/PublicKey.java

    r44c0d93 r50450ec  
    3030     * Deprecated - used only by deprecated Destination.readBytes(data, off)
    3131     *
    32      * @throws AIOOBE if not enough bytes, FIXME should throw DataFormatException
     32     * @throws ArrayIndexOutOfBoundsException if not enough bytes, FIXME should throw DataFormatException
    3333     * @since 0.8.3
    3434     */
  • core/java/src/net/i2p/data/SDSCache.java

    r44c0d93 r50450ec  
    2626 *  <pre>
    2727
    28     private static final SDSCache<Foo> _cache = new SDSCache(Foo.class, LENGTH, 1024);
     28    private static final SDSCache&lt;Foo&gt; _cache = new SDSCache(Foo.class, LENGTH, 1024);
    2929
    3030    public static Foo create(byte[] data) {
     
    114114     *          makes a new object and returns it
    115115     *  @throws IllegalArgumentException if data is not the correct number of bytes
    116      *  @throws NPE
     116     *  @throws NullPointerException
    117117     */
    118118    public V get(byte[] data) {
     
    156156     *  @return the cached value if available, otherwise
    157157     *          makes a new object and returns it
    158      *  @throws AIOOBE if not enough bytes
    159      *  @throws NPE
     158     *  @throws ArrayIndexOutOfBoundsException if not enough bytes
     159     *  @throws NullPointerException
    160160     */
    161161    public V get(byte[] b, int off) {
  • core/java/src/net/i2p/data/SigningPublicKey.java

    r44c0d93 r50450ec  
    4141     * Deprecated - used only by deprecated Destination.readBytes(data, off)
    4242     *
    43      * @throws AIOOBE if not enough bytes, FIXME should throw DataFormatException
     43     * @throws ArrayIndexOutOfBoundsException if not enough bytes, FIXME should throw DataFormatException
    4444     * @since 0.8.3
    4545     */
     
    151151     *  if any
    152152     *
    153      *  @return leading padding length > 0 or null if no padding or type is unknown
     153     *  @return leading padding length &gt; 0 or null if no padding or type is unknown
    154154     *  @throws IllegalArgumentException if this is already typed to a different type
    155155     *  @since 0.9.12
  • core/java/src/net/i2p/data/i2cp/I2CPMessageImpl.java

    r44c0d93 r50450ec  
    2929
    3030    /**
    31      * Validate the type and size of the message, and then read the message into the data structures.  <p />
     31     * Validate the type and size of the message, and then read the message into the data structures.  <p>
    3232     *
    3333     * @throws IOException
  • core/java/src/net/i2p/data/i2cp/RequestVariableLeaseSetMessage.java

    r44c0d93 r50450ec  
    4545     *
    4646     *  @param clientVersion may be null
    47      *  @return version != null and version >= 0.9.7
     47     *  @return version != null and version &gt;= 0.9.7
    4848     */
    4949    public static boolean isSupported(String clientVersion) {
  • core/java/src/net/i2p/kademlia/KBucketImpl.java

    r44c0d93 r50450ec  
    3535 *  Per-key last-seen-time, failures, etc. must be tracked elsewhere.
    3636 *
    37  *  If this bucket is full (i.e. begin == end && size == max)
     37 *  If this bucket is full (i.e. begin == end &amp;&amp; size == max)
    3838 *  then add() will call KBucketTrimmer.trim() do
    3939 *  (possibly) remove older entries, and indicate whether
  • core/java/src/net/i2p/kademlia/KBucketSet.java

    r44c0d93 r50450ec  
    7373     * @param us the local identity (typically a SHA1Hash or Hash)
    7474     *           The class must have a zero-argument constructor.
    75      * @param max the Kademlia value "k", the max per bucket, k >= 4
     75     * @param max the Kademlia value "k", the max per bucket, k &gt;= 4
    7676     * @param b the Kademlia value "b", split buckets an extra 2**(b-1) times,
    77      *           b > 0, use 1 for bittorrent, Kademlia paper recommends 5
     77     *           b &gt; 0, use 1 for bittorrent, Kademlia paper recommends 5
    7878     */
    7979    public KBucketSet(I2PAppContext context, T us, int max, int b) {
     
    169169    /**
    170170     *  No lock required.
    171      *  FIXME will split the closest buckets too far if B > 1 and K < 2**B
     171     *  FIXME will split the closest buckets too far if B &gt; 1 and K &lt; 2**B
    172172     *  Won't ever really happen and if it does it still works.
    173173     */
     
    626626    /**
    627627     *  Make a new SimpleDataStrucure from the data
    628      *  @param data size <= SDS length, else throws IAE
     628     *  @param data size &lt;= SDS length, else throws IAE
    629629     *              Can be 1 bigger if top byte is zero
    630630     */
  • core/java/src/net/i2p/stat/Rate.java

    r44c0d93 r50450ec  
    139139    /**
    140140     * Create a new rate and load its state from the properties, taking data
    141      * from the data points underneath the given prefix.  <p />
     141     * from the data points underneath the given prefix.  <p>
    142142     * (e.g. prefix = "profile.dbIntroduction.60m", this will load the associated data points such
    143143     * as "profile.dbIntroduction.60m.lifetimeEventCount").  The data can be exported
  • core/java/src/net/i2p/stat/RateAverages.java

    r44c0d93 r50450ec  
    3939     * @since 0.9.4
    4040     * @return one of several things:
    41      * if there are any events (current or last) => weighted average
     41     * if there are any events (current or last) =&gt; weighted average
    4242     * otherwise if the useLifetime parameter to Rate.computeAverages was:
    43      * true => the lifetime average value
    44      * false => zero
     43     * true =&gt; the lifetime average value
     44     * false =&gt; zero
    4545     */
    4646    public double getAverage() {
  • core/java/src/net/i2p/util/Addresses.java

    r44c0d93 r50450ec  
    5757        // not as good as using a Java DBus implementation to talk to NetworkManager...
    5858        return !getAddresses(true, false, false).isEmpty();
     59    }
     60
     61    /**
     62     *  Do we have any non-loop, non-wildcard IPv6 address at all?
     63     *  @since 0.9.29
     64     */
     65    public static boolean isConnectedIPv6() {
     66        // not as good as using a Java DBus implementation to talk to NetworkManager...
     67        for (String ip : getAddresses(false, true)) {
     68            if (ip.contains(":"))
     69                return true;
     70        }
     71        return false;
    5972    }
    6073
     
    600613            System.out.println(buf.toString());
    601614        }
    602         System.out.println("\nIs connected? " + isConnected());
     615        System.out.println("\nIs connected? " + isConnected() +
     616                           "\nHas IPv6?     " + isConnectedIPv6());
    603617    }
    604618}
  • core/java/src/net/i2p/util/EepGet.java

    r44c0d93 r50450ec  
    608608     * Blocking fetch.
    609609     *
    610      * @param fetchHeaderTimeout <= 0 for none (proxy will timeout if none, none isn't recommended if no proxy)
    611      * @param totalTimeout <= 0 for default none
    612      * @param inactivityTimeout <= 0 for default 60 sec
     610     * @param fetchHeaderTimeout &lt;= 0 for none (proxy will timeout if none, none isn't recommended if no proxy)
     611     * @param totalTimeout &lt;= 0 for default none
     612     * @param inactivityTimeout &lt;= 0 for default 60 sec
    613613     */
    614614    public boolean fetch(long fetchHeaderTimeout, long totalTimeout, long inactivityTimeout) {
  • core/java/src/net/i2p/util/EventDispatcher.java

    r44c0d93 r50450ec  
    1414/**
    1515 * Event dispatching interface.  It allows objects to receive and
    16  * notify data events (basically String->Object associations) and
     16 * notify data events (basically String-&gt;Object associations) and
    1717 * create notification chains.  To ease the usage of this interface,
    1818 * you could define an EventDispatcherImpl attribute called
  • core/java/src/net/i2p/util/InternalServerSocket.java

    r44c0d93 r50450ec  
    3232
    3333    /**
    34      *  @param port > 0
     34     *  @param port &gt; 0
    3535     */
    3636    public InternalServerSocket(int port) throws IOException {
     
    8888     *  This is how the client connects.
    8989     *
    90      *  @param port > 0
     90     *  @param port &gt; 0
    9191     */
    9292    static void internalConnect(int port, InternalSocket clientSock) throws IOException {
  • core/java/src/net/i2p/util/InternalSocket.java

    r44c0d93 r50450ec  
    2727    /**
    2828     *  client side
    29      *  @param port > 0
     29     *  @param port &gt; 0
    3030     */
    3131    public InternalSocket(int port) throws IOException {
     
    3737    /**
    3838     *  Convenience method to return either a Socket or an InternalSocket
    39      *  @param port > 0
     39     *  @param port &gt; 0
    4040     */
    4141    public static Socket getSocket(String host, int port) throws IOException {
  • core/java/src/net/i2p/util/Log.java

    r44c0d93 r50450ec  
    207207   
    208208    /**
    209      * logs a loop when closing a resource with level INFO
     209     * logs a loop when closing a resource with level DEBUG
    210210     * This method is for debugging purposes only and
    211      * as such subject to change or removal w/o notice.
     211     * is subject to change or removal w/o notice.
     212     * NOT a supported API.
    212213     * @param desc vararg description
    213214     * @since 0.9.8
    214215     */
    215216    public void logCloseLoop(Object... desc) {
    216         logCloseLoop(Log.INFO, desc);
     217        logCloseLoop(Log.DEBUG, desc);
    217218    }
    218219   
     
    220221     * Logs a close loop when closing a resource
    221222     * This method is for debugging purposes only and
    222      * as such subject to change or removal w/o notice.
     223     * is subject to change or removal w/o notice.
     224     * NOT a supported API.
    223225     * @param desc vararg description of the resource
    224226     * @param level level at which to log
  • core/java/src/net/i2p/util/ObjectCounter.java

    r44c0d93 r50450ec  
    4545
    4646    /**
    47      *  @return set of objects with counts > 0
     47     *  @return set of objects with counts &gt; 0
    4848     */
    4949    public Set<K> objects() {
  • core/java/src/net/i2p/util/PortMapper.java

    r44c0d93 r50450ec  
    5151    /**
    5252     *  Add the service
    53      *  @param port > 0
     53     *  @param port &gt; 0
    5454     *  @return success, false if already registered
    5555     */
     
    6060    /**
    6161     *  Add the service
    62      *  @param port > 0
     62     *  @param port &gt; 0
    6363     *  @return success, false if already registered
    6464     *  @since 0.9.21
  • core/java/src/net/i2p/util/ReusableGZIPInputStream.java

    r44c0d93 r50450ec  
    6464        byte b[] = "hi, how are you today?".getBytes();
    6565        try {
    66             ByteArrayOutputStream baos = new ByteArrayOutputStream(64);
    67             GZIPOutputStream o = new GZIPOutputStream(baos);
     66            java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(64);
     67            ResettableGZIPOutputStream o = new ResettableGZIPOutputStream(baos);
    6868            o.write(b);
    6969            o.finish();
     
    7272           
    7373            ReusableGZIPInputStream in = ReusableGZIPInputStream.acquire();
    74             in.initialize(new ByteArrayInputStream(compressed));
     74            in.initialize(new java.io.ByteArrayInputStream(compressed));
    7575            byte rv[] = new byte[128];
    7676            int read = in.read(rv);
    77             if (!DataHelper.eq(rv, 0, b, 0, b.length))
     77            if (!net.i2p.data.DataHelper.eq(rv, 0, b, 0, b.length))
    7878                throw new RuntimeException("foo, read=" + read);
    7979            else
     
    8585    private static boolean test(int size) {
    8686        byte b[] = new byte[size];
    87         new java.util.Random().nextBytes(b);
     87        RandomSource.getInstance().nextBytes(b);
    8888        try {
    89             ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
    90             GZIPOutputStream o = new GZIPOutputStream(baos);
     89            java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream(size);
     90            ResettableGZIPOutputStream o = new ResettableGZIPOutputStream(baos);
    9191            o.write(b);
    9292            o.finish();
     
    9595           
    9696            ReusableGZIPInputStream in = ReusableGZIPInputStream.acquire();
    97             in.initialize(new ByteArrayInputStream(compressed));
    98             ByteArrayOutputStream baos2 = new ByteArrayOutputStream(size);
     97            in.initialize(new java.io.ByteArrayInputStream(compressed));
     98            java.io.ByteArrayOutputStream baos2 = new java.io.ByteArrayOutputStream(size);
    9999            byte rbuf[] = new byte[128];
    100100            try {
     
    105105                    baos2.write(rbuf, 0, read);
    106106                }
    107             } catch (IOException ioe) {
     107            } catch (java.io.IOException ioe) {
    108108                ioe.printStackTrace();
    109                 long crcVal = in.getCurrentCRCVal();
     109                //long crcVal = in.getCurrentCRCVal();
    110110                //try { in.verifyFooter(); } catch (IOException ioee) {
    111111                //    ioee.printStackTrace();
     
    121121                throw new RuntimeException("read length: " + rv.length + " expected: " + b.length);
    122122           
    123             if (!DataHelper.eq(rv, 0, b, 0, b.length)) {
     123            if (!net.i2p.data.DataHelper.eq(rv, 0, b, 0, b.length)) {
    124124                throw new RuntimeException("foo, read=" + rv.length);
    125125            } else {
    126                 System.out.println("match, w00t");
     126                System.out.println("match, w00t @ " + size);
    127127                return true;
    128128            }
  • core/java/src/net/i2p/util/ReusableGZIPOutputStream.java

    r44c0d93 r50450ec  
    9090            for (int i = 0; i < 2; i++)
    9191                test();
    92             for (int i = 500; i < 64*1024; i++) {
     92            for (int i = 0; i < 64*1024; i++) {
    9393                if (!test(i)) break;
    9494            }
     
    107107            ReusableGZIPOutputStream.release(o);
    108108           
    109             GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(compressed));
     109            ResettableGZIPInputStream in = new ResettableGZIPInputStream(new java.io.ByteArrayInputStream(compressed));
    110110            byte rv[] = new byte[128];
    111111            int read = in.read(rv);
     
    119119    private static boolean test(int size) {
    120120        byte b[] = new byte[size];
    121         new java.util.Random().nextBytes(b);
     121        RandomSource.getInstance().nextBytes(b);
    122122        try {
    123123            ReusableGZIPOutputStream o = ReusableGZIPOutputStream.acquire();
     
    128128            ReusableGZIPOutputStream.release(o);
    129129           
    130             GZIPInputStream in = new GZIPInputStream(new ByteArrayInputStream(compressed));
    131             ByteArrayOutputStream baos2 = new ByteArrayOutputStream(256*1024);
     130            ResettableGZIPInputStream in = new ResettableGZIPInputStream(new java.io.ByteArrayInputStream(compressed));
     131            ByteArrayOutputStream baos2 = new ByteArrayOutputStream(size);
    132132            byte rbuf[] = new byte[128];
    133133            while (true) {
  • core/java/src/net/i2p/util/SSLEepGet.java

    r44c0d93 r50450ec  
    272272            _stm = new SavingTrustManager(defaultTrustManager);
    273273            sslc.init(null, new TrustManager[] {_stm}, null);
     274        /****
    274275            if (_log.shouldLog(Log.DEBUG)) {
    275276                SSLEngine eng = sslc.createSSLEngine();
     
    316317                }
    317318            }
     319          ****/
    318320            return sslc;
    319321        } catch (GeneralSecurityException gse) {
    320322            _log.error("Key Store update error", gse);
     323        } catch (ExceptionInInitializerError eiie) {
     324            // java 9 b134 see ../crypto/CryptoCheck for example
     325            // Catching this may be pointless, fetch still fails
     326            _log.error("SSL context error - Java 9 bug?", eiie);
    321327        }
    322328        return null;
  • core/java/src/net/i2p/util/SimpleTimer2.java

    r44c0d93 r50450ec  
    209209     *
    210210     * valid transitions:
    211      * {IDLE,CANCELLED,RUNNING} -> SCHEDULED [ -> SCHEDULED ]* -> RUNNING -> {IDLE,CANCELLED,SCHEDULED}
    212      * {IDLE,CANCELLED,RUNNING} -> SCHEDULED [ -> SCHEDULED ]* -> CANCELLED
     211     * {IDLE,CANCELLED,RUNNING} -&gt; SCHEDULED [ -&gt; SCHEDULED ]* -&gt; RUNNING -&gt; {IDLE,CANCELLED,SCHEDULED}
     212     * {IDLE,CANCELLED,RUNNING} -&gt; SCHEDULED [ -&gt; SCHEDULED ]* -&gt; CANCELLED
    213213     *
    214214     * anything else is invalid.
     
    232232     *
    233233     * Other porting:
    234      *   SimpleTimer.getInstance().addEvent(new foo(), timeout) => new foo(SimpleTimer2.getInstance(), timeout)
    235      *   SimpleTimer.getInstance().addEvent(this, timeout) => schedule(timeout)
    236      *   SimpleTimer.getInstance().addEvent(foo, timeout) => foo.reschedule(timeout)
    237      *   SimpleTimer.getInstance().removeEvent(foo) => foo.cancel()
     234     *   SimpleTimer.getInstance().addEvent(new foo(), timeout) =&gt; new foo(SimpleTimer2.getInstance(), timeout)
     235     *   SimpleTimer.getInstance().addEvent(this, timeout) =&gt; schedule(timeout)
     236     *   SimpleTimer.getInstance().addEvent(foo, timeout) =&gt; foo.reschedule(timeout)
     237     *   SimpleTimer.getInstance().removeEvent(foo) =&gt; foo.cancel()
    238238     *
    239239     * There's no global locking, but for scheduling, we synchronize on this
  • core/java/src/net/i2p/util/SystemVersion.java

    r44c0d93 r50450ec  
    2121     */
    2222    public static final String DAEMON_USER = "i2psvc";
     23    public static final String GENTOO_USER = "i2p";
    2324
    2425    private static final boolean _isWin = System.getProperty("os.name").startsWith("Win");
     
    6465        _isOpenJDK = runtime != null && runtime.contains("OpenJDK");
    6566        _isLinuxService = !_isWin && !_isMac && !_isAndroid &&
    66                           DAEMON_USER.equals(System.getProperty("user.name"));
     67                          (DAEMON_USER.equals(System.getProperty("user.name")) ||
     68                           (_isGentoo && GENTOO_USER.equals(System.getProperty("user.name"))));
    6769
    6870        int sdk = 0;
     
    150152
    151153    /**
    152      *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") >= 0
     154     *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.6") &gt;= 0
    153155     *  as it handles Android also, where java.version = "0".
    154156     *
     
    160162
    161163    /**
    162      *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.7") >= 0
     164     *  Better than (new VersionComparator()).compare(System.getProperty("java.version"), "1.7") &gt;= 0
    163165     *  as it handles Android also, where java.version = "0".
    164166     *
     
    194196     * http://mark.koli.ch/2009/10/reliably-checking-os-bitness-32-or-64-bit-on-windows-with-a-tiny-c-app.html
    195197     * sun.arch.data.model not on all JVMs
    196      * sun.arch.data.model == 64 => 64 bit processor
    197      * sun.arch.data.model == 32 => A 32 bit JVM but could be either 32 or 64 bit processor or libs
     198     * sun.arch.data.model == 64 =&gt; 64 bit processor
     199     * sun.arch.data.model == 32 =&gt; A 32 bit JVM but could be either 32 or 64 bit processor or libs
    198200     * os.arch contains "64" could be 32 or 64 bit libs
    199201     */
  • core/java/src/net/i2p/util/Translate.java

    r44c0d93 r50450ec  
    6868     *  @param s string to be translated containing {0}
    6969     *    The {0} will be replaced by the parameter.
    70      *    Single quotes must be doubled, i.e. ' -> '' in the string.
     70     *    Single quotes must be doubled, i.e. ' -&gt; '' in the string.
    7171     *  @param o parameter, not translated.
    7272     *    To translate parameter also, use _t("foo {0} bar", _t("baz"))
  • core/java/src/net/i2p/util/ZipFileComment.java

    r44c0d93 r50450ec  
    3838     *          The string is decoded with UTF-8
    3939     *
    40      *  @throws IOE if no valid end-of-central-directory record found
     40     *  @throws IOException if no valid end-of-central-directory record found
    4141     */
    4242    public static String getComment(File file, int max) throws IOException {
     
    5454     *          The string is decoded with UTF-8
    5555     *
    56      *  @throws IOE if no valid end-of-central-directory record found
     56     *  @throws IOException if no valid end-of-central-directory record found
    5757     */
    5858    public static String getComment(File file, int max, int skip) throws IOException {
  • core/java/src/net/metanotion/io/block/BlockFile.java

    r44c0d93 r50450ec  
    338338         *  Go to any page but the superblock.
    339339         *  Page 1 is the superblock, must use file.seek(0) to get there.
    340          *  @param page >= 2
     340         *  @param page &gt;= 2
    341341         */
    342342        public static void pageSeek(RandomAccessInterface file, int page) throws IOException {
  • core/java/src/net/metanotion/io/block/index/BSkipList.java

    r44c0d93 r50450ec  
    222222****/
    223223
     224        /** find */
    224225        @Override
    225226        public SkipIterator<K, V> find(K key) {
  • core/java/src/org/bouncycastle/oldcrypto/Mac.java

    r44c0d93 r50450ec  
    3939     *
    4040     * @param key the key required by the MAC.
    41      * @exception IllegalArgumentException if the params argument is
     41     * @throws IllegalArgumentException if the params argument is
    4242     * inappropriate.
    4343     */
     
    6363     *
    6464     * @param in the byte to be processed.
    65      * @exception IllegalStateException if the MAC is not initialised.
     65     * @throws IllegalStateException if the MAC is not initialised.
    6666     */
    6767    public void update(byte in)
     
    7272     * @param inOff the index in the array the data begins at.
    7373     * @param len the length of the input starting at inOff.
    74      * @exception IllegalStateException if the MAC is not initialised.
     74     * @throws IllegalStateException if the MAC is not initialised.
    7575     */
    7676    public void update(byte[] in, int inOff, int len)
     
    8585     * @param out the array the MAC is to be output to.
    8686     * @param outOff the offset into the out buffer the output is to start at.
    87      * @exception IllegalStateException if the MAC is not initialised.
     87     * @throws IllegalStateException if the MAC is not initialised.
    8888     */
    8989    public int doFinal(byte[] out, int outOff)
  • debian-alt/doc/dependencies.txt

    r44c0d93 r50450ec  
    4747  For some Debian and Ubuntu releases, these seem to be much older than what we're bundling,
    4848  which is 8.1.21, but there's no particular version that we need.
    49   Jetty 8 is now EOL and we plan to migrate to Jetty 9.x in late 2017.
    50   Jetty 9.2.x is in recent Ubuntu, but not Debian?
     49  Jetty 8 is now EOL and we plan to migrate to Jetty 9.2 in late 2017.
     50  Jetty 8 is NOT in Debian stretch.
     51  Jetty 9 is NOT in Debian wheezy and is only in jessie backports and stretch.
     52  Jetty 9.2.x is in recent Ubuntu and Debian.
    5153  Jetty 9 ticket is https://trac.i2p2.de/ticket/1512
    5254  Updating Jetty may break external plugins. Extensive testing is required.
     
    9395  We bundle source from https://github.com/maxmind/geoip-api-java
    9496  No package or not widely available.
     97  There is a Maven geoip-api package at http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.maxmind.geoip%22
    9598
    9699* hashcash
     
    109112  We bundle a large portion of the 1.6.0 source from https://github.com/OpenNMS/jrobin
    110113  No package or not widely available.
     114  There is an old 1.5.9 Maven jrobin package at http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.jrobin%22
    111115
    112116* libtomcat6-java
     
    141145  We bundle a portion of the source from https://github.com/zxing/zxing
    142146  No package or not widely available.
     147  There are Maven zxing packages at http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.google.zxing%22
    143148
    144149
  • debian/i2p-router.manpages

    r44c0d93 r50450ec  
    11installer/resources/man/eepget.1
     2installer/resources/man/eepget.de.1
     3installer/resources/man/eepget.es.1
     4installer/resources/man/eepget.fr.1
     5installer/resources/man/eepget.it.1
     6installer/resources/man/eepget.zh.1
  • debian/i2p.manpages

    r44c0d93 r50450ec  
    11installer/resources/man/i2prouter.1
     2installer/resources/man/i2prouter.de.1
     3installer/resources/man/i2prouter.es.1
     4installer/resources/man/i2prouter.fr.1
     5installer/resources/man/i2prouter.it.1
     6installer/resources/man/i2prouter.zh.1
     7installer/resources/man/i2prouter-nowrapper.1
     8installer/resources/man/i2prouter-nowrapper.de.1
     9installer/resources/man/i2prouter-nowrapper.es.1
     10installer/resources/man/i2prouter-nowrapper.fr.1
     11installer/resources/man/i2prouter-nowrapper.it.1
     12installer/resources/man/i2prouter-nowrapper.zh.1
  • history.txt

    r44c0d93 r50450ec  
     12017-02-09 zzz
     2 * Streaming: Fix optional delay and choking (tickets #1046, 1939)
     3
     42017-02-08 zzz
     5 * I2CP: Return local delivery failure on queue overflow (ticket #1939)
     6
     72017-02-05 zzz
     8 * Console: Consolidate timer threads (ticket #1068)
     9 * NTCP: Don't write to an inbound connection before
     10   fully established, causing NPE (ticket #996)
     11 * Streaming:
     12   - Don't always send optional delay (ticket #1046)
     13   - Don't hard fail on expired message error (ticket #1748)
     14
     152017-02-04 zzz
     16 * HTTP proxies:
     17   - Pass through relative referer URIs, convert same-origin
     18     absolute referer URIs to relative (ticket #1862)
     19 * NTP: Enable IPv6 support (ticket #1896)
     20
     212017-01-30 zzz
     22 * Router: Run shutdown tasks in parallel,
     23   increase max time for shutdown tasks (ticket #1893)
     24   i2psnark: Remove most delay between announces at shutdown
     25
     262017-01-29 zzz
     27 * i2ptunnel CONNECT proxy:
     28   - Add support for outproxy plugin (tickets #1364, #1895)
     29   - Add support for ports
     30
     312017-01-28 zzz
     32 * Utils: Detect when running as service on Gentoo
     33
     342017-01-26 zzz
     35 * Build: Set up translations for man pages
     36 * Javadoc: Fixes (ticket #1894)
     37
     382017-01-24 zzz
     39 * i2prouter: Add root check to restart and condrestart (ticket #1770)
     40
     412017-01-17 zzz
     42 * Utils: Java 9 yakkety workarounds
     43
     442017-01-12 zzz
     45 * DTG: Don't try to start if headless (ticket #1924)
     46
    1472017-01-07 zzz
    248 * i2ptunnel: Fix NPE on proxy.i2p/add when no params
     
    2975   - Verify source address and port
    3076   - Add to command line
    31    - Add KoD support (ticket #1896)
    32    - Add initial IPv6 support (ticket #1897)
     77   - Add KoD support (ticket #1897)
     78   - Add initial IPv6 support (ticket #1896)
    3379
    34802016-12-20 zzz
  • installer/java/src/net/i2p/installer/FixWinPaths.java

    r44c0d93 r50450ec  
    1818 * <li>corrects the paths, rewriting <code>/</code> to <code>\</code></li>
    1919 * </ul>
    20  * </p>
     20 * <p>
    2121 * Usage: <code>FixWinPaths [WrapperConfigFile]</code>
    2222 * @since 0.9.5
  • installer/resources/checklist.md

    r44c0d93 r50450ec  
    5555    tx and pull again, or (if new) comment out in .tx/config (add a comment why)
    5656    and delete the po file
     57  - `installer/resources/poupdate-man.sh` to generate new man page translations
    5758  - `mtn add` for any new po files
    5859  - `mtn ci` all changed po files, and .tx/config if changed
  • installer/resources/i2prouter

    r44c0d93 r50450ec  
    19231923
    19241924        'restart')
     1925            checkifstartingasroot
    19251926            checkUser touchlock "$COMMAND"
    19261927            if [ ! -n "$FIXED_COMMAND" ] ; then
     
    19321933
    19331934        'condrestart')
     1935            checkifstartingasroot
    19341936            checkUser touchlock "$COMMAND"
    19351937            if [ ! -n "$FIXED_COMMAND" ] ; then
  • installer/resources/i2ptunnel.config

    r44c0d93 r50450ec  
    9797tunnel.3.option.inbound.nickname=eepsite
    9898tunnel.3.option.outbound.nickname=eepsite
    99 tunnel.3.option.i2cp.destination.sigType=ECDSA_SHA256_P256
     99tunnel.3.option.i2cp.destination.sigType=7
    100100tunnel.3.option.inbound.length=3
    101101tunnel.3.option.inbound.lengthVariance=0
  • installer/resources/man/eepget.1

    r44c0d93 r50450ec  
    1 .TH EEEPGET 1 "September 18, 2015" "" "Eepget - I2P Downloader"
     1.TH EEPGET 1 "January 26, 2017" "" "I2P"
    22
    33.SH NAME
     
    8787.TP
    8888
    89 .SH EXIT STATUS
     89.SH "EXIT STATUS"