mirror of https://github.com/lukechilds/node.git
Browse Source
Replace booleans with `common.mustCall()`, migrate from `var` to `const`, and apply minor formatting changes. PR-URL: https://github.com/nodejs/node/pull/6756 Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>v6.x
Rich Trott
9 years ago
committed by
Rod Vagg
1 changed files with 8 additions and 18 deletions
@ -1,27 +1,17 @@ |
|||||
'use strict'; |
'use strict'; |
||||
var common = require('../common'); |
const common = require('../common'); |
||||
var assert = require('assert'); |
|
||||
|
|
||||
if (!common.hasCrypto) { |
if (!common.hasCrypto) { |
||||
common.skip('missing crypto'); |
common.skip('missing crypto'); |
||||
return; |
return; |
||||
} |
} |
||||
var tls = require('tls'); |
const tls = require('tls'); |
||||
|
|
||||
var net = require('net'); |
const net = require('net'); |
||||
var connected = false; |
|
||||
var secure = false; |
|
||||
|
|
||||
process.on('exit', function() { |
const socket = net.connect(443, 'www.example.org', common.mustCall(() => { |
||||
assert(connected); |
const secureSocket = tls.connect({socket: socket}, common.mustCall(() => { |
||||
assert(secure); |
|
||||
console.log('ok'); |
|
||||
}); |
|
||||
|
|
||||
var socket = net.connect(443, 'www.google.com', function() { |
|
||||
connected = true; |
|
||||
var secureSocket = tls.connect({ socket: socket }, function() { |
|
||||
secure = true; |
|
||||
secureSocket.destroy(); |
secureSocket.destroy(); |
||||
}); |
console.log('ok'); |
||||
}); |
})); |
||||
|
})); |
||||
|
Loading…
Reference in new issue