[issue1193577] add server.shutdown() method to SocketServer

Jeffrey Yasskin report at bugs.python.org
Sun Mar 2 09:18:39 CET 2008


Jeffrey Yasskin added the comment:

It seems that .await_request() was only added a month ago to fix issue
742598, so it's no great hardship to refactor it again now. Timeouts
never worked for .serve_forever() because the try/except in
.handle_request() turned their exception into a plain return, which
didn't stop .server_forever() from looping. Timeouts also seem to be
unnecessary in a situation in which shutdown works. Shutdown can only be
called from a separate thread, and when you have more threads you can
also do periodic tasks in them.

So I've made that explicit: the .serve_forever/shutdown combination
doesn't handle timeouts. [This has nothing to do with the fact that it
takes three times as much code to handle them. Don't look at the excuse
behind the curtain. ;)]

This patch needs some more documentation and a NEWS entry before it gets
submitted, but I want to check that everyone would be happy with the
concept.

----------
nosy: +akuchling, pilcrow
versions: +Python 2.6, Python 3.0
Added file: http://bugs.python.org/file9581/polling_shutdown.patch

_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1193577>
_____________________________________


More information about the Python-bugs-list mailing list