SAM: Set keepalive on sockets (ticket #1573)

Also on both sides of I2CP.
BOB already does it.
This commit is contained in:
zzz
2015-05-12 20:13:17 +00:00
parent 40130a8a61
commit b5455cee6e
5 changed files with 6 additions and 0 deletions

View File

@ -488,6 +488,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
try {
I2PSSLSocketFactory fact = new I2PSSLSocketFactory(_context, false, "certificates/i2cp");
_socket = fact.createSocket(_hostname, _portNum);
_socket.setKeepAlive(true);
} catch (GeneralSecurityException gse) {
IOException ioe = new IOException("SSL Fail");
ioe.initCause(gse);
@ -495,6 +496,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
}
} else {
_socket = new Socket(_hostname, _portNum);
_socket.setKeepAlive(true);
}
// _socket.setSoTimeout(1000000); // Uhmmm we could really-really use a real timeout, and handle it.
OutputStream out = _socket.getOutputStream();

View File

@ -89,6 +89,7 @@ class I2PSimpleSession extends I2PSessionImpl2 {
} else {
_socket = new Socket(_hostname, _portNum);
}
_socket.setKeepAlive(true);
OutputStream out = _socket.getOutputStream();
out.write(I2PClient.PROTOCOL_BYTE);
out.flush();