Fixes another event handler leak.

It turns out 'error' handlers were leaking as well, although more slowly.
This commit is contained in:
Dan Robinson
2014-04-06 03:49:25 -07:00
parent b40918ddb8
commit 591a11c955
2 changed files with 3 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ var CopyStreamQuery = function(text) {
util.inherits(CopyStreamQuery, Transform)
var eventTypes = ['close', 'data', 'end']
var eventTypes = ['close', 'data', 'end', 'error']
CopyStreamQuery.prototype.submit = function(connection) {
connection.query(this.text)

View File

@@ -49,9 +49,10 @@ var testLeak = function(rounds) {
async.timesSeries(rounds, runStream, function(err) {
assert.equal(err, null)
assert.equal(fromClient.connection.stream.listeners('close').length, 0)
assert.equal(fromClient.connection.stream.listeners('data').length, 1)
assert.equal(fromClient.connection.stream.listeners('end').length, 2)
assert.equal(fromClient.connection.stream.listeners('close').length, 0)
assert.equal(fromClient.connection.stream.listeners('error').length, 1)
fromClient.end()
})
}