Comparing version 4.1.2 to 4.1.3
@@ -341,6 +341,8 @@ /* jshint node: true */ | ||
events.EventEmitter.call(this); | ||
this._ptcl = ptcl; | ||
this._strict = !!opts.strictErrors; | ||
this._endWritable = !!utils.getOption(opts, 'endWritable', true); | ||
this._timeout = utils.getOption(opts, 'timeout', 10000); | ||
this._timeout = opts.timeout === undefined ? 10000 : opts.timeout; | ||
this._cache = opts.cache || {}; | ||
@@ -554,6 +556,9 @@ var fgpt = opts.serverFingerprint; | ||
writable.end({ | ||
writable.write({ | ||
id: id, | ||
payload: [HANDSHAKE_REQUEST_TYPE.toBuffer(hreq), reqBuf] | ||
}); | ||
if (self._endWritable) { | ||
writable.end(); | ||
} | ||
} | ||
@@ -581,2 +586,5 @@ }; | ||
// Remove references to this emitter to avoid potential memory leaks. | ||
if (this._endWritable) { | ||
this._writable.end(); | ||
} | ||
this._readable | ||
@@ -669,6 +677,8 @@ .removeListener('data', onPing) | ||
events.EventEmitter.call(this); | ||
this._ptcl = ptcl; | ||
this._strict = !!opts.strictErrors; | ||
this._endWritable = !!utils.getOption(opts, 'endWritable', true); | ||
this._cache = opts.cache || {}; | ||
var fgpt = this._ptcl.getFingerprint(); | ||
@@ -851,3 +861,3 @@ if (!this._cache[fgpt]) { | ||
self.emit('_writable'); | ||
}).once('data', onRequest) | ||
}).on('data', onRequest) | ||
.on('end', onEnd); | ||
@@ -885,3 +895,6 @@ }); | ||
]; | ||
self._writable.end({id: id, payload: payload}); | ||
self._writable.write({id: id, payload: payload}); | ||
if (self._endWritable) { | ||
self._writable.end(); | ||
} | ||
} | ||
@@ -917,3 +930,6 @@ } | ||
this.on('eot', function () { | ||
// Clean up any references to the listener on the underlying streams. | ||
if (this._endWritable) { | ||
this._writable.end(); | ||
} | ||
// Also clean up any references to the listener on the underlying streams. | ||
this._writable.removeListener('finish', onFinish); | ||
@@ -920,0 +936,0 @@ this._readable |
@@ -34,2 +34,18 @@ /* jshint node: true */ | ||
/** | ||
* Get option or default if undefined. | ||
* | ||
* @param opts {Object} Options. | ||
* @param key {String} Name of the option. | ||
* @param def {...} Default value. | ||
* | ||
* This is useful mostly for true-ish defaults and false-ish values (where the | ||
* usual `||` idiom breaks down). | ||
* | ||
*/ | ||
function getOption(opts, key, def) { | ||
var value = opts[key]; | ||
return value === undefined ? def : value; | ||
} | ||
/** | ||
* Compute a string's hash. | ||
@@ -694,2 +710,3 @@ * | ||
compare: compare, | ||
getOption: getOption, | ||
jsonEnd: jsonEnd, | ||
@@ -696,0 +713,0 @@ toMap: toMap, |
{ | ||
"name": "avsc", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "Avro for JavaScript", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/mtth/avsc", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
192709
6308