diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2017-10-25 09:26:20 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2017-10-25 14:48:30 -0400 |
commit | cecbb595d5c4ea97264092abf2ade16b54a945fd (patch) | |
tree | 942fea48b889e12a37403da25137900e024ff5e0 /test/parallel/test-net-timeout-no-handle.js | |
parent | a78327f48be4266e250ad4c2170a0f263b47bc5f (diff) | |
download | android-node-v8-cecbb595d5c4ea97264092abf2ade16b54a945fd.tar.gz android-node-v8-cecbb595d5c4ea97264092abf2ade16b54a945fd.tar.bz2 android-node-v8-cecbb595d5c4ea97264092abf2ade16b54a945fd.zip |
net: fix timeout with null handle
This commit handles the case where _onTimeout is called with a
null handle.
Refs: https://github.com/nodejs/node/pull/15791
Fixes: https://github.com/nodejs/node/issues/16484
PR-URL: https://github.com/nodejs/node/pull/16489
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'test/parallel/test-net-timeout-no-handle.js')
-rw-r--r-- | test/parallel/test-net-timeout-no-handle.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/parallel/test-net-timeout-no-handle.js b/test/parallel/test-net-timeout-no-handle.js new file mode 100644 index 0000000000..539f661cae --- /dev/null +++ b/test/parallel/test-net-timeout-no-handle.js @@ -0,0 +1,17 @@ +'use strict'; + +const common = require('../common'); +const net = require('net'); +const assert = require('assert'); + +const socket = new net.Socket(); +socket.setTimeout(common.platformTimeout(50)); + +socket.on('timeout', common.mustCall(() => { + assert.strictEqual(socket._handle, null); +})); + +socket.on('connect', common.mustNotCall()); + +// since the timeout is unrefed, the code will exit without this +setTimeout(() => {}, common.platformTimeout(200)); |