mirror of
https://github.com/certbot/certbot.git
synced 2026-04-23 23:33:27 -04:00
I'm not even sure why `serve_forever2` and `shutdown2` were introduced in the first place... It probably follows from my misconception about the SocketServer module. After having studied the module again, I come to the conclusion that we can get rid of my crap, simultanously reducing probability of #1085 (hopefully down to 0)! `server_forever` is used throughout tests instead of `handle_request`, because `shutdown`, following docs, "must be called while serve_forever() is running in another thread, or it will deadlock", and our `probe_sni` HTTP request is already enough to kill single `handle_request`. We don't need to use any busy waiting block or `sleep` between serve and shutdown; studying CPython source code leads to the conclusion that the following construction is non-blocking: ```python import threading, SocketServer s = SocketServer.TCPServer(("", 0), None) t = threading.Thread(target=s.shutdown) t.start() s.serve_forever() # returns immediately t.join() # returns immediately ``` |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| common.py | ||
| common_test.py | ||
| disco.py | ||
| disco_test.py | ||
| manual.py | ||
| manual_test.py | ||
| null.py | ||
| null_test.py | ||
| standalone.py | ||
| standalone_test.py | ||
| util.py | ||
| util_test.py | ||
| webroot.py | ||
| webroot_test.py | ||