diff options
| author | pooryorick <com.digitalsmarties@pooryorick.com> | 2024-04-04 11:50:51 (GMT) |
|---|---|---|
| committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2024-04-04 11:50:51 (GMT) |
| commit | c0279cc641d237a25c2a4fc47b6a17d4b9f9b58a (patch) | |
| tree | cc2de13192092c81c62fff2310ef001714ae2111 | |
| parent | 0ca975c075b6ea99fa4236306ef4ed8c3986d857 (diff) | |
| download | tcl-c0279cc641d237a25c2a4fc47b6a17d4b9f9b58a.zip tcl-c0279cc641d237a25c2a4fc47b6a17d4b9f9b58a.tar.gz tcl-c0279cc641d237a25c2a4fc47b6a17d4b9f9b58a.tar.bz2 | |
Possibly a fix for [080f846fd58958ef]: When updating the interest of a
channel, don't schedule the channel handler timer if a nonblocking channel
doesn't yet have a buffer or if the buffer is empty or overflowing. Where
asynchronous connection state is concerned, this should mean that the time
won't be scheduled if the initial connection isn't established.
| -rw-r--r-- | generic/tclIO.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 4b5cb7d..c836342 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8631,6 +8631,7 @@ UpdateInterest( { ChannelState *statePtr = chanPtr->state; /* State info for channel */ + ChannelBuffer *bufPtr = statePtr->outQueueHead; int mask = statePtr->interestMask; if (chanPtr->typePtr == NULL) { @@ -8711,7 +8712,15 @@ UpdateInterest( if (!statePtr->timer && mask & TCL_WRITABLE - && GotFlag(statePtr, CHANNEL_NONBLOCKING)) { + && GotFlag(statePtr, CHANNEL_NONBLOCKING) + && ( + bufPtr + && + !IsBufferEmpty(bufPtr) + && + !IsBufferFull(bufPtr) + ) + ) { TclChannelPreserve((Tcl_Channel)chanPtr); statePtr->timerChanPtr = chanPtr; statePtr->timer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME, |
