tls: error after socket.close()
sidorares opened this issue · 3 comments
sidorares commented
when tls is used, quit() command writes "quit" and immediately closed socket with socket.end()
this seems to confuse tls, I'm getting random errors like
Error: read ECONNRESET
at exports._errnoException (util.js:859:11)
at TLSWrap.onread (net.js:550:26)
seems to be race condition somewhere in tls, and it's hard to intercept
My workaround: I expect server to gracefully close connection, so I changed code to be like this:
//...
} else if (this._command.cmd === state.QUIT) {
var self = this;
this._socket.on('end', function() {
self.connected = false;
if (self._command.callback) {
self._command.callback.call(this, null);
}
});
} else {
//...
agsh commented
Hello Andrey!
Confirm this.
I'll be so glad if you send a pull request with your changes to me.
agsh commented
Made this changes for you, please check this, if I understand you right
sidorares commented
thanks, looks good!