2004-10-01 jrandom
* Additional error handling for a variety of transport layer errors.
This commit is contained in:
@ -1,4 +1,7 @@
|
||||
$Id: history.txt,v 1.23 2004/09/30 01:57:22 jrandom Exp $
|
||||
$Id: history.txt,v 1.24 2004/09/30 10:58:55 jrandom Exp $
|
||||
|
||||
2004-10-01 jrandom
|
||||
* Additional error handling for a variety of transport layer errors.
|
||||
|
||||
* 2004-09-30 0.4.1 released (not backwards compatible)
|
||||
|
||||
|
@ -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 ID = "$Revision: 1.34 $ $Date: 2004/09/30 10:58:55 $";
|
||||
public final static String VERSION = "0.4.1";
|
||||
public final static long BUILD = 0;
|
||||
public final static long BUILD = 1;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -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))
|
||||
|
@ -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 "
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user