summaryrefslogtreecommitdiffstats
path: root/tests/socket.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2012-05-03 20:22:35 (GMT)
committerdgp <dgp@users.sourceforge.net>2012-05-03 20:22:35 (GMT)
commit8124b5fb585273485814508c23908f35f44d3fba (patch)
tree6354097144b6cca3633eaa74620b80445186b974 /tests/socket.test
parent657c0cf4897b8ee11f1138b800a014c1461bc20d (diff)
downloadtcl-8124b5fb585273485814508c23908f35f44d3fba.zip
tcl-8124b5fb585273485814508c23908f35f44d3fba.tar.gz
tcl-8124b5fb585273485814508c23908f35f44d3fba.tar.bz2
3428754 Test socket-14.2 tolerate [socket -async] connection that connects
synchronously.
Diffstat (limited to 'tests/socket.test')
-rw-r--r--tests/socket.test21
1 files changed, 12 insertions, 9 deletions
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} \