hostlist: minor.

This commit is contained in:
Christopher Jeffrey 2017-03-01 11:39:14 -08:00
parent da69c5d888
commit 53f607e19f
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -69,6 +69,14 @@ function HostList(options) {
this._init();
}
/**
* Serialization version.
* @const {Number}
* @default
*/
HostList.VERSION = 0;
/**
* Initialize options.
* @private
@ -972,7 +980,7 @@ HostList.prototype.toJSON = function toJSON() {
}
return {
version: 1,
version: HostList.VERSION,
addrs: addrs,
fresh: fresh,
used: used
@ -996,7 +1004,9 @@ HostList.prototype.fromJSON = function fromJSON(json) {
var i, j, bucket, keys, key, addr, entry, src;
assert(json && typeof json === 'object');
assert(json.version === 1, 'Bad address serialization version.');
assert(json.version === HostList.VERSION,
'Bad address serialization version.');
assert(Array.isArray(json.addrs));