diff options
author | max <max@tclers.tk> | 2011-05-11 15:43:06 (GMT) |
---|---|---|
committer | max <max@tclers.tk> | 2011-05-11 15:43:06 (GMT) |
commit | f457d73c6c66e6b751cd6bc28efd8a88f56daadc (patch) | |
tree | e7da087c144a91023e9b7d18e18917c0489f3e97 | |
parent | 5e902ae378db6fa9d0ef3272832d1a14bde3b44d (diff) | |
download | tcl-f457d73c6c66e6b751cd6bc28efd8a88f56daadc.zip tcl-f457d73c6c66e6b751cd6bc28efd8a88f56daadc.tar.gz tcl-f457d73c6c66e6b751cd6bc28efd8a88f56daadc.tar.bz2 |
* unix/tclUnixSock.c (TcpWatchProc): No need to check for server sockets here, as the generic server code already takes care of that.
* tests/socket.test (accept): Add tests to make sure that this remains so.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | tests/socket.test | 18 | ||||
-rw-r--r-- | unix/tclUnixSock.c | 27 |
3 files changed, 35 insertions, 18 deletions
@@ -1,3 +1,11 @@ +2011-05-11 Reinhard Max <max@suse.de> + + * unix/tclUnixSock.c (TcpWatchProc): No need to check for server + sockets here, as the generic server code already takes care of + that. + * tests/socket.test (accept): Add tests to make sure that this + remains so. + 2011-05-10 Don Porter <dgp@users.sourceforge.net> * generic/tclInt.h: New internal routines TclScanElement() and diff --git a/tests/socket.test b/tests/socket.test index 09b34ad..f1acedc 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -800,6 +800,24 @@ test socket_$af-6.1 {accept callback error} -constraints [list socket supported_ interp bgerror {} $handler } -result {divide by zero} +test socket_$af-6.2 { + readable fileevent on server socket +} -setup { + set sock [socket -server dummy 0] +} -body { + fileevent $sock readable dummy +} -cleanup { + close $sock +} -returnCodes 1 -result "channel is not readable" + +test socket_$af-6.3 {writable fileevent on server socket} -setup { + set sock [socket -server dummy 0] +} -body { + fileevent $sock writable dummy +} -cleanup { + close $sock +} -returnCodes 1 -result "channel is not writable" + test socket_$af-7.1 {testing socket specific options} -setup { file delete $path(script) set f [open $path(script) w] diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c index 35728e1..cb72759 100644 --- a/unix/tclUnixSock.c +++ b/unix/tclUnixSock.c @@ -785,25 +785,16 @@ TcpWatchProc( * TCL_EXCEPTION. */ { TcpState *statePtr = (TcpState *) instanceData; + TcpFdList *fds; - /* - * Make sure we don't mess with server sockets since they will never be - * readable or writable at the Tcl level. This keeps Tcl scripts from - * interfering with the -accept behavior. - */ - - if (!statePtr->acceptProc) { - TcpFdList *fds; - - for (fds = statePtr->fds; fds != NULL; fds = fds->next) { - if (mask) { - Tcl_CreateFileHandler(fds->fd, mask, - (Tcl_FileProc *) Tcl_NotifyChannel, - (ClientData) statePtr->channel); - } else { - Tcl_DeleteFileHandler(fds->fd); - } - } + for (fds = statePtr->fds; fds != NULL; fds = fds->next) { + if (mask) { + Tcl_CreateFileHandler(fds->fd, mask, + (Tcl_FileProc *) Tcl_NotifyChannel, + (ClientData) statePtr->channel); + } else { + Tcl_DeleteFileHandler(fds->fd); + } } } |