Tcl Source Code

Check-in [70a407c245]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | main
Files: files | file ages | folders
SHA3-256: 70a407c2453e5aa3021f237ba7a01ab0d1e50dbb79eed76574ee21a695c23add
User & Date: pooryorick 2024-04-04 11:50:51
References
2024-04-18
15:04 Ticket [080f846fd5] Channel system generating writable events BEFORE channel is open (refchan) status still Open with 3 other changes artifact: 85049380dd user: jan.nijtmans
2024-04-12
08:45 Ticket [080f846fd5]: 4 changes artifact: bdd295557a user: oehhar
2024-04-09
20:15 Ticket [de232b49f2] write-only nonblocking refchan and Tcl internal buffers status still Open with 3 other changes artifact: 6616a7be86 user: pooryorick
2024-04-04
11:57 Ticket [080f846fd5] Channel system generating writable events BEFORE channel is open (refchan) status still Open with 3 other changes artifact: c9a991ec2e user: pooryorick
Context
2024-04-11
13:22
(cherry-pick): Possibly a fix for [080f846fd58958ef]: When updating the interest of a channel, don'... check-in: 1cc41db97a user: jan.nijtmans tags: core-8-branch
2024-04-04
12:35
Merge 8.7. encodingPtr -> encodingNamePtr (for consistency) check-in: 4a704590fe user: jan.nijtmans tags: trunk, main
11:50
Possibly a fix for [080f846fd58958ef]: When updating the interest of a channel, don't schedule the ... check-in: 70a407c245 user: pooryorick tags: trunk, main
2024-04-03
18:51
merge 8.7 (closes [dc0770a2397ae0b1]) check-in: 33460960ef user: sebres tags: trunk, main
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

8627
8628
8629
8630
8631
8632
8633

8634
8635
8636
8637
8638
8639
8640

static void
UpdateInterest(
    Channel *chanPtr)		/* Channel to update. */
{
    ChannelState *statePtr = chanPtr->state;
				/* State info for channel */

    int mask = statePtr->interestMask;

    if (chanPtr->typePtr == NULL) {
	/* Do not update interest on a closed channel */
	return;
    }








>







8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641

static void
UpdateInterest(
    Channel *chanPtr)		/* Channel to update. */
{
    ChannelState *statePtr = chanPtr->state;
				/* State info for channel */
    ChannelBuffer *bufPtr = statePtr->outQueueHead;
    int mask = statePtr->interestMask;

    if (chanPtr->typePtr == NULL) {
	/* Do not update interest on a closed channel */
	return;
    }

8707
8708
8709
8710
8711
8712
8713
8714








8715
8716
8717
8718
8719
8720
8721
			ChannelTimerProc, chanPtr);
	    }
	}
    }

    if (!statePtr->timer
	    && mask & TCL_WRITABLE
	    && GotFlag(statePtr, CHANNEL_NONBLOCKING)) {








	TclChannelPreserve((Tcl_Channel)chanPtr);
	statePtr->timerChanPtr = chanPtr;
	statePtr->timer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
		ChannelTimerProc,chanPtr);
    }









|
>
>
>
>
>
>
>
>







8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
			ChannelTimerProc, chanPtr);
	    }
	}
    }

    if (!statePtr->timer
	    && mask & TCL_WRITABLE
	    && GotFlag(statePtr, CHANNEL_NONBLOCKING)
	    && (
		bufPtr
		&&
		!IsBufferEmpty(bufPtr)
		&&
		!IsBufferFull(bufPtr)
	   )
    ) {
	TclChannelPreserve((Tcl_Channel)chanPtr);
	statePtr->timerChanPtr = chanPtr;
	statePtr->timer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
		ChannelTimerProc,chanPtr);
    }