diff options
author | dgp <dgp@users.sourceforge.net> | 2014-05-28 16:54:02 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-05-28 16:54:02 (GMT) |
commit | 1c2468956cac48003a15f5984176963d5135d340 (patch) | |
tree | 2fa7e3ae46d7ac1154c7668e222a150c1f71ad62 | |
parent | 00ef775fc158959acc2c14c5ff3568e1f86fe538 (diff) | |
download | tcl-1c2468956cac48003a15f5984176963d5135d340.zip tcl-1c2468956cac48003a15f5984176963d5135d340.tar.gz tcl-1c2468956cac48003a15f5984176963d5135d340.tar.bz2 |
Increase size of test io-29.34 so that it more portably tests the case where
the OS networking machinery gets backed up and blocks.
Added several TODO comments on potential simplifications.
-rw-r--r-- | generic/tclIO.c | 9 | ||||
-rw-r--r-- | tests/io.test | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 4e325ba..9e0d7f1 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -2555,6 +2555,7 @@ FlushChannel( PreserveChannelBuffer(bufPtr); toWrite = BytesLeft(bufPtr); if (toWrite == 0) { + /* TODO: This cannot happen. */ written = 0; } else { written = (chanPtr->typePtr->outputProc)(chanPtr->instanceData, @@ -2667,6 +2668,8 @@ FlushChannel( ReleaseChannelBuffer(bufPtr); continue; } else { + /* TODO: Consider detecting and reacting to short writes + * on blocking channels. Ought not happen. See iocmd-24.2. */ wroteSome = 1; } @@ -2700,6 +2703,12 @@ FlushChannel( ResetFlag(statePtr, BG_FLUSH_SCHEDULED); (chanPtr->typePtr->watchProc)(chanPtr->instanceData, statePtr->interestMask); + } else { + /* TODO: If code reaches this point, it means a writable + * event is being handled on the channel, but the channel + * could not in fact be written to. This ought not happen, + * but Unix pipes appear to act this way (see io-53.4). + * Also can imagine broken reflected channels. */ } } diff --git a/tests/io.test b/tests/io.test index c7da8e6..f1248b9 100644 --- a/tests/io.test +++ b/tests/io.test @@ -2786,7 +2786,7 @@ test io-29.34 {Tcl_Close, async flush on close, using sockets} {socket tempNotMa variable x running set l abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz proc writelots {s l} { - for {set i 0} {$i < 2000} {incr i} { + for {set i 0} {$i < 9000} {incr i} { puts $s $l } } @@ -2817,7 +2817,7 @@ test io-29.34 {Tcl_Close, async flush on close, using sockets} {socket tempNotMa close $ss vwait [namespace which -variable x] set c -} 2000 +} 9000 test io-29.35 {Tcl_Close vs fileevent vs multiple interpreters} {socket tempNotMac fileevent} { # On Mac, this test screws up sockets such that subsequent tests using port 2828 # either cause errors or panic(). |