You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joey Ekstrom <jc...@gmail.com> on 2005/06/27 22:53:20 UTC

protocol handler holding a connection patch

I sent an email to the list a little over a week ago about adding the
ability for a protocol handler to keep a TCP connection open for
notifications, but then free in the worker thread back to MPM. No one
responded, so I have created a basic patch to allow this, and patched
the event and worker mpm's to allow this.

First, I added two new methods to the ap_mpm.h:

AP_DECLARE(apr_status_t) ap_mpm_close_connection(conn_rec *connection);
AP_DECLARE(apr_status_t) ap_mpm_reprocess_connection(conn_rec *connection);

I made very few changes to event.c, but a couple more to worker.c, but
all in all the patch set was relatively small. The behavior is
slightly different between the two. I have also started working on the
winnt mpm, but I haven't finished it for both code paths. I have
_thought_ about changing the above methods to:

AP_DECLARE(apr_status_t) ap_mpm_close_connection(conn_rec *connection);
AP_DECLARE(apr_status_t) ap_mpm_reprocess_connection(conn_rec *connection);
AP_DECLARE(apr_status_t) ap_mpm_requeue_connection(conn_rec *connection);

Where the ap_mpm_requeue_connection would requeue, such as the event
mpm, to be processed by another thread, but then have
ap_mpm_reprocess_connection, use the current thread of execution. To
make it clearer to a protocol modules what will happen in the mpm.

I also added a really lame example module called mod_queue, that
allows you to push and pop on a queue.

I would really appreciate any feedback. I would like to get a change
like this accepted into the main apache code.

Thanks.

-Joey

Re: protocol handler holding a connection patch

Posted by Paul Querna <ch...@force-elite.com>.
Joey Ekstrom wrote:
> I sent an email to the list a little over a week ago about adding the
> ability for a protocol handler to keep a TCP connection open for
> notifications, but then free in the worker thread back to MPM. No one
> responded, so I have created a basic patch to allow this, and patched
> the event and worker mpm's to allow this.
> 
> First, I added two new methods to the ap_mpm.h:
> 
> AP_DECLARE(apr_status_t) ap_mpm_close_connection(conn_rec *connection);
> AP_DECLARE(apr_status_t) ap_mpm_reprocess_connection(conn_rec *connection);
> 
> I made very few changes to event.c, but a couple more to worker.c, but
> all in all the patch set was relatively small. The behavior is
> slightly different between the two. I have also started working on the
> winnt mpm, but I haven't finished it for both code paths. I have
> _thought_ about changing the above methods to:
> 
> AP_DECLARE(apr_status_t) ap_mpm_close_connection(conn_rec *connection);
> AP_DECLARE(apr_status_t) ap_mpm_reprocess_connection(conn_rec *connection);
> AP_DECLARE(apr_status_t) ap_mpm_requeue_connection(conn_rec *connection);
> 
> Where the ap_mpm_requeue_connection would requeue, such as the event
> mpm, to be processed by another thread, but then have
> ap_mpm_reprocess_connection, use the current thread of execution. To
> make it clearer to a protocol modules what will happen in the mpm.
> 

Wow. This is really cool.

This does give a generic API to allow any MPM to 'fake' what the Event
MPM does.  This means modules can be setup to easily work with any MPM,
and not have to worry about the MPM, since the end behavior will be the
same.

> I also added a really lame example module called mod_queue, that
> allows you to push and pop on a queue.
> 
> I would really appreciate any feedback. I would like to get a change
> like this accepted into the main apache code.

I will try to review the code in detail later.  I agree, this would be
great to get into SVN.

Thanks,

Paul