Skip to content

Commit 1e982fb

Browse files
committed
tests: improve streaming test robustness
1 parent f0dfda8 commit 1e982fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/FakeServer.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,15 @@ FakeConnection.prototype._writePacketStream = function _writePacketStream(count)
365365
this._sendPacket(new Packets.EofPacket());
366366

367367
function cleanup() {
368-
var socket = this._socket || this;
369-
socket.removeListener('close', cleanup);
370-
socket.removeListener('error', cleanup);
371368
clearInterval(timer);
372369
}
373370

374371
function writeRow() {
375372
if (remaining === 0) {
376-
cleanup.call(this);
373+
cleanup();
374+
375+
this._socket.removeListener('close', cleanup);
376+
this._socket.removeListener('error', cleanup);
377377

378378
this._sendPacket(new Packets.EofPacket());
379379
this._parser.resetPacketNumber();

0 commit comments

Comments
 (0)