> Hence my idea of "hijacking" the socket from the CP thread. Should not
> be too hard to find the socket, I just don't know how to tell CP to
> kill the thread without closing the socket.. is there something like
> an exception I can throw or something? Maybe I would need to patch
> CherryPy?
>

You cannot. Well not easily anyway. Here is how CP works internally roughly:

- Starting up the engine in the main process
- A thread starts up the HTTP server
- The HTTP server class creates a pool of threads
- The HTTP server thread listens for incoming connections
- When an incoming connection is accepted, a Request object is created
with the socket and added to a queue
- One of the free thread of the pool then pops the Request from the queue
and handles it
- The response is then sent back to the UA and the socket is closed
- The thread waits for another Request in the queue

As you can see the socket object is burried deeply into the Request object
handled by a thread. You would not have an easy access to it.

You may have a look at an article I wrote a month ago about using asyncore
with CP:
http://www.defuze.org/archives/2006/05/30/asyncore-and-cherrypy

It was merely a proof of concept and I haven't pushed further.

- Sylvain

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to