mscdex / socksv5

SOCKS protocol version 5 server and client implementations for node.js
MIT License
400 stars 121 forks source link

Agent doesn't handle connection errors #19

Open stroncium opened 8 years ago

stroncium commented 8 years ago

Agent doesn't listen to error event on socks client, so if one occurs it goes up to throw from EventListener. I'm not sure about all the cases, but I encountered it while trying to connect to non-existent server.

I've worked around it by listening to error event together with connect event and then providing connect event with fake socket which then sends out error on this fake socket on next tick, while providing fake read and destroy methods. It seems to work for now, however I don't really know the flow of Agent api so I'm afraid to provide this hack as a patch.