Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
accesslog: Pass file descriptors through response.
[ashd.git]
/
python3
/
ashd-wsgi3
diff --git
a/python3/ashd-wsgi3
b/python3/ashd-wsgi3
index
a07ac8d
..
a63362d
100755
(executable)
--- a/
python3/ashd-wsgi3
+++ b/
python3/ashd-wsgi3
@@
-1,7
+1,7
@@
#!/usr/bin/python3
#!/usr/bin/python3
-import sys, os, getopt,
threading, socket, logging, time, locale, collections
-import ashd.
proto, ashd.util, ashd.perf
, ashd.serve
+import sys, os, getopt,
socket, logging, time, locale, collections, signal
+import ashd.
util
, ashd.serve
try:
import pdm.srv
except:
try:
import pdm.srv
except:
@@
-13,7
+13,7
@@
def usage(out):
hspec = "free", {}
modwsgi_compat = False
setlog = True
hspec = "free", {}
modwsgi_compat = False
setlog = True
-opts, args = getopt.getopt(sys.argv[1:], "+hALp:t:m:")
+opts, args = getopt.getopt(sys.argv[1:], "+hALp:t:
l:
m:")
for o, a in opts:
if o == "-h":
usage(sys.stdout)
for o, a in opts:
if o == "-h":
usage(sys.stdout)
@@
-24,6
+24,8
@@
for o, a in opts:
setlog = False
elif o == "-A":
modwsgi_compat = True
setlog = False
elif o == "-A":
modwsgi_compat = True
+ elif o == "-l":
+ hspec = "free", {"max": a, "abort": "10"}
elif o == "-t":
hspec = ashd.serve.parsehspec(a)
elif o == "-m":
elif o == "-t":
hspec = ashd.serve.parsehspec(a)
elif o == "-m":
@@
-195,6
+197,11
@@
except ValueError as exc:
sys.stderr.write("ashd-wsgi3: %s\n" % exc)
sys.exit(1)
sys.stderr.write("ashd-wsgi3: %s\n" % exc)
sys.exit(1)
+def sigterm(sig, frame):
+ socket.fromfd(0, socket.AF_UNIX, socket.SOCK_SEQPACKET).shutdown(socket.SHUT_RDWR) # :P
+for signum in [signal.SIGINT, signal.SIGTERM]:
+ signal.signal(signum, sigterm)
+
reqhandler = hclass(**hargs)
try:
ashd.util.serveloop(handle)
reqhandler = hclass(**hargs)
try:
ashd.util.serveloop(handle)