Changeset 5694206


Ignore:
Timestamp:
Sep 13, 2005 11:02:35 PM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
76266dc
Parents:
4293a18
git-author:
jrandom <jrandom> (09/13/05 23:02:35)
git-committer:
zzz <zzz@…> (09/13/05 23:02:35)
Message:

2005-09-13 jrandom

  • More careful error handling with introductions (thanks dust!)
  • Fix the forceIntroducers checkbox on config.jsp (thanks Complication!)
  • Hide the shitlist on the summary so it doesn't confuse new users.
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java

    r4293a18 r5694206  
    66import net.i2p.data.RouterAddress;
    77import net.i2p.router.transport.udp.UDPAddress;
     8import net.i2p.router.transport.udp.UDPTransport;
    89
    910public class ConfigNetHelper {
     
    6768        switch (status) {
    6869            case CommSystemFacade.STATUS_OK:
     70                if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
     71                    return "checked=\"true\"";
    6972                return "";
    7073            case CommSystemFacade.STATUS_DIFFERENT:
     
    7275                return "checked=\"true\"";
    7376            case CommSystemFacade.STATUS_UNKNOWN:
     77                if ("true".equalsIgnoreCase(_context.getProperty(UDPTransport.PROP_FORCE_INTRODUCERS, "false")))
     78                    return "checked=\"true\"";
    7479                return "";
    7580            default:
  • apps/routerconsole/jsp/summary.jsp

    r4293a18 r5694206  
    4141 <b>Well integrated:</b> <jsp:getProperty name="helper" property="wellIntegratedPeers" /><br />
    4242 <b>Failing:</b> <jsp:getProperty name="helper" property="failingPeers" /><br />
    43  <b>Shitlisted:</b> <jsp:getProperty name="helper" property="shitlistedPeers" /><br />
     43 <!-- <b>Shitlisted:</b> <jsp:getProperty name="helper" property="shitlistedPeers" /><br /> -->
    4444 <b>Known:</b> <jsp:getProperty name="helper" property="allPeers" /><br /><%
    4545     if (helper.getActivePeers() <= 0) {
  • history.txt

    r4293a18 r5694206  
    1 $Id: history.txt,v 1.247 2005/09/12 22:32:30 jrandom Exp $
     1$Id: history.txt,v 1.248 2005/09/13 04:06:07 comwiz Exp $
     2
     32005-09-13  jrandom
     4    * More careful error handling with introductions (thanks dust!)
     5    * Fix the forceIntroducers checkbox on config.jsp (thanks Complication!)
     6    * Hide the shitlist on the summary so it doesn't confuse new users.
    27
    382005-09-12  comwiz
  • router/java/src/net/i2p/router/RouterVersion.java

    r4293a18 r5694206  
    1616 */
    1717public class RouterVersion {
    18     public final static String ID = "$Revision: 1.233 $ $Date: 2005/09/12 20:12:43 $";
     18    public final static String ID = "$Revision: 1.234 $ $Date: 2005/09/12 22:32:30 $";
    1919    public final static String VERSION = "0.6.0.5";
    20     public final static long BUILD = 8;
     20    public final static long BUILD = 9;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
  • router/java/src/net/i2p/router/transport/udp/EstablishmentManager.java

    r4293a18 r5694206  
    765765        public void run() {
    766766            while (_alive) {
    767                 _activity = 0;
    768                 long now = _context.clock().now();
    769                 long nextSendTime = -1;
    770                 long nextSendInbound = handleInbound();
    771                 long nextSendOutbound = handleOutbound();
    772                 if (nextSendInbound > 0)
    773                     nextSendTime = nextSendInbound;
    774                 if ( (nextSendTime < 0) || (nextSendOutbound < nextSendTime) )
    775                     nextSendTime = nextSendOutbound;
    776 
    777                 long delay = nextSendTime - now;
    778                 if ( (nextSendTime == -1) || (delay > 0) ) {
    779                     boolean interrupted = false;
    780                     try {
    781                         synchronized (_activityLock) {
    782                             if (_activity > 0)
    783                                 continue;
    784                             if (nextSendTime == -1)
    785                                 _activityLock.wait();
    786                             else
    787                                 _activityLock.wait(delay);
    788                         }
    789                     } catch (InterruptedException ie) {
    790                         interrupted = true;
    791                     }
    792                     if (_log.shouldLog(Log.DEBUG))
    793                         _log.debug("After waiting w/ nextSend=" + nextSendTime
    794                                    + " and delay=" + delay + " and interrupted=" + interrupted);
    795                 }
    796             }
     767                try {
     768                    doPass();
     769                } catch (OutOfMemoryError oom) {
     770                    throw oom;
     771                } catch (RuntimeException re) {
     772                    _log.log(Log.CRIT, "Error in the establisher", re);
     773                }
     774            }
     775        }
     776    }
     777   
     778    private void doPass() {
     779        _activity = 0;
     780        long now = _context.clock().now();
     781        long nextSendTime = -1;
     782        long nextSendInbound = handleInbound();
     783        long nextSendOutbound = handleOutbound();
     784        if (nextSendInbound > 0)
     785            nextSendTime = nextSendInbound;
     786        if ( (nextSendTime < 0) || (nextSendOutbound < nextSendTime) )
     787            nextSendTime = nextSendOutbound;
     788
     789        long delay = nextSendTime - now;
     790        if ( (nextSendTime == -1) || (delay > 0) ) {
     791            boolean interrupted = false;
     792            try {
     793                synchronized (_activityLock) {
     794                    if (_activity > 0)
     795                        return;
     796                    if (nextSendTime == -1)
     797                        _activityLock.wait();
     798                    else
     799                        _activityLock.wait(delay);
     800                }
     801            } catch (InterruptedException ie) {
     802                interrupted = true;
     803            }
     804            if (_log.shouldLog(Log.DEBUG))
     805                _log.debug("After waiting w/ nextSend=" + nextSendTime
     806                           + " and delay=" + delay + " and interrupted=" + interrupted);
    797807        }
    798808    }
  • router/java/src/net/i2p/router/transport/udp/PacketBuilder.java

    r4293a18 r5694206  
    642642    public UDPPacket buildRelayRequest(OutboundEstablishState state, SessionKey ourIntroKey) {
    643643        UDPAddress addr = state.getRemoteAddress();
    644         int index = _context.random().nextInt(UDPAddress.MAX_INTRODUCERS) % addr.getIntroducerCount();
     644        int count = addr.getIntroducerCount();
     645        if (count <= 0)
     646            return null;
     647        int index = _context.random().nextInt(count);
    645648        InetAddress iaddr = addr.getIntroducerHost(index);
    646649        int iport = addr.getIntroducerPort(index);
    647650        byte ikey[] = addr.getIntroducerKey(index);
    648651        long tag = addr.getIntroducerTag(index);
     652        if ( (ikey == null) || (iport <= 0) || (iaddr == null) || (tag <= 0) ) {
     653            if (_log.shouldLog(_log.ERROR))
     654                _log.error("Cannot build a relay request to " + state.getRemoteIdentity().calculateHash().toBase64()
     655                           + ", as their UDP address is invalid: addr=" + addr + " index=" + index);
     656            return null;
     657        }
    649658        return buildRelayRequest(iaddr, iport, ikey, tag, ourIntroKey, state.getIntroNonce(), true);
    650659    }
  • router/java/src/net/i2p/router/transport/udp/PeerTestManager.java

    r4293a18 r5694206  
    423423            aliceIntroKey = new SessionKey(new byte[SessionKey.KEYSIZE_BYTES]);
    424424            testInfo.readIntroKey(aliceIntroKey.getData(), 0);
    425            
     425
    426426            UDPAddress addr = new UDPAddress(charlieInfo.getTargetAddress(UDPTransport.STYLE));
    427427            SessionKey charlieIntroKey = new SessionKey(addr.getIntroKey());
  • router/java/src/net/i2p/router/transport/udp/UDPAddress.java

    r4293a18 r5694206  
    6262   
    6363    private void parse(RouterAddress addr) {
     64        if (addr == null) return;
    6465        Properties opts = addr.getOptions();
    6566        _host = opts.getProperty(PROP_HOST);
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    r4293a18 r5694206  
    11741174            if ( (dontInclude != null) && (dontInclude.equals(peer.getRemoteHostId())) )
    11751175                continue;
    1176             return peer;
     1176            RouterInfo peerInfo = _context.netDb().lookupRouterInfoLocally(peer.getRemotePeer());
     1177            if (peerInfo == null)
     1178                continue;
     1179            RouterAddress addr = peerInfo.getTargetAddress(STYLE);
     1180            if (addr != null)
     1181                return peer;
    11771182        }
    11781183        return null;
  • router/java/src/net/i2p/router/tunnel/FragmentHandler.java

    r4293a18 r5694206  
    9191                offset = off;
    9292            }
     93        } catch (ArrayIndexOutOfBoundsException aioobe) {
     94            _context.statManager().addRateData("tunnel.corruptMessage", 1, 1);
    9395        } catch (RuntimeException e) {
    9496            if (_log.shouldLog(Log.ERROR))
     
    217219       
    218220        if (type == TYPE_TUNNEL) {
     221            if (offset + 4 >= preprocessed.length)
     222                return -1;
    219223            long id = DataHelper.fromLong(preprocessed, offset, 4);
    220224            tunnelId = new TunnelId(id);
     
    223227        if ( (type == TYPE_ROUTER) || (type == TYPE_TUNNEL) ) {
    224228            byte h[] = new byte[Hash.HASH_LENGTH];
     229            if (offset + Hash.HASH_LENGTH >= preprocessed.length)
     230                return -1;
    225231            System.arraycopy(preprocessed, offset, h, 0, Hash.HASH_LENGTH);
    226232            router = new Hash(h);
     
    228234        }
    229235        if (fragmented) {
     236            if (offset + 4 >= preprocessed.length)
     237                return -1;
    230238            messageId = DataHelper.fromLong(preprocessed, offset, 4);
    231239            if (_log.shouldLog(Log.DEBUG))
     
    242250        }
    243251       
     252        if (offset + 2 >= preprocessed.length)
     253            return -1;
    244254        int size = (int)DataHelper.fromLong(preprocessed, offset, 2);
    245255        offset += 2;
Note: See TracChangeset for help on using the changeset viewer.