2005-02-22 jrandom

* Temporary workaround for the I2CP disconnect bug (have the streaminglib
      try to automatically reconnect on accept()/connect(..)).
    * Loop check for expired lease republishing (just in case)
This commit is contained in:
jrandom
2005-02-22 22:58:21 +00:00
committed by zzz
parent c17433cb93
commit b8291ac5a4
5 changed files with 20 additions and 9 deletions

View File

@ -105,7 +105,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
}
public I2PSocket receiveSocket() throws I2PException {
if (_session.isClosed()) throw new I2PException("Session closed");
verifySession();
Connection con = _connectionManager.getConnectionHandler().accept(-1);
if (_log.shouldLog(Log.DEBUG))
_log.debug("receiveSocket() called: " + con);
@ -149,6 +149,12 @@ public class I2PSocketManagerFull implements I2PSocketManager {
return _serverSocket;
}
private void verifySession() throws I2PException {
if (!_connectionManager.getSession().isClosed())
return;
_connectionManager.getSession().connect();
}
/**
* Create a new connected socket (block until the socket is created)
*
@ -160,8 +166,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
*/
public I2PSocket connect(Destination peer, I2PSocketOptions options)
throws I2PException, NoRouteToHostException {
if (_connectionManager.getSession().isClosed())
throw new I2PException("Session is closed");
verifySession();
if (options == null)
options = _defaultOptions;
ConnectionOptions opts = null;

View File

@ -225,6 +225,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
*/
public void connect() throws I2PSessionException {
_closed = false;
_availabilityNotifier.stopNotifying();
I2PThread notifier = new I2PThread(_availabilityNotifier);
notifier.setName("Notifier " + _myDestination.calculateHash().toBase64().substring(0,4));
notifier.setDaemon(true);

View File

@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.145 $ $Date: 2005/02/21 13:02:16 $";
public final static String ID = "$Revision: 1.146 $ $Date: 2005/02/22 02:07:33 $";
public final static String VERSION = "0.5";
public final static long BUILD = 4;
public final static long BUILD = 5;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION);
System.out.println("Router ID: " + RouterVersion.ID);

View File

@ -227,7 +227,10 @@ public class ClientConnectionRunner {
}
void disconnectClient(String reason) {
_log.error("Disconnecting the client: " + reason);
if (_log.shouldLog(Log.CRIT))
_log.log(Log.CRIT, "Disconnecting the client ("
+ _config.getDestination().calculateHash().toBase64().substring(0,4)
+ ": " + reason);
DisconnectMessage msg = new DisconnectMessage();
msg.setReason(reason);
try {

View File

@ -74,8 +74,10 @@ public class RepublishLeaseSetJob extends JobImpl {
public OnFailure(RouterContext ctx) { super(ctx); }
public String getName() { return "Publish leaseSet failed"; }
public void runJob() {
if (_log.shouldLog(Log.ERROR))
_log.error("FAILED publishing of the leaseSet for " + _dest.toBase64());
if (_log.shouldLog(Log.WARN))
_log.warn("FAILED publishing of the leaseSet for " + _dest.toBase64());
LeaseSet ls = _facade.lookupLeaseSetLocally(_dest);
if ( (ls != null) && (ls.isCurrent(0)) )
getContext().jobQueue().addJob(new RepublishLeaseSetJob(getContext(), _facade, _dest));
}
}