Skip to content

Commit

Permalink
tests: improve streaming test robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Jul 10, 2015
1 parent f0dfda8 commit 1e982fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/FakeServer.js
Expand Up @@ -365,15 +365,15 @@ FakeConnection.prototype._writePacketStream = function _writePacketStream(count)
this._sendPacket(new Packets.EofPacket());

function cleanup() {
var socket = this._socket || this;
socket.removeListener('close', cleanup);
socket.removeListener('error', cleanup);
clearInterval(timer);
}

function writeRow() {
if (remaining === 0) {
cleanup.call(this);
cleanup();

this._socket.removeListener('close', cleanup);
this._socket.removeListener('error', cleanup);

this._sendPacket(new Packets.EofPacket());
this._parser.resetPacketNumber();
Expand Down

0 comments on commit 1e982fb

Please sign in to comment.