hostlist: minor.
This commit is contained in:
parent
da69c5d888
commit
53f607e19f
@ -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));
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user