mirror of https://github.com/lukechilds/node.git
Browse Source
There is no official way to figure out if the socket that you have on hand is still connecting to the remote host. Introduce `Socket#connecting`, which is essentially an unprefixed `_connecting` property that we already had. PR-URL: https://github.com/nodejs/node/pull/6404 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>v6.x
Fedor Indutny
9 years ago
committed by
Jeremiah Senkpiel
6 changed files with 55 additions and 21 deletions
@ -0,0 +1,21 @@ |
|||
'use strict'; |
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const net = require('net'); |
|||
|
|||
const server = net.createServer((conn) => { |
|||
conn.end(); |
|||
server.close(); |
|||
}).listen(common.PORT, () => { |
|||
const client = net.connect(common.PORT, () => { |
|||
assert.strictEqual(client.connecting, false); |
|||
|
|||
// Legacy getter
|
|||
assert.strictEqual(client._connecting, false); |
|||
client.end(); |
|||
}); |
|||
assert.strictEqual(client.connecting, true); |
|||
|
|||
// Legacy getter
|
|||
assert.strictEqual(client._connecting, true); |
|||
}); |
Loading…
Reference in new issue