aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-05-04 19:51:25 +0000
committerRob Austein <sra@hactrn.net>2009-05-04 19:51:25 +0000
commit8b02cc3b7a66caa972f2ff571fc52daec2088138 (patch)
tree68c336fd152a039b624ba0a7a3d8c7bc01988d12 /scripts
parent2271be2ab671d8d67602a6957d358ac5bebd9ad7 (diff)
Move signal wrapper to rpki.async.event_loop().
svn path=/rpkid/rpki/async.py; revision=2397
Diffstat (limited to 'scripts')
-rw-r--r--scripts/async-http.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/scripts/async-http.py b/scripts/async-http.py
index e4a366fb..5b5fc1cd 100644
--- a/scripts/async-http.py
+++ b/scripts/async-http.py
@@ -39,7 +39,7 @@ PERFORMANCE OF THIS SOFTWARE.
# significantly depending on whether client signals HTTP 1.0 or 1.1;
# the latter produces chunked output.
-import sys, os, time, socket, asyncore, asynchat, traceback, urlparse, signal
+import sys, os, time, socket, asyncore, asynchat, traceback, urlparse
import rpki.async, rpki.sundial
debug = True
@@ -473,21 +473,11 @@ class http_manager(dict):
def client(msg, url, timeout = 300, callback = None):
pass
-def server(handlers, port, host ="", catch_signals = (signal.SIGINT, signal.SIGTERM)):
+def server(handlers, port, host =""):
if not isinstance(handlers, (tuple, list)):
handlers = (("/", handlers),)
- try:
- def raiseExitNow(signum, frame):
- logger(None, "Signal received, shutting down")
- raise asyncore.ExitNow
- old_signal_handlers = tuple((sig, signal.signal(sig, raiseExitNow)) for sig in catch_signals)
- listener = http_listener(port = 8000, handlers = handlers)
- rpki.async.event_loop()
- except asyncore.ExitNow:
- pass
- finally:
- for sig, handler in old_signal_handlers:
- signal.signal(sig, handler)
+ listener = http_listener(port = 8000, handlers = handlers)
+ rpki.async.event_loop()
if len(sys.argv) == 1: