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:
@ -105,7 +105,7 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public I2PSocket receiveSocket() throws I2PException {
|
public I2PSocket receiveSocket() throws I2PException {
|
||||||
if (_session.isClosed()) throw new I2PException("Session closed");
|
verifySession();
|
||||||
Connection con = _connectionManager.getConnectionHandler().accept(-1);
|
Connection con = _connectionManager.getConnectionHandler().accept(-1);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("receiveSocket() called: " + con);
|
_log.debug("receiveSocket() called: " + con);
|
||||||
@ -149,6 +149,12 @@ public class I2PSocketManagerFull implements I2PSocketManager {
|
|||||||
return _serverSocket;
|
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)
|
* 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)
|
public I2PSocket connect(Destination peer, I2PSocketOptions options)
|
||||||
throws I2PException, NoRouteToHostException {
|
throws I2PException, NoRouteToHostException {
|
||||||
if (_connectionManager.getSession().isClosed())
|
verifySession();
|
||||||
throw new I2PException("Session is closed");
|
|
||||||
if (options == null)
|
if (options == null)
|
||||||
options = _defaultOptions;
|
options = _defaultOptions;
|
||||||
ConnectionOptions opts = null;
|
ConnectionOptions opts = null;
|
||||||
|
@ -225,6 +225,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
|||||||
*/
|
*/
|
||||||
public void connect() throws I2PSessionException {
|
public void connect() throws I2PSessionException {
|
||||||
_closed = false;
|
_closed = false;
|
||||||
|
_availabilityNotifier.stopNotifying();
|
||||||
I2PThread notifier = new I2PThread(_availabilityNotifier);
|
I2PThread notifier = new I2PThread(_availabilityNotifier);
|
||||||
notifier.setName("Notifier " + _myDestination.calculateHash().toBase64().substring(0,4));
|
notifier.setName("Notifier " + _myDestination.calculateHash().toBase64().substring(0,4));
|
||||||
notifier.setDaemon(true);
|
notifier.setDaemon(true);
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
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 String VERSION = "0.5";
|
||||||
public final static long BUILD = 4;
|
public final static long BUILD = 5;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION);
|
System.out.println("I2P Router version: " + VERSION);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
@ -227,7 +227,10 @@ public class ClientConnectionRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void disconnectClient(String reason) {
|
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();
|
DisconnectMessage msg = new DisconnectMessage();
|
||||||
msg.setReason(reason);
|
msg.setReason(reason);
|
||||||
try {
|
try {
|
||||||
|
@ -74,8 +74,10 @@ public class RepublishLeaseSetJob extends JobImpl {
|
|||||||
public OnFailure(RouterContext ctx) { super(ctx); }
|
public OnFailure(RouterContext ctx) { super(ctx); }
|
||||||
public String getName() { return "Publish leaseSet failed"; }
|
public String getName() { return "Publish leaseSet failed"; }
|
||||||
public void runJob() {
|
public void runJob() {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.error("FAILED publishing of the leaseSet for " + _dest.toBase64());
|
_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));
|
getContext().jobQueue().addJob(new RepublishLeaseSetJob(getContext(), _facade, _dest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user