On an exception, the ENIP class's destroy function attempts to write to the TCP socket, to gracefully close it. But, if the exception was caused by unexpectedly closed socket, this results in an endless loop.
Expected Behavior
The destroy function should not attempt to write to a closed socket, triggering an exception.
Possible Solution (Optional)
If the exception.code is EPIPE, don't write to the socket.
Current Behavior
On an exception, the ENIP class's
destroy
function attempts to write to the TCP socket, to gracefully close it. But, if the exception was caused by unexpectedly closed socket, this results in an endless loop.Expected Behavior
The destroy function should not attempt to write to a closed socket, triggering an exception.
Possible Solution (Optional)
If the
exception.code
isEPIPE
, don't write to the socket.https://github.com/Jon-Biz/ST-node-ethernet-ip/commit/010de84d7f86659a94e2dd80a8a4ceb973f24f57
Context
I was attempting to set up node-red to work with eth-ip messaging. Whenever I closed the ethip server simulator, node-red crashed.
Steps to Reproduce (for bugs only)
Your Environment
npm list
- e.g. 1.0.6): node-red-contrib-cip-st-ethernet-ip@2.0.0-beta.3node --version
- e.g. 9.8.0):