--------
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