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

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

View File

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