lib: emit listening event once when call listen twice
Currently we can call listen twice with same server in cluster worker. It will make some issues.
- the server will emit
listening
event twice(See https://github.com/nodejs/node/pull/52118). - resource leak if we do not clear the old resource correctly, such as the old handle.
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines