Artifact
cae78d4d70c18c1b9f30c163ba5bdbe333e76a56:
Attachment "selectbomb2.tcl" to
ticket [3486554fff]
added by
ferrieux
2012-02-10 21:56:45.
# Program 2, the proxy (the one that exhibits bad behavior):
socket -server proxyit 12344
proc proxyit {chan ca cp} {
fconfigure $chan -blocking 0
set ds [socket -async localhost 12345]
fconfigure $ds -blocking 0
fileevent $ds readable "writeit $ds $chan"
}
proc writeit {ds chan} {
puts stderr "write $ds -> $chan"
set d [read $ds]
if {[eof $ds]} {
puts "eof read $ds"
close $ds
close $chan
} else {
puts stderr "not eof $ds, data = '$d'"
puts -nonewline $chan $d
if {[eof $chan]} {
puts "eof puts $chan"
close $chan
close $ds
}
}
}
vwait forever