mirror of
https://github.com/nodejs/node.git
synced 2024-11-28 22:46:31 +01:00
9b6b05556f
`TLSSocket` wraps the original `net.Socket`, but writes/reads to/from `TLSSocket` do not touch the timers of original `net.Socket`. Introduce `socket._parent` property, and iterate through all parents to unref timers and prevent timeout event on original `net.Socket`. Fix: https://github.com/joyent/node/issues/9242 PR-URL: https://github.com/iojs/io.js/pull/891 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
35 lines
809 B
JavaScript
35 lines
809 B
JavaScript
if (!process.versions.openssl) process.exit();
|
|
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var net = require('net');
|
|
var tls = require('tls');
|
|
var fs = require('fs');
|
|
|
|
var options = {
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
};
|
|
|
|
var server = tls.createServer(options, function(c) {
|
|
setTimeout(function() {
|
|
c.write('hello');
|
|
setTimeout(function() {
|
|
c.destroy();
|
|
server.close();
|
|
}, 75);
|
|
}, 75);
|
|
});
|
|
|
|
server.listen(common.PORT, function() {
|
|
var socket = net.connect(common.PORT, function() {
|
|
socket.setTimeout(120, assert.fail);
|
|
|
|
var tsocket = tls.connect({
|
|
socket: socket,
|
|
rejectUnauthorized: false
|
|
});
|
|
tsocket.resume();
|
|
});
|
|
});
|