1414import copy
1515import socket
1616import multiprocessing
17+ import time
1718
1819import signal
1920from urllib .parse import unquote
@@ -38,7 +39,8 @@ def run(*args, **kwargs):
3839 try :
3940 run_old (* args , ** kwargs )
4041 except (KeyboardInterrupt , SystemExit ):
41- print ("VPython server stopped." )
42+ pass
43+ # ("VPython server stopped.")
4244 except :
4345 raise
4446 threading .Thread .run = run
@@ -49,7 +51,7 @@ def run(*args, **kwargs):
4951
5052# Check for Ctrl+C. SIGINT will also be sent by our code if WServer is closed.
5153def signal_handler (signal , frame ):
52- print ("in signal handler, calling stop server" )
54+ # print("in signal handler, calling stop server")
5355 stop_server ()
5456
5557signal .signal (signal .SIGINT , signal_handler )
@@ -342,7 +344,7 @@ def start_websocket_server():
342344
343345def stop_server ():
344346 """Shuts down all threads and exits cleanly."""
345- print ("in stop server" )
347+ # print("in stop server")
346348 global __server
347349 __server .shutdown ()
348350
@@ -364,20 +366,21 @@ def stop_server():
364366 raise KeyboardInterrupt
365367
366368 if threading .main_thread ().is_alive ():
367- print ("main is alive..." )
369+ # print("main is alive...")
368370 sys .exit (0 )
369371 else :
370372 #
371373 # check to see if the event loop is still going, if so join it.
372374 #
373- print ("main is dead.." )
375+ # print("main is dead..")
374376 if __t .is_alive ():
375- print ("__t is alive still" )
377+ # print("__t is alive still")
376378 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...")
378380 __t .join ()
379381 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
381384 else :
382385 if makeDaemonic :
383386 sys .exit (0 )
@@ -390,7 +393,7 @@ def stop_server():
390393GW = GlowWidget ()
391394
392395while not (httpserving and websocketserving ): # try to make sure setup is complete
393- rate ( 60 )
396+ time . sleep ( 0.1 )
394397
395398
396399# Dummy variable to import
0 commit comments