2005-12-27 jrandom
* Add a new Status: line on the router console - "ERR-ClockSkew", in case the clock is too skewed to do anything useful (check the year and month, not just the hour and minute). * Fixed the read/write timeouts in the streaming lib (so that it actually honors them now) * Minor I2PSnark cleanups (no read timeout, more careful shutdown and torrent closing) * Handle an oddball tunnel creation failure (thanks Xunk)
This commit is contained in:
@ -95,6 +95,8 @@ public class Connection {
|
||||
_outboundQueue = queue;
|
||||
_handler = handler;
|
||||
_options = (opts != null ? opts : new ConnectionOptions());
|
||||
_outputStream.setWriteTimeout((int)_options.getWriteTimeout());
|
||||
_inputStream.setReadTimeout((int)_options.getReadTimeout());
|
||||
_lastSendId = -1;
|
||||
_nextSendTime = -1;
|
||||
_ackedPackets = 0;
|
||||
@ -145,8 +147,8 @@ public class Connection {
|
||||
*/
|
||||
boolean packetSendChoke(long timeoutMs) {
|
||||
if (false) return true;
|
||||
long writeExpire = timeoutMs;
|
||||
long start = _context.clock().now();
|
||||
long writeExpire = start + timeoutMs;
|
||||
boolean started = false;
|
||||
while (true) {
|
||||
long timeLeft = writeExpire - _context.clock().now();
|
||||
|
@ -90,6 +90,7 @@ public class I2PSocketFull implements I2PSocket {
|
||||
Connection c = _connection;
|
||||
if (c == null) return;
|
||||
|
||||
c.getInputStream().setReadTimeout((int)ms);
|
||||
c.getOptions().setReadTimeout(ms);
|
||||
}
|
||||
|
||||
@ -106,8 +107,11 @@ public class I2PSocketFull implements I2PSocket {
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
Connection c = _connection;
|
||||
_connection = null;
|
||||
_listener = null;
|
||||
if (c != null)
|
||||
c.disconnectComplete();
|
||||
}
|
||||
public String toString() {
|
||||
Connection c = _connection;
|
||||
|
@ -405,6 +405,10 @@ public class MessageOutputStream extends OutputStream {
|
||||
|
||||
void destroy() {
|
||||
_dataReceiver = null;
|
||||
synchronized (_dataLock) {
|
||||
_closed = true;
|
||||
_dataLock.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
/** Define a component to receive data flushed from this stream */
|
||||
|
Reference in New Issue
Block a user