Add forking support.

This commit is contained in:
Darko Poljak 2016-10-30 20:25:32 +01:00
parent 297367390f
commit 8c985fe2cb

View file

@ -24,6 +24,7 @@ import logging
import re
import socket
import http.server
import socketserver
from http.server import BaseHTTPRequestHandler, HTTPServer
@ -49,10 +50,6 @@ class Trigger():
# can only be set once
multiprocessing.set_start_method('forkserver')
# Create pool suitable for passing objects
def __init_pool(self):
pass
def run_httpd(self):
server_address = ('', self.http_port)
@ -78,7 +75,6 @@ class Trigger():
class TriggerHttp(BaseHTTPRequestHandler):
def do_GET(self):
# FIXME: dispatch to pool instead of single process
host = self.client_address[0]
code = 200
mode = None
@ -124,7 +120,7 @@ class TriggerHttp(BaseHTTPRequestHandler):
parallel=False)
class HTTPServerV6(http.server.HTTPServer):
class HTTPServerV6(socketserver.ForkingMixIn, http.server.HTTPServer):
"""
Server that listens both to IPv4 and IPv6 requests.
"""