I wrote a SOCKS protocol handler for Apache. I'm having a problem doing a clean shutdown because SOCKS connections can be long lived and Apache assumes that connections are not long lived. It always end up killing the threads handling SOCKS if the connection is long lived (like proxying Citrix ICA over SOCKS).

 

I'm trying to figure out the best way to handle this problem and I'm wondering if anybody has though about this problem and what ideas you have.

 

The way the SOCKS protocol handler works is similar to mod_proxy where it loops infinitely and pools on a downstream and a upstream socket.

 

What I was thinking is that if I add a pipe to the poll set I can write to the pipe when shutting down to get the thread out of the apr_poll() and then get out of the loop and return. So the mpm needs to provide a pipe per thread and needs to write on each one when shutting down... something along those lines.

 

Anybody has a better idea on how to do this?

 

Juan

Reply via email to