Open louislam opened 3 years ago
You're a life saver.
In theory piped sockets are closed automatically when the source stream emits 'end': https://nodejs.org/api/stream.html#readablepipedestination-options
Anyway, if node doesn't do what it says it does, better do it manually.
As topic.
If you use this server as a web proxy, because websites nowadays make a lot of requests, it also creates a lot of sockets on socksv5 server. As all successful sockets are not closed, it will eats up all system resources and emits EMFILE error shortly. As a result, the server is no longer working anymore.
After some investigations, in server.js, I found out that after the dstSock (the socket between proxy server and destination server) is closed, it do not close the client socket together.
To fix this, just need to add close event and destroy the client socket.
server.js
However, it seems that this project is abandoned. My recommendation is you should not use this library.