proxysocket: minor. fix disconnect handling.

This commit is contained in:
Christopher Jeffrey 2016-08-27 12:38:33 -07:00
parent 51f817a60f
commit 47411fc5e2
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -56,8 +56,9 @@ ProxySocket.prototype._init = function _init() {
}); });
this.socket.on('tcp data', function(data) { this.socket.on('tcp data', function(data) {
self.bytesRead += data.length / 2; data = new Buffer(data, 'hex');
self.emit('data', new Buffer(data, 'hex')); self.bytesRead += data.length;
self.emit('data', data);
}); });
this.socket.on('tcp close', function(data) { this.socket.on('tcp close', function(data) {
@ -73,7 +74,7 @@ ProxySocket.prototype._init = function _init() {
self.emit('error', err); self.emit('error', err);
}); });
this.socket.on('close', function() { this.socket.on('disconnect', function() {
if (self.closed) if (self.closed)
return; return;
self.closed = true; self.closed = true;