diff options
author | dgp <dgp@users.sourceforge.net> | 2012-05-03 20:22:35 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2012-05-03 20:22:35 (GMT) |
commit | 8124b5fb585273485814508c23908f35f44d3fba (patch) | |
tree | 6354097144b6cca3633eaa74620b80445186b974 | |
parent | 657c0cf4897b8ee11f1138b800a014c1461bc20d (diff) | |
download | tcl-8124b5fb585273485814508c23908f35f44d3fba.zip tcl-8124b5fb585273485814508c23908f35f44d3fba.tar.gz tcl-8124b5fb585273485814508c23908f35f44d3fba.tar.bz2 |
3428754 Test socket-14.2 tolerate [socket -async] connection that connects
synchronously.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | tests/socket.test | 21 |
2 files changed, 15 insertions, 9 deletions
@@ -1,5 +1,8 @@ 2012-05-03 Don Porter <dgp@users.sourceforge.net> + * tests/socket.test: [Bug 3428754] Test socket-14.2 tolerate + [socket -async] connection that connects synchronously. + * unix/tclUnixSock.c: [Bug 3428753] Fix [socket -async] connections that manage to connect synchronously. diff --git a/tests/socket.test b/tests/socket.test index f63f5ca..f06a548 100644 --- a/tests/socket.test +++ b/tests/socket.test @@ -1776,17 +1776,20 @@ test socket-14.1 {[socket -async] fileevent while still connecting} \ test socket-14.2 {[socket -async] fileevent connection refused} \ -constraints [list socket supported_any] \ -body { - set client [socket -async localhost [randport]] - fileevent $client writable {set x [fconfigure $client -error]} - set after [after 1000 {set x timeout}] - vwait x - if {$x eq "timeout"} { - append x ": [fconfigure $client -error]" - } + if {[catch {socket -async localhost [randport]} client]} { + regexp {[^:]*: (.*)} $client -> x + } else { + fileevent $client writable {set x [fconfigure $client -error]} + set after [after 1000 {set x timeout}] + vwait x + after cancel $after + if {$x eq "timeout"} { + append x ": [fconfigure $client -error]" + } + close $client + } set x } -cleanup { - after cancel $after - close $client unset x } -result "connection refused" test socket-14.3 {[socket -async] when server only listens on IPv6} \ |