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

wtfnode

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wtfnode - npm Package Compare versions

Comparing version 0.7.3 to 0.8.0

83

index.js

@@ -14,3 +14,4 @@ 'use strict';

Timer,
TlsServer;
TlsServer,
async_hooks;

@@ -70,2 +71,48 @@ var NODE_VERSION = process.version.slice(1).split('.').map(function (v) { return parseInt(v, 10); });

var trackedAsyncResources = null, refSymbol = null;
function getRefSymbol() {
function _noop() { }
function _getRefSymbol(asyncId, type, triggerAsyncId, resource) {
var symbols = Object.getOwnPropertySymbols(resource);
symbols.forEach(function (sym) {
if (sym.description === 'refed') {
refSymbol = sym;
}
});
}
var hook = async_hooks.createHook({
init: _getRefSymbol
});
hook.enable();
var timer = setTimeout(_noop, 1000);
hook.disable();
clearTimeout(timer);
}
function setupAsyncHooks() {
async_hooks = require('async_hooks');
getRefSymbol();
trackedAsyncResources = new Map();
function init(asyncId, type, triggerAsyncId, resource) {
if (type === 'Timeout') {
trackedAsyncResources.set(asyncId, {
resource: resource,
type: type
});
}
}
function destroy(asyncId) {
if (trackedAsyncResources.has(asyncId)) {
trackedAsyncResources.delete(asyncId);
}
}
var hook = async_hooks.createHook({
init: init,
destroy: destroy
});
hook.enable();
}
// hook stuff

@@ -299,3 +346,7 @@ (function () {

Socket = require('net').Socket;
Timer = process.binding('timer_wrap').Timer;
if (NODE_VERSION[0] < 11) {
Timer = process.binding('timer_wrap').Timer;
} else {
setupAsyncHooks();
}
TlsServer = require('tls').Server;

@@ -381,3 +432,3 @@

else if (h instanceof dgramSocket) { servers.push(h); }
else if (h instanceof Timer) { _timers.push(h); }
else if (NODE_VERSION[0] < 11 && h instanceof Timer) { _timers.push(h); }
else if (h instanceof ChildProcess) { processes.push(h); }

@@ -390,2 +441,12 @@ else if (h.hasOwnProperty('__worker')) { clusterWorkers.push(h); }

if (trackedAsyncResources !== null) {
trackedAsyncResources.forEach(function (obj) {
if (obj.type === 'Timeout') {
if (obj.resource[refSymbol] === true) {
_timers.push(obj.resource);
}
}
});
}
if (fds.length) {

@@ -526,3 +587,14 @@ log('info', '- File descriptors: (note: stdio always exists)');

var timer = t._list, cb, cbkey;
if (t._list) {
if (NODE_VERSION[0] > 10) {
timer = t;
cbkey = timerCallback(timer);
if (cbkey && timers.indexOf(timer) === -1) {
cb = timer[cbkey];
if (cb.__isInterval) {
intervals.push(timer);
} else {
timers.push(timer);
}
}
} else if (t._list) {
// node v5ish behavior

@@ -551,3 +623,3 @@ do {

if (cbkey && timers.indexOf(timer) === -1) {
cb = timer[cbkey]
cb = timer[cbkey];
if (cb.__isInterval) {

@@ -560,3 +632,2 @@ intervals.push(timer);

}
});

@@ -563,0 +634,0 @@ }

2

package.json
{
"name": "wtfnode",
"version": "0.7.3",
"version": "0.8.0",
"description": "Utility to help find out why Node isn't exiting",

@@ -5,0 +5,0 @@ "repository": {

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