add limit for adjusted time.

This commit is contained in:
Christopher Jeffrey 2016-04-19 05:49:05 -07:00
parent b9369412d2
commit 8b3db92bbf
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -21,6 +21,7 @@ var assert = utils.assert;
* @param {Number} [limit=200]
* @property {Array} samples
* @property {Object} known
* @property {Number} limit
*/
function AdjustedTime(limit) {
@ -34,6 +35,7 @@ function AdjustedTime(limit) {
this.samples = [];
this.known = {};
this.limit = limit;
this._checked = false;
}
@ -49,7 +51,7 @@ AdjustedTime.prototype.add = function add(host, time) {
var sample = time - utils.now();
var i, median, match, offset;
if (this.samples.length >= 200)
if (this.samples.length >= this.limit)
return;
if (this.known[host])