summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-06-02 20:03:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-06-02 20:03:14 (GMT)
commitabb4df1befac97bab990b6aefbbb6c21d330eb08 (patch)
treea7121fb462da5136135109fa4c8d034d27cd05fd
parentc564e71550c301b91656eb54602bb8c1ece62f01 (diff)
downloadtcl-abb4df1befac97bab990b6aefbbb6c21d330eb08.zip
tcl-abb4df1befac97bab990b6aefbbb6c21d330eb08.tar.gz
tcl-abb4df1befac97bab990b6aefbbb6c21d330eb08.tar.bz2
These edits make the tests socket-14.11.[01] stop hanging, but also introduce
a whole raft of test failures. WIP.
-rw-r--r--generic/tclIO.c18
-rw-r--r--tests/socket.test2
-rw-r--r--unix/tclUnixSock.c8
3 files changed, 16 insertions, 12 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 7d94037..5552329 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -3288,10 +3288,15 @@ Tcl_Close(
stickyError = 0;
if ((statePtr->encoding != NULL)
- && !(statePtr->outputEncodingFlags & TCL_ENCODING_START)
- && (CheckChannelErrors(statePtr, TCL_WRITABLE) == 0)) {
- statePtr->outputEncodingFlags |= TCL_ENCODING_END;
- if (WriteChars(chanPtr, "", 0) < 0) {
+ && !(statePtr->outputEncodingFlags & TCL_ENCODING_START)) {
+
+ int code = CheckChannelErrors(statePtr, TCL_WRITABLE);
+
+ if (code == 0) {
+ statePtr->outputEncodingFlags |= TCL_ENCODING_END;
+ code = WriteChars(chanPtr, "", 0);
+ }
+ if (code < 0) {
stickyError = Tcl_GetErrno();
}
@@ -8034,8 +8039,9 @@ Tcl_NotifyChannel(
*/
if (GotFlag(statePtr, BG_FLUSH_SCHEDULED) && (mask & TCL_WRITABLE)) {
- FlushChannel(NULL, chanPtr, 1);
- mask &= ~TCL_WRITABLE;
+ if (0 == FlushChannel(NULL, chanPtr, 1)) {
+ mask &= ~TCL_WRITABLE;
+ }
}
/*
diff --git a/tests/socket.test b/tests/socket.test
index 88d8767..0c9320a 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -2161,7 +2161,7 @@ test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener
unset x
} -result {socket is not connected} -returnCodes 1
test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener, flush} \
- -constraints {socket knownBug} \
+ -constraints {socket} \
-body {
set sock [socket -async localhost [randport]]
fconfigure $sock -blocking 0
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index 08a14d3..47d0681 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -1160,11 +1160,9 @@ out:
* the event mechanism one roundtrip through select().
*/
- /* Note: disabling this for now as it causes spurious event triggering
- * under Linux (see test socket-14.15). */
-#if 0
- Tcl_NotifyChannel(statePtr->channel, TCL_WRITABLE);
-#endif
+ if (statePtr->cachedBlocking == TCL_MODE_NONBLOCKING) {
+ Tcl_NotifyChannel(statePtr->channel, TCL_WRITABLE);
+ }
}
if (error != 0) {
/*