proxy: do handshake in forked process too.

This commit is contained in:
Joel Martin
2010-09-10 14:31:34 -05:00
parent a0315ab1dc
commit edc4725260
2 changed files with 18 additions and 8 deletions

View File

@@ -208,14 +208,19 @@ def start_server():
settings['listen_host'], settings['listen_port'])
startsock, address = lsock.accept()
handler_msg('got client connection from %s' % address[0])
csock = do_handshake(startsock)
if not csock: continue
if settings['multiprocess']:
handler_msg("forking handler process")
pid = os.fork()
if pid == 0: # handler process
csock = do_handshake(startsock)
if not csock:
if settings['multiprocess']:
handler_msg("No connection after handshake");
break
else:
continue
settings['handler'](csock)
else: # parent process
settings['handler_id'] += 1