summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoroehhar <harald.oehlmann@elmicron.de>2014-04-02 12:43:29 (GMT)
committeroehhar <harald.oehlmann@elmicron.de>2014-04-02 12:43:29 (GMT)
commit7d3ace5344fa211a19628c2ddec28510b515fa4c (patch)
tree23996255a826e971b126afeef032fdf50009a66b /tests
parent30a15d58d30ef07b7bcf90e876e495fdfb55a830 (diff)
parent6db3b6dd9d1acdae281ff36db51632a2efbf1853 (diff)
downloadtcl-7d3ace5344fa211a19628c2ddec28510b515fa4c.zip
tcl-7d3ace5344fa211a19628c2ddec28510b515fa4c.tar.gz
tcl-7d3ace5344fa211a19628c2ddec28510b515fa4c.tar.bz2
Fix bug [581937ab1e]: fire readable event on async socket connect failurebug_581937ab1e
Diffstat (limited to 'tests')
-rw-r--r--tests/socket.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 218cce4..a3d4b4b 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -67,6 +67,10 @@ namespace import -force ::tcltest::*
testConstraint testthread [llength [info commands testthread]]
testConstraint exec [llength [info commands exec]]
+# Produce a random port number in the Dynamic/Private range
+# from 49152 through 65535.
+proc randport {} { expr {int(rand()*16383+49152)} }
+
# If remoteServerIP or remoteServerPort are not set, check in the
# environment variables for externally set values.
#
@@ -926,6 +930,19 @@ test socket-8.2 {testing writable event when quick failure} {socket win} {
set x
} writable
+test socket-8.3 {testing fileevent readable on failed async socket connect} {socket} {
+ # Test for bug 581937ab1e
+
+ set a1 [after 5000 {set x timeout}]
+ # This connect should fail
+ set s [socket -async localhost [randport]]
+ fileevent $s readable {set x readable}
+ vwait x
+ catch {close $s}
+ after cancel $a1
+ set x
+} readable
+
test socket-9.1 {testing spurious events} {socket} {
set len 0
set spurious 0