Compare commits

..

6 Commits

Author SHA1 Message Date
jrandom
a14da92e1d * 2004-10-01 0.4.1.1 released 2004-10-01 17:23:00 +00:00
jrandom
2b54d850ea logging 2004-10-01 17:19:37 +00:00
jrandom
a63c1b19fc 2004-10-01 jrandom
* Handle partial reseeds, caused by seeds going away before the download
      completes (thanks Sugadude!)
2004-10-01 14:35:49 +00:00
jrandom
34f74cd6ef 2004-10-01 jrandom
* Explicitly refuse IPv6 addresses, since only some peers support
      them and we want fully reachable peers.
2004-10-01 11:49:02 +00:00
jrandom
c0b8e62135 2004-10-01 jrandom
* Additional error handling for a variety of transport layer errors.
2004-10-01 09:39:14 +00:00
jrandom
ea24166b8e added identiguy.i2p 2004-10-01 09:32:46 +00:00
13 changed files with 114 additions and 26 deletions

View File

@@ -176,7 +176,7 @@ public class I2PSocketManager implements I2PSessionListener {
}
if (s == null) {
_log.warn(getName() + ": No socket responsible for ACK packet");
_log.warn(getName() + ": No socket responsible for ACK packet for id " + getReadableForm(id));
return;
}
@@ -223,7 +223,8 @@ public class I2PSocketManager implements I2PSessionListener {
s = (I2PSocketImpl) _outSockets.get(id);
}
_log.debug(getName() + ": *Disconnect outgoing for socket " + s);
_log.debug(getName() + ": *Disconnect outgoing for socket " + s + " on id "
+ getReadableForm(id));
try {
if (s != null) {
if (payload.length > 0) {
@@ -259,7 +260,8 @@ public class I2PSocketManager implements I2PSessionListener {
// packet send outgoing
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": *Packet send outgoing [" + payload.length + "] for socket " + s);
_log.debug(getName() + ": *Packet send outgoing [" + payload.length + "] for socket "
+ s + " on id " + getReadableForm(id));
if (s != null) {
s.queueData(payload);
return;
@@ -293,7 +295,8 @@ public class I2PSocketManager implements I2PSessionListener {
s.setRemoteID(id);
}
}
_log.debug(getName() + ": *Syn! for socket " + s);
_log.debug(getName() + ": *Syn! for socket " + s + " on id " + getReadableForm(newLocalID)
+ " from " + d.calculateHash().toBase64().substring(0,6));
if (!acceptConnections) {
// The app did not instantiate an I2PServerSocket
@@ -454,6 +457,10 @@ public class I2PSocketManager implements I2PSessionListener {
s = new I2PSocketImpl(peer, this, true, localID);
_outSockets.put(localID, s);
}
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": connect(" + peer.calculateHash().toBase64().substring(0,6)
+ ", ...): localID = " + lcID);
try {
ByteArrayOutputStream pubkey = new ByteArrayOutputStream();
_session.getMyDestination().writeBytes(pubkey);
@@ -462,18 +469,30 @@ public class I2PSocketManager implements I2PSessionListener {
boolean sent = false;
sent = _session.sendMessage(peer, packet);
if (!sent) {
_log.info(getName() + ": Unable to send & receive ack for SYN packet for socket " + s);
_log.info(getName() + ": Unable to send & receive ack for SYN packet for socket "
+ s + " with localID = " + lcID);
synchronized (lock) {
_outSockets.remove(s.getLocalID());
}
_context.statManager().addRateData("streaming.synNoAck", 1, 1);
throw new I2PException("Error sending through I2P network");
} else {
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": syn sent ok to "
+ peer.calculateHash().toBase64().substring(0,6)
+ " with localID = " + lcID);
}
if (options != null)
remoteID = s.getRemoteID(true, options.getConnectTimeout());
else
remoteID = s.getRemoteID(true, getDefaultOptions().getConnectTimeout());
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": remoteID received from "
+ peer.calculateHash().toBase64().substring(0,6)
+ ": " + getReadableForm(remoteID)
+ " with localID = " + lcID);
if (remoteID == null) {
_context.statManager().addRateData("streaming.nackReceived", 1, 1);
throw new ConnectException("Connection refused by peer for socket " + s);
@@ -490,7 +509,8 @@ public class I2PSocketManager implements I2PSessionListener {
} catch (InterruptedIOException ioe) {
if (_log.shouldLog(Log.ERROR))
_log.error(getName() + ": Timeout waiting for ack from syn for id "
+ getReadableForm(lcID) + " for socket " + s, ioe);
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, ioe);
synchronized (lock) {
_outSockets.remove(s.getLocalID());
}
@@ -498,14 +518,24 @@ public class I2PSocketManager implements I2PSessionListener {
_context.statManager().addRateData("streaming.synNoAck", 1, 1);
throw new InterruptedIOException("Timeout waiting for ack");
} catch (ConnectException ex) {
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": Connection error waiting for ack from syn for id "
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, ex);
s.internalClose();
throw ex;
} catch (NoRouteToHostException ex) {
if (_log.shouldLog(Log.DEBUG))
_log.debug(getName() + ": No route to host waiting for ack from syn for id "
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, ex);
s.internalClose();
throw ex;
} catch (IOException ex) {
if (_log.shouldLog(Log.ERROR))
_log.error(getName() + ": Error sending syn on id " + getReadableForm(lcID) + " for socket " + s, ex);
_log.error(getName() + ": Error sending syn on id "
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, ex);
synchronized (lock) {
_outSockets.remove(s.getLocalID());
}
@@ -513,7 +543,9 @@ public class I2PSocketManager implements I2PSessionListener {
throw new I2PException("Unhandled IOException occurred");
} catch (I2PException ex) {
if (_log.shouldLog(Log.INFO))
_log.info(getName() + ": Error sending syn on id " + getReadableForm(lcID) + " for socket " + s, ex);
_log.info(getName() + ": Error sending syn on id "
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, ex);
synchronized (lock) {
_outSockets.remove(s.getLocalID());
}
@@ -521,7 +553,9 @@ public class I2PSocketManager implements I2PSessionListener {
throw ex;
} catch (Exception e) {
s.internalClose();
_log.error(getName() + ": Unhandled error connecting", e);
_log.error(getName() + ": Unhandled error connecting on "
+ lcID + " to " + peer.calculateHash().toBase64().substring(0,6)
+ " for socket " + s, e);
throw new ConnectException("Unhandled error connecting: " + e.getMessage());
}
}
@@ -624,9 +658,11 @@ public class I2PSocketManager implements I2PSessionListener {
}
public void removeSocket(I2PSocketImpl sock) {
String localId = sock.getLocalID();
boolean removed = false;
synchronized (lock) {
_inSockets.remove(sock.getLocalID());
_outSockets.remove(sock.getLocalID());
removed = (null != _inSockets.remove(localId));
removed = removed || (null != _outSockets.remove(localId));
lock.notify();
}
@@ -637,9 +673,10 @@ public class I2PSocketManager implements I2PSessionListener {
long recv = sock.getBytesReceived();
if (_log.shouldLog(Log.DEBUG)) {
_log.debug(getName() + ": Removing socket \"" + getReadableForm(sock.getLocalID()) + "\" [" + sock
_log.debug(getName() + ": Removing socket \"" + getReadableForm(localId) + "\" [" + sock
+ ", send: " + sent + ", recv: " + recv
+ ", lifetime: " + lifetime + "ms, time since close: " + timeSinceClose + ")]",
+ ", lifetime: " + lifetime + "ms, time since close: " + timeSinceClose
+ " removed? " + removed + ")]",
new Exception("removeSocket called"));
}

View File

@@ -145,11 +145,16 @@ public class ConfigNetHandler extends FormHandler {
}
int fetched = 0;
int errors = 0;
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
fetchSeed(seedURL, (String)iter.next());
fetched++;
try {
fetchSeed(seedURL, (String)iter.next());
fetched++;
} catch (Exception e) {
errors++;
}
}
addFormNotice("Reseeded with " + fetched + " peers");
addFormNotice("Reseeded with " + fetched + " peers (and " + errors + " failures)");
} catch (Throwable t) {
_context.logManager().getLog(ConfigNetHandler.class).error("Error reseeding", t);
addFormError("Error reseeding (RESEED_EXCEPTION)");

View File

@@ -14,8 +14,8 @@ package net.i2p;
*
*/
public class CoreVersion {
public final static String ID = "$Revision: 1.20 $ $Date: 2004/09/08 21:26:42 $";
public final static String VERSION = "0.4.1";
public final static String ID = "$Revision: 1.21 $ $Date: 2004/09/30 10:58:55 $";
public final static String VERSION = "0.4.1.1";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -1,4 +1,17 @@
$Id: history.txt,v 1.23 2004/09/30 01:57:22 jrandom Exp $
$Id: history.txt,v 1.27 2004/10/01 09:35:49 jrandom Exp $
* 2004-10-01 0.4.1.1 released
2004-10-01 jrandom
* Handle partial reseeds, caused by seeds going away before the download
completes (thanks Sugadude!)
2004-10-01 jrandom
* Explicitly refuse IPv6 addresses, since only some peers support
them and we want fully reachable peers.
2004-10-01 jrandom
* Additional error handling for a variety of transport layer errors.
* 2004-09-30 0.4.1 released (not backwards compatible)

View File

@@ -1,6 +1,7 @@
; TC's hosts.txt guaranteed freshness
; $Id: hosts.txt,v 1.51 2004/09/22 19:08:51 jrandom Exp $
; $Id: hosts.txt,v 1.52 2004/09/30 08:25:31 jrandom Exp $
; changelog:
; (1.75) added identiguy.i2p
; (1.74) added jabber-2.i2p
; (1.73) added jake.i2p
; (1.72) added anonymnet.i2p sasquotch.i2p orz.i2p microbleu.i2p {www,smtp,pop3}.postman.i2p
@@ -174,3 +175,4 @@ smtp.postman.i2p=AUVlGWmbU0qNUBGvu1ls5OQcdZNjq7k1OPzqkhheGlc3HoQFi97-3BZevo4ThjL
pop.postman.i2p=W4ZehJpFv9HnM4qnWb6c305H1vWRoghgSz~UXVVl7AM6cNYPU~DHzI0ezxyYIcsywhDvRdSvN5QQSyb2t-waFRaoMxmub9Z68uvcNPjAyG1Hc-igVbcmiGKo1RwXXO1JTzaAFE8NB2mvZmpksPDks0ugcd3AzBrrkxsqt8KLYSXBc7hDM59YUGl0j59NUZoE3tJgZlQ~fYr4P4P9VetBgVQ5mJFpwF~RvM2frx9zQ2SonCSTNFR88MEUJ6EoZUTDG-iz6mUVv2qOanAD1ZfSmmMZpbtFLovqvUGv8JLxFhFdkNmt3AmIZzPjmvrAu2X~VnAhX80Wrvba8df9w0qtplH5LYBykmN~wndjcQxOH7~LbGeJ-8q4DHf-DSDPFyn6L4uCk35kCSGXjEf1f44DSHU338Wiagn9ut7twiFSf8NLXvKV2-uWmx~twDLTd9cEjCEBm7ZXMaqWTK1kOGj0nlybm~mgMW-~IRnb6alnR0GMxAE-6fnWS52PJtmWU0ToAAAA
jake.i2p=BzdF-Ib~jWRj9i1hypIasw67yv0YDEdCqloJr4Qq2Wvkt56slqzd0Qri6FQnWsGfTpmilvGI1H-7WAyU5KXc~nQ7F7KB~Im9cI1mIeMKeGK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4BSCgQr0gRjDa~L~JmtxPRUpZX2NyBvD0w5MSaD~9t4RuCRQ2gVDpUUDcTh2jkm2bX-R9vRIHhCZLasHxDR7rJC9-38uMsQ6ywd4ulQQYIs0kB1sEofdXUypyqphQU9xIxz7azgzKJp~dHnJpJ6SpaH7UrDN-YfOkAvGFBbk9k-u3NGl571Y205dQF~l3XHvVKf6NS9~JvtVh0JibwQ2qLVPy3Y~TtViffvpunNGOrfnVrT5-1c3lWNHx8gTalY3R-vU5rDd8Bz3AhNM6KWktZq8LiHHhJUxIkebXZsid-f2g~QgRRywxG7ksIlKsCMEn076f03L-oWJIlrAg5MdQd-qlg1Bs1IhrR8YT8jNYrX1bGdlmPrJDpiAAAA

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>

View File

@@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.33 $ $Date: 2004/09/26 10:16:44 $";
public final static String VERSION = "0.4.1";
public final static long BUILD = 0;
public final static String ID = "$Revision: 1.37 $ $Date: 2004/10/01 09:35:49 $";
public final static String VERSION = "0.4.1.1";
public final static long BUILD = 3;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@@ -245,6 +245,11 @@ public abstract class TransportImpl implements Transport {
*
*/
public void send(OutNetMessage msg) {
if (msg.getTarget() == null) {
if (_log.shouldLog(Log.ERROR))
_log.error("Error - bad message enqueued [target is null]: " + msg, new Exception("Added by"));
return;
}
boolean duplicate = false;
synchronized (_sendPool) {
if (_sendPool.contains(msg))

View File

@@ -713,6 +713,11 @@ public class ConnectionBuilder {
public boolean getCreated() { return _created; }
public void run() {
if ( (_target == null) || (_transport == null) ) {
fail("Internal error - null while running");
_log.log(Log.CRIT, "Internal error - target = " + _target + " _transport = " + _transport);
return;
}
RouterAddress addr = _target.getTargetAddress(_transport.getStyle());
if (addr == null) {
fail("Peer "

View File

@@ -483,6 +483,10 @@ public class ConnectionHandler {
DHSessionKeyBuilder builder = null;
try {
builder = DHSessionKeyBuilder.exchangeKeys(_rawIn, _rawOut);
if (builder == null) {
fail("Error exchanging the keys with " + _from);
return false;
}
} catch (IOException ioe) {
fail("Error exchanging keys with " + _from);
return false;

View File

@@ -116,6 +116,12 @@ public class TCPAddress {
try {
InetAddress addr = InetAddress.getByName(_host);
byte quad[] = addr.getAddress();
if (quad.length != 4) {
if (_log.shouldLog(Log.ERROR))
_log.error("Refusing IPv6 address (" + _host + " / " + addr.getHostAddress() + ") "
+ " since not all peers support it, and we don't support restricted routes");
return false;
}
if (quad[0] == (int)127) return false;
if (quad[0] == (int)10) return false;
if ( (quad[0] == (int)172) && (quad[1] >= (int)16) && (quad[1] <= (int)31) ) return false;

View File

@@ -26,7 +26,13 @@ public class TCPConnectionEstablisher implements Runnable {
RouterInfo info = _transport.getNextPeer();
ConnectionBuilder cb = new ConnectionBuilder(_context, _transport, info);
TCPConnection con = cb.establishConnection();
TCPConnection con = null;
try {
con = cb.establishConnection();
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled exception establishing a connection to "
+ info.getIdentity().getHash().toBase64(), e);
}
if (con != null) {
_transport.connectionEstablished(con);
} else {

View File

@@ -289,7 +289,12 @@ class TCPListener {
public void handle() {
SimpleTimer.getInstance().addEvent(TimedHandler.this, HANDLE_TIMEOUT);
ConnectionHandler ch = new ConnectionHandler(_context, _transport, _socket);
TCPConnection con = ch.receiveConnection();
TCPConnection con = null;
try {
con = ch.receiveConnection();
} catch (Exception e) {
_log.log(Log.CRIT, "Unhandled exception receiving a connection on " + _socket, e);
}
if (con != null) {
_wasSuccessful = true;
_transport.connectionEstablished(con);