Changeset 33de6be


Ignore:
Timestamp:
Sep 8, 2012 12:29:55 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ca91ad3
Parents:
871f046
Message:
  • SSU: Move UDPSender and UDPReceiver queues to CoDel?
Location:
router/java/src/net/i2p/router/transport/udp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/UDPPacket.java

    r871f046 r33de6be  
    1010import net.i2p.data.DataHelper;
    1111import net.i2p.data.SessionKey;
     12import net.i2p.router.util.CDQEntry;
    1213import net.i2p.util.Log;
    1314
     
    1718 *
    1819 */
    19 class UDPPacket {
     20class UDPPacket implements CDQEntry {
    2021    private I2PAppContext _context;
    2122    private final DatagramPacket _packet;
     
    247248    }
    248249
    249     /** the UDPReceiver has tossed it onto the inbound queue */
    250     void enqueue() { _enqueueTime = _context.clock().now(); }
     250    /**
     251     *  For CDQ
     252     *  @since 0.9.3
     253     */
     254    public void setEnqueueTime(long now) { _enqueueTime = now; }
     255
    251256    /** a packet handler has pulled it off the inbound queue */
    252257    void received() { _receivedTime = _context.clock().now(); }
     
    257262    //void afterHandling() { _afterHandlingTime = _context.clock().now(); }
    258263     
    259     /** the UDPReceiver has tossed it onto the inbound queue */
    260     //long getTimeSinceEnqueue() { return (_enqueueTime > 0 ? _context.clock().now() - _enqueueTime : 0); }
     264    /**
     265     *  For CDQ
     266     *  @since 0.9.3
     267     */
     268    public long getEnqueueTime() { return _enqueueTime; }
    261269
    262270    /** a packet handler has pulled it off the inbound queue */
     
    270278    // Following 5: All used only for stats in PacketHandler, commented out
    271279
    272     /** when it was added to the endpoint's receive queue */
    273     //long getEnqueueTime() { return _enqueueTime; }
    274280    /** when it was pulled off the endpoint receive queue */
    275281    //long getReceivedTime() { return _receivedTime; }
     
    327333    }
    328334
     335    /**
     336     *  For CDQ
     337     *  @since 0.9.3
     338     */
     339    public void drop() {
     340        release();
     341    }
     342
    329343    public void release() {
    330344        verifyNotReleased();
  • router/java/src/net/i2p/router/transport/udp/UDPReceiver.java

    r871f046 r33de6be  
    55import java.util.Arrays;
    66import java.util.concurrent.BlockingQueue;
    7 import java.util.concurrent.LinkedBlockingQueue;
    87
    98import net.i2p.router.RouterContext;
    109import net.i2p.router.transport.FIFOBandwidthLimiter;
     10import net.i2p.router.util.CoDelBlockingQueue;
    1111import net.i2p.util.I2PThread;
    1212import net.i2p.util.Log;
     
    4848            maxMemory = 96*1024*1024l;
    4949        int qsize = (int) Math.max(MIN_QUEUE_SIZE, Math.min(MAX_QUEUE_SIZE, maxMemory / (2*1024*1024)));
    50         _inboundQueue = new LinkedBlockingQueue(qsize);
     50        _inboundQueue = new CoDelBlockingQueue(ctx, "UDP-Receiver", qsize);
    5151        _socket = socket;
    5252        _transport = transport;
     
    178178        }
    179179
     180/****
    180181        packet.enqueue();
    181182        boolean rejected = false;
     
    191192            }
    192193            if (!rejected) {
     194****/
    193195                try {
    194196                    _inboundQueue.put(packet);
     
    199201                //return queueSize + 1;
    200202                return 0;
     203/****
    201204            }
    202205       
     
    215218        }
    216219        return queueSize;
     220****/
    217221    }
    218222   
  • router/java/src/net/i2p/router/transport/udp/UDPSender.java

    r871f046 r33de6be  
    55import java.net.DatagramSocket;
    66import java.util.concurrent.BlockingQueue;
    7 import java.util.concurrent.LinkedBlockingQueue;
    87
    98import net.i2p.router.RouterContext;
    109import net.i2p.router.transport.FIFOBandwidthLimiter;
     10import net.i2p.router.util.CoDelBlockingQueue;
    1111import net.i2p.util.I2PThread;
    1212import net.i2p.util.Log;
     
    3636            maxMemory = 96*1024*1024l;
    3737        int qsize = (int) Math.max(MIN_QUEUE_SIZE, Math.min(MAX_QUEUE_SIZE, maxMemory / (1024*1024)));
    38         _outboundQueue = new LinkedBlockingQueue(qsize);
     38        _outboundQueue = new CoDelBlockingQueue(ctx, "UDP-Sender", qsize);
    3939        _socket = socket;
    4040        _runner = new Runner();
Note: See TracChangeset for help on using the changeset viewer.