From 08d277c12acd7105ddf5c9fa9008b10aeba01383 Mon Sep 17 00:00:00 2001 From: Ben Page Date: Thu, 16 Jun 2016 16:06:11 -0500 Subject: [PATCH] check if connection is closed in reset callback updated .gitignore updated docs --- .gitignore | 1 + README.md | 3 +++ lib/connection-pool.js | 3 +++ 3 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 4743e9d..8b4dde6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ npm-debug.log node_modules/ *.sublime-* .idea/ +/test.js diff --git a/README.md b/README.md index a0b2a1c..71852ff 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,9 @@ Release the connect back to the pool to be used again ## Changelog +### Version 1.0.3 +* bug fix only + ### Version 1.0.3 * Pool modifies the Tedious connection object rather than the Connection prototype. diff --git a/lib/connection-pool.js b/lib/connection-pool.js index f6fe152..8679fa8 100755 --- a/lib/connection-pool.js +++ b/lib/connection-pool.js @@ -239,6 +239,9 @@ ConnectionPool.prototype.release = function(connection) { if (pooled.con === connection) { //reset connection & release it connection.reset(function (err) { + if (!pooled.con) //the connection failed during the reset + return; + if (err) { //there is an error, don't reuse the connection, just close it pooled.con.close(); return;