Skip to content

Commit 4077178

Browse files
committed
fix: end stream in connection.end
1 parent d4aa616 commit 4077178

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

lib/connection.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ Connection.prototype.end = function() {
328328
this.writer.add(emptyBuffer);
329329
this._ending = true;
330330
this._send(0x58);
331+
this.stream.end();
331332
};
332333

333334
Connection.prototype.close = function(msg, more) {

test/unit/connection/outbound-sending-tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ test('sends end command', function() {
183183
con.end();
184184
var expected = new Buffer([0x58, 0, 0, 0, 4]);
185185
assert.received(stream, expected);
186+
assert.equal(stream.closed, true);
186187
});
187188

188189
test('sends describe command',function() {

test/unit/test-helper.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ p.write = function(packet) {
1515
this.packets.push(packet);
1616
};
1717

18+
p.end = function() {
19+
p.closed = true;
20+
}
21+
1822
p.setKeepAlive = function(){};
1923

24+
p.closed = false;
2025
p.writable = true;
2126

2227
createClient = function() {

0 commit comments

Comments
 (0)