Skip to content

Commit

Permalink
fix: end stream in connection.end
Browse files Browse the repository at this point in the history
  • Loading branch information
Vratislav committed Apr 4, 2018
1 parent d4aa616 commit 4077178
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ Connection.prototype.end = function() {
this.writer.add(emptyBuffer);
this._ending = true;
this._send(0x58);
this.stream.end();
};

Connection.prototype.close = function(msg, more) {
Expand Down
1 change: 1 addition & 0 deletions test/unit/connection/outbound-sending-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ test('sends end command', function() {
con.end();
var expected = new Buffer([0x58, 0, 0, 0, 4]);
assert.received(stream, expected);
assert.equal(stream.closed, true);
});

test('sends describe command',function() {
Expand Down
5 changes: 5 additions & 0 deletions test/unit/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ p.write = function(packet) {
this.packets.push(packet);
};

p.end = function() {
p.closed = true;
}

p.setKeepAlive = function(){};

p.closed = false;
p.writable = true;

createClient = function() {
Expand Down

0 comments on commit 4077178

Please sign in to comment.