Saju Pillai wrote:

For a brand new client connection, why should there be 2 exchanges between the listener thread and the worker thread before the request is actually read ?

The client socket is accepted() and passed to a worker thread which runs the create_connection hooks and marks the connection in the CONN_STATE_CHECK_REQUEST_LINE_READABLE state.

hmmm?

in event.c::process_socket()

if (cs == NULL) {           /* This is a new connection */
    cs = apr_pcalloc(p, sizeof(conn_state_t));
[...]
    cs->state = CONN_STATE_READ_REQUEST_LINE;

This is again pushed back to the listener which will poll it for readability and mark it as CONN_STATE_READ_REQUEST_LINE if it's readable. A worker now grabs this client and performs the actual read.

I want to walk thru this with gdb. obviously you've been studying the code and I've been away from it for too long.

Why do we need an explicit state CONN_STATE_CHECK_REQUEST_LINE_READABLE ?.

it is very useful when checking for requests after the first (Keep-Alive)

Can the first worker not read() directly from the accepted client ?

sure it can.  that is the intention.

Greg

Reply via email to