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.
Forward port of 00ec5fc193
from stable6.
This commit is contained in:
parent
ab7cff6dfd
commit
ce168c286a
|
@ -968,6 +968,8 @@ function initCore() {
|
||||||
* time out
|
* time out
|
||||||
*/
|
*/
|
||||||
function initSessionHeartBeat(){
|
function initSessionHeartBeat(){
|
||||||
|
// max interval in seconds set to 24 hours
|
||||||
|
var maxInterval = 24 * 3600;
|
||||||
// interval in seconds
|
// interval in seconds
|
||||||
var interval = 900;
|
var interval = 900;
|
||||||
if (oc_config.session_lifetime) {
|
if (oc_config.session_lifetime) {
|
||||||
|
@ -977,6 +979,9 @@ function initCore() {
|
||||||
if (interval < 60) {
|
if (interval < 60) {
|
||||||
interval = 60;
|
interval = 60;
|
||||||
}
|
}
|
||||||
|
if (interval > maxInterval) {
|
||||||
|
interval = maxInterval;
|
||||||
|
}
|
||||||
var url = OC.generateUrl('/heartbeat');
|
var url = OC.generateUrl('/heartbeat');
|
||||||
setInterval(function(){
|
setInterval(function(){
|
||||||
$.post(url);
|
$.post(url);
|
||||||
|
|
Loading…
Reference in New Issue