1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-07 22:29:19 +00:00

fhemweb.js: Fix memory problem for longrunning lonpoll process (Forum #23774)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6243 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-07-12 12:46:44 +00:00
parent 69a9774d57
commit 06175f3826

View File

@ -105,13 +105,24 @@ FW_doUpdate()
FW_widgets[w].updateDevs(devs); FW_widgets[w].updateDevs(devs);
} }
} }
// reset the connection to avoid memory problems
if(FW_pollConn.responseText.length > 300*1024)
FW_longpoll();
} }
function function
FW_longpoll() FW_longpoll()
{ {
log("Connecting...");
FW_curLine = 0; FW_curLine = 0;
if(FW_pollConn) {
FW_leaving = 1;
FW_pollConn.abort();
}
FW_pollConn = new XMLHttpRequest(); FW_pollConn = new XMLHttpRequest();
FW_leaving = 0;
var filter = document.body.getAttribute("longpollfilter"); var filter = document.body.getAttribute("longpollfilter");
if(filter == null) if(filter == null)
@ -325,8 +336,10 @@ loadScript(sname, callback)
} }
} }
} else { } else {
if(isiOS) if(isiOS) {
FW_leaving = 1;
FW_pollConn.abort(); FW_pollConn.abort();
}
script.onload = function(){ script.onload = function(){
if(callback) if(callback)
callback(); callback();