backported max_clients
This commit is contained in:
parent
7ecab27d56
commit
06054b1291
@ -24,6 +24,7 @@ This file is part of OpenWebRX.
|
|||||||
#Server settings
|
#Server settings
|
||||||
web_port=8073
|
web_port=8073
|
||||||
server_hostname="localhost" # If this contains an incorrect value, the web UI may freeze on load (it can't open websocket)
|
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
|
#Web GUI configuration
|
||||||
receiver_name="[Callsign]"
|
receiver_name="[Callsign]"
|
||||||
|
10
openwebrx.py
10
openwebrx.py
@ -202,7 +202,7 @@ def cleanup_clients():
|
|||||||
for i in range(0,len(clients)):
|
for i in range(0,len(clients)):
|
||||||
i-=correction
|
i-=correction
|
||||||
#print "cleanup_clients:: len(clients)=", len(clients), "i=", i
|
#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"
|
print "[openwebrx] cleanup_clients :: client timeout to open WebSocket"
|
||||||
close_client(i, False)
|
close_client(i, False)
|
||||||
correction+=1
|
correction+=1
|
||||||
@ -385,6 +385,14 @@ class WebRXHandler(BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write("<html><body><h1>Object moved</h1>Please <a href=\"/upgrade.html\">click here</a> to continue.</body></html>")
|
self.wfile.write("<html><body><h1>Object moved</h1>Please <a href=\"/upgrade.html\">click here</a> to continue.</body></html>")
|
||||||
return
|
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("<html><body><h1>Object moved</h1>Please <a href=\"/retry.html\">click here</a> to continue.</body></html>")
|
||||||
|
return
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
if(("wrx","html","htm").count(extension)):
|
if(("wrx","html","htm").count(extension)):
|
||||||
self.send_header('Content-type','text/html')
|
self.send_header('Content-type','text/html')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user