rwinston 2004/12/13 03:16:25
Modified: net/src/java/org/apache/commons/net/telnet
TelnetInputStream.java
Log:
Optimise the fix for TelnetInputStream so available() works properly. Thanks
to Tom Palkot
Revision Changes Path
1.15 +7 -5
jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java
Index: TelnetInputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/telnet/TelnetInputStream.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TelnetInputStream.java 10 Dec 2004 16:01:30 -0000 1.14
+++ TelnetInputStream.java 13 Dec 2004 11:16:25 -0000 1.15
@@ -60,9 +60,8 @@
__receiveState = _STATE_DATA;
__isClosed = true;
__hasReachedEOF = false;
- // Make it 1025, because when full, one slot will go unused, and we
- // want a 1024 byte buffer just to have a round number (base 2 that
is)
- //__queue = new int[1025];
+ // Make it 2049, because when full, one slot will go unused, and we
+ // want a 2048 byte buffer just to have a round number (base 2 that
is)
__queue = new int[2049];
__queueHead = 0;
__queueTail = 0;
@@ -407,8 +406,11 @@
--__bytesAvailable;
- // Need to explicitly notify()
- __queue.notify();
+ // Need to explicitly notify() so available() works properly
+ if(__bytesAvailable == 0 && __threaded) {
+ __queue.notify();
+ }
+
return ch;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]