| Ticket UUID: | 794839 | ||
| Title: | async sockets: readable vs writable fileevents | ||
| Type: | Bug | Created on: | 2003-08-25 18:43:18 |
| Submitter: | ralfixx | Assigned to: | davygrvy |
| Subsystem: | 27. Channel Types | Severity: | |
| Priority: | 5 Medium | Last modified: | 2004-05-06 01:51:21 |
| Status: | Closed | Closed by: | davygrvy |
| Resolution: | Fixed | Closed on: | 2004-05-05 18:50:38 |
| Version: | obsolete: 8.3.3 | ||
| Description: | ||||
Try to async-connect to a host/port which refuses the
connection:
proc foo {fd} {
puts "$fd: errstat [fconfigure -error $fd]"
close $fd
}
# chose any port which is not open on local machine
set port_not_open 65432
set fd [socket -async localhost $port_not_open]
Now we need some means to get informed when the
conection is
available, the manpage tells use to use fileevent.
I find that on IRIX both readable and writable
fileevents work to
detect the failed connection:
fileevent $fd readable [list foo $fd]
fileevent $fd writable [list foo $fd]
both immediately show the failed connection.
However on Windows, only the `writable' fileevent
triggers, the
`readable' just hangs around forever. The same goes
for connection
timeouts (host offline): readable fileevents do not
time out,
`writables' do.
David Gravereaux said: "... I agree this is a problem.
Please post this bug to the sourceforge bug db."
So here we are...
| ||||
| User Comments: | ||||
davygrvy added on 2004-05-06 01:30:25:
Logged In: YES
user_id=7549
Using the following test case:
proc foo {fd which} {
puts "$fd: errstat $which [fconfigure $fd -error]"
catch {close $fd}
}
set port_not_open 65432
set fd [socket -async localhost $port_not_open]
fileevent $fd readable [list foo $fd readable]
fileevent $fd writable [list foo $fd writable]
I found that when I added the ability for an async connection
that returned an error to fire both read and write handlers,
only the first would be called due to the 'close $fd'. If neither
closed, both would be called relentlessly.
[committed fix to HEAD]
| ||||
