diff options
author | andreas_kupries <akupries@shaw.ca> | 2001-11-07 04:48:14 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2001-11-07 04:48:14 (GMT) |
commit | d3041fc8916b673bd05d90747fd37b0d8765e8f8 (patch) | |
tree | 6bb3f6aa1e7b151cbdd996cbdf7ef9b70e753b37 | |
parent | 4496bc0277350ccf1016a0eaa1a2983f3fb5b29e (diff) | |
download | tcl-d3041fc8916b673bd05d90747fd37b0d8765e8f8.zip tcl-d3041fc8916b673bd05d90747fd37b0d8765e8f8.tar.gz tcl-d3041fc8916b673bd05d90747fd37b0d8765e8f8.tar.bz2 |
See ChangeLog.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | generic/tclIO.c | 24 |
2 files changed, 28 insertions, 7 deletions
@@ -1,3 +1,14 @@ +2001-11-06 Andreas Kupries <andreas_kupries@users.sourceforge.net> + + * generic/tclIO.c (ReadChars): Fixed bug #478856 reported by + Stuart Cassoff <stwo@users.sourceforge.net>. The bug caused loss + of fileevents when [read]ing less data from the channel than + buffered. Due to an empty input buffer the flag + CHANNEL_NEED_MORE_DATA was set but never reset, causing the I/O + system to wait for more data instead of using a timer to + synthesize fileevents and to flush the pending data out of the + buffers. + 2001-10-19 Jeff Hobbs <jeffh@ActiveState.com> ************************ diff --git a/generic/tclIO.c b/generic/tclIO.c index b9d942d..c05682c 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.20.2.11 2001/09/28 16:30:12 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.20.2.12 2001/11/07 04:48:14 andreas_kupries Exp $ */ #include "tclInt.h" @@ -4219,13 +4219,23 @@ ReadChars(statePtr, objPtr, charsToRead, offsetPtr, factorPtr) nextPtr = bufPtr->nextPtr; if (nextPtr == NULL) { - /* - * There isn't enough data in the buffers to complete the next - * character, so we need to wait for more data before the next - * file event can be delivered. - */ + if (srcLen > 0) { + /* + * There isn't enough data in the buffers to complete the next + * character, so we need to wait for more data before the next + * file event can be delivered. + * + * SF #478856. + * + * The exception to this is if the input buffer was + * completely empty before we tried to convert its + * contents. Nothing in, nothing out, and no incomplete + * character data. The conversion before the current one + * was complete. + */ - statePtr->flags |= CHANNEL_NEED_MORE_DATA; + statePtr->flags |= CHANNEL_NEED_MORE_DATA; + } return -1; } nextPtr->nextRemoved -= srcLen; |