diff options
author | Jesusaves <cpntb1@ymail.com> | 2022-01-02 14:45:11 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2022-01-02 14:45:11 -0300 |
commit | 217aa334ba382c45ce565ce534c52a6401ce73f0 (patch) | |
tree | 381f00a3650077ee832e90353c41cb0a447b5548 | |
parent | b0f9f17c84125184799612c9d16cf01c56a80c6c (diff) | |
download | client-217aa334ba382c45ce565ce534c52a6401ce73f0.tar.gz client-217aa334ba382c45ce565ce534c52a6401ce73f0.tar.bz2 client-217aa334ba382c45ce565ce534c52a6401ce73f0.tar.xz client-217aa334ba382c45ce565ce534c52a6401ce73f0.zip |
send_packet_now - Retry up to 5 times when facing an error with ws.send
-rw-r--r-- | game/01_init.rpy | 1 | ||||
-rw-r--r-- | game/04_init.rpy | 26 |
2 files changed, 16 insertions, 11 deletions
diff --git a/game/01_init.rpy b/game/01_init.rpy index 7015bc5..7995f85 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -58,6 +58,7 @@ init -3 python: SSL_IS_BROKEN=False CERT_NONE=0 INT_MAX=2147483647 + MAX_RETRIES = 5 debug=copy.copy(config.developer) TERMINATE=False CLOSING=False diff --git a/game/04_init.rpy b/game/04_init.rpy index 85e153b..6724720 100644 --- a/game/04_init.rpy +++ b/game/04_init.rpy @@ -103,19 +103,23 @@ init python: global ws, tr_load, tr_val, tr_busy, TERMINATE, CLOSING stdout("Sending: %s" % packet) - try: - ws.send(get_token() + ";" + packet + ";" + args) - except: - traceback.print_exc() - stdout("FATAL ERROR, packet was not sent!") + cnt = 0 + while cnt < MAX_RETRIES: + cnt+=1 try: - renpy.call_screen("msgbox", - "An unrecoverable error happened.\nPlease close and re-open the app.") + ws.send(get_token() + ";" + packet + ";" + args) + break # Success attained, continue except: - pass - TERMINATE=True - if not CLOSING: - renpy.quit(relaunch=True) + traceback.print_exc() + stdout("FATAL ERROR, packet was not sent!") + try: + renpy.call_screen("msgbox", + "An unrecoverable error happened.\nPlease close and re-open the app.") + except: + pass + TERMINATE=True + if not CLOSING: + renpy.quit(relaunch=True) return |