take care of another scenario where a thread can leak

This commit is contained in:
jrandom
2004-08-26 03:08:19 +00:00
committed by zzz
parent 7e7f97d72a
commit fab3c0df3e

View File

@ -464,7 +464,12 @@ class TCPConnection implements I2NPMessageReader.I2NPMessageEventListener {
private OutNetMessage getNext() {
OutNetMessage msg = null;
while ( (msg == null) && (_running) ) {
// _running is kept seperate from _closed, since _running refers
// to the ConnectionRunner, while _closed refers to the TCPConnection
// (in case we want to pause running, etc). they both need to be
// checked here, since the connection may be closed before this
// thread even gets started up
while ( (msg == null) && (_running) && (!_closed) ) {
synchronized (_toBeSent) {
if (_toBeSent.size() <= 0) {
try {