summaryrefslogtreecommitdiff
path: root/game/04_init.rpy
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-12-17 17:48:44 -0300
committerJesusaves <cpntb1@ymail.com>2020-12-17 17:48:44 -0300
commit9bd6a5501475b74784ccf60bbb493030a5f02f0f (patch)
tree3a0ec2deddf5d7dfc64de36c9bd4a205a58a1f13 /game/04_init.rpy
parent60f85cda41bbae22ae8236d263ddc1fe495f4266 (diff)
downloadclient-9bd6a5501475b74784ccf60bbb493030a5f02f0f.tar.gz
client-9bd6a5501475b74784ccf60bbb493030a5f02f0f.tar.bz2
client-9bd6a5501475b74784ccf60bbb493030a5f02f0f.tar.xz
client-9bd6a5501475b74784ccf60bbb493030a5f02f0f.zip
Stop running supervisor() after we are done in hopes to lower CPU usage.
...It did not lower the CPU use nor avoided the AttributeError =/ So, uh, yes, restart is still broken
Diffstat (limited to 'game/04_init.rpy')
-rw-r--r--game/04_init.rpy32
1 files changed, 6 insertions, 26 deletions
diff --git a/game/04_init.rpy b/game/04_init.rpy
index 86a269a..99359f6 100644
--- a/game/04_init.rpy
+++ b/game/04_init.rpy
@@ -141,17 +141,16 @@ init python:
def send_packet(packet, args=""):
global tr_cmd, tr_busy, tr_load
schedule_packet()
- tr_cmd=[packet, args]
+ send_packet_now(packet, args)
tr_val = wait_packet()
return
- # This is not really required, just makes we use two threads
- # instead of one? tr_busy is handled by shcedule_packet() which is
- # summoned by send_packet() already, so it should not be needed
- # I guess it could be handful to auto-restart connection laterâ„¢?
+ # In past, this would keep running, in hopes of catching the program quit
+ # and being able to kill the threads... But well, it worked poorly.
+ # Still called "supervisor" but all it does now is init.
# sslopt={"cert_reqs": CERT_NONE})
def supervisor(use_ssl):
- global tr_load, tr_val, tr_busy, tr_cmd, ws
+ global ws
stdout(_("Opening new socket..."))
if use_ssl:
ws = GameClient("wss://"+HOST+":61000")
@@ -160,25 +159,6 @@ init python:
ws.connect()
renpy.invoke_in_thread(ws.run_forever) # May be problematic
stdout("Connection established!")
-
- # Begin loop
- while True:
- try:
- if tr_cmd[0] != "":
- #schedule_packet()
- send_packet_now(tr_cmd[0], tr_cmd[1])
- tr_cmd=["", ""]
- # Main thread is the one waiting, not us
- time.sleep(0.02)
- pass
- except NameError:
- print("NameError, perhaps the program has terminated?")
- break
- try:
- ws.close()
- except:
- pass
-
- # Close the supervisor module
+ # The supervisor module is now uneeded as thread was cast
return