2004-12-08 jrandom
* Revised the buffering when reading from the SAM client and writing to the stream. Also added a thread (sigh) so we don't block the SAM client from giving us more messages for abnormally long periods of time. * Display the router version in the logs on startup (oft requested) * Fix a race during the closing of a messageOutputStream
This commit is contained in:
@ -394,15 +394,12 @@ public class Connection {
|
||||
if (_socket != null)
|
||||
_socket.destroy();
|
||||
_socket = null;
|
||||
_inputStream = null;
|
||||
if (_outputStream != null)
|
||||
_outputStream.destroy();
|
||||
_outputStream = null;
|
||||
_outboundQueue = null;
|
||||
if (_receiver != null)
|
||||
_receiver.destroy();
|
||||
if (_activityTimer != null)
|
||||
SimpleTimer.getInstance().addEvent(_activityTimer, 1);
|
||||
SimpleTimer.getInstance().removeEvent(_activityTimer);
|
||||
_activityTimer = null;
|
||||
|
||||
if (!_disconnectScheduled) {
|
||||
|
@ -155,12 +155,13 @@ public class MessageOutputStream extends OutputStream {
|
||||
}
|
||||
public void timeReached() {
|
||||
_enqueued = false;
|
||||
DataReceiver rec = _dataReceiver;
|
||||
long timeLeft = (_lastBuffered + _passiveFlushDelay - _context.clock().now());
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("flusher time reached: left = " + timeLeft);
|
||||
if (timeLeft > 0)
|
||||
enqueue();
|
||||
else if (_dataReceiver.writeInProcess())
|
||||
else if ( (rec != null) && (rec.writeInProcess()) )
|
||||
enqueue(); // don't passive flush if there is a write being done (unacked outbound)
|
||||
else
|
||||
doFlush();
|
||||
|
Reference in New Issue
Block a user