* i2ptunnel:

- Set default read timeout in standard server
   - Reduce header timeout, enforce total header timeout
     in IRC and HTTP servers (ticket #723)
 * Streaming: Don't ignore option or force connect timeout to 5 minutes
 * Streaming javadocs
 * SocketTimeout cleanup
This commit is contained in:
zzz
2012-10-07 20:57:35 +00:00
parent 6b97e1bfaf
commit b095b7e769
11 changed files with 101 additions and 23 deletions

View File

@@ -17,6 +17,9 @@ public interface I2PSocketOptions {
/**
* How long we will wait for the ACK from a SYN, in milliseconds.
*
* Default 60 seconds. Max of 2 minutes enforced in Connection.java,
* and it also interprets <= 0 as default.
*
* @return milliseconds to wait, or -1 if we will wait indefinitely
*/
public long getConnectTimeout();
@@ -24,6 +27,9 @@ public interface I2PSocketOptions {
/**
* Define how long we will wait for the ACK from a SYN, in milliseconds.
*
* Default 60 seconds. Max of 2 minutes enforced in Connection.java,
* and it also interprets <= 0 as default.
*
* @param ms timeout in ms
*/
public void setConnectTimeout(long ms);
@@ -32,6 +38,9 @@ public interface I2PSocketOptions {
* What is the longest we'll block on the input stream while waiting
* for more data. If this value is exceeded, the read() throws
* InterruptedIOException
*
* WARNING: Default -1 (unlimited), which is probably not what you want.
*
* @return timeout in ms
*/
public long getReadTimeout();
@@ -40,6 +49,9 @@ public interface I2PSocketOptions {
* What is the longest we'll block on the input stream while waiting
* for more data. If this value is exceeded, the read() throws
* InterruptedIOException
*
* WARNING: Default -1 (unlimited), which is probably not what you want.
*
* @param ms timeout in ms
*/
public void setReadTimeout(long ms);
@@ -50,6 +62,8 @@ public interface I2PSocketOptions {
* either some data is removed or the connection is closed. If this is
* less than or equal to zero, there is no limit (warning: can eat ram)
*
* Default 64 KB
*
* @return buffer size limit, in bytes
*/
public int getMaxBufferSize();
@@ -60,6 +74,8 @@ public interface I2PSocketOptions {
* either some data is removed or the connection is closed. If this is
* less than or equal to zero, there is no limit (warning: can eat ram)
*
* Default 64 KB
*
* @param numBytes How much data will we accept that hasn't been written out yet.
*/
public void setMaxBufferSize(int numBytes);
@@ -69,6 +85,9 @@ public interface I2PSocketOptions {
* for the data to flush. If this value is exceeded, the write() throws
* InterruptedIOException. If this is less than or equal to zero, there
* is no timeout.
*
* Default -1 (unlimited)
*
* @return wait time to block on the output stream while waiting for the data to flush.
*/
public long getWriteTimeout();
@@ -78,6 +97,9 @@ public interface I2PSocketOptions {
* for the data to flush. If this value is exceeded, the write() throws
* InterruptedIOException. If this is less than or equal to zero, there
* is no timeout.
*
* Default -1 (unlimited)
*
* @param ms wait time to block on the output stream while waiting for the data to flush.
*/
public void setWriteTimeout(long ms);

View File

@@ -96,6 +96,9 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
/**
* How long we will wait for the ACK from a SYN, in milliseconds.
*
* Default 60 seconds. Max of 2 minutes enforced in Connection.java,
* and it also interprets <= 0 as default.
*
* @return milliseconds to wait, or -1 if we will wait indefinitely
*/
public long getConnectTimeout() {
@@ -105,6 +108,9 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
/**
* Define how long we will wait for the ACK from a SYN, in milliseconds.
*
* Default 60 seconds. Max of 2 minutes enforced in Connection.java,
* and it also interprets <= 0 as default.
*
*/
public void setConnectTimeout(long ms) {
_connectTimeout = ms;
@@ -114,6 +120,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* What is the longest we'll block on the input stream while waiting
* for more data. If this value is exceeded, the read() throws
* InterruptedIOException
*
* WARNING: Default -1 (unlimited), which is probably not what you want.
*/
public long getReadTimeout() {
return _readTimeout;
@@ -123,6 +131,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* What is the longest we'll block on the input stream while waiting
* for more data. If this value is exceeded, the read() throws
* InterruptedIOException
*
* WARNING: Default -1 (unlimited), which is probably not what you want.
*/
public void setReadTimeout(long ms) {
_readTimeout = ms;
@@ -134,6 +144,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* either some data is removed or the connection is closed. If this is
* less than or equal to zero, there is no limit (warning: can eat ram)
*
* Default 64 KB
*
* @return buffer size limit, in bytes
*/
public int getMaxBufferSize() {
@@ -146,6 +158,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* either some data is removed or the connection is closed. If this is
* less than or equal to zero, there is no limit (warning: can eat ram)
*
* Default 64 KB
*
*/
public void setMaxBufferSize(int numBytes) {
_maxBufferSize = numBytes;
@@ -156,6 +170,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* for the data to flush. If this value is exceeded, the write() throws
* InterruptedIOException. If this is less than or equal to zero, there
* is no timeout.
*
* Default -1 (unlimited)
*/
public long getWriteTimeout() {
return _writeTimeout;
@@ -166,6 +182,8 @@ class I2PSocketOptionsImpl implements I2PSocketOptions {
* for the data to flush. If this value is exceeded, the write() throws
* InterruptedIOException. If this is less than or equal to zero, there
* is no timeout.
*
* Default -1 (unlimited)
*/
public void setWriteTimeout(long ms) {
_writeTimeout = ms;