Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handle-thing

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handle-thing - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

51

lib/handle.js

@@ -19,2 +19,3 @@ var assert = require('assert');

this._flowing = false;
this._reading = false;
this._options = options || {};

@@ -47,2 +48,9 @@

this.writeQueueSize = 1;
if (mode === 'rusty') {
if (this._stream)
this._rustyInit();
else
this.once('stream', this._rustyInit);
}
}

@@ -52,2 +60,4 @@ util.inherits(Handle, EventEmitter);

Handle.mode = mode;
Handle.create = function create(stream, options) {

@@ -76,2 +86,4 @@ return new Handle(stream, options);

Handle.prototype.readStart = function readStart() {
this._reading = true;
if (!this._stream) {

@@ -92,2 +104,4 @@ this.once('stream', this.readStart);

Handle.prototype.readStop = function readStop() {
this._reading = false;
if (!this._stream) {

@@ -113,2 +127,9 @@ this.once('stream', this.readStop);

});
this._stream.on('close', function() {
setImmediate(function() {
if (self._reading)
self.onread(uv.UV_ECONNRESET, new Buffer(0));
});
});
};

@@ -143,2 +164,15 @@

});
this._stream.on('close', function() {
setImmediate(function() {
if (!self._reading)
return;
var errno = process._errno;
process._errno = 'ECONNRESET';
self.onread(null, 0, 0);
if (process._errno === 'ECONNRESET')
process._errno = errno;
});
});
};

@@ -161,2 +195,19 @@

} else {
Handle.prototype._rustyInit = function _rustyInit() {
var self = this;
this._stream.on('close', function() {
process.nextTick(function() {
if (!self._reading)
return;
var errno = global.errno;
global.errno = 'ECONNRESET';
self.onread(null, 0, 0);
if (global.errno === 'ECONNRESET')
global.errno = errno;
});
});
};
Handle.prototype._flow = function flow() {

@@ -163,0 +214,0 @@ var self = this;

2

package.json
{
"name": "handle-thing",
"version": "1.2.3",
"version": "1.2.4",
"description": "Wrap Streams2 instance into a HandleWrap",

@@ -5,0 +5,0 @@ "main": "lib/handle.js",

@@ -96,2 +96,19 @@ var assert = require('assert');

});
it('should emit ECONNRESET at `close` event', function(done) {
pair.other.emit('close');
// No error emitted in v0.8
if (thing.mode === 'rusty') {
socket.on('close', function() {
done();
});
return;
}
socket.on('error', function(err) {
assert(/ECONNRESET/.test(err.message));
done();
});
});
}

@@ -98,0 +115,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc