Skip to content

Commit

Permalink
win,test: fix test-process-active-wraps.js
Browse files Browse the repository at this point in the history
b636ba8 broke this test, because it now takes a loop iteration or two
to resolve the loopback address. That consequence is that the TCPWrap
handle that we *don't* want to see is created a bit later, and also
destroyed later, so when we assert that the active handle list is empty
the TCPWrap object is still "busy" being closed.

Wait one extra loop iteration before checking there are no more active
handles. This allows name resolution and clean-up to finish before the
assertion.

BUG: #246
PR-URL: nodejs/node-v0.x-archive#8998
Reviewed-By: Bert Belder <bertbelder@gmail.com>
  • Loading branch information
cjihrig authored and piscisaureus committed Jan 8, 2015
1 parent c9fd9e2 commit b5c9dcb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/parallel/test-process-active-wraps.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var handles = [];

expect(1, 0);
var conn = net.createConnection(common.PORT);
conn.on('lookup', onlookup);
conn.on('lookup', onlookup);
conn.on('error', function() { assert(false); });
expect(2, 1);
conn.destroy();
Expand All @@ -65,8 +65,11 @@ var handles = [];
});
function onclose() {
if (++n === handles.length) {
// Allow the server handle a few loop iterations to wind down.
setImmediate(function() {
assert.equal(process._getActiveHandles().length, 0);
setImmediate(function() {
assert.equal(process._getActiveHandles().length, 0);
});
});
}
}
Expand Down

0 comments on commit b5c9dcb

Please sign in to comment.