http2: Prevent unnecessary listeners from being registered
When multiple requests are started on a client HTTP/2 session while it it still connecting, a warning might get emitted: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to Http2Session
This PR modifies the offending code so that only one event listener is registered, no matter how many requests are started. A test for the fix is included.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines