cluster: rewrite debug ports consistently
Checklist
-
tests and code linting passes -
a test and/or benchmark is included -
the commit message follows commit guidelines
Affected core subsystem(s)
cluster
Description of change
When debug flags are passed to clustered applications, the debug port is rewritten for each worker process to avoid collisions. Prior to this commit, each debug flag would get a unique value. This commit reworks the logic to assign the same port value to all debug flags for a single worker.
I'm not 100% sure if this is actually a bug, or desirable behavior. However, the question came up in https://github.com/nodejs/node/pull/6792#issuecomment-222366233, so I decided to take a shot at solving it.