diff --git a/history.txt b/history.txt index 7efc7ee060..1fb30002b7 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,8 @@ -$Id: history.txt,v 1.248 2005/09/13 04:06:07 comwiz Exp $ +$Id: history.txt,v 1.249 2005/09/13 18:02:44 jrandom Exp $ + +2005-09-15 jrandom + * Error handling for failed intro packets (thanks red.hand!) + * More carefully verify intro addresses 2005-09-13 jrandom * More careful error handling with introductions (thanks dust!) diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 6efac71996..6a66b3f9c4 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -15,9 +15,9 @@ import net.i2p.CoreVersion; * */ public class RouterVersion { - public final static String ID = "$Revision: 1.234 $ $Date: 2005/09/12 22:32:30 $"; + public final static String ID = "$Revision: 1.235 $ $Date: 2005/09/13 18:02:40 $"; public final static String VERSION = "0.6.0.5"; - public final static long BUILD = 9; + public final static long BUILD = 10; public static void main(String args[]) { System.out.println("I2P Router version: " + VERSION + "-" + BUILD); System.out.println("Router ID: " + RouterVersion.ID); diff --git a/router/java/src/net/i2p/router/transport/udp/UDPAddress.java b/router/java/src/net/i2p/router/transport/udp/UDPAddress.java index 2ea29a4e5b..df8b024f58 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPAddress.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPAddress.java @@ -114,6 +114,40 @@ public class UDPAddress { _introKeys[i] = ikey; _introTags[i] = tag; } + + int numOK = 0; + if (_introHosts != null) { + for (int i = 0; i < _introHosts.length; i++) { + if ( (_introKeys[i] != null) && + (_introPorts[i] > 0) && + (_introTags[i] > 0) && + (_introHosts[i] != null) ) + numOK++; + } + if (numOK != _introHosts.length) { + String hosts[] = new String[numOK]; + int ports[] = new int[numOK]; + long tags[] = new long[numOK]; + byte keys[][] = new byte[numOK][]; + int cur = 0; + for (int i = 0; i < _introHosts.length; i++) { + if ( (_introKeys[i] != null) && + (_introPorts[i] > 0) && + (_introTags[i] > 0) && + (_introHosts[i] != null) ) { + hosts[cur] = _introHosts[i]; + ports[cur] = _introPorts[i]; + tags[cur] = _introTags[i]; + keys[cur] = _introKeys[i]; + } + } + _introKeys = keys; + _introTags = tags; + _introPorts = ports; + _introHosts = hosts; + _introAddresses = new InetAddress[numOK]; + } + } } public String getHost() { return _host; } diff --git a/router/java/src/net/i2p/router/transport/udp/UDPSender.java b/router/java/src/net/i2p/router/transport/udp/UDPSender.java index 7f181e3614..94e52f1483 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPSender.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPSender.java @@ -107,6 +107,7 @@ public class UDPSender { * @return number of packets in the queue */ public int add(UDPPacket packet) { + if (packet == null) return 0; int size = 0; long lifetime = -1; synchronized (_outboundQueue) {