}); socket.unref();
async close() { await this.client.destroy() this.client.unref() this.closed = true }
server.on('connection', (socket) => { if (!ref) { socket.unref(); } });
_shutdown(msg, keepSocket) { if (this.isShutdown()) { return; } delete this._connectPromise; let cmd; while ((cmd = this.dequeueCommand())) { cmd.callback(new Error(msg)); } this._status = Status.SHUTDOWN; // reset connection this.node.endConnection(this); if (this.socket) { this.socket.end(); if (!keepSocket) this.socket.destroy(); this.socket.unref(); } delete this.socket; delete this.client; delete this.node; }
socket.unref() })
http.createServer((req, res) => { if (!ref) { req.connection.unref(); } switch (req.url) { case '/invalid-json': res.setHeader('Content-Type', 'application/json'); res.end('{ "a": 1'); break; case '/form-urlencoded': res.setHeader('Content-Type', 'application/x-www-form-urlencoded'); res.end('test=1&hello=world'); break; case '/echo': { req.on('data', (c) => { res.write(c); }); req.on('end', () => { res.end(); }); break; } default: res.end(); break; } })
server.on('connection', socket => socket.unref()); server.listen(PORT);
server.on('connection', socket => socket.unref()); server.listen(PORT);