fhemweb.js: fix error if FHEM is behind proxy and is dead (Forum #64672)
git-svn-id: https://svn.fhem.de/fhem/trunk@13125 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -741,6 +741,12 @@ FW_doUpdate(evt)
|
|||||||
log("Rcvd: "+(l.length>132 ? l.substring(0,132)+"...("+l.length+")":l));
|
log("Rcvd: "+(l.length>132 ? l.substring(0,132)+"...("+l.length+")":l));
|
||||||
if(!l.length)
|
if(!l.length)
|
||||||
continue;
|
continue;
|
||||||
|
if(l.indexOf("<")== 0) { // HTML returned by proxy, if FHEM behind is dead
|
||||||
|
FW_closeConn();
|
||||||
|
FW_errmsg(errstr, retryTime-100);
|
||||||
|
setTimeout(FW_longpoll, retryTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var d = JSON.parse(l);
|
var d = JSON.parse(l);
|
||||||
if(d.length != 3)
|
if(d.length != 3)
|
||||||
continue;
|
continue;
|
||||||
@@ -788,20 +794,26 @@ FW_doUpdate(evt)
|
|||||||
FW_longpoll();
|
FW_longpoll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function
|
||||||
|
FW_closeConn()
|
||||||
|
{
|
||||||
|
FW_leaving = 1;
|
||||||
|
if(!FW_pollConn)
|
||||||
|
return;
|
||||||
|
if(typeof FW_pollConn.close == "function")
|
||||||
|
FW_pollConn.close();
|
||||||
|
else if(typeof FW_pollConn.abort == "function")
|
||||||
|
FW_pollConn.abort();
|
||||||
|
FW_pollConn = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
FW_longpoll()
|
FW_longpoll()
|
||||||
{
|
{
|
||||||
FW_longpollOffset = 0;
|
FW_closeConn();
|
||||||
if(FW_pollConn) {
|
|
||||||
FW_leaving = 1;
|
|
||||||
if(FW_longpollType == "websocket")
|
|
||||||
FW_pollConn.close();
|
|
||||||
else
|
|
||||||
FW_pollConn.abort();
|
|
||||||
FW_pollConn = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
FW_leaving = 0;
|
FW_leaving = 0;
|
||||||
|
FW_longpollOffset = 0;
|
||||||
|
|
||||||
// Build the notify filter for the backend
|
// Build the notify filter for the backend
|
||||||
var filter = $("body").attr("longpollfilter");
|
var filter = $("body").attr("longpollfilter");
|
||||||
|
|||||||
Reference in New Issue
Block a user