Changeset 1b95a03d


Ignore:
Timestamp:
Nov 10, 2013 11:27:39 PM (6 years ago)
Author:
kytv <kytv@…>
Branches:
master
Children:
76078de, 90919eb
Parents:
d2f0c25 (diff), 108039d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge of '3a7591d75dacb165b1b1d26c6bdd94184076fb03'

and 'ba02b6daf2d660339ff05cfe0479344391e6e34f'

Files:
8 added
53 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java

    rd2f0c25 r1b95a03d  
    518518   */
    519519  boolean checkPiece(PartialPiece pp) {
    520     MessageDigest sha1 = SHA1.getInstance();
    521520    int piece = pp.getPiece();
    522521    byte[] hash;
  • apps/i2psnark/java/src/org/klomp/snark/PeerAcceptor.java

    rd2f0c25 r1b95a03d  
    171171            throw new IOException("Bad protocol 0x" + Integer.toHexString(b) + " at byte " + i);
    172172    }
    173     if (in.skip(8) != 8)
    174         throw new IOException("EOF before hash");
     173    DataHelper.skip(in, 8);
    175174    byte buf[] = new byte[20];
    176175    int read = DataHelper.read(in, buf);
  • apps/i2psnark/java/src/org/klomp/snark/Snark.java

    rd2f0c25 r1b95a03d  
    233233  private final byte[] infoHash;
    234234  private String additionalTrackerURL;
    235   private final I2PSnarkUtil _util;
     235  protected final I2PSnarkUtil _util;
    236236  private final Log _log;
    237237  private final PeerCoordinatorSet _peerCoordinatorSet;
  • apps/i2psnark/java/src/org/klomp/snark/SnarkManager.java

    rd2f0c25 r1b95a03d  
    532532                            changed = true;
    533533                            _config.setProperty(PROP_STARTUP_DELAY, Integer.toString(minutes));
    534                             addMessage(_("Startup delay changed to {0}", DataHelper.formatDuration2(minutes * 60 * 1000)));
     534                            addMessage(_("Startup delay changed to {0}", DataHelper.formatDuration2(minutes * (60L * 1000))));
    535535                }
    536536        }
     
    755755     */
    756756    public void saveOpenTrackers(List<String> ot) {
    757         String val = setListConfig(PROP_OPENTRACKERS, ot);
     757        setListConfig(PROP_OPENTRACKERS, ot);
    758758        if (ot == null)
    759759            ot = Collections.singletonList(I2PSnarkUtil.DEFAULT_OPENTRACKERS);
     
    14901490        public void run() {
    14911491            // don't bother delaying if auto start is false
    1492             long delay = 60 * 1000 * getStartupDelayMinutes();
     1492            long delay = (60L * 1000) * getStartupDelayMinutes();
    14931493            if (delay > 0 && shouldAutoStart()) {
    14941494                addMessage(_("Adding torrents in {0}", DataHelper.formatDuration2(delay)));
  • apps/i2psnark/java/src/org/klomp/snark/TrackerClient.java

    rd2f0c25 r1b95a03d  
    474474                    long uploaded = coordinator.getUploaded();
    475475                    long downloaded = coordinator.getDownloaded();
     476                    long len = snark.getTotalLength();
     477                    if (len > 0 && downloaded > len)
     478                        downloaded = len;
    476479                    left = coordinator.getLeft();
    477480                    String event;
     
    509512                        coordinator.getPeerCount() <= 0 &&
    510513                        _util.getContext().clock().now() > _startedOn + 2*60*60*1000 &&
     514                        snark.getTotalLength() > 0 &&
    511515                        uploaded >= 2 * snark.getTotalLength()) {
    512516                        if (_log.shouldLog(Log.WARN))
     
    716720        long uploaded = coordinator.getUploaded();
    717721        long downloaded = coordinator.getDownloaded();
     722        long len = snark.getTotalLength();
     723        if (len > 0 && downloaded > len)
     724            downloaded = len;
    718725        long left = coordinator.getLeft();
    719726        try
  • apps/i2psnark/java/src/org/klomp/snark/bencode/BDecoder.java

    rd2f0c25 r1b95a03d  
    6161
    6262  // Used for ugly hack to get SHA hash over the metainfo info map
    63   private final String special_map = "info";
     63  private static final String special_map = "info";
    6464  private boolean in_special_map = false;
    6565  /** creation deferred until we encounter the special map, to make processing of announce replies more efficient */
  • apps/i2psnark/java/src/org/klomp/snark/web/BasicServlet.java

    rd2f0c25 r1b95a03d  
    3737import net.i2p.I2PAppContext;
    3838import net.i2p.data.ByteArray;
     39import net.i2p.data.DataHelper;
    3940import net.i2p.util.ByteCache;
    4041import net.i2p.util.Log;
     
    470471            String cpath = getServletContext().getContextPath();
    471472            // this won't work if we aren't at top level
    472             String cname = cpath == "" ? "i2psnark" : cpath.substring(1).replace("/", "_");
     473            String cname = "".equals(cpath) ? "i2psnark" : cpath.substring(1).replace("/", "_");
    473474            return (new File(_context.getBaseDir(), "webapps/" + cname + ".war")).lastModified();
    474475        }
     
    579580        try {
    580581            if (skip > 0)
    581                 in.skip(skip);
     582                DataHelper.skip(in, skip);
    582583            int read = 0;
    583584            long tot = 0;
  • apps/i2psnark/java/src/org/klomp/snark/web/FetchAndAdd.java

    rd2f0c25 r1b95a03d  
    199199         _transferred = 0;
    200200         _failCause = null;
    201         _started = _ctx.clock().now();
     201        _started = _util.getContext().clock().now();
    202202        _isRunning = true;
    203203        _active = false;
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    rd2f0c25 r1b95a03d  
    25492549                buf.append("<td class=\"priority\">");
    25502550                File f = item;
    2551                 if ((!complete) && (!item.isDirectory()) && f != null) {
     2551                if ((!complete) && (!item.isDirectory())) {
    25522552                    int pri = snark.getStorage().getPriority(f.getCanonicalPath());
    25532553                    buf.append("<input type=\"radio\" value=\"5\" name=\"pri.").append(f.getCanonicalPath()).append("\" ");
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/irc/IRCFilter.java

    rd2f0c25 r1b95a03d  
    7272        // Allow numerical responses
    7373        try {
    74             new Integer(command);
     74            Integer.parseInt(command);
    7575            return s;
    7676        } catch(NumberFormatException nfe){}
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS4aServer.java

    rd2f0c25 r1b95a03d  
    105105        }
    106106
    107         connHostName = new String("");
     107        StringBuilder builder = new StringBuilder();
    108108        boolean alreadyWarned = false;
    109109        for (int i = 0; i < 4; ++i) {
    110110            int octet = in.readByte() & 0xff;
    111             connHostName += Integer.toString(octet);
     111            builder.append(Integer.toString(octet));
    112112            if (i != 3) {
    113                 connHostName += ".";
     113                builder.append(".");
    114114                if (octet != 0 && !alreadyWarned) {
    115115                    _log.warn("IPV4 address type in request: " + connHostName + ". Is your client secure?");
     
    118118            }
    119119        }
     120        connHostName = builder.toString();
    120121
    121122        // Check if the requested IP should be mapped to a domain name
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/socks/SOCKS5Server.java

    rd2f0c25 r1b95a03d  
    199199        switch (addressType) {
    200200        case AddressType.IPV4:
    201             connHostName = new String("");
     201            //connHostName = new String();
     202            StringBuilder builder = new StringBuilder();
    202203            for (int i = 0; i < 4; ++i) {
    203204                int octet = in.readUnsignedByte();
    204                 connHostName += Integer.toString(octet);
     205                builder.append(Integer.toString(octet));
    205206                if (i != 3) {
    206                     connHostName += ".";
     207                    builder.append(".");
    207208                }
    208209            }
     210            connHostName = builder.toString();
    209211            // Check if the requested IP should be mapped to a domain name
    210212            String mappedDomainName = getMappedDomainNameForIP(connHostName);
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    rd2f0c25 r1b95a03d  
    274274       
    275275        Properties config = getConfig();
    276         if (config == null)
    277             return "Invalid params";
    278276       
    279277        if (cur == null) {
     
    971969        TunnelController tun = getController(_tunnel);
    972970        Properties config = getConfig();
    973         if (config == null)
    974             return "Invalid params";
    975971        if (tun == null) {
    976972            // creating new
     
    10391035        TunnelController tun = getController(_tunnel);
    10401036        Properties config = getConfig();
    1041         if (config == null)
    1042             return "Invalid params";
    10431037        if (tun == null) {
    10441038            // creating new
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java

    rd2f0c25 r1b95a03d  
    239239    }
    240240    private String kbytesToBits(int kbytes) {
    241         return DataHelper.formatSize(kbytes * 8 * 1024) + ' ' + _("bits per second") +
    242                ' ' + _("or {0} bytes per month maximum", DataHelper.formatSize(kbytes * 1024l * 60 * 60 * 24 * 31));
     241        return DataHelper.formatSize(kbytes * (8 * 1024L)) + ' ' + _("bits per second") +
     242               ' ' + _("or {0} bytes per month maximum", DataHelper.formatSize(kbytes * (1024L * 60 * 60 * 24 * 31)));
    243243    }
    244244    public String getInboundBurstRate() {
  • apps/routerconsole/java/src/net/i2p/router/web/HomeHelper.java

    rd2f0c25 r1b95a03d  
    3939        _x("Bug Reports") + S + _x("Bug tracker") + S + "http://trac.i2p2.i2p/report/1" + S + I + "bug.png" + S +
    4040        //"colombo-bt.i2p" + S + _x("The Italian Bittorrent Resource") + S + "http://colombo-bt.i2p/" + S + I + "colomboicon.png" + S +
    41         _x("Dev Forum") + S + _x("Development forum") + S + "http://zzz.i2p/" + S + I + "eepsite.png" + S +
    42         _x("diftracker") + S + _x("Bittorrent tracker") + S + "http://diftracker.i2p/" + S + I + "eepsite.png" + S +
    43         "echelon.i2p" + S + _x("I2P Applications") + S + "http://echelon.i2p/" + S + I + "eepsite.png" + S +
     41        _x("Dev Forum") + S + _x("Development forum") + S + "http://zzz.i2p/" + S + I + "group_gear.png" + S +
     42        _x("diftracker") + S + _x("Bittorrent tracker") + S + "http://diftracker.i2p/" + S + I + "magnet.png" + S +
     43        "echelon.i2p" + S + _x("I2P Applications") + S + "http://echelon.i2p/" + S + I + "box_open.png" + S +
    4444        _x("FAQ") + S + _x("Frequently Asked Questions") + S + "http://www.i2p2.i2p/faq" + S + I + "question.png" + S +
    45         _x("Forum") + S + _x("Community forum") + S + "http://forum.i2p/" + S + I + "eepsite.png" + S +
     45        _x("Forum") + S + _x("Community forum") + S + "http://forum.i2p/" + S + I + "group.png" + S +
    4646        _x("Anonymous Git Hosting") + S + _x("A public anonymous Git hosting site - supports pulling via Git and HTTP and pushing via SSH") + S + "http://git.repo.i2p/" + S + I + "git-logo.png" + S +
    4747        "Ident " + _x("Microblog") + S + _x("Your premier microblogging service on I2P") + S + "http://id3nt.i2p/" + S + I + "ident_icon_blue.png" + S +
    4848        _x("Javadocs") + S + _x("Technical documentation") + S + "http://i2p-javadocs.i2p/" + S + I + "education.png" + S +
    4949        //_x("Key Server") + S + _x("OpenPGP Keyserver") + S + "http://keys.i2p/" + S + I + "education.png" + S +
    50         "killyourtv.i2p" + S + _x("Debian and Tahoe-LAFS repositories") + S + "http://killyourtv.i2p/" + S + I + "eepsite.png" + S +
     50        "killyourtv.i2p" + S + _x("Debian and Tahoe-LAFS repositories") + S + "http://killyourtv.i2p/" + S + I + "television_delete.png" + S +
    5151        _x("Free Web Hosting") + S + _x("Free eepsite hosting with PHP and MySQL") + S + "http://open4you.i2p/" + S + I + "open4you-logo.png" + S +
    52         _x("Pastebin") + S + _x("I2P Pastebin") + S + "http://pastethis.i2p/" + S + I + "eepsite.png" + S +
    53         "Planet I2P" + S + _x("I2P News") + S + "http://planet.i2p/" + S + I + "eepsite.png" + S +
     52        _x("Pastebin") + S + _x("I2P Pastebin") + S + "http://pastethis.i2p/" + S + I + "paste_plain.png" + S +
     53        "Planet I2P" + S + _x("I2P News") + S + "http://planet.i2p/" + S + I + "world.png" + S +
    5454        _x("Plugins") + S + _x("Add-on directory") + S + "http://plugins.i2p/" + S + I + "plugin.png" + S +
    55         _x("Postman's Tracker") + S + _x("Bittorrent tracker") + S + "http://tracker2.postman.i2p/" + S + I + "eepsite.png" + S +
     55        _x("Postman's Tracker") + S + _x("Bittorrent tracker") + S + "http://tracker2.postman.i2p/" + S + I + "magnet.png" + S +
    5656        _x("Project Website") + S + _x("I2P home page") + S + "http://www.i2p2.i2p/" + S + I + "info_rhombus.png" + S +
    5757        "Salt" + S + "salt.i2p" + S + "http://salt.i2p/" + S + I + "salt_console.png" + S +
    5858        "stats.i2p" + S + _x("I2P Network Statistics") + S + "http://stats.i2p/cgi-bin/dashboard.cgi" + S + I + "chart_line.png" + S +
    5959        _x("Technical Docs") + S + _x("Technical documentation") + S + "http://www.i2p2.i2p/how" + S + I + "education.png" + S +
    60         _x("Trac Wiki") + S + S + "http://trac.i2p2.i2p/" + S + I + "eepsite.png" + S +
    61         _x("Ugha's Wiki") + S + S + "http://ugha.i2p/" + S + I + "eepsite.png" + S +
    62         _x("Sponge's main site") + S + _x("Seedless and the Robert BitTorrent applications") + S + "http://sponge.i2p/" + S + I + "eepsite.png" + S +
     60        _x("Trac Wiki") + S + S + "http://trac.i2p2.i2p/" + S + I + "billiard_marker.png" + S +
     61        _x("Ugha's Wiki") + S + S + "http://ugha.i2p/" + S + I + "billiard_marker.png" + S +
     62        _x("Sponge's main site") + S + _x("Seedless and the Robert BitTorrent applications") + S + "http://sponge.i2p/" + S + I + "user_astronaut.png" + S +
    6363        "";
    6464
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java

    rd2f0c25 r1b95a03d  
    9494        if (doSend) {
    9595            PacketLocal packet = send(buf, off, size);
    96             if (packet == null) return _dummyStatus;
     96            // this shouldn't be null
     97            //if (packet == null) return _dummyStatus;
    9798           
    9899            //dont wait for non-acks
     
    116117     * @param off offset into the buffer to start writing from
    117118     * @param size how many bytes of the buffer to write (may be 0)
    118      * @return the packet sent, or null if the connection died
     119     * @return the packet sent
    119120     */
    120121    public PacketLocal send(byte buf[], int off, int size) {
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionPacketHandler.java

    rd2f0c25 r1b95a03d  
    202202               
    203203                if (_log.shouldLog(Log.WARN))
    204                     _log.warn(String.format("%s congestion.. dup packet %s ackDelay %d lastSend %d ago",
     204                    _log.warn(String.format("%s congestion.. dup packet %s ackDelay %d lastSend %s ago",
    205205                                    con, packet, ackDelay, DataHelper.formatDuration(now - lastSendTime)));
    206206               
  • apps/streaming/java/src/net/i2p/client/streaming/PcapWriter.java

    rd2f0c25 r1b95a03d  
    239239        long acked = 0;
    240240        if (con != null) {
    241             if (isInbound)
    242                 acked = getLowestAckedThrough(pkt, con);
    243             else
    244                 acked = getLowestAckedThrough(pkt, con);
     241            acked = getLowestAckedThrough(pkt, con);
    245242        }
    246243        DataHelper.writeLong(_fos, 4, pkt.getSequenceNum());
  • apps/susimail/src/src/org/mortbay/servlet/MultiPartRequest.java

    rd2f0c25 r1b95a03d  
    436436   
    437437    /* ------------------------------------------------------------ */
    438     private class Part
    439     {
    440         String _name=null;
    441         String _filename=null;
     438    private static class Part
     439    {
     440        String _name;
     441        String _filename;
    442442        Hashtable _headers= new Hashtable(10);
    443         byte[] _data=null;
     443        byte[] _data;
    444444    }   
    445445};
  • core/java/src/freenet/support/CPUInformation/CPUIDCPUInfo.java

    rd2f0c25 r1b95a03d  
    1515    public boolean hasMMX()
    1616    {
    17         return (CPUID.getEDXCPUFlags() & 0x800000) >0; //EDX Bit 23
     17        return (CPUID.getEDXCPUFlags() & 0x800000) != 0; //EDX Bit 23
    1818    }
    1919    public boolean hasSSE(){
    20         return (CPUID.getEDXCPUFlags() & 0x2000000) >0; //EDX Bit 25
     20        return (CPUID.getEDXCPUFlags() & 0x2000000) != 0; //EDX Bit 25
    2121    }
    2222    public boolean hasSSE2()
    2323    {
    24         return (CPUID.getEDXCPUFlags() & 0x4000000) >0; //EDX Bit 26
     24        return (CPUID.getEDXCPUFlags() & 0x4000000) != 0; //EDX Bit 26
    2525    }
    2626    public boolean hasSSE3()
    2727    {
    28         return (CPUID.getEDXCPUFlags() & 0x1) >0; //ECX Bit 0
     28        return (CPUID.getEDXCPUFlags() & 0x1) != 0; //ECX Bit 0
    2929    }
    3030    public boolean hasSSE41()
    3131    {
    32         return (CPUID.getEDXCPUFlags() & 0x80000) >0; //ECX Bit 19
     32        return (CPUID.getEDXCPUFlags() & 0x80000) != 0; //ECX Bit 19
    3333    }
    3434    public boolean hasSSE42()
    3535    {
    36         return (CPUID.getEDXCPUFlags() & 0x100000) >0; //ECX Bit 20
     36        return (CPUID.getEDXCPUFlags() & 0x100000) != 0; //ECX Bit 20
    3737    }
    3838    public boolean hasSSE4A()
    3939    {
    40         return (CPUID.getExtendedECXCPUFlags() & 0x40) >0; //Extended ECX Bit 6
     40        return (CPUID.getExtendedECXCPUFlags() & 0x40) != 0; //Extended ECX Bit 6
    4141    }
    4242   
  • core/java/src/net/i2p/crypto/DSAEngine.java

    rd2f0c25 r1b95a03d  
    599599        SigType type = privateKey.getType();
    600600        String algo = getRawAlgo(type);
    601         java.security.Signature jsig = java.security.Signature.getInstance(algo);
    602601        PrivateKey privKey = SigUtil.toJavaKey(privateKey);
    603602        return altSignRaw(algo, hash, privKey, type);
  • core/java/src/net/i2p/crypto/SigUtil.java

    rd2f0c25 r1b95a03d  
    176176        SigType type = pk.getType();
    177177        int len = type.getPubkeyLen();
    178         int sublen = len / 2;
    179178        byte[] b = pk.getData();
    180179        BigInteger s = new NativeBigInteger(1, b);
  • core/java/src/net/i2p/crypto/TrustedUpdate.java

    rd2f0c25 r1b95a03d  
    475475        try {
    476476            fileInputStream = new FileInputStream(signedFile);
    477             long skipped = fileInputStream.skip(Signature.SIGNATURE_BYTES);
    478             if (skipped != Signature.SIGNATURE_BYTES)
    479                 return "";
     477            DataHelper.skip(fileInputStream, Signature.SIGNATURE_BYTES);
    480478            byte[] data = new byte[VERSION_BYTES];
    481479            int bytesRead = DataHelper.read(fileInputStream, data);
     
    516514    public static String getVersionString(InputStream inputStream) {
    517515        try {
    518             long skipped = inputStream.skip(Signature.SIGNATURE_BYTES);
    519             if (skipped != Signature.SIGNATURE_BYTES)
    520                 return "";
     516            DataHelper.skip(inputStream, Signature.SIGNATURE_BYTES);
    521517            byte[] data = new byte[VERSION_BYTES];
    522518            int bytesRead = DataHelper.read(inputStream, data);
     
    641637            fileInputStream = new FileInputStream(signedFile);
    642638            fileOutputStream = new FileOutputStream(outputFile);
    643             long skipped = 0;
    644 
    645             while (skipped < HEADER_BYTES)
    646                 skipped += fileInputStream.skip(HEADER_BYTES - skipped);
     639
     640            DataHelper.skip(fileInputStream, HEADER_BYTES);
    647641
    648642            byte[] buffer = new byte[16*1024];
  • core/java/src/net/i2p/data/DataHelper.java

    rd2f0c25 r1b95a03d  
    11421142
    11431143    /**
     1144     *  This is different than InputStream.skip(), in that it
     1145     *  does repeated reads until the full amount is skipped.
     1146     *  To fix findbugs issues with skip().
     1147     *
     1148     *  Guaranteed to skip exactly n bytes or throw an IOE.
     1149     *
     1150     *  http://stackoverflow.com/questions/14057720/robust-skipping-of-data-in-a-java-io-inputstream-and-its-subtypes
     1151     *  http://stackoverflow.com/questions/11511093/java-inputstream-skip-return-value-near-end-of-file
     1152     *
     1153     *  @since 0.9.9
     1154     */
     1155    public static void skip(InputStream in, long n) throws IOException {
     1156        if (n < 0)
     1157            throw new IllegalArgumentException();
     1158        if (n == 0)
     1159            return;
     1160        long read = 0;
     1161        long nm1 = n - 1;
     1162        if (nm1 > 0) {
     1163            // skip all but the last byte
     1164            do {
     1165                long c = in.skip(nm1 - read);
     1166                if (c < 0)
     1167                    throw new EOFException("EOF while skipping " + n + ", read only " + read);
     1168                if (c == 0) {
     1169                    // see second SO link above
     1170                    if (in.read() == -1)
     1171                        throw new EOFException("EOF while skipping " + n + ", read only " + read);
     1172                    read++;
     1173                } else {
     1174                    read += c;
     1175                }
     1176            } while (read < nm1);
     1177        }
     1178        // read the last byte to check for EOF
     1179        if (in.read() == -1)
     1180            throw new EOFException("EOF while skipping " + n + ", read only " + read);
     1181    }
     1182
     1183    /**
    11441184     *  This is different than InputStream.read(target), in that it
    11451185     *  does repeated reads until the full data is received.
  • core/java/src/net/i2p/util/Log.java

    rd2f0c25 r1b95a03d  
    210210       
    211211        // catenate all toString()s
    212         String descString = "close() loop in";
     212        StringBuilder builder = new StringBuilder();
     213        builder.append("close() loop in");
    213214        for (Object o : desc) {
    214             descString += " ";
    215             descString += String.valueOf(o);
     215            builder.append(" ");
     216            builder.append(String.valueOf(o));
    216217        }
    217218       
    218219        Exception e = new Exception("check stack trace");
    219         log(level,descString,e);
     220        log(level,builder.toString(),e);
    220221    }
    221222
  • core/java/src/net/i2p/util/SimpleTimer.java

    rd2f0c25 r1b95a03d  
    150150            // FIXME if you plan to use this class again
    151151            while (_events.containsKey(time))
    152                 time = new Long(time.longValue() + 1);
     152                time = Long.valueOf(time.longValue() + 1);
    153153            _events.put(time, event);
    154154            _eventTimes.put(event, time);
  • core/java/src/net/i2p/util/SipHashInline.java

    rd2f0c25 r1b95a03d  
    5454        while (i < last) {
    5555            // pack a block to long, as LE 8 bytes
    56             m = (long) data[i++]      |
    57                 (long) data[i++] <<  8 |
    58                 (long) data[i++] << 16 |
    59                 (long) data[i++] << 24 |
    60                 (long) data[i++] << 32 |
    61                 (long) data[i++] << 40 |
    62                 (long) data[i++] << 48 |
    63                 (long) data[i++] << 56 ;
     56            m = ((((long) data[i++]) & 0xff)      ) |
     57                ((((long) data[i++]) & 0xff) <<  8) |
     58                ((((long) data[i++]) & 0xff) << 16) |
     59                ((((long) data[i++]) & 0xff) << 24) |
     60                ((((long) data[i++]) & 0xff) << 32) |
     61                ((((long) data[i++]) & 0xff) << 40) |
     62                ((((long) data[i++]) & 0xff) << 48) |
     63                ((((long) data[i++]) & 0xff) << 56);
    6464            // MSGROUND {
    6565                v3 ^= m;
     
    133133        m = 0;
    134134        for (i = off + len - 1; i >= last; --i) {
    135             m <<= 8; m |= (long) data[i];
     135            m <<= 8; m |= (long) (data[i] & 0xff);
    136136        }
    137137        m |= (long) len << 56;
  • core/java/src/net/i2p/util/ZipFileComment.java

    rd2f0c25 r1b95a03d  
    7070            in = new FileInputStream(file);
    7171            if (skip > 0)
    72                 in.skip(skip);
     72                DataHelper.skip(in, skip);
    7373            byte[] hdr = new byte[HEADER_LEN];
    7474            DataHelper.read(in, hdr);
    7575            if (!DataHelper.eq(hdr, magicStart))
    7676                throw new ZipException("Not a zip file: " + file);
    77             in.skip(fileLen - (skip + HEADER_LEN + buffer.length));
     77            DataHelper.skip(in, fileLen - (skip + HEADER_LEN + buffer.length));
    7878            DataHelper.read(in, buffer);
    7979            return getComment(buffer);
  • core/java/src/net/metanotion/io/block/index/BSkipSpan.java

    rd2f0c25 r1b95a03d  
    391391
    392392                BSkipSpan bss = this;
     393                // findbugs ok (set in load() above)
    393394                int np = nextPage;
    394395                while(np != 0) {
  • core/java/test/junit/net/i2p/data/DataHelperTest.java

    rd2f0c25 r1b95a03d  
    33import java.io.ByteArrayInputStream;
    44import java.io.ByteArrayOutputStream;
     5import java.io.IOException;
    56import java.util.Calendar;
    67import java.util.Date;
     
    127128        }
    128129    }
     130
     131    public void testSkip() throws Exception {
     132        final int sz = 256;
     133        TestInputStream tis = new TestInputStream(sz);
     134        DataHelper.skip(tis, sz);
     135        try {
     136            DataHelper.skip(tis, 1);
     137            fail();
     138        } catch (IOException ioe) {}
     139       
     140        DataHelper.skip(tis, 0);
     141       
     142        try {
     143            DataHelper.skip(tis, -1);
     144            fail("skipped negative?");
     145        } catch (IllegalArgumentException expected) {}
     146    }
     147
     148    private static class TestInputStream extends ByteArrayInputStream {
     149        private final Random r = new Random();
     150
     151        public TestInputStream(int size) {
     152            super(new byte[size]);
     153            r.nextBytes(buf);
     154        }
     155
     156        /** skip a little at a time, or sometimes zero */
     157        @Override
     158        public long skip(long n) {
     159            return super.skip(Math.min(n, r.nextInt(4)));
     160        }
     161    }
    129162}
  • router/java/src/net/i2p/router/Blocklist.java

    rd2f0c25 r1b95a03d  
    526526            if (pib == null) continue;
    527527            // O(n**2)
     528            boolean dup = false;
    528529            for (int i = 0; i < rv.size(); i++) {
    529                 if (DataHelper.eq(rv.get(i), pib)) continue;
    530             }
    531             rv.add(pib);
     530                if (DataHelper.eq(rv.get(i), pib)) {
     531                    dup = true;
     532                    break;
     533                }
     534            }
     535            if (!dup)
     536                rv.add(pib);
    532537         }
    533538         return rv;
  • router/java/src/net/i2p/router/MessageHistory.java

    rd2f0c25 r1b95a03d  
    375375        buf.append("timed out waiting for a reply to [").append(sentMessage.getMessageType());
    376376        buf.append("] [").append(sentMessage.getMessageId()).append("] expiring on [");
    377         if (sentMessage != null)
    378             buf.append(getTime(sentMessage.getReplySelector().getExpiration()));
     377        buf.append(getTime(sentMessage.getReplySelector().getExpiration()));
    379378        buf.append("] ").append(sentMessage.getReplySelector().toString());
    380379        addEntry(buf.toString());
  • router/java/src/net/i2p/router/RouterVersion.java

    rd2f0c25 r1b95a03d  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 23;
     21    public final static long BUILD = 24;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/StatisticsManager.java

    rd2f0c25 r1b95a03d  
    8787        if (_context.getBooleanPropertyDefaultTrue(PROP_PUBLISH_RANKINGS) &&
    8888            _context.random().nextInt(RANDOM_INCLUDE_STATS) == 0) {
    89             long publishedUptime = _context.router().getUptime();
     89            //long publishedUptime = _context.router().getUptime();
    9090            // Don't publish these for first hour
    9191            // Disabled in 0.9
  • router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java

    rd2f0c25 r1b95a03d  
    224224        if (info == null) return true;
    225225        String cap = info.getCapabilities();
    226         if (cap == null) return false;
    227226        return cap.indexOf(Router.CAPABILITY_REACHABLE) >= 0;
    228227    }
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java

    rd2f0c25 r1b95a03d  
    147147            final String log = String.format(
    148148                    "FF criteria breakdown: happy=%b, capabilities=%s, maxLag=%d, known=%d, " +
    149                     "active=%d, participating=%d, offset=%d, ssuAddr=%b",
     149                    "active=%d, participating=%d, offset=%d, ssuAddr=%s",
    150150                    happy,
    151151                    rc.router().getRouterInfo().getCapabilities(),
     
    155155                    rc.tunnelManager().getParticipatingCount(),
    156156                    Math.abs(rc.clock().getOffset()),
    157                     rc.router().getRouterInfo().getTargetAddress("SSU")
     157                    rc.router().getRouterInfo().getTargetAddress("SSU").toString()
    158158                    );
    159159            _log.debug(log);
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java

    rd2f0c25 r1b95a03d  
    311311            return rv;
    312312        Collection<RouterAddress> paddr = pinfo.getAddresses();
    313         if (paddr == null)
    314             return rv;
    315313        for (RouterAddress pa : paddr) {
    316314            byte[] pib = pa.getIP();
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    rd2f0c25 r1b95a03d  
    927927    void dropAfterLookupFailed(Hash peer) {
    928928        _context.peerManager().removeCapabilities(peer);
    929         boolean removed = _kb.remove(peer);
     929        _kb.remove(peer);
    930930        //if (removed) {
    931931        //    if (_log.shouldLog(Log.INFO))
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    rd2f0c25 r1b95a03d  
    12711271            return rv;
    12721272        Collection<RouterAddress> paddr = pinfo.getAddresses();
    1273         if (paddr == null)
    1274             return rv;
    12751273        for (RouterAddress pa : paddr) {
    12761274            byte[] pib = pa.getIP();
  • router/java/src/net/i2p/router/transport/GeoIPv6.java

    rd2f0c25 r1b95a03d  
    8484                throw new IOException("Not a IPv6 geoip data file");
    8585            // skip timestamp and comments
    86             in.skip(HEADER_LEN - MAGIC.length());
     86            DataHelper.skip(in, HEADER_LEN - MAGIC.length());
    8787            byte[] buf = new byte[18];
    8888            while (DataHelper.read(in, buf) == 18 && idx < search.length) {
  • router/java/src/net/i2p/router/transport/OutboundMessageRegistry.java

    rd2f0c25 r1b95a03d  
    140140                    if (o instanceof OutNetMessage) {
    141141                        msg = (OutNetMessage)o;
    142                         if (msg != null)
    143                             rv.add(msg);
     142                        rv.add(msg);
    144143                    } else if (o instanceof List) {
    145144                        msgs = (List<OutNetMessage>)o;
    146                         if (msgs != null)
    147                             rv.addAll(msgs);
     145                        rv.addAll(msgs);
    148146                    }
    149147                }
  • router/java/src/net/i2p/router/transport/UPnP.java

    rd2f0c25 r1b95a03d  
    99import java.net.URL;
    1010import java.util.Collections;
     11import java.util.HashMap;
    1112import java.util.HashSet;
    1213import java.util.Iterator;
     
    7980        private Device _router;
    8081        private Service _service;
     82        // UDN -> friendly name
     83        private final Map<String, String> _otherUDNs;
    8184        private boolean isDisabled = false; // We disable the plugin if more than one IGD is found
    8285        private volatile boolean _serviceLacksAPM;
     
    9396
    9497        private static final String PROP_ADVANCED = "routerconsole.advanced";
     98        private static final String PROP_IGNORE = "i2np.upnp.ignore";
    9599       
    96100        public UPnP(I2PAppContext context) {
     
    100104                portsToForward = new HashSet<ForwardPort>();
    101105                portsForwarded = new HashSet<ForwardPort>();
     106                _otherUDNs = new HashMap<String, String>(4);
    102107                addDeviceChangeListener(this);
    103108        }
     
    179184         */
    180185        public void deviceAdded(Device dev) {
     186                String udn = dev.getUDN();
     187                if (udn == null)
     188                        udn = "???";
     189                String name = dev.getFriendlyName();
     190                if (name == null)
     191                        name = "???";
    181192                synchronized (lock) {
    182193                        if(isDisabled) {
    183194                                if (_log.shouldLog(Log.WARN))
    184                                         _log.warn("Plugin has been disabled previously, ignoring new device.");
     195                                        _log.warn("Plugin has been disabled previously, ignoring " + name + " UDN: " + udn);
     196                                _otherUDNs.put(udn, name);
    185197                                return;
    186198                        }
     
    188200                if(!ROUTER_DEVICE.equals(dev.getDeviceType()) || !dev.isRootDevice()) {
    189201                        if (_log.shouldLog(Log.WARN))
    190                                 _log.warn("UP&P non-IGD device found, ignoring : " + dev.getFriendlyName());
     202                                _log.warn("UP&P non-IGD device found, ignoring " + name);
     203                        synchronized (lock) {
     204                                _otherUDNs.put(udn, name);
     205                        }
    191206                        return; // ignore non-IGD devices
    192207                } else if(isNATPresent()) {
    193208                        // maybe we should see if the old one went away before ignoring the new one?
    194                         if (_log.shouldLog(Log.WARN))
    195                                 _log.warn("UP&P ignoring additional IGD device found: " + dev.getFriendlyName() + " UDN: " + dev.getUDN());
     209                        _log.logAlways(Log.WARN, "UP&P ignoring additional device " + name + " UDN: " + udn);
     210                        synchronized (lock) {
     211                                _otherUDNs.put(udn, name);
     212                        }
    196213                        /********** seems a little drastic
    197214                        isDisabled = true;
     
    207224                }
    208225               
     226                boolean ignore = false;
     227                String toIgnore = _context.getProperty(PROP_IGNORE);
     228                if (toIgnore != null) {
     229                        String[] ignores = toIgnore.split("[,; \r\n\t]");
     230                        for (int i = 0; i < ignores.length; i++) {
     231                                if (ignores[i].equals(udn)) {
     232                                        ignore = true;
     233                                        _log.logAlways(Log.WARN, "Ignoring by config: " + name + " UDN: " + udn);
     234                                        break;
     235                                }
     236                        }
     237                }
     238                synchronized(lock) {
     239                        if (ignore) {
     240                                _otherUDNs.put(udn, name);
     241                                return;
     242                        } else {
     243                                _router = dev;
     244                        }
     245                }
     246
    209247                if (_log.shouldLog(Log.WARN))
    210                         _log.warn("UP&P IGD found : " + dev.getFriendlyName() + " UDN: " + dev.getUDN() + " lease time: " + dev.getLeaseTime());
    211                 synchronized(lock) {
    212                         _router = dev;
    213                 }
     248                        _log.warn("UP&P IGD found : " + name + " UDN: " + udn + " lease time: " + dev.getLeaseTime());
    214249               
    215250                discoverService();
     
    304339         */
    305340        public void deviceRemoved(Device dev ){
     341                String udn = dev.getUDN();
    306342                if (_log.shouldLog(Log.WARN))
    307                         _log.warn("UP&P device removed : " + dev.getFriendlyName() + " UDN: " + dev.getUDN());
     343                        _log.warn("UP&P device removed : " + dev.getFriendlyName() + " UDN: " + udn);
    308344                synchronized (lock) {
    309345                        if(_router == null) return;
     346                        if (udn != null)
     347                                _otherUDNs.remove(udn);
     348                        else
     349                                _otherUDNs.remove("???");
    310350                        // I2P this wasn't working
    311351                        //if(_router.equals(dev)) {
     
    313353                           dev.isRootDevice() &&
    314354                           stringEquals(_router.getFriendlyName(), dev.getFriendlyName()) &&
    315                            stringEquals(_router.getUDN(), dev.getUDN())) {
     355                           stringEquals(_router.getUDN(), udn)) {
    316356                                if (_log.shouldLog(Log.WARN))
    317357                                        _log.warn("UP&P IGD device removed : " + dev.getFriendlyName());
     
    376416                        return -1;
    377417
    378                 return Integer.valueOf(getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate").getValue());
     418                try {
     419                    return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewUpstreamMaxBitRate").getValue());
     420                } catch (NumberFormatException nfe) {
     421                    return -1;
     422                }
    379423        }
    380424       
     
    390434                        return -1;
    391435
    392                 return Integer.valueOf(getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate").getValue());
     436                try {
     437                    return Integer.parseInt(getIP.getOutputArgumentList().getArgument("NewDownstreamMaxBitRate").getValue());
     438                } catch (NumberFormatException nfe) {
     439                    return -1;
     440                }
    393441        }
    394442       
     
    558606                sb.append("<h3><a name=\"upnp\"></a>").append(_("UPnP Status")).append("</h3>");
    559607               
     608                synchronized(_otherUDNs) {
     609                        if (!_otherUDNs.isEmpty()) {
     610                                sb.append(_("Disabled UPnP Devices"));
     611                                sb.append("<ul>");
     612                                for (Map.Entry<String, String> e : _otherUDNs.entrySet()) {
     613                                        String udn = e.getKey();
     614                                        String name = e.getValue();
     615                                        sb.append("<li>").append(name)
     616                                          .append("<br>UDN: ").append(udn)
     617                                          .append("</li>");
     618                                }
     619                                sb.append("</ul>");
     620                        }
     621                }
     622
    560623                if(isDisabled) {
    561624                        sb.append(_("UPnP has been disabled; Do you have more than one UPnP Internet Gateway Device on your LAN ?"));
  • router/java/src/net/i2p/router/transport/crypto/DHSessionKeyBuilder.java

    rd2f0c25 r1b95a03d  
    230230    }
    231231
    232     public BigInteger getPeerPublicValue() {
     232    public synchronized BigInteger getPeerPublicValue() {
    233233        return _peerValue;
    234234    }
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    rd2f0c25 r1b95a03d  
    953953        } else if (enabled.equals("false") &&
    954954                   name != null && name.length() > 0 &&
    955                    !name.equals(ohost) &&
    956                    nport != null) {
     955                   !name.equals(ohost)) {
    957956            // Host name is configured, and we have a port (either auto or configured)
    958957            // but we probably only get here if the port is auto,
  • router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java

    rd2f0c25 r1b95a03d  
    13071307        // should have already been removed in handleOutbound() above
    13081308        // remove only if value == state
    1309         boolean removed = _outboundStates.remove(outboundState.getRemoteHostId(), outboundState);
     1309        _outboundStates.remove(outboundState.getRemoteHostId(), outboundState);
    13101310        if (outboundState.getState() != OB_STATE_CONFIRMED_COMPLETELY) {
    13111311            if (_log.shouldLog(Log.INFO))
  • router/java/src/net/i2p/router/transport/udp/OutboundMessageFragments.java

    rd2f0c25 r1b95a03d  
    151151     */
    152152    public void add(OutNetMessage msg) {
    153         I2NPMessage msgBody = msg.getMessage();
    154153        RouterInfo target = msg.getTarget();
    155154        if (target == null)
  • router/java/src/net/i2p/router/tunnel/FragmentHandler.java

    rd2f0c25 r1b95a03d  
    364364                msg = _fragmentedMessages.get(Long.valueOf(messageId));
    365365                if (msg == null) {
    366                     msg = new FragmentedMessage(_context);
     366                    msg = new FragmentedMessage(_context, messageId);
    367367                    _fragmentedMessages.put(Long.valueOf(messageId), msg);
    368368                }
     
    371371            // synchronized is required, fragments may be arriving in different threads
    372372            synchronized(msg) {
    373                 boolean ok = msg.receive(messageId, preprocessed, offset, size, false, router, tunnelId);
     373                boolean ok = msg.receive(preprocessed, offset, size, false, router, tunnelId);
    374374                if (!ok) return -1;
    375375                if (msg.isComplete()) {
     
    431431            msg = _fragmentedMessages.get(Long.valueOf(messageId));
    432432            if (msg == null) {
    433                 msg = new FragmentedMessage(_context);
     433                msg = new FragmentedMessage(_context, messageId);
    434434                _fragmentedMessages.put(Long.valueOf(messageId), msg);
    435435            }
     
    438438        // synchronized is required, fragments may be arriving in different threads
    439439        synchronized(msg) {
    440             boolean ok = msg.receive(messageId, fragmentNum, preprocessed, offset, size, isLast);
     440            boolean ok = msg.receive(fragmentNum, preprocessed, offset, size, isLast);
    441441            if (!ok) return -1;
    442442           
  • router/java/src/net/i2p/router/tunnel/FragmentedMessage.java

    rd2f0c25 r1b95a03d  
    2020    private final I2PAppContext _context;
    2121    private final Log _log;
    22     private long _messageId;
     22    private final long _messageId;
    2323    private Hash _toRouter;
    2424    private TunnelId _toTunnel;
     
    3434    // 64 is pretty absurd, 32 is too, most likely
    3535    private static final int MAX_FRAGMENTS = 64;
    36    
    37     public FragmentedMessage(I2PAppContext ctx) {
     36    private static final int MAX_FRAGMENT_SIZE = 996;
     37   
     38    public FragmentedMessage(I2PAppContext ctx, long messageId) {
    3839        _context = ctx;
    3940        _log = ctx.logManager().getLog(FragmentedMessage.class);
    40         _messageId = -1;
     41        _messageId = messageId;
    4142        _fragments = new ByteArray[MAX_FRAGMENTS];
    4243        _highFragmentNum = -1;
     
    4950     * prior to the fragment # 0.
    5051     *
    51      * @param messageId what messageId is this fragment a part of
    52      * @param fragmentNum sequence number within the message (must be greater than 1)
    53      * @param payload data for the fragment
     52     * @param fragmentNum sequence number within the message (1 - 63)
     53     * @param payload data for the fragment non-null
    5454     * @param offset index into the payload where the fragment data starts (past headers/etc)
    5555     * @param length how much past the offset should we snag?
    5656     * @param isLast is this the last fragment in the message?
    5757     */
    58     public boolean receive(long messageId, int fragmentNum, byte payload[], int offset, int length, boolean isLast) {
    59         if (fragmentNum < 0) {
     58    public boolean receive(int fragmentNum, byte payload[], int offset, int length, boolean isLast) {
     59        if (fragmentNum <= 0 || fragmentNum >= MAX_FRAGMENTS) {
    6060            if (_log.shouldLog(Log.ERROR))
    61                 _log.error("Fragment # == " + fragmentNum + " for messageId " + messageId);
    62             return false;
    63         }
    64         if (payload == null) {
    65             if (_log.shouldLog(Log.ERROR))
    66                 _log.error("Payload is null for messageId " + messageId);
    67             return false;
    68         }
    69         if (length <= 0) {
     61                _log.error("Fragment # == " + fragmentNum + " for messageId " + _messageId);
     62            return false;
     63        }
     64        if (length <= 0 || length > MAX_FRAGMENT_SIZE) {
    7065            if (_log.shouldLog(Log.WARN))
    71                 _log.warn("Length is impossible (" + length + ") for messageId " + messageId);
     66                _log.warn("Length is impossible (" + length + ") for messageId " + _messageId);
    7267            return false;
    7368        }
    7469        if (offset + length > payload.length) {
    7570            if (_log.shouldLog(Log.WARN))
    76                 _log.warn("Length is impossible (" + length + "/" + offset + " out of " + payload.length + ") for messageId " + messageId);
     71                _log.warn("Length is impossible (" + length + "/" + offset + " out of " + payload.length + ") for messageId " + _messageId);
    7772            return false;
    7873        }
    7974        if (_log.shouldLog(Log.DEBUG))
    80             _log.debug("Receive message " + messageId + " fragment " + fragmentNum + " with " + length + " bytes (last? " + isLast + ") offset = " + offset);
    81         _messageId = messageId;
     75            _log.debug("Receive message " + _messageId + " fragment " + fragmentNum + " with " + length + " bytes (last? " + isLast + ") offset = " + offset);
    8276        // we should just use payload[] and use an offset/length on it
    8377        ByteArray ba = _cache.acquire(); //new ByteArray(payload, offset, length); //new byte[length]);
     
    9690        if (isLast && fragmentNum <= 0) {
    9791            if (_log.shouldLog(Log.ERROR))
    98                 _log.error("hmm, isLast and fragmentNum=" + fragmentNum + " for message " + messageId);
     92                _log.error("hmm, isLast and fragmentNum=" + fragmentNum + " for message " + _messageId);
    9993            return false;
    10094        }
     
    10397   
    10498    /**
    105      * Receive the first fragment and related metadata.  This may not be the first
     99     * Receive the first fragment (#0) and related metadata.  This may not be the first
    106100     * one to arrive at the endpoint however.
    107101     *
    108      * @param messageId what messageId is this fragment a part of
    109      * @param payload data for the fragment
     102     * @param payload data for the fragment non-null
    110103     * @param offset index into the payload where the fragment data starts (past headers/etc)
    111104     * @param length how much past the offset should we snag?
     
    114107     * @param toTunnel what tunnel is this destined for (may be null)
    115108     */
    116     public boolean receive(long messageId, byte payload[], int offset, int length, boolean isLast, Hash toRouter, TunnelId toTunnel) {
    117         if (payload == null) {
    118             if (_log.shouldLog(Log.ERROR))
    119                 _log.error("Payload is null for messageId " + messageId);
    120             return false;
    121         }
    122         if (length <= 0) {
     109    public boolean receive(byte payload[], int offset, int length, boolean isLast, Hash toRouter, TunnelId toTunnel) {
     110        if (length <= 0 || length > MAX_FRAGMENT_SIZE) {
    123111            if (_log.shouldLog(Log.WARN))
    124                 _log.warn("Length is impossible (" + length + ") for messageId " + messageId);
     112                _log.warn("Length is impossible (" + length + ") for messageId " + _messageId);
    125113            return false;
    126114        }
    127115        if (offset + length > payload.length) {
    128116            if (_log.shouldLog(Log.WARN))
    129                 _log.warn("Length is impossible (" + length + "/" + offset + " out of " + payload.length + ") for messageId " + messageId);
     117                _log.warn("Length is impossible (" + length + "/" + offset + " out of " + payload.length + ") for messageId " + _messageId);
    130118            return false;
    131119        }
    132120        if (_log.shouldLog(Log.DEBUG))
    133             _log.debug("Receive message " + messageId + " with " + length + " bytes (last? " + isLast + ") targetting " + toRouter + " / " + toTunnel + " offset=" + offset);
    134         _messageId = messageId;
     121            _log.debug("Receive message " + _messageId + " with " + length + " bytes (last? " + isLast + ") targetting " + toRouter + " / " + toTunnel + " offset=" + offset);
    135122        ByteArray ba = _cache.acquire(); // new ByteArray(payload, offset, length); // new byte[length]);
    136123        System.arraycopy(payload, offset, ba.getData(), 0, length);
  • router/java/src/net/i2p/router/tunnel/OutboundTunnelEndpoint.java

    rd2f0c25 r1b95a03d  
    5959                _log.debug("outbound tunnel " + _config + " received a full message: " + msg
    6060                           + " to be forwarded on to "
    61                            + (toRouter != null ? toRouter.toBase64().substring(0,4) : "")
     61                           + toRouter.toBase64().substring(0,4)
    6262                           + (toTunnel != null ? ":" + toTunnel.getTunnelId() : ""));
    6363            int size = msg.getMessageSize();
  • router/java/src/net/i2p/router/tunnel/pool/TunnelPeerSelector.java

    rd2f0c25 r1b95a03d  
    349349    private static boolean shouldExclude(RouterContext ctx, Log log, RouterInfo peer, char excl[]) {
    350350        String cap = peer.getCapabilities();
    351         if (cap == null) {
    352             return true;
    353         }
    354351        for (int j = 0; j < excl.length; j++) {
    355352            if (cap.indexOf(excl[j]) >= 0) {
  • router/java/src/net/i2p/router/util/DecayingHashSet.java

    rd2f0c25 r1b95a03d  
    8080        _current = new ConcurrentHashSet(128);
    8181        _previous = new ConcurrentHashSet(128);
    82         if (_log.shouldLog(Log.WARN))
    83            _log.warn("New DHS " + name + " entryBytes = " + entryBytes +
     82        if (_log.shouldLog(Log.DEBUG))
     83            _log.debug("New DHS " + name + " entryBytes = " + entryBytes +
    8484                     " cycle (s) = " + (durationMs / 1000));
    8585        // try to get a handle on memory usage vs. false positives
  • router/java/src/org/xlattice/crypto/filters/BloomSHA1.java

    rd2f0c25 r1b95a03d  
    4646
    4747public class BloomSHA1 {
    48     protected final int m;
    49     protected final int k;
    50     protected int count;
     48    private final int m;
     49    private final int k;
     50    private int count;
    5151   
    52     protected final int[] filter;
    53     protected final KeySelector ks;
     52    private final int[] filter;
     53    private final KeySelector ks;
    5454   
    5555    // convenience variables
    56     protected final int filterBits;
    57     protected final int filterWords;
     56    private final int filterBits;
     57    private final int filterWords;
    5858   
    5959    private final BlockingQueue<int[]> buf;
     
    121121    }
    122122    /** Clear the filter, unsynchronized */
    123     protected void doClear() {
     123    private void doClear() {
    124124        Arrays.fill(filter, 0);
    125125        count = 0;
     
    187187     * @return true if b is in the filter
    188188     */
    189     protected final boolean isMember(byte[] b) { return isMember(b, 0, b.length); }
    190 
    191     protected final boolean isMember(byte[] b, int offset, int len) {
     189    private final boolean isMember(byte[] b) { return isMember(b, 0, b.length); }
     190
     191    private final boolean isMember(byte[] b, int offset, int len) {
    192192        int[] bitOffset = acquire();
    193193        int[] wordOffset = acquire();
  • router/java/src/org/xlattice/crypto/filters/KeySelector.java

    rd2f0c25 r1b95a03d  
    4141
    4242    /** AND with byte to expose index-many bits */
    43     public final static int[] UNMASK = {
     43    private final static int[] UNMASK = {
    4444 // 0  1  2  3   4   5   6    7    8   9     10   11     12    13     14     15
    4545    0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767};
    4646    /** AND with byte to zero out index-many bits */
    47     public final static int[] MASK   = {
     47    private final static int[] MASK   = {
    4848    ~0,~1,~3,~7,~15,~31,~63,~127,~255,~511,~1023,~2047,~4095,~8191,~16383,~32767};
    4949
    50     public final static int TWO_UP_15 = 32 * 1024;
     50    private final static int TWO_UP_15 = 32 * 1024;
    5151
    5252    /**
Note: See TracChangeset for help on using the changeset viewer.