Added max heartbeat interval to prevent integer overflow

When using big session timeout values, the interval value might overflow
and cause the setInterval() call to ping the server in a loop without
any delay.

This fix adds a maximum ping interval of 24 hours.
remotes/origin/stable6
Vincent Petry 10 years ago
parent b2fae8a8b7
commit 00ec5fc193

@ -741,6 +741,8 @@ function initCore() {
* time out
*/
function initSessionHeartBeat(){
// max interval in seconds set to 24 hours
var maxInterval = 24 * 3600;
// interval in seconds
var interval = 900;
if (oc_config.session_lifetime) {
@ -750,6 +752,9 @@ function initCore() {
if (interval < 60) {
interval = 60;
}
if (interval > maxInterval) {
interval = maxInterval;
}
OC.Router.registerLoadedCallback(function(){
var url = OC.Router.generate('heartbeat');
setInterval(function(){

Loading…
Cancel
Save