
I need a front-end to a complex of Zope systems. The front-end listens on an address/port and examines incoming http transactions, and, based upon http headers and other information, connects to one or another of the Zope systems. The underlying approach is straightforward -- a Listener waits for a http transaction, it spawns a receiver which gathers the message, decides what to do, spawns a sender to the destination. When the sender responds, the process is reversed. I currently use an adaptation of Antony Baxter's pydirector to do the job. I use his asynchat version, but have found that it leaks file descriptors in my application. I've not tried the twisted version. So I thought I'd try to craft a tailored, light-weight version using the twisted framework. I see how to manage things when everything works, but what if one or another of the endpoints fails? How do I get everything cleaned up?