-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add server.shutdown() method to SocketServer #41934
Comments
First of all the daemon_threads property on socket instead of temp = TCPServer(...)
temp.daemon_threads=True
temp.serve_forever Secondly there should be a way to STOP the server, once self.server.stop_serving() This would work by setting a flag in the server object. This method was suggested by Skip Montanaro in a clpy |
This is getting in my way, so I'll take a look at it. I'm planning to |
I had some code here to do the exact same thing with XML-RPC server. The I disagree on adding the daemon_threads arg as a keyword to TCPServer |
Polling isn't a great way to handle shutdown, since it wastes CPU time I've merged your patch with my conflicting change in the trunk and Two things:
|
Also, Pedro's argument against a daemon_threads argument to TCPServer |
It seems that .await_request() was only added a month ago to fix issue So I've made that explicit: the .serve_forever/shutdown combination This patch needs some more documentation and a NEWS entry before it gets |
I'll submit the attached patch in a couple days unless I get comments. |
Hearing no objections, I've submitted this as r61289. |
So this has a race. See bpo-2302 to discuss a fix. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: