Skip to content

Commit bba6e93

Browse files
committed
close socket when Protocol emits end
1 parent f34d089 commit bba6e93

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/Connection.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ Connection.prototype.connect = function(cb) {
6969

7070
//this._socket.pipe(this._protocol);
7171
//this._protocol.pipe(this._socket);
72+
73+
7274
var connection = this;
7375
this._protocol.on('data', function(data) {
7476
connection._socket.write(data);
7577
});
7678
this._socket.on('data', function(data) {
7779
connection._protocol.write(data);
7880
});
81+
this._protocol.on('end', function() {
82+
connection._socket.end()
83+
});
7984

8085
this._socket.on('error', this._handleNetworkError.bind(this));
8186
this._socket.on('connect', this._handleProtocolConnect.bind(this));

0 commit comments

Comments
 (0)