From 135001abc4f240eaff69121fb140b89a31aead45 Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Sat, 4 Nov 2023 09:18:19 +0800 Subject: [PATCH] try to make the tunnel more reliable --- koboldcpp.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/koboldcpp.py b/koboldcpp.py index 4be2a7b3a..de7aa1296 100755 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -1814,12 +1814,12 @@ def setuptunnel(): tunnelrawlog = "" time.sleep(0.2) if os.name == 'nt': - print("Starting Cloudflare Tunnel for Windows...") + print("Starting Cloudflare Tunnel for Windows, please wait...") tunnelproc = subprocess.Popen(f"cloudflared.exe tunnel --url localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) else: - print("Starting Cloudflare Tunnel for Linux...") + print("Starting Cloudflare Tunnel for Linux, please wait...") tunnelproc = subprocess.Popen(f"./cloudflared-linux-amd64 tunnel --url http://localhost:{args.port}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) - time.sleep(6) + time.sleep(10) def tunnel_reader(): nonlocal tunnelproc,tunneloutput,tunnelrawlog pattern = r'https://[\w\.-]+\.trycloudflare\.com' @@ -1831,15 +1831,15 @@ def setuptunnel(): found = re.findall(pattern, line) for x in found: tunneloutput = x + print(f"Your remote tunnel is ready, please connect to {tunneloutput}") return tunnel_reader_thread = threading.Thread(target=tunnel_reader) tunnel_reader_thread.start() - time.sleep(0.8) - if tunneloutput!="": - print(f"Your remote tunnel is ready, please connect to {tunneloutput}") - else: + time.sleep(5) + if tunneloutput=="": print(f"Error: Could not create cloudflare tunnel!\nMore Info:\n{tunnelrawlog}") + time.sleep(0.5) tunnelproc.wait() if os.name == 'nt':