Перевод на threading, multiprocessing не запускается в Windows

main
none 9 months ago
parent 180bae8162
commit 1b2be86ea5

@ -1,6 +1,5 @@
from os import system, name from os import system, name
#from threading import Thread from threading import Thread
from multiprocessing import Process
from time import sleep from time import sleep
global http_out ; http_out = None global http_out ; http_out = None
@ -21,28 +20,28 @@ def proxy_serv(port):
def watch_http(port): def watch_http(port):
run = Process(target=proxy_http, args=(port,)) run = Thread(target=proxy_http, args=(port,))
run.start() run.start()
global http_out global http_out
while True: while True:
# Если команда вышла # Если команда вышла
if http_out: if http_out or not run.is_alive():
run.terminate() run.join(1)
http_out = None http_out = None
run = Process(target=proxy_http, args=(port,)) run = Thread(target=proxy_http, args=(port,))
run.start() run.start()
sleep(1) sleep(1)
def watch_serv(port): def watch_serv(port):
run = Process(target=proxy_serv, args=(port,)) run = Thread(target=proxy_serv, args=(port,))
run.start() run.start()
global serv_out global serv_out
while True: while True:
if serv_out: if serv_out or not run.is_alive():
run.terminate() run.join(1)
serv_out = None serv_out = None
run = Process(target=proxy_serv, args=(port,)) run = Thread(target=proxy_serv, args=(port,))
run.start() run.start()
sleep(1) sleep(1)

Loading…
Cancel
Save