Overview
| Artifact ID: | e818f439f1d818a9282ae70ff635997f0b7eac1c |
|---|---|
| Ticket: | 2827000fffffffffffffffffffffffffffffffff
tcl incorrectly reports eof to application |
| User & Date: | andreas_kupries on 2009-07-29 01:28:43 |
Changes
- icomment:
A review of the IChan class shows no anomalies. Using watch to (de)activate events on the underlying channel is a nice trick for avoiding flags. It should work I would think. And with that the immediate forwarding of events in the methods readable/writable should work as well. I tried to compare to my refchan examples, but they are all about base channels without a channel underneath, so not really comparable. The nearest is the fifo2, sort of, as it consists of two ref channels talking to each, i.e. internally joined at the hip. But even there the whole buffer mgmt is by the fifo code, there is no regular channel involved. After I got me the Debug package I could run the Chan.tcl by itself, demo mode. That worked. Do you have a demo script using Chan.tcl and showing the problem ? I hope here that I can avoid getting the whole wub sources. Looking over the save.anno, maybe some more clues there > * as a result of an app [gets], tcl watches reads on the rc: > chan @@{rc18 watch sock15 read} Here might be a misunderstanding of the IO core. 'watch' is primarily called in response to 'chan event'. Calls from the guts of gets/read happen for temp. deactivate events, and re-activate them when the Tcl buffers are empty. A call this early is more likely from a 'chan event' than 'gets'. > (App parses the header from some of the received bytes: Httpd @@{::Httpd::rc18_1504 > reader got request: (...)}) This gets events on rc18, as per step 9. > * tcl reads a buffer's worth of bytes from rc18, but there are no bytes buffered in sock15, so an > empty string is returned: > chan @@{rc18 read sock15 4096 -> 0 bytes '...'} Yes. This is like in testRefchan.tcl, step 13. Event through timer, not enough data in the buffers, ask the OS if it has more. Empty read. > * tcl watches read (presumably because the app has a fileevent readable): > chan @@{rc18 watch sock15 read} Like step 15. Interest in the base events is re-activated. This also re-activates sock15 events, should be. > * application calles [eof rc18] which returns true, and terminates its reader: > Httpd @@{::Httpd::rc18_1504 terminate: (entity)} Hm. Here I would have expected fblocked ... Hm ... It should be possible to model that using testRefchan ... Basically, instead of going into state 2 where it always returns the empty string it should return nothing once, and at the next read something ... But the next read will not happen, won't it. Because of the 'eof' getting signaled ... Ok. That means I should concentrate on the happenings in and around steps 16 and 17 in rc.tcl. - login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"