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

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.0.0 to 3.1.0

30

index.js

@@ -8,10 +8,13 @@ 'use strict';

var delays = isNaN(time) ? time : {socket: time, connect: time};
var host = req._headers ? (' to ' + req._headers.host) : '';
req.timeoutTimer = setTimeout(function timeoutHandler() {
req.abort();
var e = new Error('Connection timed out on request' + host);
e.code = 'ETIMEDOUT';
req.emit('error', e);
}, time);
if (delays.connect !== undefined) {
req.timeoutTimer = setTimeout(function timeoutHandler() {
req.abort();
var e = new Error('Connection timed out on request' + host);
e.code = 'ETIMEDOUT';
req.emit('error', e);
}, delays.connect);
}

@@ -24,8 +27,11 @@ // Clear the connection timeout timer once a socket is assigned to the

clear();
socket.setTimeout(time, function socketTimeoutHandler() {
req.abort();
var e = new Error('Socket timed out on request' + host);
e.code = 'ESOCKETTIMEDOUT';
req.emit('error', e);
});
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);
});
}
});

@@ -32,0 +38,0 @@ });

2

package.json
{
"name": "timed-out",
"version": "3.0.0",
"version": "3.1.0",
"description": "Emit `ETIMEDOUT` or `ESOCKETTIMEDOUT` when ClientRequest is hanged",

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

@@ -31,8 +31,13 @@ # timed-out [![Build Status](https://travis-ci.org/floatdrop/timed-out.svg?branch=master)](https://travis-ci.org/floatdrop/timed-out)

*Required*
Type: `number`
Type: `number` or `object`
Time in milliseconds to wait for `connect` event on socket and also time to wait on inactive socket.
Or you can pass Object with following fields:
- `connnect` - time to wait for connection
- `socket` - time to wait for activity on socket
## License
MIT © [Vsevolod Strukchinsky](floatdrop@gmail.com)
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