2005-09-15 jrandom

* Error handling for failed intro packets (thanks red.hand!)
    * More carefully verify intro addresses
This commit is contained in:
jrandom
2005-09-15 05:39:31 +00:00
committed by zzz
parent 5694206b35
commit 76266dce0d
4 changed files with 42 additions and 3 deletions

View File

@ -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!)

View File

@ -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);

View File

@ -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; }

View File

@ -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) {