Changes made to how the socket initially connects to its endpoint.
As per Nodejs documentation, "[socket.connect()] should only be used for reconnecting a socket after 'close' has been emitted or otherwise it may lead to undefined behavior".
The previous version was at times calling socket.connect() without the close event being emitted. This would sometimes try to connect to a socket that is already connected (EISCONN) and would destroy the stream. Additionally, the writable property in net.Socket() was removed since it was causing socket streams on node >=v15.3.0 to start as readOnly and with an additional connect() attempt would lead to undefined behaviour.
To avoid the same issues pre 0034ce1cd5e7109a43f3a1551a985ffa984247ce, an async init() method within the constructor was added to initialize the connection once a TCP Socket is created.
Issue #, if available: #120
Description of changes:
Changes made to how the socket initially connects to its endpoint.
As per Nodejs documentation, "[socket.connect()] should only be used for reconnecting a socket after 'close' has been emitted or otherwise it may lead to undefined behavior". The previous version was at times calling
socket.connect()
without theclose
event being emitted. This would sometimes try to connect to a socket that is already connected (EISCONN) and would destroy the stream. Additionally, thewritable
property innet.Socket()
was removed since it was causing socket streams on node >=v15.3.0 to start asreadOnly
and with an additionalconnect()
attempt would lead to undefined behaviour.To avoid the same issues pre 0034ce1cd5e7109a43f3a1551a985ffa984247ce, an async
init()
method within the constructor was added to initialize the connection once a TCP Socket is created.Additionally, fixed critical, high and moderate severity dependency related security alerts: #124, CVE-2021-43138, CVE-2021-3807, CVE-2021-3918, CVE-2021-44906, CVE-2021-3777, CVE-2021-23343, CVE-2020-28469
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.