i2ptunnel: Retry accept after server socket closed (ticket #2003)

This commit is contained in:
zzz
2018-05-26 20:00:10 +00:00
parent 2d7f0d35ce
commit e67c750fab

View File

@ -593,9 +593,13 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
} catch (ConnectException ce) {
if (_log.shouldLog(Log.ERROR))
_log.error("Error accepting", ce);
open = false;
if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}
break;
try {
Thread.sleep(2*60*1000);
} catch (InterruptedException ie) {}
// Server socket possbily closed out from under us, perhaps as part of a router restart;
// wait a while and try to get a new socket
i2pss = sockMgr.getServerSocket();
} catch(SocketTimeoutException ste) {
// ignored, we never set the timeout
if (i2ps != null) try { i2ps.close(); } catch (IOException ioe) {}