Message54518
First of all the daemon_threads property on socket
servers should be added as an optional arg to the
server constructor, so you can say:
TCPServer(..., daemon_threads=True).serve_forever()
instead of
temp = TCPServer(...)
temp.daemon_threads=True
temp.serve_forever
Secondly there should be a way to STOP the server, once
you've started serving forever! A request handler
should be able to say
self.server.stop_serving()
This would work by setting a flag in the server object.
The serve_forever loop would use select with a timeout
(default 0.5 sec, also settable as an optional arg to
the server constructor) or alternatively set a timeout
on the socket object. So it would block listening for
new connections, but every 0.5 sec it would check the
stop_serving flag and break out of the loop if the flag
was set.
This method was suggested by Skip Montanaro in a clpy
thread about how to stop SocketServer and it's useful
enough that I think it should be part of the standard
impl. I can make a patch if it's not obvious how to do it. |
|
Date |
User |
Action |
Args |
2007-08-23 16:10:58 | admin | link | issue1193577 messages |
2007-08-23 16:10:58 | admin | create | |
|