mirror of
https://github.com/nodejs/node.git
synced 2025-05-02 18:44:40 +00:00

Add more information to the "ECONNRESET" errors generated when the socket hang ups before establishing the secure connection. These kind of errors are really hard to troubleshoot without this info. PR-URL: https://github.com/nodejs/node/pull/7476 Reviewed-By: Trevor Norris <trevnorris@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Yazhong Liu <yorkiefixer@gmail.com>
27 lines
671 B
JavaScript
27 lines
671 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const tls = require('tls');
|
|
|
|
const server = net.createServer((c) => {
|
|
c.end();
|
|
}).listen(common.mustCall(() => {
|
|
const port = server.address().port;
|
|
|
|
const socket = new net.Socket();
|
|
|
|
tls.connect({ socket })
|
|
.once('error', common.mustCall((e) => {
|
|
assert.strictEqual(e.code, 'ECONNRESET');
|
|
assert.strictEqual(e.path, undefined);
|
|
assert.strictEqual(e.host, undefined);
|
|
assert.strictEqual(e.port, undefined);
|
|
assert.strictEqual(e.localAddress, undefined);
|
|
server.close();
|
|
}));
|
|
|
|
socket.connect(port);
|
|
}));
|