Skip to content

Commit b2a2251

Browse files
committed
listen socket end events
1 parent bba6e93 commit b2a2251

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/Connection.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,6 @@ Connection.prototype.connect = function(cb) {
6464
? Net.createConnection(this.config.socketPath)
6565
: Net.createConnection(this.config);
6666

67-
// Node v0.10+ Switch socket into "old mode" (Streams2)
68-
//this._socket.on("data",function() {});
69-
70-
//this._socket.pipe(this._protocol);
71-
//this._protocol.pipe(this._socket);
72-
73-
7467
var connection = this;
7568
this._protocol.on('data', function(data) {
7669
connection._socket.write(data);
@@ -81,6 +74,9 @@ Connection.prototype.connect = function(cb) {
8174
this._protocol.on('end', function() {
8275
connection._socket.end()
8376
});
77+
this._socket.on('end', function(err) {
78+
connection._protocol.end();
79+
});
8480

8581
this._socket.on('error', this._handleNetworkError.bind(this));
8682
this._socket.on('connect', this._handleProtocolConnect.bind(this));

0 commit comments

Comments
 (0)