Changeset a3f290e


Ignore:
Timestamp:
Aug 27, 2009 7:31:24 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
2e2bff3
Parents:
e0dd1f13
Message:
  • Tunnel:
    • Adjust the random drop probability for the message size
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java

    re0dd1f13 ra3f290e  
    546546     * OBEPs however may see a wide variety of sizes.
    547547     *
    548      * @param type unused except for logging
     548     * Network-wise, it's most efficient to drop OBEP messages, because they
     549     * are unfragmented and we know their size. Therefore we drop the big ones
     550     * and we drop a single wrapped I2CP message, not a fragment of one or more messages.
     551     * Also, the OBEP is the earliest identifiable hop in the message's path
     552     * (a plain participant could be earlier or later, but on average is later)
     553     *
     554     * @param type message hop location and type
    549555     * @param length the length of the message
    550556     */
     
    584590        if (pctDrop <= 0)
    585591            return false;
     592        // increase the drop probability for OBEP,
     593        // and lower it for IBGW, for network efficiency
     594        double len = length;
     595        if (type.startsWith("OBEP"))
     596            len *= 1.5;
     597        else if (type.startsWith("IBGW"))
     598            len /= 1.5;
    586599        // drop in proportion to size w.r.t. a standard 1024-byte message
    587600        // this is a little expensive but we want to adjust the curve between 0 and 1
    588601        // Most messages are 1024, only at the OBEP do we see other sizes
    589         if (length != 1024)
    590             pctDrop = (float) Math.pow(pctDrop, 1024d / length);
     602        if (len != 1024d)
     603            pctDrop = (float) Math.pow(pctDrop, 1024d / len);
    591604        float rand = _context.random().nextFloat();
    592605        boolean reject = rand <= pctDrop;
Note: See TracChangeset for help on using the changeset viewer.