Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def rtcWatchdog(uuid):
- global userUUIDAssociations
- print("Starting Watchdog")
- # While kill signal is false check uuid and if time goes over 5 seconds, then stop RTCPeer.
- while sigint == False:
- iPingtime = userUUIDAssociations[uuid][1]
- diffTime = float(time.time()) - float(iPingtime)
- time.sleep(0.300)
- print("Found Pingtime: " + str(iPingtime))
- print("Diff time:" + str(diffTime))
- if (diffTime > 5.0 and iPingtime > 0):
- print("Broken Watchdog, killing loop uuid: " + str(uuid))
- print("Running Threads Now: " + str(threading.active_count()))
- try:
- print("Is Running: " + str(userUUIDAssociations[uuid][2].is_running()))
- print("Is Closed: " + str(userUUIDAssociations[uuid][2].is_closed()))
- print("RtcConnectionState: ")
- print((userUUIDAssociations[uuid][5]).connectionState)
- time.sleep(3)
- print("Attempting to stop loop")
- userUUIDAssociations[uuid][2].stop() # Close event loop, which reduces thread count back to what it was originally. <---- THIS WAS A BIG FIX, now does not work? Never worked?
- print("Loop stopped")
- print("Is Running: " + str(userUUIDAssociations[uuid][2].is_running()))
- print("Is Closed: " + str(userUUIDAssociations[uuid][2].is_closed()))
- print("RtcConnectionState: ")
- print((userUUIDAssociations[uuid][5]).connectionState)
- time.sleep(2)
- # Remove from userUUIDAssociations
- del userUUIDAssociations[uuid]
- print("Running Threads After: " + str(threading.active_count()))
- print("At end of stopping event loop, should be all cleaned up.")
- break
- print("Should not have been printed")
- except Exception as e:
- print("Failed in stopping event loop")
- print(e)
Advertisement
Add Comment
Please, Sign In to add comment