mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 13:51:07 +00:00
The CONNECT handler pipes clientSocket and upstreamSocket together but only registers an error handler on upstreamSocket. If the client disconnects abruptly (ECONNRESET), the unhandled error event on clientSocket causes the Node process to crash. Add a clientSocket error handler that logs the event and destroys the upstream socket. Also change clientSocket.end() to clientSocket.destroy() in the upstream error handler since destroy() is more appropriate for error cleanup of piped sockets. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>