fix even more hang situations due to client_mutex
This commit is contained in:
parent
7b680a8ed3
commit
4332466210
@ -1251,7 +1251,7 @@ function on_ws_closed()
|
|||||||
audio_node.disconnect();
|
audio_node.disconnect();
|
||||||
}
|
}
|
||||||
catch (dont_care) {}
|
catch (dont_care) {}
|
||||||
divlog("WebSocket has closed unexpectedly. Please reload the page.", 1);
|
divlog("WebSocket has closed unexpectedly. Please reload the page.", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function on_ws_error(event)
|
function on_ws_error(event)
|
||||||
@ -1259,9 +1259,15 @@ function on_ws_error(event)
|
|||||||
divlog("WebSocket error.",1);
|
divlog("WebSocket error.",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.startswith=function(str){ return this.indexOf(str) == 0; }; //http://stackoverflow.com/questions/646628/how-to-check-if-a-string-startswith-another-string
|
||||||
|
|
||||||
function open_websocket()
|
function open_websocket()
|
||||||
{
|
{
|
||||||
//ws_url="ws://"+(window.location.origin.split("://")[1])+"/ws/" //guess automatically
|
if(ws_url.startswith("ws://localhost:")&&window.location.hostname!="127.0.0.1"&&window.location.hostname!="localhost")
|
||||||
|
{
|
||||||
|
divlog("Server administrator should set <em>server_hostname</em> correctly, because it is left as <em>\"localhost\"</em>. Now guessing hostname from page URL.",1);
|
||||||
|
ws_url="ws://"+(window.location.origin.split("://")[1])+"/ws/"; //guess automatically
|
||||||
|
}
|
||||||
if (!("WebSocket" in window))
|
if (!("WebSocket" in window))
|
||||||
divlog("Your browser does not support WebSocket, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.");
|
divlog("Your browser does not support WebSocket, which is required for WebRX to run. Please upgrade to a HTML5 compatible browser.");
|
||||||
ws = new WebSocket(ws_url+client_id);
|
ws = new WebSocket(ws_url+client_id);
|
||||||
|
@ -153,10 +153,13 @@ def spectrum_thread_function():
|
|||||||
data=dsp.read(cfg.fft_size*4)
|
data=dsp.read(cfg.fft_size*4)
|
||||||
#print "gotcha",len(data),"bytes of spectrum data via spectrum_thread_function()"
|
#print "gotcha",len(data),"bytes of spectrum data via spectrum_thread_function()"
|
||||||
clients_mutex.acquire()
|
clients_mutex.acquire()
|
||||||
|
correction=0
|
||||||
for i in range(0,len(clients)):
|
for i in range(0,len(clients)):
|
||||||
|
i-=correction
|
||||||
if (clients[i].ws_started):
|
if (clients[i].ws_started):
|
||||||
if clients[i].spectrum_queue.full():
|
if clients[i].spectrum_queue.full():
|
||||||
close_client(i, False)
|
close_client(i, False)
|
||||||
|
correction+=1
|
||||||
else:
|
else:
|
||||||
clients[i].spectrum_queue.put([data]) # add new string by "reference" to all clients
|
clients[i].spectrum_queue.put([data]) # add new string by "reference" to all clients
|
||||||
clients_mutex.release()
|
clients_mutex.release()
|
||||||
|
Loading…
Reference in New Issue
Block a user