Skip to content

net: use actual Timeout instances on Sockets

This makes net.Sockets use actual Timeout objects in a _timeout property, rather than making the socket itself a timer and appending properties to it directly.

This should make the code generally easier to understand, and might also prevent some deopts from properties being changes on the socket itself.

It is possible this could effect performance either better or worse, but I highly doubt it would be a significant difference. I'll try to run benchmarks on it in the coming days, but if anyone else would like to that would also be appreciated.

This also exposes timers.Timeout so as to avoid a circular dependency with the new lib/internal/timers.js, but we might not want that so I should be able to refactor more of timers into the internals file if necessary. Tagging as semver-minor for now due to this. I could also split that into separate commits.

Made live on https://twitch.tv/nodesource

CI: https://ci.nodejs.org/job/node-test-pull-request/6202/

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

net, timers

Merge request reports

Loading