diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2014-04-02 13:33:29 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2014-04-02 13:33:29 (GMT) |
commit | 1007034bc363be609efa893cb0283dcb8187fb96 (patch) | |
tree | 23996255a826e971b126afeef032fdf50009a66b /tests | |
parent | 30a15d58d30ef07b7bcf90e876e495fdfb55a830 (diff) | |
parent | 7d3ace5344fa211a19628c2ddec28510b515fa4c (diff) | |
download | tcl-1007034bc363be609efa893cb0283dcb8187fb96.zip tcl-1007034bc363be609efa893cb0283dcb8187fb96.tar.gz tcl-1007034bc363be609efa893cb0283dcb8187fb96.tar.bz2 |
Fix bug [581937ab1e]: fire readable event on async socket connect failure
Diffstat (limited to 'tests')
-rw-r--r-- | tests/socket.test | 17 |
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 |