diff options
author | dgp <dgp@users.sourceforge.net> | 2014-11-06 16:20:44 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-11-06 16:20:44 (GMT) |
commit | 84ba82da5966fbae82a7ac9c613f3360919460ec (patch) | |
tree | 29b61befba5c9a37ff421e33e662e03aa565b2ab /generic/tclIOGT.c | |
parent | 06fa92e9a424d57ed4c9458474f5f8a7b42cc654 (diff) | |
parent | 4cb80cd4e64044f5891b073788734efd753e5100 (diff) | |
download | tcl-84ba82da5966fbae82a7ac9c613f3360919460ec.zip tcl-84ba82da5966fbae82a7ac9c613f3360919460ec.tar.gz tcl-84ba82da5966fbae82a7ac9c613f3360919460ec.tar.bz2 |
merge iogt fixes.bug_5adc350683_86
Diffstat (limited to 'generic/tclIOGT.c')
-rw-r--r-- | generic/tclIOGT.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/generic/tclIOGT.c b/generic/tclIOGT.c index ca66d4d..58d1a22 100644 --- a/generic/tclIOGT.c +++ b/generic/tclIOGT.c @@ -187,6 +187,7 @@ struct TransformChannelData { Tcl_Channel self; /* Our own Channel handle. */ int readIsFlushed; /* Flag to note whether in.flushProc was * called or not. */ + int eofPending; /* Flag: EOF seen down, not raised up */ int flags; /* Currently CHANNEL_ASYNC or zero. */ int watchMask; /* Current watch/event/interest mask. */ int mode; /* Mode of parent channel, OR'ed combination @@ -292,6 +293,7 @@ TclChannelTransform( Tcl_DStringInit(&ds); Tcl_GetChannelOption(interp, chan, "-blocking", &ds); dataPtr->readIsFlushed = 0; + dataPtr->eofPending = 0; dataPtr->flags = 0; if (ds.string[0] == '0') { dataPtr->flags |= CHANNEL_ASYNC; @@ -624,7 +626,7 @@ TransformInputProc( if (toRead == 0 || dataPtr->self == NULL) { /* - * Catch a no-op. + * Catch a no-op. TODO: Is this a panic()? */ return 0; } @@ -676,8 +678,7 @@ TransformInputProc( if (toRead <= 0) { break; } - - if (dataPtr->readIsFlushed) { + if (dataPtr->eofPending) { /* * Already saw EOF from downChan; don't ask again. * NOTE: Could move this up to avoid the last maxRead @@ -723,6 +724,7 @@ TransformInputProc( * on the down channel. */ + dataPtr->eofPending = 1; dataPtr->readIsFlushed = 1; ExecuteCallback(dataPtr, NULL, A_FLUSH_READ, NULL, 0, TRANSMIT_IBUF, P_PRESERVE); @@ -750,8 +752,11 @@ TransformInputProc( break; } } /* while toRead > 0 */ - ReleaseData(dataPtr); + if (gotBytes == 0) { + dataPtr->eofPending = 0; + } + ReleaseData(dataPtr); return gotBytes; } @@ -862,6 +867,7 @@ TransformSeekProc( P_NO_PRESERVE); ResultClear(&dataPtr->result); dataPtr->readIsFlushed = 0; + dataPtr->eofPending = 0; } ReleaseData(dataPtr); @@ -935,6 +941,7 @@ TransformWideSeekProc( P_NO_PRESERVE); ResultClear(&dataPtr->result); dataPtr->readIsFlushed = 0; + dataPtr->eofPending = 0; } ReleaseData(dataPtr); |