From 06054b1291ccf473c9d69538dfddb54969c147de Mon Sep 17 00:00:00 2001 From: ha7ilm Date: Thu, 21 May 2015 21:13:30 +0200 Subject: [PATCH] backported max_clients --- config_webrx.py | 1 + openwebrx.py | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config_webrx.py b/config_webrx.py index f4f3de5..6b1800f 100755 --- a/config_webrx.py +++ b/config_webrx.py @@ -24,6 +24,7 @@ This file is part of OpenWebRX. #Server settings web_port=8073 server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket) +max_clients=20 #Web GUI configuration receiver_name="[Callsign]" diff --git a/openwebrx.py b/openwebrx.py index 1d7b44a..8bbc0ed 100755 --- a/openwebrx.py +++ b/openwebrx.py @@ -202,7 +202,7 @@ def cleanup_clients(): for i in range(0,len(clients)): i-=correction #print "cleanup_clients:: len(clients)=", len(clients), "i=", i - if (not clients[i].ws_started) and (time.time()-clients[i].gen_time)>180: + if (not clients[i].ws_started) and (time.time()-clients[i].gen_time)>45: print "[openwebrx] cleanup_clients :: client timeout to open WebSocket" close_client(i, False) correction+=1 @@ -385,6 +385,14 @@ class WebRXHandler(BaseHTTPRequestHandler): self.end_headers() self.wfile.write("

Object moved

Please click here to continue.") return + if extension == "wrx": cleanup_clients() + if extension == "wrx" and cfg.max_clients<=len(clients): + self.send_response(302) #backported max_clients fix + self.send_header('Content-type','text/html') + self.send_header("Location", "http://{0}:{1}/retry.html".format(cfg.server_hostname,cfg.web_port)) + self.end_headers() + self.wfile.write("

Object moved

Please click here to continue.") + return self.send_response(200) if(("wrx","html","htm").count(extension)): self.send_header('Content-type','text/html')