updated on Fri Jan 13 08:00:32 UTC 2012
[aur-mirror.git] / woof-python3 / woof-nofork.patch
blob2fc7233c27eb69af29daf41980a4373ac0f8c4c2
1 --- woof-2009-12-27.py 2011-03-31 20:29:40.000000000 +0200
2 +++ woof-2009-12-27.py 2011-03-31 21:28:32.355233473 +0200
3 @@ -34,7 +34,6 @@
5 maxdownloads = 1
6 TM = object
7 -cpid = -1
8 compressed = 'gz'
9 upload = False
11 @@ -209,7 +208,7 @@
14 def do_GET (self):
15 - global maxdownloads, cpid, compressed, upload
16 + global maxdownloads, compressed, upload
18 # Form for uploading a file
19 if upload:
20 @@ -266,11 +265,7 @@
21 # let a separate process handle the actual download, so that
22 # multiple downloads can happen simultaneously.
24 - cpid = os.fork ()
26 - if cpid == 0:
27 - # Child process
28 - child = None
29 + if True:
30 type = None
32 if os.path.isfile (self.filename):
33 @@ -340,7 +335,7 @@
34 if ip_addr:
35 print("Now serving on http://%s:%s/" % (ip_addr, httpd.server_port))
37 - while cpid != 0 and maxdownloads > 0:
38 + while maxdownloads > 0:
39 httpd.handle_request ()
42 @@ -389,7 +384,7 @@
45 def main ():
46 - global cpid, upload, compressed
47 + global upload, compressed
49 maxdown = 1
50 port = 8080
51 @@ -491,16 +486,6 @@
53 serve_files (filename, maxdown, ip_addr, port)
55 - # wait for child processes to terminate
56 - if cpid != 0:
57 - try:
58 - while 1:
59 - os.wait ()
60 - except OSError:
61 - pass
65 if __name__=='__main__':
66 try:
67 main ()