net: emit 'close' after 'end'
Currently the writable side of the socket is closed as soon as UV_EOF
is read regardless of the state of the socket. This allows the handle
to be closed before 'end'
is emitted and thus 'close'
can be
emitted before 'end'
if the socket is paused.
This commit prevents the handle from being closed until 'end'
is
emitted ensuring the correct order of events.
Fixes: https://github.com/nodejs/node/issues/19166
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines