Changeset 758293d


Ignore:
Timestamp:
Dec 21, 2004 4:32:49 PM (16 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
484b528
Parents:
6cb316b3
git-author:
jrandom <jrandom> (12/21/04 16:32:49)
git-committer:
zzz <zzz@…> (12/21/04 16:32:49)
Message:

2004-12-21 jrandom

  • Cleaned up the postinstall/startup scripts a bit more to handle winME, and added windows info to the headless docs. (thanks ardvark!)
  • Fixed a harmless (yet NPE inspiring) race during the final shutdown of a stream (thanks frosk!)
  • Add a pair of new stats for monitoring tunnel participation - tunnel.participatingBytesProcessed (total # bytes transferred) and tunnel.participatingBytesProcessedActive (total # bytes transferred for tunnels whose byte count exceed the 10m average). This should help further monitor congestion issues.
  • Made the NamingService? factory property public (thanks susi!)
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/ConnectionDataReceiver.java

    r6cb316b3 r758293d  
    1818    private Log _log;
    1919    private Connection _connection;
    20     private MessageOutputStream.WriteStatus _dummyStatus;
     20    private static final MessageOutputStream.WriteStatus _dummyStatus = new DummyStatus();
    2121   
    2222    public ConnectionDataReceiver(I2PAppContext ctx, Connection con) {
     
    2424        _log = ctx.logManager().getLog(ConnectionDataReceiver.class);
    2525        _connection = con;
    26         _dummyStatus = new DummyStatus();
    2726    }
    2827   
    2928    public boolean writeInProcess() {
    30         return _connection.getUnackedPacketsSent() > 0;
     29        Connection con = _connection;
     30        if (con != null)
     31            return con.getUnackedPacketsSent() > 0;
     32        else
     33            return false;
    3134    }
    3235   
     
    4346     */
    4447    public MessageOutputStream.WriteStatus writeData(byte[] buf, int off, int size) {
     48        Connection con = _connection;
     49        if (con == null) return _dummyStatus;
    4550        boolean doSend = true;
    46         if ( (size <= 0) && (_connection.getLastSendId() >= 0) ) {
    47             if (_connection.getOutputStream().getClosed()) {
    48                 if (_connection.getCloseSentOn() < 0) {
     51        if ( (size <= 0) && (con.getLastSendId() >= 0) ) {
     52            if (con.getOutputStream().getClosed()) {
     53                if (con.getCloseSentOn() < 0) {
    4954                    doSend = true;
    5055                } else {
     
    5863        }
    5964       
    60         if (_connection.getUnackedPacketsReceived() > 0)
     65        if (con.getUnackedPacketsReceived() > 0)
    6166            doSend = true;
    6267       
    6368        if (_log.shouldLog(Log.INFO) && !doSend)
    6469            _log.info("writeData called: size="+size + " doSend=" + doSend
    65                        + " unackedReceived: " + _connection.getUnackedPacketsReceived()
    66                        + " con: " + _connection, new Exception("write called by"));
     70                       + " unackedReceived: " + con.getUnackedPacketsReceived()
     71                       + " con: " + con, new Exception("write called by"));
    6772
    6873        if (doSend) {
    6974            PacketLocal packet = send(buf, off, size);
     75            if (packet == null) return _dummyStatus;
     76           
    7077            //dont wait for non-acks
    7178            if ( (packet.getSequenceNum() > 0) || (packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) )
     
    8693     * @param off offset into the buffer to start writing from
    8794     * @param size how many bytes of the buffer to write (may be 0)
    88      * @return the packet sent
     95     * @return the packet sent, or null if the connection died
    8996     */
    9097    public PacketLocal send(byte buf[], int off, int size) {
     
    100107     */
    101108    public PacketLocal send(byte buf[], int off, int size, boolean forceIncrement) {
     109        Connection con = _connection;
     110        if (con == null) return null;
    102111        long before = System.currentTimeMillis();
    103         PacketLocal packet = buildPacket(buf, off, size, forceIncrement);
     112        PacketLocal packet = buildPacket(con, buf, off, size, forceIncrement);
    104113        long built = System.currentTimeMillis();
    105         _connection.sendPacket(packet);
     114        con.sendPacket(packet);
    106115        long sent = System.currentTimeMillis();
    107116       
     
    113122    }
    114123   
    115     private boolean isAckOnly(int size) {
     124    private boolean isAckOnly(Connection con, int size) {
    116125        boolean ackOnly = ( (size <= 0) && // no data
    117                             (_connection.getLastSendId() >= 0) && // not a SYN
    118                             ( (!_connection.getOutputStream().getClosed()) || // not a CLOSE
    119                             (_connection.getOutputStream().getClosed() &&
    120                              _connection.getCloseSentOn() > 0) )); // or it is a dup CLOSE
     126                            (con.getLastSendId() >= 0) && // not a SYN
     127                            ( (!con.getOutputStream().getClosed()) || // not a CLOSE
     128                            (con.getOutputStream().getClosed() &&
     129                             con.getCloseSentOn() > 0) )); // or it is a dup CLOSE
    121130        return ackOnly;
    122131    }
    123132   
    124     private PacketLocal buildPacket(byte buf[], int off, int size, boolean forceIncrement) {
    125         boolean ackOnly = isAckOnly(size);
    126         PacketLocal packet = new PacketLocal(_context, _connection.getRemotePeer(), _connection);
     133    private PacketLocal buildPacket(Connection con, byte buf[], int off, int size, boolean forceIncrement) {
     134        boolean ackOnly = isAckOnly(con, size);
     135        PacketLocal packet = new PacketLocal(_context, con.getRemotePeer(), con);
    127136        byte data[] = new byte[size];
    128137        if (size > 0)
     
    132141                        packet.setSequenceNum(0);
    133142        else
    134             packet.setSequenceNum(_connection.getNextOutboundPacketNum());
    135         packet.setSendStreamId(_connection.getSendStreamId());
    136         packet.setReceiveStreamId(_connection.getReceiveStreamId());
     143            packet.setSequenceNum(con.getNextOutboundPacketNum());
     144        packet.setSendStreamId(con.getSendStreamId());
     145        packet.setReceiveStreamId(con.getReceiveStreamId());
    137146       
    138         _connection.getInputStream().updateAcks(packet);
    139         packet.setOptionalDelay(_connection.getOptions().getChoke());
    140         packet.setOptionalMaxSize(_connection.getOptions().getMaxMessageSize());
    141         packet.setResendDelay(_connection.getOptions().getResendDelay());
     147        con.getInputStream().updateAcks(packet);
     148        packet.setOptionalDelay(con.getOptions().getChoke());
     149        packet.setOptionalMaxSize(con.getOptions().getMaxMessageSize());
     150        packet.setResendDelay(con.getOptions().getResendDelay());
    142151       
    143         if (_connection.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
     152        if (con.getOptions().getProfile() == ConnectionOptions.PROFILE_INTERACTIVE)
    144153            packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, true);
    145154        else
    146155            packet.setFlag(Packet.FLAG_PROFILE_INTERACTIVE, false);
    147156       
    148         packet.setFlag(Packet.FLAG_SIGNATURE_REQUESTED, _connection.getOptions().getRequireFullySigned());
     157        packet.setFlag(Packet.FLAG_SIGNATURE_REQUESTED, con.getOptions().getRequireFullySigned());
    149158       
    150159        if ( (!ackOnly) && (packet.getSequenceNum() <= 0) ) {
    151160            packet.setFlag(Packet.FLAG_SYNCHRONIZE);
    152             packet.setOptionalFrom(_connection.getSession().getMyDestination());
     161            packet.setOptionalFrom(con.getSession().getMyDestination());
    153162        }
    154163       
     
    156165        // packets sent, otherwise the other side could receive the CLOSE prematurely,
    157166        // since this ACK could arrive before the unacked payload message.
    158         if (_connection.getOutputStream().getClosed() &&
    159             ( (size > 0) || (_connection.getUnackedPacketsSent() <= 0) ) ) {
     167        if (con.getOutputStream().getClosed() &&
     168            ( (size > 0) || (con.getUnackedPacketsSent() <= 0) ) ) {
    160169            packet.setFlag(Packet.FLAG_CLOSE);
    161             _connection.setCloseSentOn(_context.clock().now());
     170            con.setCloseSentOn(_context.clock().now());
    162171            if (_log.shouldLog(Log.DEBUG))
    163                 _log.debug("Closed is set for a new packet on " + _connection + ": " + packet);
     172                _log.debug("Closed is set for a new packet on " + con + ": " + packet);
    164173        } else {
    165174            //if (_log.shouldLog(Log.DEBUG))
  • core/java/src/net/i2p/client/naming/NamingService.java

    r6cb316b3 r758293d  
    2323    protected I2PAppContext _context;
    2424
    25     private static final String PROP_IMPL = "i2p.naming.impl";
     25    /** what classname should be used as the naming service impl? */
     26    public static final String PROP_IMPL = "i2p.naming.impl";
    2627    private static final String DEFAULT_IMPL = "net.i2p.client.naming.HostsTxtNamingService";
    2728
  • history.txt

    r6cb316b3 r758293d  
    1 $Id: history.txt,v 1.115 2004/12/19 13:55:09 jrandom Exp $
     1$Id: history.txt,v 1.116 2004/12/20 00:14:56 jrandom Exp $
     2
     32004-12-21  jrandom
     4    * Cleaned up the postinstall/startup scripts a bit more to handle winME,
     5      and added windows info to the headless docs. (thanks ardvark!)
     6    * Fixed a harmless (yet NPE inspiring) race during the final shutdown of
     7      a stream (thanks frosk!)
     8    * Add a pair of new stats for monitoring tunnel participation -
     9      tunnel.participatingBytesProcessed (total # bytes transferred) and
     10      tunnel.participatingBytesProcessedActive (total # bytes transferred for
     11      tunnels whose byte count exceed the 10m average).  This should help
     12      further monitor congestion issues.
     13    * Made the NamingService factory property public (thanks susi!)
    214
    3152004-12-20  jrandom
  • install-headless.txt

    r6cb316b3 r758293d  
    1 $Id: install-headless.txt,v 1.2 2004/09/02 01:54:37 jrandom Exp $
     1$Id: install-headless.txt,v 1.3 2004/09/29 14:38:15 jrandom Exp $
    22Headless I2P installation instructions
    33
     
    1111
    1212To run I2P explicitly:
    13    sh i2prouter start
     13   (*nix): sh i2prouter start
     14   (win*): I2Psvc.exe -c wrapper.config
    1415
    1516To stop the router (gracefully):
  • installer/resources/i2prouter.bat

    r6cb316b3 r758293d  
    11@echo off
    22setlocal
     3set INSTALL_PATH="%1"
    34
    45rem
     
    67rem
    78
    8 rem
    9 rem Resolve the real path of the Wrapper.exe
    10 rem  For non NT systems, the _REALPATH and _WRAPPER_CONF values
    11 rem  can be hard-coded below and the following test removed.
    12 rem
    13 if "%OS%"=="Windows_NT" goto nt
    14 echo This script only works with NT-based versions of Windows.
    15 goto :eof
     9set _WRAPPER_EXE=%INSTALL_PATH%I2Psvc.exe
     10set _WRAPPER_CONF="%INSTALL_PATH%wrapper.config"
    1611
    17 :nt
    18 rem
    19 rem Find the application home.
    20 rem
    21 rem %~dp0 is location of current script under NT
    22 set _REALPATH=%~dp0
    23 set _WRAPPER_EXE=%_REALPATH%I2Psvc.exe
    24 
    25 rem
    26 rem Find the wrapper.conf
    27 rem
    28 :conf
    29 set _WRAPPER_CONF="%~f1"
    30 if not %_WRAPPER_CONF%=="" goto startup
    31 set _WRAPPER_CONF="%_REALPATH%wrapper.config"
    32 
    33 rem
    34 rem Start the Wrapper
    35 rem
    36 :startup
    3712"%_WRAPPER_EXE%" -c %_WRAPPER_CONF%
    3813if not errorlevel 1 goto :eof
  • installer/resources/postinstall.bat

    r6cb316b3 r758293d  
    3434del /f /q "%INSTALL_PATH%icons\*.xpm"
    3535rmdir /q /s "%INSTALL_PATH%lib\wrapper"
    36 start /b /i /d"%INSTALL_PATH%" i2prouter.bat
     36start /b /i /d"%INSTALL_PATH%" i2prouter.bat %INSTALL_PATH%
    3737
    3838) else (
     
    4848del "%INSTALL_PATH%icons\*.xpm"
    4949deltree /Y "%INSTALL_PATH%lib\wrapper"
    50 start /M "%INSTALL_PATH%i2prouter.bat"
     50start /M "%INSTALL_PATH%i2prouter.bat" %INSTALL_PATH%
    5151
    5252)
  • router/java/src/net/i2p/router/RouterThrottleImpl.java

    r6cb316b3 r758293d  
    111111        }
    112112       
    113         // ok, we're not hosed, but can we handle the bandwidth requirements
    114         // of another tunnel?
    115         rs = _context.statManager().getRate("tunnel.participatingMessagesProcessed");
    116         r = null;
    117         if (rs != null)
    118             r = rs.getRate(10*60*1000);
    119         double msgsPerTunnel = (r != null ? r.getAverageValue() : 0);
    120         r = null;
    121         rs = _context.statManager().getRate("tunnel.relayMessageSize");
    122         if (rs != null)
    123             r = rs.getRate(10*60*1000);
    124         double bytesPerMsg = (r != null ? r.getAverageValue() : 0);
    125         double bytesPerTunnel = msgsPerTunnel * bytesPerMsg;
    126 
    127113        int numTunnels = _context.tunnelManager().getParticipatingCount();
    128         double bytesAllocated =  (numTunnels + 1) * bytesPerTunnel;
    129114
    130115        if (_context.getProperty(Router.PROP_SHUTDOWN_IN_PROGRESS) != null) {
     
    210195            }
    211196        }
     197
     198        // ok, we're not hosed, but can we handle the bandwidth requirements
     199        // of another tunnel?
     200        rs = _context.statManager().getRate("tunnel.participatingBytesProcessed");
     201        r = null;
     202        if (rs != null)
     203            r = rs.getRate(10*60*1000);
     204        double bytesAllocated = r.getCurrentTotalValue();
    212205       
    213206        if (!allowTunnel(bytesAllocated, numTunnels)) {
  • router/java/src/net/i2p/router/RouterVersion.java

    r6cb316b3 r758293d  
    1616 */
    1717public class RouterVersion {
    18     public final static String ID = "$Revision: 1.120 $ $Date: 2004/12/19 13:55:09 $";
     18    public final static String ID = "$Revision: 1.121 $ $Date: 2004/12/20 00:14:56 $";
    1919    public final static String VERSION = "0.4.2.4";
    20     public final static long BUILD = 5;
     20    public final static long BUILD = 6;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION);
  • router/java/src/net/i2p/router/StatisticsManager.java

    r6cb316b3 r758293d  
    116116            //includeRate("inNetPool.dropped", stats, new long[] { 60*60*1000, 24*60*60*1000 });
    117117            includeRate("tunnel.participatingTunnels", stats, new long[] { 5*60*1000, 60*60*1000 });
     118            includeRate("tunnel.participatingBytesProcessed", stats, new long[] { 10*60*1000 });
     119            includeRate("tunnel.participatingBytesProcessedActive", stats, new long[] { 10*60*1000 });
    118120            includeRate("tunnel.testSuccessTime", stats, new long[] { 60*60*1000l, 24*60*60*1000l });
    119121            //includeRate("tunnel.outboundMessagesProcessed", stats, new long[] { 10*60*1000, 60*60*1000 });
  • router/java/src/net/i2p/router/TunnelInfo.java

    r6cb316b3 r758293d  
    5757    private int _messagesProcessed;
    5858    private int _tunnelFailures;
     59    private long _bytesProcessed;
    5960   
    6061    public TunnelInfo(I2PAppContext context) {
     
    8081        _messagesProcessed = 0;
    8182        _tunnelFailures = 0;
     83        _bytesProcessed = 0;
    8284    }
    8385   
     
    183185    }
    184186    /** we have just processed a message for this tunnel */
    185     public void messageProcessed() { _messagesProcessed++; }
     187    public void messageProcessed(int size) {
     188        _messagesProcessed++;
     189        _bytesProcessed += size;
     190    }
     191    /** how many bytes have been pumped through this tunnel in its lifetime? */
     192    public long getBytesProcessed() { return _bytesProcessed; }
    186193   
    187194    /**
  • router/java/src/net/i2p/router/message/HandleTunnelMessageJob.java

    r6cb316b3 r758293d  
    241241            return;
    242242       
    243         info.messageProcessed();
     243        info.messageProcessed(_message.getMessageSize());
    244244       
    245245        //if ( (_message.getVerificationStructure() == null) && (info.getSigningKey() != null) ) {
  • router/java/src/net/i2p/router/message/SendTunnelMessageJob.java

    r6cb316b3 r758293d  
    122122        }
    123123       
    124         info.messageProcessed();
     124        info.messageProcessed(_message.getMessageSize());
    125125       
    126126        if (isEndpoint(info)) {
  • router/java/src/net/i2p/router/tunnelmanager/TunnelPool.java

    r6cb316b3 r758293d  
    6969        _context.statManager().createRateStat("tunnel.participatingMessagesProcessed", "How many messages does an inbound tunnel process in its lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
    7070        _context.statManager().createRateStat("tunnel.participatingMessagesProcessedActive", "How many messages beyond the average were processed in a more-than-average tunnel's lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
     71        _context.statManager().createRateStat("tunnel.participatingBytesProcessed", "How many bytes does an inbound tunnel process in its lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
     72        _context.statManager().createRateStat("tunnel.participatingBytesProcessedActive", "How many bytes beyond the average were processed in a more-than-average tunnel's lifetime?", "Tunnels", new long[] { 10*60*1000l, 60*60*1000l, 24*60*60*1000l });
    7173       
    7274        _isLive = true;
     
    663665                                                           info.getSettings().getExpiration() -
    664666                                                           info.getSettings().getCreated());
     667                    long numBytes = info.getBytesProcessed();
     668                    lastAvg = (long)_context.statManager().getRate("tunnel.participatingBytesProcessed").getRate(10*60*1000l).getAverageValue();
     669                    _context.statManager().addRateData("tunnel.participatingBytesProcessed", numBytes, numMsgs);
     670                    if (numBytes > lastAvg)
     671                        _context.statManager().addRateData("tunnel.participatingBytesProcessedActive", numBytes-lastAvg, numMsgs);
    665672                    break;
    666673                case TunnelId.TYPE_UNSPECIFIED:
Note: See TracChangeset for help on using the changeset viewer.