Thanks! I'm not sure how to do that, though. I'm aiming for something like this (omitting the queue-producer code):
--------
def handle(request): # gevent.core.http_connection
### Wait for another greenlet to put an item on a queue
request.send_reply(200, 'OK', item_from_queue)
def main():
### launch separate greenlet to put items on queue
# set up web server
server = HTTPServer(('0.0.0.0', 10545), handle)
print "Serving on port 10545."
server.serve_forever()
--------
I was hoping HTTPServer would allow for a connection loss handler, but it doesn't seem to.
I'm not sure how to implement your suggestion for two reasons:
- How can I access the socket from the gevent.core.http_connection object? I can't find anything in the docs.
- If I can get to the socket, does this mean I have to poll the socket periodically for EOF? I'd rather avoid polling.
Any suggestions?
Thanks!
~ Esteban
On Tuesday, August 28, 2012 2:17:10 PM UTC-7, smurf wrote:
> Hi,
> eestolano:
> > Here's the part I haven't been able to figure out: how can I make the handler detect the client timeout *when it happens*?
> The client's socket becomes readable; actually reading from it yields EOF.
> --
> -- Matthias Urlichs