Changeset 3dd5950


Ignore:
Timestamp:
Apr 4, 2009 5:08:20 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9e7dd23, b1bedb56
Parents:
8de5609
Message:

Don't let NTCP bid on msgs too big to handle

Location:
router/java/src/net/i2p/router/transport/ntcp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/ntcp/NTCPConnection.java

    r8de5609 r3dd5950  
    105105    private static final int META_FREQUENCY = 10*60*1000;
    106106    private static final int INFO_FREQUENCY = 6*60*60*1000;
     107    /**
     108     *  Why this is 16K, and where it is documented, good question?
     109     *  We claim we can do 32K datagrams so this is a problem.
     110     *  Needs to be fixed. But SSU can handle it?
     111     *  In the meantime, don't let the transport bid on big messages.
     112     */
     113    public static final int BUFFER_SIZE = 16*1024;
     114    /** 2 bytes for length and 4 for CRC */
     115    public static final int MAX_MSG_SIZE = BUFFER_SIZE - (2 + 4);
    107116   
    108117    /**
  • router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java

    r8de5609 r3dd5950  
    106106        _context.statManager().createRateStat("ntcp.outboundFailedIOEImmediate", "", "ntcp", new long[] { 60*1000, 10*60*1000 });
    107107        _context.statManager().createRateStat("ntcp.invalidOutboundSkew", "", "ntcp", new long[] { 60*1000, 10*60*1000 });
     108        _context.statManager().createRateStat("ntcp.noBidTooLargeI2NP", "send size", "ntcp", new long[] { 60*60*1000 });
    108109        _context.statManager().createRateStat("ntcp.prepBufCache", "", "ntcp", new long[] { 60*1000, 10*60*1000 });
    109110        _context.statManager().createRateStat("ntcp.queuedRecv", "", "ntcp", new long[] { 60*1000, 10*60*1000 });
     
    244245        if (!isAlive())
    245246            return null;
     247        if (dataSize > NTCPConnection.MAX_MSG_SIZE) {
     248            // let SSU deal with it
     249            _context.statManager().addRateData("ntcp.noBidTooLargeI2NP", dataSize, 0);
     250            return null;
     251        }
    246252        Hash peer = toAddress.getIdentity().calculateHash();
    247253        if (_context.shitlist().isShitlisted(peer, STYLE)) {
Note: See TracChangeset for help on using the changeset viewer.