src: fix external memory usage going negative
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
Fixes a bug introduced in https://github.com/nodejs/node/commit/d7cba76856e80108edb47b2e4c50a2c5fe5e1427 that decrements the external memory twice when using SSL connections (Reset is called both during destructuring and in Close).
This in turn made process.memoryUsage().external
report negative numbers.
Added a test as well. Fixes https://github.com/nodejs/node/issues/21570