diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2019-07-09 12:16:46 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2019-07-09 12:16:46 -0400 |
| commit | e6677d6fa36e62ebec7544b5f8774bcb3eb8b9db (patch) | |
| tree | f9ec9939bbc3ad673e8953547aea30ab02026207 /www/js/NVR.js | |
| parent | f24b90a7b98a5f5c9ee1df2fad9bd1ffbe7c0aee (diff) | |
don't regen montage connkeys immediatey. Implement a timer
Diffstat (limited to 'www/js/NVR.js')
| -rw-r--r-- | www/js/NVR.js | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/www/js/NVR.js b/www/js/NVR.js index d9991b38..be2265ff 100644 --- a/www/js/NVR.js +++ b/www/js/NVR.js @@ -1465,6 +1465,33 @@ angular.module('zmApp.controllers') } + function regenConnKeys (mon) { + var nowt = moment(); + if (mon) { + debug ("NVR: Regnerating connkey for Monitor:"+mon.Monitor.Id + " at "+nowt); + mon.Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + mon.Monitor.regenTime = nowt; + if (mon.Monitor.regenHandle) { + //debug ("cancelling regen timer for Monitor:"+mon.Monitor.Id); + $timeout.cancel(mon.Monitor.regenHandle); + mon.Monitor.regenHandle = null; + } + + } else { + debug("NVR: Regenerating connkeys for all monitors at "+nowt); + for (var i = 0; i < monitors.length; i++) { + monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + monitors[i].Monitor.rndKey = (Math.floor((Math.random() * 999999) + 1)).toString(); + monitors[i].Monitor.regenTime = nowt; + if (monitors[i].Monitor.regenHandle) { + $timeout.cancel(monitors[i].Monitor.regenHandle); + monitors[i].Monitor.regenHandle = null; + } + } + + } + } + //-------------------------------------------------------------------------- // Banner display of messages //-------------------------------------------------------------------------- @@ -2540,13 +2567,9 @@ angular.module('zmApp.controllers') }, - regenConnKeys: function () { + regenConnKeys: function (mon) { - debug("NVR: Regenerating connkeys..."); - for (var i = 0; i < monitors.length; i++) { - monitors[i].Monitor.connKey = (Math.floor((Math.random() * 999999) + 1)).toString(); - monitors[i].Monitor.rndKey = (Math.floor((Math.random() * 999999) + 1)).toString(); - } + return regenConnKeys (mon); }, getMonitors: function (forceReload) { |
