net: ensure Write/ShutdownWrap references handle
authorFedor Indutny <fedor@indutny.com>
Sat, 2 May 2015 15:32:29 +0000 (17:32 +0200)
committerFedor Indutny <fedor@indutny.com>
Sun, 3 May 2015 00:58:53 +0000 (03:58 +0300)
commitb4f58983952fb56262795893b4f7b0482d1256f2
tree9e6dc34fb44ca55120a7dd496ed9d7634e4c9f85
parent2a3a1909ab5c1d6ac3104327e148acfbc6b5eb24
net: ensure Write/ShutdownWrap references handle

`StreamBase::AfterWrite` is passing handle as an argument to the
`afterWrite` function in net.js. Thus GC should not collect the handle
and the request separately and assume that they are tied together.

With this commit - request will always outlive the StreamBase instance,
helping us survive the GC pass.

Same applies to the ShutdownWrap instances, they should never be
collected after the StreamBase instance.

Fix: https://github.com/iojs/io.js/pull/1580
PR-URL: https://github.com/iojs/io.js/pull/1590
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
lib/net.js