Skip to content

net: refactor overloaded argument handling

Rodrigo Muino Tomonari requested to merge github/fork/joyeecheung/net-args into master
  • Destructure arguments when it will always be converted into an array
  • Rename some args[i] for readability
  • Use Socket.prototype.connect.call instead of .apply when the number of arguments is certain(returned by normalizeArgs)
  • Make normalizeArgs return either [options, null] or [options, cb] (the second element won't be undefined anymore) and avoid OOB read
  • Refactor Server.prototype.listen, separate backlogFromArgs and options.backlog, avoid making options a handle, comment the overloading process

Pending benchmark results...

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

Merge request reports

Loading