Socket
Socket
Sign inDemoInstall

timed-out

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

timed-out - npm Package Compare versions

Comparing version 3.1.1 to 3.1.2

36

index.js

@@ -21,23 +21,12 @@ 'use strict';

// Clear the connection timeout timer once a socket is assigned to the
// request and is connected. Abort the request if there is no activity
// on the socket for more than `time` milliseconds.
// request and is connected.
req.on('socket', function assign(socket) {
// Socket may come from Agent pool and may be already connected
// .connecting is for node 6.x and ._connecting is fallback for older releases
if (!(socket.connecting || socket._connecting)) {
if (socket._timedOutHandlerSet) {
clear();
return;
}
socket.on('connect', function connect() {
clear();
if (delays.socket !== undefined) {
socket.setTimeout(delays.socket, function socketTimeoutHandler() {
req.abort();
var e = new Error('Socket timed out on request' + host);
e.code = 'ESOCKETTIMEDOUT';
req.emit('error', e);
});
}
});
socket._timedOutHandlerSet = true;
socket.on('connect', connect);
});

@@ -52,3 +41,18 @@

function connect() {
clear();
if (delays.socket !== undefined) {
// Abort the request if there is no activity on the socket for more
// than `delays.socket` milliseconds.
this.setTimeout(delays.socket, function socketTimeoutHandler() {
req.abort();
var e = new Error('Socket timed out on request' + host);
e.code = 'ESOCKETTIMEDOUT';
req.emit('error', e);
});
}
}
return req.on('error', clear);
};
{
"name": "timed-out",
"version": "3.1.1",
"version": "3.1.2",
"description": "Emit `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged",

@@ -5,0 +5,0 @@ "license": "MIT",

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