Changeset d2c52e5


Ignore:
Timestamp:
Jun 30, 2009 1:11:11 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
055cd99
Parents:
a934595 (diff), c7541f8 (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 '44eff3cb8553cf29a7e4eb6c02f624648f91b124'

and 'f400e9b73f924edf556205f9f75b4e2c58e92998'

Files:
15 edited

Legend:

Unmodified
Added
Removed
  • apps/BOB/nbproject/private/private.xml

    ra934595 rd2c52e5  
    22<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
    33    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
     4    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
     5        <file>file:/root/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/MUXlisten.java</file>
     6    </open-files>
    47</project-private>
  • apps/ministreaming/java/src/net/i2p/client/streaming/I2PSocketOptionsImpl.java

    ra934595 rd2c52e5  
    77 *
    88 */
    9 class I2PSocketOptionsImpl implements I2PSocketOptions {
     9public class I2PSocketOptionsImpl implements I2PSocketOptions {
    1010    private long _connectTimeout;
    1111    private long _readTimeout;
  • apps/streaming/java/src/net/i2p/client/streaming/Connection.java

    ra934595 rd2c52e5  
    5050    private boolean _updatedShareOpts;
    5151    /** Packet ID (Long) to PacketLocal for sent but unacked packets */
    52     private Map _outboundPackets;
     52    private final Map _outboundPackets;
    5353    private PacketQueue _outboundQueue;
    5454    private ConnectionPacketHandler _handler;
     
    6767    private boolean _ackSinceCongestion;
    6868    /** Notify this on connection (or connection failure) */
    69     private Object _connectLock;
     69    private final Object _connectLock;
    7070    /** how many messages have been resent and not yet ACKed? */
    7171    private int _activeResends;
     
    9191    public Connection(I2PAppContext ctx, ConnectionManager manager, SchedulerChooser chooser, PacketQueue queue, ConnectionPacketHandler handler, ConnectionOptions opts) {
    9292        _context = ctx;
    93         _log = ctx.logManager().getLog(Connection.class);
    94         _receiver = new ConnectionDataReceiver(ctx, this);
    95         _inputStream = new MessageInputStream(ctx);
    96         _outputStream = new MessageOutputStream(ctx, _receiver, (opts == null ? Packet.MAX_PAYLOAD_SIZE : opts.getMaxMessageSize()));
     93        _connectionManager = manager;
    9794        _chooser = chooser;
    98         _outboundPackets = new TreeMap();
    9995        _outboundQueue = queue;
    10096        _handler = handler;
     97        _log = _context.logManager().getLog(Connection.class);
     98        _receiver = new ConnectionDataReceiver(_context, this);
     99        _inputStream = new MessageInputStream(_context);
     100        _outputStream = new MessageOutputStream(_context, _receiver, (opts == null ? Packet.MAX_PAYLOAD_SIZE : opts.getMaxMessageSize()));
     101        _outboundPackets = new TreeMap();
    101102        _options = (opts != null ? opts : new ConnectionOptions());
    102103        _outputStream.setWriteTimeout((int)_options.getWriteTimeout());
     
    105106        _nextSendTime = -1;
    106107        _ackedPackets = 0;
    107         _createdOn = ctx.clock().now();
     108        _createdOn = _context.clock().now();
    108109        _closeSentOn = -1;
    109110        _closeReceivedOn = -1;
     
    114115        _lastCongestionTime = -1;
    115116        _lastCongestionHighestUnacked = -1;
    116         _connectionManager = manager;
    117117        _resetReceived = false;
    118118        _connected = true;
     
    127127        _updatedShareOpts = false;
    128128        _connectionEvent = new ConEvent();
    129         _hardDisconnected = false;
     129        _hardDisconnected = false;
    130130        _randomWait = _context.random().nextInt(10*1000); // just do this once to reduce usage
    131131        _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 });
     
    10191019            eventOccurred();
    10201020        }
     1021        @Override
    10211022        public String toString() { return "event on " + Connection.this.toString(); }
    10221023    }
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionHandler.java

    ra934595 rd2c52e5  
    1717 * @author zzz modded to use concurrent and bound queue size
    1818 */
    19 class ConnectionHandler {
     19public class ConnectionHandler {
    2020    private I2PAppContext _context;
    2121    private Log _log;
     
    110110                while(true) {
    111111                    Packet packet = _synQueue.poll(); // fails immediately if empty
    112                     if (packet == null || packet.getOptionalDelay() == PoisonPacket.MAX_DELAY_REQUEST)
     112                    if (packet == null || packet.getOptionalDelay() == PoisonPacket.POISON_MAX_DELAY_REQUEST)
    113113                        break;
    114114                    sendReset(packet);
     
    143143
    144144            if (syn != null) {
    145                 if (syn.getOptionalDelay() == PoisonPacket.MAX_DELAY_REQUEST)
     145                if (syn.getOptionalDelay() == PoisonPacket.POISON_MAX_DELAY_REQUEST)
    146146                    return null;
    147147
     
    227227    /**
    228228     * Simple end-of-queue marker.
    229      * The standard class limits the delay to MAX_DELAY_REQUEST so
     229     * The standard class limits the delay to POISON_MAX_DELAY_REQUEST so
    230230     * an evil user can't use this to shut us down
    231231     */
    232232    private static class PoisonPacket extends Packet {
    233         public static final int MAX_DELAY_REQUEST = Packet.MAX_DELAY_REQUEST + 1;
     233        public static final int POISON_MAX_DELAY_REQUEST = Packet.MAX_DELAY_REQUEST + 1;
    234234
    235235        public PoisonPacket() {
    236             setOptionalDelay(MAX_DELAY_REQUEST);
     236            setOptionalDelay(POISON_MAX_DELAY_REQUEST);
    237237        }
    238238    }
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionManager.java

    ra934595 rd2c52e5  
    3535    private Map _connectionByInboundId;
    3636    /** Ping ID (Long) to PingRequest */
    37     private Map _pendingPings;
     37    private final Map _pendingPings;
    3838    private boolean _allowIncoming;
    3939    private int _maxConcurrentStreams;
    4040    private ConnectionOptions _defaultOptions;
    4141    private volatile int _numWaiting;
    42     private Object _connectionLock;
     42    private final Object _connectionLock;
    4343    private long SoTimeout;
    4444   
    4545    public ConnectionManager(I2PAppContext context, I2PSession session, int maxConcurrent, ConnectionOptions defaultOptions) {
    4646        _context = context;
    47         _log = context.logManager().getLog(ConnectionManager.class);
     47        _session = session;
     48        _maxConcurrentStreams = maxConcurrent;
     49        _defaultOptions = defaultOptions;
     50        _log = _context.logManager().getLog(ConnectionManager.class);
    4851        _connectionByInboundId = new HashMap(32);
    4952        _pendingPings = new HashMap(4);
    5053        _connectionLock = new Object();
    51         _messageHandler = new MessageHandler(context, this);
    52         _packetHandler = new PacketHandler(context, this);
    53         _connectionHandler = new ConnectionHandler(context, this);
    54         _schedulerChooser = new SchedulerChooser(context);
    55         _conPacketHandler = new ConnectionPacketHandler(context);
    56         _tcbShare = new TCBShare(context);
    57         _session = session;
    58         session.setSessionListener(_messageHandler);
    59         _outboundQueue = new PacketQueue(context, session, this);
     54        _messageHandler = new MessageHandler(_context, this);
     55        _packetHandler = new PacketHandler(_context, this);
     56        _connectionHandler = new ConnectionHandler(_context, this);
     57        _schedulerChooser = new SchedulerChooser(_context);
     58        _conPacketHandler = new ConnectionPacketHandler(_context);
     59        _tcbShare = new TCBShare(_context);
     60        _session.setSessionListener(_messageHandler);
     61        _outboundQueue = new PacketQueue(_context, _session, this);
    6062        _allowIncoming = false;
    61         _maxConcurrentStreams = maxConcurrent;
    62         _defaultOptions = defaultOptions;
    6363        _numWaiting = 0;
    6464        /** Socket timeout for accept() */
     
    278278    public MessageHandler getMessageHandler() { return _messageHandler; }
    279279    public PacketHandler getPacketHandler() { return _packetHandler; }
    280     public ConnectionHandler getConnectionHandler() { return _connectionHandler; }
    281280    public I2PSession getSession() { return _session; }
    282     public PacketQueue getPacketQueue() { return _outboundQueue; }
    283281    public void updateOptsFromShare(Connection con) { _tcbShare.updateOptsFromShare(con); }
    284282    public void updateShareOpts(Connection con) { _tcbShare.updateShareOpts(con); }
     283    // Both of these methods are
     284    // exporting non-public type through public API, this is a potential bug.
     285    public ConnectionHandler getConnectionHandler() { return _connectionHandler; }
     286    public PacketQueue getPacketQueue() { return _outboundQueue; }
    285287   
    286288    /**
     
    346348        }
    347349    }
    348    
    349350    public boolean ping(Destination peer, long timeoutMs) {
    350351        return ping(peer, timeoutMs, true);
     
    353354        return ping(peer, timeoutMs, blocking, null, null, null);
    354355    }
     356
    355357    public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set tagsToSend, PingNotifier notifier) {
    356358        Long id = new Long(_context.random().nextLong(Packet.MAX_STREAM_ID-1)+1);
     
    391393    }
    392394
    393     interface PingNotifier {
     395    public interface PingNotifier {
    394396        public void pingComplete(boolean ok);
    395397    }
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionOptions.java

    ra934595 rd2c52e5  
    1616    private int _rttDev;
    1717    private int _rto;
    18     private int _trend[];
    1918    private int _resendDelay;
    2019    private int _sendAckDelay;
     
    5958    public static final int DEFAULT_INITIAL_RTT = 8*1000;   
    6059    static final int MIN_WINDOW_SIZE = 1;
    61    
     60    // Syncronization fix, but doing it this way causes NPE...
     61    // private final int _trend[] = new int[TREND_COUNT];
     62    private int _trend[];
     63
    6264    /**
    6365     *  OK, here is the calculation on the message size to fit in a single
     
    204206        super.init(opts);
    205207        _trend = new int[TREND_COUNT];
    206        
    207208        setMaxWindowSize(getInt(opts, PROP_MAX_WINDOW_SIZE, Connection.MAX_WINDOW_SIZE));
    208209        setConnectDelay(getInt(opts, PROP_CONNECT_DELAY, -1));
  • apps/streaming/java/src/net/i2p/client/streaming/MessageHandler.java

    ra934595 rd2c52e5  
    1919    private I2PAppContext _context;
    2020    private Log _log;
    21     private List _listeners;
     21    private final List _listeners;
    2222   
    2323    public MessageHandler(I2PAppContext ctx, ConnectionManager mgr) {
  • apps/streaming/java/src/net/i2p/client/streaming/MessageInputStream.java

    ra934595 rd2c52e5  
    5656    private byte[] _oneByte = new byte[1];
    5757   
    58     private Object _dataLock;
     58    private final Object _dataLock;
    5959   
    6060    public MessageInputStream(I2PAppContext ctx) {
  • apps/streaming/java/src/net/i2p/client/streaming/MessageOutputStream.java

    ra934595 rd2c52e5  
    2121    private byte _buf[];
    2222    private int _valid;
    23     private Object _dataLock;
     23    private final Object _dataLock;
    2424    private DataReceiver _dataReceiver;
    2525    private IOException _streamError;
     
    320320    }
    321321   
     322    @Override
    322323    public void close() throws IOException {
    323324        if (_closed) {
  • apps/streaming/java/src/net/i2p/client/streaming/PacketHandler.java

    ra934595 rd2c52e5  
    1010import net.i2p.data.DataHelper;
    1111import net.i2p.util.Log;
    12 import net.i2p.util.SimpleTimer;
    1312
    1413/**
  • apps/streaming/java/src/net/i2p/client/streaming/PacketQueue.java

    ra934595 rd2c52e5  
    1919 *
    2020 */
    21 class PacketQueue {
     21public class PacketQueue {
    2222    private I2PAppContext _context;
    2323    private Log _log;
  • apps/streaming/java/src/net/i2p/client/streaming/SchedulerChooser.java

    ra934595 rd2c52e5  
    1111 *
    1212 */
    13 class SchedulerChooser {
     13public class SchedulerChooser {
    1414    private I2PAppContext _context;
    1515    private Log _log;
  • apps/streaming/java/src/net/i2p/client/streaming/TaskScheduler.java

    ra934595 rd2c52e5  
    66 *
    77 */
    8 interface TaskScheduler {
     8public interface TaskScheduler {
    99    /**
    1010     * An event has occurred (timeout, message sent, or message received),
  • history.txt

    ra934595 rd2c52e5  
    130130    * NetDb stats: Normalize tunnel build stats for increased anonymity,
    131131      effective in 0.7.6
     132
     1332009-06-30 sponge
     134    * General cleanup on streaming and ministreaming.
     135      This fixes some compile warnings, and prepares for a larger fix.
     136      There is no code-flow changes, just lint. One warning remains as I am
     137      unsure exactly how to solve the problem yet.
    132138
    133139* 2009-06-29  0.7.5 released
  • router/java/src/net/i2p/router/RouterVersion.java

    ra934595 rd2c52e5  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 0;
     21    public final static long BUILD = 1;
    2222    /** for example "-test" */
    2323    public final static String EXTRA = "";
Note: See TracChangeset for help on using the changeset viewer.