Fixes another event handler leak.

It turns out 'error' handlers were leaking as well, although more slowly.
PushSpring-master
Dan Robinson 11 years ago
parent b40918ddb8
commit 591a11c955

@ -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)

@ -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()
})
}

Loading…
Cancel
Save