14
14
import copy
15
15
import socket
16
16
import multiprocessing
17
+ import time
17
18
18
19
import signal
19
20
from urllib .parse import unquote
@@ -38,7 +39,8 @@ def run(*args, **kwargs):
38
39
try :
39
40
run_old (* args , ** kwargs )
40
41
except (KeyboardInterrupt , SystemExit ):
41
- print ("VPython server stopped." )
42
+ pass
43
+ # ("VPython server stopped.")
42
44
except :
43
45
raise
44
46
threading .Thread .run = run
@@ -49,7 +51,7 @@ def run(*args, **kwargs):
49
51
50
52
# Check for Ctrl+C. SIGINT will also be sent by our code if WServer is closed.
51
53
def signal_handler (signal , frame ):
52
- print ("in signal handler, calling stop server" )
54
+ # print("in signal handler, calling stop server")
53
55
stop_server ()
54
56
55
57
signal .signal (signal .SIGINT , signal_handler )
@@ -342,7 +344,7 @@ def start_websocket_server():
342
344
343
345
def stop_server ():
344
346
"""Shuts down all threads and exits cleanly."""
345
- print ("in stop server" )
347
+ # print("in stop server")
346
348
global __server
347
349
__server .shutdown ()
348
350
@@ -364,20 +366,21 @@ def stop_server():
364
366
raise KeyboardInterrupt
365
367
366
368
if threading .main_thread ().is_alive ():
367
- print ("main is alive..." )
369
+ # print("main is alive...")
368
370
sys .exit (0 )
369
371
else :
370
372
#
371
373
# check to see if the event loop is still going, if so join it.
372
374
#
373
- print ("main is dead.." )
375
+ # print("main is dead..")
374
376
if __t .is_alive ():
375
- print ("__t is alive still" )
377
+ # print("__t is alive still")
376
378
if threading .get_ident () != __t .ident :
377
- print ("but it's not my thread, so I'll join..." )
379
+ # print("but it's not my thread, so I'll join...")
378
380
__t .join ()
379
381
else :
380
- print ("__t is alive, but that's my thread! So skip it." )
382
+ #print("__t is alive, but that's my thread! So skip it.")
383
+ pass
381
384
else :
382
385
if makeDaemonic :
383
386
sys .exit (0 )
@@ -390,7 +393,7 @@ def stop_server():
390
393
GW = GlowWidget ()
391
394
392
395
while not (httpserving and websocketserving ): # try to make sure setup is complete
393
- rate ( 60 )
396
+ time . sleep ( 0.1 )
394
397
395
398
396
399
# Dummy variable to import
0 commit comments