Hi Andrew -

> That sounds kind of interesting.  But, is it subject to race
> conditions?  I have not examined your code, but my guess is that it
> is.

Forgive me, I'm a pretty inexperienced C programmer. Define "race
conditions".

> Is it possible for ns_conn state to return "filter", then to finish
> processing the filter and actually be in state "tcl" at the time you
> try to abort the filter processing?  If so what happens (what breaks)
> when this occurs?

Basically what the patch does is it creates a new element to the Ns_Conn
struct for the state. Upon the entrance to each phase of the processing
of the conn (e.g. filter, trace, processing the page) the value of this
element is updated.

So immediately before processing the first filter, Ns_Conn->state is set
to "filter". Immediately before processing the first trace,
Ns_Conn->state is set to "trace". Immediately before parsing an ADP,
Ns_Conn->state is set to "adp. Immediately before processing a
registered TCL proc (which covers .tcl pages in the pageroot as well),
Ns_Conn->state is set to "tcl".

> Why specifically do you want to call your ns_stop proc?

Okay, here's an example. One library function I use a lot that I wrote
is an XML-RPC client. I call this function in filters, in adp's, and in
.tcl's. XML-RPC methods can return faults. The system is designed so
that fault handlers register themselves to handle certain fault codes.
Some fault codes return some error information to the client. Others
redirect the client to another page. There are many things they can do.

Let's say a particular fault handler redirects the client. After it
redirects the client, all processing of this conn should simply cease,
lest needless errors populate your logfiles. But what do you call to do
that? If you're in an adp, you have to call and adp function (e.g.
ns_adp_abort or ns_adp_break). If you're in a tcl script, you have to
call ns_tcl_abort. If you're in a filter, you have to return
"filter_break".

The value of [ns_conn state] allows you to determine where you are in
processing the conn so you can address what needs to accordingly be
done.

-jag

--
Joshua Ginsberg <[EMAIL PROTECTED]>


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to